db-player 0.0.0-stage → 0.4.1
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 +56 -2
- package/bin/db-player.mjs +149 -0
- package/dist/client/assets/EmptyState-B_8ZzjRf.js +2 -0
- package/dist/client/assets/c._connectionId-BAPOAiu0.js +1 -0
- package/dist/client/assets/index-Cre7NCFa.js +136 -0
- package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/client/assets/routes-_dAU0q9L.js +1 -0
- package/dist/client/assets/styles-D3kk8PAA.css +1669 -0
- package/dist/client/assets/t._tabId-DJ7LAi8J.js +1 -0
- package/dist/server/assets/EmptyState-D1iyQsG1.js +366 -0
- package/dist/server/assets/_tanstack-start-manifest_v-AE6zwk_Q.js +38 -0
- package/dist/server/assets/c._connectionId-BXPGBd-R.js +19 -0
- package/dist/server/assets/createServerRpc-F6SI7pt8.js +11 -0
- package/dist/server/assets/empty-plugin-adapters-BiGySXWX.js +4 -0
- package/dist/server/assets/fns-DNn8Qat1.js +321 -0
- package/dist/server/assets/layout-pJu_-O4s.js +36 -0
- package/dist/server/assets/router-C6umP2o0.js +4061 -0
- package/dist/server/assets/routes-Ce6MPKxr.js +24 -0
- package/dist/server/assets/start-Bai9AeXo.js +3 -0
- package/dist/server/assets/store-Bb9KDsJx.js +827 -0
- package/dist/server/assets/t._tabId-Cf1urQNG.js +4 -0
- package/dist/server/assets/theme-EhZN9QoB.js +32 -0
- package/dist/server/server.js +7788 -0
- package/package.json +73 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-_dAU0q9L.js","assets/rolldown-runtime-XKyaHtl9.js","assets/EmptyState-B_8ZzjRf.js","assets/c._connectionId-BAPOAiu0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{$ as r,A as i,At as a,B as o,C as s,Ct as c,D as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,H as g,I as _,It as v,J as y,K as b,L as x,M as S,Mt as C,N as w,Nt as T,O as E,Ot as D,P as O,Pt as k,Q as A,R as j,S as M,St as N,T as P,Tt as F,U as I,V as L,W as R,X as z,Y as B,Z as V,_ as H,_t as ee,a as te,at as ne,b as re,bt as ie,c as ae,ct as U,d as oe,dt as se,et as ce,f as le,ft as ue,g as de,gt as fe,h as pe,ht as me,i as he,it as ge,j as _e,jt as ve,k as ye,kt as be,l as xe,lt as Se,m as Ce,mt as we,n as Te,nt as Ee,o as De,ot as Oe,p as ke,pt as Ae,q as je,r as Me,rt as Ne,s as Pe,st as Fe,t as Ie,tt as Le,u as Re,ut as ze,v as Be,vt as Ve,w as He,wt as Ue,x as We,xt as Ge,y as Ke,yt as qe,z as Je}from"./EmptyState-B_8ZzjRf.js";var Ye=n((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(e.unstable_now=void 0,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=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(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 x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(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_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`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},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_requestPaint=function(){g=!0},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?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Xe=n(((e,t)=>{t.exports=Ye()})),Ze=n((e=>{var t=v();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),Qe=n(((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=Ze()})),$e=n((e=>{var t=Xe(),n=v(),r=Qe();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),P=Symbol.for(`react.forward_ref`),F=Symbol.for(`react.suspense`),I=Symbol.for(`react.suspense_list`),L=Symbol.for(`react.memo`),R=Symbol.for(`react.lazy`),z=Symbol.for(`react.activity`),B=Symbol.for(`react.legacy_hidden`),V=Symbol.for(`react.memo_cache_sentinel`),H=Symbol.for(`react.view_transition`),ee=Symbol.for(`react.recoverable`),te=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case F:return`Suspense`;case I:return`SuspenseList`;case z:return`Activity`;case H:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case P:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case L:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case R:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,U=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ce=[],le=-1;function ue(e){return{current:e}}function de(e){0>le||(e.current=ce[le],ce[le]=null,le--)}function fe(e,t){le++,ce[le]=e.current,e.current=t}var pe=ue(null),me=ue(null),he=ue(null),ge=ue(null);function _e(e,t){switch(fe(he,t),fe(me,e),fe(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=vp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}de(pe),fe(pe,e)}function ve(){de(pe),de(me),de(he)}function ye(e){var t=e.memoizedState;t!==null&&(mh._currentValue=t.memoizedState,fe(ge,e)),t=pe.current;var n=vp(t,e.type);t!==n&&(fe(me,e),fe(pe,n))}function be(e){me.current===e&&(de(pe),de(me)),ge.current===e&&(de(ge),mh._currentValue=se)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+xe+e+Se}var we=!1;function Te(e,t){if(!e||we)return``;we=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ce(n):``}function Ee(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce(`Lazy`);case 13:return e.child!==t&&t!==null?Ce(`Suspense Fallback`):Ce(`Suspense`);case 19:return Ce(`SuspenseList`);case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return Ce(`Activity`);case 30:return Ce(`ViewTransition`);default:return``}}function De(e){try{var t=``,n=null;do t+=Ee(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,je=t.unstable_shouldYield,Me=t.unstable_requestPaint,Ne=t.unstable_now,Pe=t.unstable_getCurrentPriorityLevel,Fe=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,Re=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Be=t.log,Ve=t.unstable_setDisableYieldValue,He=null,Ue=null;function We(e){if(typeof Be==`function`&&Ve(e),Ue&&typeof Ue.setStrictMode==`function`)try{Ue.setStrictMode(He,e)}catch{}}var Ge=Math.clz32?Math.clz32:Je,Ke=Math.log,qe=Math.LN2;function Je(e){return e>>>=0,e===0?32:31-(Ke(e)/qe|0)|0}var Ye=256,Ze=262144,$e=4194304;function et(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function tt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=et(n))):i=et(o):i=et(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=et(n))):i=et(o)):i=et(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function nt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Ge(n),i=1<<r;t|=e[r],n&=~i}return t}function it(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=$e;return $e<<=1,!($e&62914560)&&($e=4194304),e}function ot(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function st(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ct(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ge(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&<(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function lt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ge(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ut(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ge(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function dt(e,t){var n=t&-t;return n=n&42?1:ft(n),(n&(e.suspendedLanes|t))===0?n:0}function ft(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function mt(){var e=oe.p;return e===0?(e=window.event,e===void 0?32:Ah(e.type)):e}function ht(e,t){var n=oe.p;try{return oe.p=e,t()}finally{oe.p=n}}var gt=Math.random().toString(36).slice(2),_t=`__reactFiber$`+gt,vt=`__reactProps$`+gt,yt=`__reactContainer$`+gt,bt=`__reactEvents$`+gt,xt=`__reactListeners$`+gt,St=`__reactHandles$`+gt,Ct=`__reactResources$`+gt,wt=`__reactMarker$`+gt,Tt=`__reactLoad$`+gt;function Et(e){delete e[_t],delete e[vt],delete e[xt],delete e[St]}function Dt(e){var t;if(t=e[_t])return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ym(e);e!==null;){if(n=e[_t])return n;e=ym(e)}return t}e=n,n=e.parentNode}return null}function Ot(e){if(e=e[_t]||e[yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function At(e){var t=e[Ct];return t||=e[Ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function jt(e){e[wt]=!0}function Mt(e){e[Tt]=void 0}var Nt=new Set,Pt={};function Ft(e,t){It(e,t),It(e+`Capture`,t)}function It(e,t){for(Pt[e]=t,e=0;e<t.length;e++)Nt.add(t[e])}var Lt=RegExp(`^[: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]*$`),Rt={},zt={};function Bt(e){return Oe.call(zt,e)?!0:Oe.call(Rt,e)?!1:Lt.test(e)?zt[e]=!0:(Rt[e]=!0,!1)}var Vt=!1;function Ht(){var e=Vt;return Vt=!1,e}function Ut(e,t,n){if(Bt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Wt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Gt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function qt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yt(e){if(!e._valueTracker){var t=qt(e)?`checked`:`value`;e._valueTracker=Jt(e,t,``+e[t])}}function Xt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=qt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Zt=/[\n"\\]/g;function Qt(e){return e.replace(Zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function $t(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Kt(t)):e.value!==``+Kt(t)&&(e.value=``+Kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):tn(e,Kt(n)):o===`number`&&e.value==t?tn(e,Kt(e.value)):tn(e,Kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Kt(s):e.removeAttribute(`name`)}function en(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Yt(e);return}n=n==null?``:``+Kt(n),t=t==null?n:``+Kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Yt(e)}function tn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function nn(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=``+Kt(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 rn(e,t,n){t!=null&&(t=``+Kt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Kt(n)}function an(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ae(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Yt(e)}function on(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function cn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||sn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function ln(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Vt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(cn(e,a,r),Vt=!0)}else for(var o in t)t.hasOwnProperty(o)&&cn(e,o,t[o])}function un(e){if(e.indexOf(`-`)===-1)return!1;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 dn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),fn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function pn(e){return fn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function mn(){}var hn=null;function gn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _n=null,vn=null;function yn(e){var t=Ot(e);if(t&&(e=t.stateNode)){var n=e[vt]||null;a:switch(e=t.stateNode,t.type){case`input`:if($t(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Qt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[vt]||null;if(!a)throw Error(i(90));$t(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Xt(r)}break a;case`textarea`:rn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&nn(e,!!n.multiple,t,!1)}}}var bn=!1;function xn(e,t,n){if(bn)return e(t,n);bn=!0;try{return e(t)}finally{if(bn=!1,(_n!==null||vn!==null)&&(Ud(),_n&&(t=_n,e=vn,vn=_n=null,yn(t),e)))for(t=0;t<e.length;t++)yn(e[t])}}function Sn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vt]||null;if(r===null)return null;n=r[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`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,wn=!1;if(Cn)try{var Tn={};Object.defineProperty(Tn,"passive",{get:function(){wn=!0}}),window.addEventListener(`test`,Tn,Tn),window.removeEventListener(`test`,Tn,Tn)}catch{wn=!1}var En=null,Dn=null,On=null;function kn(){if(On)return On;var e,t=Dn,n=t.length,r,i=`value`in En?En.value:En.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 On=i.slice(e,1<r?1-r:void 0)}function An(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 jn(){return!0}function Mn(){return!1}function Nn(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)?jn:Mn,this.isPropagationStopped=Mn,this}return T(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=jn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=jn)},persist:function(){},isPersistent:jn}),t}var Pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fn=Nn(Pn),In=T({},Pn,{view:0,detail:0}),Ln=Nn(In),Rn,zn,Bn,Vn=T({},In,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qn,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!==Bn&&(Bn&&e.type===`mousemove`?(Rn=e.screenX-Bn.screenX,zn=e.screenY-Bn.screenY):zn=Rn=0,Bn=e),Rn)},movementY:function(e){return`movementY`in e?e.movementY:zn}}),Hn=Nn(Vn),Un=Nn(T({},Vn,{dataTransfer:0})),Wn=Nn(T({},In,{relatedTarget:0})),Gn=Nn(T({},Pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Kn=Nn(T({},Pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),qn=Nn(T({},Pn,{data:0})),Jn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Yn={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`},Xn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Zn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xn[e])?!!t[e]:!1}function Qn(){return Zn}var $n=Nn(T({},In,{key:function(e){if(e.key){var t=Jn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=An(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Yn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qn,charCode:function(e){return e.type===`keypress`?An(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?An(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),er=Nn(T({},Vn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),tr=Nn(T({},Pn,{submitter:0})),nr=Nn(T({},In,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qn})),rr=Nn(T({},Pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ir=Nn(T({},Vn,{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})),ar=Nn(T({},Pn,{newState:0,oldState:0,source:0})),or=[9,13,27,32],sr=Cn&&`CompositionEvent`in window,cr=null;Cn&&`documentMode`in document&&(cr=document.documentMode);var lr=Cn&&`TextEvent`in window&&!cr,ur=Cn&&(!sr||cr&&8<cr&&11>=cr),dr=` `,fr=!1;function pr(e,t){switch(e){case`keyup`:return or.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function mr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var hr=!1;function gr(e,t){switch(e){case`compositionend`:return mr(t);case`keypress`:return t.which===32?(fr=!0,dr):null;case`textInput`:return e=t.data,e===dr&&fr?null:e;default:return null}}function _r(e,t){if(hr)return e===`compositionend`||!sr&&pr(e,t)?(e=kn(),On=Dn=En=null,hr=!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 ur&&t.locale!==`ko`?null:t.data;default:return null}}var vr={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 yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!vr[e.type]:t===`textarea`}function br(e,t,n,r){_n?vn?vn.push(r):vn=[r]:_n=r,t=ep(t,`onChange`),0<t.length&&(n=new Fn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var xr=null,Sr=null;function Cr(e){Kf(e,0)}function wr(e){if(Xt(kt(e)))return e}function Tr(e,t){if(e===`change`)return t}var Er=!1;if(Cn){var Dr;if(Cn){var Or=`oninput`in document;if(!Or){var kr=document.createElement(`div`);kr.setAttribute(`oninput`,`return;`),Or=typeof kr.oninput==`function`}Dr=Or}else Dr=!1;Er=Dr&&(!document.documentMode||9<document.documentMode)}function Ar(){xr&&(xr.detachEvent(`onpropertychange`,jr),Sr=xr=null)}function jr(e){if(e.propertyName===`value`&&wr(Sr)){var t=[];br(t,Sr,e,gn(e)),xn(Cr,t)}}function Mr(e,t,n){e===`focusin`?(Ar(),xr=t,Sr=n,xr.attachEvent(`onpropertychange`,jr)):e===`focusout`&&Ar()}function Nr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return wr(Sr)}function Pr(e,t){if(e===`click`)return wr(t)}function Fr(e,t){if(e===`input`||e===`change`)return wr(t)}function Ir(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Lr=typeof Object.is==`function`?Object.is:Ir;function Rr(e,t){if(Lr(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(!Oe.call(t,i)||!Lr(e[i],t[i]))return!1}return!0}function zr(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 Br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vr(e,t){var n=Br(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=Br(n)}}function Hr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ur(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=zr(e.document)}return t}function Wr(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`)}var Gr=Cn&&`documentMode`in document&&11>=document.documentMode,Kr=null,qr=null,Jr=null,Yr=!1;function Xr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yr||Kr==null||Kr!==zr(r)||(r=Kr,`selectionStart`in r&&Wr(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}),Jr&&Rr(Jr,r)||(Jr=r,r=ep(qr,`onSelect`),0<r.length&&(t=new Fn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Kr)))}function Zr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Qr={animationend:Zr(`Animation`,`AnimationEnd`),animationiteration:Zr(`Animation`,`AnimationIteration`),animationstart:Zr(`Animation`,`AnimationStart`),transitionrun:Zr(`Transition`,`TransitionRun`),transitionstart:Zr(`Transition`,`TransitionStart`),transitioncancel:Zr(`Transition`,`TransitionCancel`),transitionend:Zr(`Transition`,`TransitionEnd`)},$r={},ei={};Cn&&(ei=document.createElement(`div`).style,`AnimationEvent`in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),`TransitionEvent`in window||delete Qr.transitionend.transition);function ti(e){if($r[e])return $r[e];if(!Qr[e])return e;var t=Qr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ei)return $r[e]=t[n];return e}var ni=ti(`animationend`),ri=ti(`animationiteration`),ii=ti(`animationstart`),ai=ti(`transitionrun`),oi=ti(`transitionstart`),si=ti(`transitioncancel`),ci=ti(`transitionend`),li=new Map,ui=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);ui.push(`scrollEnd`);function di(e,t){li.set(e,t),Ft(t,[e])}var fi=0;function pi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=wd.identifierPrefix;var n=fi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function mi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Md;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function hi(e,t){return e=mi(e),t=mi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var gi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},_i=[],vi=0,yi=0;function bi(){for(var e=vi,t=yi=vi=0;t<e;){var n=_i[t];_i[t++]=null;var r=_i[t];_i[t++]=null;var i=_i[t];_i[t++]=null;var a=_i[t];if(_i[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&W(n,i,a)}}function xi(e,t,n,r){_i[vi++]=e,_i[vi++]=t,_i[vi++]=n,_i[vi++]=r,yi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Si(e,t,n,r){return xi(e,t,n,r),wi(e)}function Ci(e,t){return xi(e,null,null,t),wi(e)}function W(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ge(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function wi(e){if(50<Nd)throw Nd=0,Pd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ti={};function Ei(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.refCleanup=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 Di(e,t,n,r){return new Ei(e,t,n,r)}function G(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Di(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&1206910976,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.refCleanup=e.refCleanup,n}function ki(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)G(r)&&(s=1);else if(typeof r==`string`)s=eh(e,n,pe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case z:return e=Di(31,n,t,a),e.elementType=z,e.lanes=o,e;case k:return ji(n.children,a,o,t);case A:s=8,a|=24;break;case j:return e=Di(12,n,t,a|2),e.elementType=j,e.lanes=o,e;case F:return e=Di(13,n,t,a),e.elementType=F,e.lanes=o,e;case I:return e=Di(19,n,t,a),e.elementType=I,e.lanes=o,e;case B:case H:return e=a|32,e=Di(30,n,t,e),e.elementType=H,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case P:s=11;break a;case L:s=14;break a;case R:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Di(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ji(e,t,n,r){return e=Di(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Di(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Di(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Di(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:De(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:De(t)}}var Li=[],Ri=0,zi=null,Bi=0,Vi=[],Hi=0,Ui=null,Wi=1,Gi=``;function Ki(e,t){Li[Ri++]=Bi,Li[Ri++]=zi,zi=e,Bi=t}function qi(e,t,n){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Ui=e;var r=Wi;e=Gi;var i=32-Ge(r)-1;r&=~(1<<i),n+=1;var a=32-Ge(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Wi=1<<32-Ge(t)+i|n<<i|r,Gi=a+e}else Wi=1<<a|n<<i|r,Gi=e}function Ji(e){e.return!==null&&(Ki(e,1),qi(e,1,0))}function Yi(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,Bi=Li[--Ri],Li[Ri]=null;for(;e===Ui;)Ui=Vi[--Hi],Vi[Hi]=null,Gi=Vi[--Hi],Vi[Hi]=null,Wi=Vi[--Hi],Vi[Hi]=null}function Xi(e,t){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Wi=t.id,Gi=t.overflow,Ui=e}var Zi=null,Qi=null,$i=!1,ea=null,ta=!1,na=Error(i(519));function ra(e){throw la(Ii(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),na}function ia(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[_t]=e,t[vt]=r,n){case`dialog`:qf(`cancel`,t),qf(`close`,t);break;case`iframe`:case`object`:case`embed`:qf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Wf.length;n++)qf(Wf[n],t);break;case`source`:qf(`error`,t);break;case`img`:case`image`:case`link`:qf(`error`,t),qf(`load`,t);break;case`details`:qf(`toggle`,t);break;case`input`:qf(`invalid`,t),en(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:qf(`invalid`,t);break;case`textarea`:qf(`invalid`,t),an(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||op(t.textContent,n)?(r.popover!=null&&(qf(`beforetoggle`,t),qf(`toggle`,t)),r.onScroll!=null&&qf(`scroll`,t),r.onScrollEnd!=null&&qf(`scrollend`,t),r.onClick!=null&&(t.onclick=mn),t=!0):t=!1,t||ra(e,!0)}function aa(e){for(Zi=e.return;Zi;)switch(Zi.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:Zi=Zi.return}}function oa(e){if(e!==Zi)return!1;if(!$i)return aa(e),$i=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||bp(e.type,e.memoizedProps)),n=!n),n&&Qi&&ra(e),aa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Qi=vm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Qi=vm(e)}else t===27?(t=Qi,kp(e.type)?(e=_m,_m=null,Qi=e):Qi=t):Qi=Zi?gm(e.stateNode.nextSibling):null;return!0}function sa(){Qi=Zi=null,$i=!1}function ca(){var e=ea;return e!==null&&(gd===null?gd=e:gd.push.apply(gd,e),ea=null),e}function la(e){ea===null?ea=[e]:ea.push(e)}var ua=ue(null),da=null,fa=null;function pa(e,t,n){fe(ua,t._currentValue),t._currentValue=n}function ma(e){e._currentValue=ua.current,de(ua)}function ha(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 ga(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ha(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ha(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ha(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function _a(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Lr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ge.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[mh]:e.push(mh))}a=a.return}return e!==null&&ga(t,e,n,r),t.flags|=262144,e!==null}function va(e){for(e=e.firstContext;e!==null;){if(!Lr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ya(e){da=e,fa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ba(e){return Sa(da,e)}function xa(e,t){return da===null&&ya(e),Sa(e,t)}function Sa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},fa===null){if(e===null)throw Error(i(308));fa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else fa=fa.next=t;return n}var Ca=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},wa=t.unstable_scheduleCallback,Ta=t.unstable_NormalPriority,Ea={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Da(){return{controller:new Ca,data:new Map,refCount:0}}function Oa(e){e.refCount--,e.refCount===0&&wa(Ta,function(){e.controller.abort()})}function ka(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Aa=null;function ja(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ma=null,Na=0,Pa=0,Fa=null;function Ia(e,t){if(Ma===null){var n=Ma=[];Na=0,Pa=zf(),Fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Na++,t.then(La,La),t}function La(){if(--Na===0&&(Aa=null,Ma!==null)){Fa!==null&&(Fa.status=`fulfilled`);var e=Ma;Ma=null,Pa=0,Fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ra(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var za=U.S;U.S=function(e,t){if(yd=Ne(),typeof t==`object`&&t&&typeof t.then==`function`&&Ia(e,t),Aa!==null)for(var n=Tf;n!==null;)ka(n,Aa),n=n.next;if(n=e.types,n!==null){for(var r=Tf;r!==null;)ka(r,n),r=r.next;if(Pa!==0){r=Aa,r===null&&(r=Aa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}za!==null&&za(e,t)};var Ba=ue(null);function Va(){var e=Ba.current;return e===null?ed.pooledCache:e}function Ha(e,t){t===null?fe(Ba,Ba.current):fe(Ba,t.pool)}function Ua(){var e=Va();return e===null?null:{parent:Ea._currentValue,pool:e}}var Wa=Error(i(460)),Ga=Error(i(474)),Ka=Error(i(542)),qa={then:function(){}};function Ja(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ya(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(mn,mn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,$a(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(mn,mn);else{if(e=ed,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,$a(e),e}throw Za=t,Wa}}function Xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Za=e,Wa):e}}var Za=null;function Qa(){if(Za===null)throw Error(i(459));var e=Za;return Za=null,e}function $a(e){if(e===Wa||e===Ka)throw Error(i(483))}var eo=null,to=0;function no(e){var t=to;return to+=1,eo===null&&(eo=[]),Ya(eo,e,t)}function ro(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function io(e,t){throw t.$$typeof===E?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ao(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 r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Oi(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|=134217730,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|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(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===k?(e=d(e,t,n.props.children,r,n.key),ro(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===R&&Xa(i)===t.type)?(t=a(t,n.props),ro(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),ro(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Pi(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=ji(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`||typeof t==`bigint`)return t=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Ai(t.type,t.key,t.props,null,e.mode,n),ro(n,t),n.return=e,n;case O:return t=Pi(t,e.mode,n),t.return=e,t;case R:return t=Xa(t),f(e,t,n)}if(ae(t)||ne(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,no(t),n);if(t.$$typeof===N)return f(e,xa(e,t),n);io(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`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case R:return n=Xa(n),p(e,t,n,r)}if(ae(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,no(n),r);if(n.$$typeof===N)return p(e,t,xa(e,n),r);io(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case R:return r=Xa(r),m(e,t,n,r,i)}if(ae(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,no(r),i);if(r.$$typeof===N)return m(e,t,n,xa(t,r),i);io(t,r)}return null}function h(i,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(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),$i&&Ki(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return $i&&Ki(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),$i&&Ki(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=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),$i&&Ki(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 $i&&Ki(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.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)}),$i&&Ki(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),ro(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===R&&Xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ro(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=ji(o.props.children,e.mode,c,o.key),ro(c,o),c.return=e,e=c):(c=Ai(o.type,o.key,o.props,null,e.mode,c),ro(c,o),c.return=e,e=c)}return s(e);case O:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Pi(o,e.mode,c),c.return=e,e=c}return s(e);case R:return o=Xa(o),_(e,r,o,c)}if(ae(o))return h(e,r,o,c);if(ne(o)){if(l=ne(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,no(o),c);if(o.$$typeof===N)return _(e,r,xa(e,o),c);io(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{to=0;var i=_(e,t,n,r);return eo=null,i}catch(t){if(t===Wa||t===Ka)throw t;var a=Di(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var oo=ao(!0),so=ao(!1),co=!1;function lo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function fo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function po(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$u&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=wi(e),W(e,null,n),t}return xi(e,r,t,n),wi(e)}function mo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}function ho(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={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,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,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var go=!1;function _o(){if(go){var e=Fa;if(e!==null)throw e}}function vo(e,t,n,r){go=!1;var i=e.updateQueue;co=!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&-536870913,p=f!==s.lane;if(p?(nd&f)===f:(r&f)===f){f!==0&&f===Pa&&(go=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,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(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:co=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else 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;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ud|=o,e.lanes=o,e.memoizedState=d}}function yo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function bo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)yo(n[e],t)}var xo=ue(null),So=ue(0);function Co(e,t){e=cd,fe(So,e),fe(xo,t),cd=e|t.baseLanes}function wo(){fe(So,cd),fe(xo,xo.current)}function To(){cd=So.current,de(xo),de(So)}var Eo=ue(null),Do=null;function Oo(e){var t=e.alternate;fe(No,No.current&1),fe(Eo,e),Do===null&&(t===null||xo.current!==null||t.memoizedState!==null)&&(Do=e)}function ko(e){fe(No,No.current),fe(Eo,e),Do===null&&(Do=e)}function Ao(e){e.tag===22?(fe(No,No.current),fe(Eo,e),Do===null&&(Do=e)):jo()}function jo(){fe(No,No.current),fe(Eo,Eo.current)}function Mo(e){de(Eo),Do===e&&(Do=null),de(No)}var No=ue(0);function Po(e,t){fe(Eo,Eo.current),fe(No,t)}function Fo(e){de(No),de(Eo),Do===e&&(Do=null)}function Io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pm(n)||mm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){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 Lo=0,Ro=null,zo=null,Bo=null,Vo=!1,Ho=!1,Uo=!1,Wo=0,Go=0,Ko=null,qo=0;function Jo(){throw Error(i(321))}function Yo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Lr(e[n],t[n]))return!1;return!0}function Xo(e,t,n,r,i,a){return Lo=a,Ro=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?pc:mc,Uo=!1,a=n(r,i),Uo=!1,Ho&&(a=Qo(t,n,r,i)),Zo(e),a}function Zo(e){U.H=fc;var t=zo!==null&&zo.next!==null;if(Lo=0,Bo=zo=Ro=null,Vo=!1,Go=0,Ko=null,t)throw Error(i(300));e===null||jc||(e=e.dependencies,e!==null&&va(e)&&(jc=!0))}function Qo(e,t,n,r){Ro=e;var a=0;do{if(Ho&&(Ko=null),Go=0,Ho=!1,25<=a)throw Error(i(301));if(a+=1,Bo=zo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}U.H=hc,o=t(n,r)}while(Ho);return o}function $o(){var e=U.H,t=e.useState()[0];return t=typeof t.then==`function`?os(t):t,e=e.useState()[0],(zo===null?null:zo.memoizedState)!==e&&(Ro.flags|=1024),t}function es(){var e=Wo!==0;return Wo=0,e}function ts(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ns(e){if(Vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Vo=!1}Lo=0,Bo=zo=Ro=null,Ho=!1,Go=Wo=0,Ko=null}function rs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bo===null?Ro.memoizedState=Bo=e:Bo=Bo.next=e,Bo}function is(){if(zo===null){var e=Ro.alternate;e=e===null?null:e.memoizedState}else e=zo.next;var t=Bo===null?Ro.memoizedState:Bo.next;if(t!==null)Bo=t,zo=e;else{if(e===null)throw Ro.alternate===null?Error(i(467)):Error(i(310));zo=e,e={memoizedState:zo.memoizedState,baseState:zo.baseState,baseQueue:zo.baseQueue,queue:zo.queue,next:null},Bo===null?Ro.memoizedState=Bo=e:Bo=Bo.next=e}return Bo}function as(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function os(e){var t=Go;return Go+=1,Ko===null&&(Ko=[]),e=Ya(Ko,e,t),t=Ro,(Bo===null?t.memoizedState:Bo.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?pc:mc),e}function ss(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return os(e);if(e.$$typeof===ee)return;if(e.$$typeof===N)return ba(e)}throw Error(i(438,String(e)))}function cs(e){var t=null,n=Ro.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Ro.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=as(),Ro.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=V;return t.index++,n}function ls(e,t){return typeof t==`function`?t(e):t}function us(e){return ds(is(),zo,e)}function ds(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Lo&f)===f:(nd&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Pa&&(d=!0);else if((Lo&p)===p){u=u.next,p===Pa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,Ro.lanes|=p,ud|=p;f=u.action,Uo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,Ro.lanes|=f,ud|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Lr(o,e.memoizedState)&&(jc=!0,d&&(n=Fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function fs(e){var t=is(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=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);Lr(o,t.memoizedState)||(jc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ps(e,t,n){var r=Ro,a=is(),o=$i;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Lr((zo||a).memoizedState,n);if(s&&(a.memoizedState=n,jc=!0),a=a.queue,Rs(gs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Bo!==null&&!!(Bo.memoizedState.tag&1),Ns(e?9:8,{destroy:void 0},hs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,ed===null)throw Error(i(349));o||Lo&127||ms(r,t,n)}return n}function ms(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ro.updateQueue,t===null?(t=as(),Ro.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function hs(e,t,n,r){t.value=n,t.getSnapshot=r,_s(t)&&vs(e)}function gs(e,t,n){return n(function(){_s(t)&&vs(e)})}function _s(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lr(e,n)}catch{return!0}}function vs(e){var t=Ci(e,2);t!==null&&Rd(t,e,2)}function ys(e){var t=rs();if(typeof e==`function`){var n=e;if(e=n(),Uo){We(!0);try{n()}finally{We(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e},t}function bs(e,t,n,r){return e.baseState=n,ds(e,zo,typeof r==`function`?r:ls)}function xs(e,t,n,r,a){if(lc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};U.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ss(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ss(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=U.T,o={};o.types=a===null?null:a.types,U.T=o;try{var s=n(i,r),c=U.S;c!==null&&c(o,s),Cs(e,t,s)}catch(n){Ts(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),U.T=a}}else try{a=n(i,r),Cs(e,t,a)}catch(n){Ts(e,t,n)}}function Cs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ws(e,t,n)},function(n){return Ts(e,t,n)}):ws(e,t,n)}function ws(e,t,n){t.status=`fulfilled`,t.value=n,Es(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ss(e,n)))}function Ts(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Es(t),t=t.next;while(t!==r)}e.action=null}function Es(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ds(e,t){return t}function Os(e,t){if($i){var n=ed.formState;if(n!==null){a:{var r=Ro;if($i){if(Qi){b:{for(var i=Qi,a=ta;i.nodeType!==8;)if(!a||(i=gm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Qi=gm(i.nextSibling),r=i.data===`F!`;break a}}ra(r)}r=!1}r&&(t=n[0])}}return n=rs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:t},n.queue=r,n=oc.bind(null,Ro,r),r.dispatch=n,r=ys(!1),a=cc.bind(null,Ro,!1,r.queue),r=rs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=xs.bind(null,Ro,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ks(e){return As(is(),zo,e)}function As(e,t,n){if(t=ds(e,t,Ds)[0],e=us(ls)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=os(t)}catch(e){throw e===Wa?Ka:e}else r=t;t=is();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Ro.flags|=2048,Ns(9,{destroy:void 0},js.bind(null,i,n),null)),[r,a,e]}function js(e,t){e.action=t}function Ms(e){var t=is(),n=zo;if(n!==null)return As(t,n,e);is(),t=t.memoizedState,n=is();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Ro.updateQueue,t===null&&(t=as(),Ro.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ps(){return is().memoizedState}function Fs(e,t,n,r){var i=rs();Ro.flags|=e,i.memoizedState=Ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function Is(e,t,n,r){var i=is();r=r===void 0?null:r;var a=i.memoizedState.inst;zo!==null&&r!==null&&Yo(r,zo.memoizedState.deps)?i.memoizedState=Ns(t,a,n,r):(Ro.flags|=e,i.memoizedState=Ns(1|t,a,n,r))}function Ls(e,t){Fs(8390656,8,e,t)}function Rs(e,t){Is(2048,8,e,t)}function zs(e){Ro.flags|=4;var t=Ro.updateQueue;if(t===null)t=as(),Ro.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Bs(e){var t=is().memoizedState;return zs({ref:t,nextImpl:e}),function(){if($u&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Vs(e,t){return Is(4,2,e,t)}function Hs(e,t){return Is(4,4,e,t)}function Us(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ws(e,t,n){n=n==null?null:n.concat([e]),Is(4,4,Us.bind(null,t,e),n)}function Gs(){}function Ks(e,t){var n=is();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Yo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function qs(e,t){var n=is();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Yo(t,r[1]))return r[0];if(r=e(),Uo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r}function Js(e,t,n){return n===void 0||Lo&1073741824&&!(nd&261930)?e.memoizedState=t:(e.memoizedState=n,e=Id(),Ro.lanes|=e,ud|=e,n)}function Ys(e,t,n,r){return Lr(n,t)?n:xo.current===null?!(Lo&106)||Lo&1073741824&&!(nd&261930)?(jc=!0,e.memoizedState=n):(e=Id(),Ro.lanes|=e,ud|=e,t):(e=Js(e,n,r),Lr(e,t)||(jc=!0),e)}function Xs(e,t,n,r,i){var a=oe.p;oe.p=a!==0&&8>a?a:8;var o=U.T,s={};s.types=o===null?null:o.types,U.T=s,cc(e,!1,t,n);try{var c=i(),l=U.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?sc(e,t,Ra(c,r),Fd(e)):sc(e,t,r,Fd(e))}catch(n){sc(e,t,{then:function(){},status:`rejected`,reason:n},Fd())}finally{oe.p=a,o!==null&&s.types!==null&&(o.types=s.types),U.T=o}}function Zs(){}function Qs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=$s(e).queue;Xs(e,a,t,se,n===null?Zs:function(){return ec(e),n(r)})}function $s(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ec(e){var t=$s(e);t.next===null&&(t=e.alternate.memoizedState),sc(e,t.next.queue,{},Fd())}function tc(){return ba(mh)}function nc(){return is().memoizedState}function rc(){return is().memoizedState}function ic(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Fd();e=fo(n);var r=po(t,e,n);r!==null&&(Rd(r,t,n),mo(r,t,n)),t={cache:Da()},e.payload=t;return}t=t.return}}function ac(e,t,n){var r=Fd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},lc(e)?uc(t,n):(n=Si(e,t,n,r),n!==null&&(Rd(n,e,r),dc(n,t,r)))}function oc(e,t,n){sc(e,t,n,Fd())}function sc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(lc(e))uc(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,Lr(s,o))return xi(e,t,i,0),ed===null&&bi(),!1}catch{}if(n=Si(e,t,i,r),n!==null)return Rd(n,e,r),dc(n,t,r),!0}return!1}function cc(e,t,n,r){if(r={lane:2,revertLane:zf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},lc(e)){if(t)throw Error(i(479))}else t=Si(e,n,r,2),t!==null&&Rd(t,e,2)}function lc(e){var t=e.alternate;return e===Ro||t!==null&&t===Ro}function uc(e,t){Ho=Vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}var fc={readContext:ba,use:ss,useCallback:Jo,useContext:Jo,useEffect:Jo,useImperativeHandle:Jo,useLayoutEffect:Jo,useInsertionEffect:Jo,useMemo:Jo,useReducer:Jo,useRef:Jo,useState:Jo,useDebugValue:Jo,useDeferredValue:Jo,useTransition:Jo,useSyncExternalStore:Jo,useId:Jo,useHostTransitionStatus:Jo,useFormState:Jo,useActionState:Jo,useOptimistic:Jo,useMemoCache:Jo,useCacheRefresh:Jo,useEffectEvent:Jo},pc={readContext:ba,use:ss,useCallback:function(e,t){return rs().memoizedState=[e,t===void 0?null:t],e},useContext:ba,useEffect:Ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Fs(4194308,4,Us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fs(4194308,4,e,t)},useInsertionEffect:function(e,t){Fs(4,2,e,t)},useMemo:function(e,t){var n=rs();t=t===void 0?null:t;var r=e();if(Uo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=rs();if(n!==void 0){var i=n(t);if(Uo){We(!0);try{n(t)}finally{We(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ac.bind(null,Ro,e),[r.memoizedState,e]},useRef:function(e){var t=rs();return e={current:e},t.memoizedState=e},useState:function(e){e=ys(e);var t=e.queue,n=oc.bind(null,Ro,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Gs,useDeferredValue:function(e,t){return Js(rs(),e,t)},useTransition:function(){var e=ys(!1);return e=Xs.bind(null,Ro,e.queue,!0,!1),rs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ro,a=rs();if($i){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ed===null)throw Error(i(349));nd&127||ms(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ls(gs.bind(null,r,o,e),[e]),r.flags|=2048,Ns(9,{destroy:void 0},hs.bind(null,r,o,n,t),null),n},useId:function(){var e=rs(),t=ed.identifierPrefix;if($i){var n=Gi,r=Wi;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Wo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=qo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:tc,useFormState:Os,useActionState:Os,useOptimistic:function(e){var t=rs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=cc.bind(null,Ro,!0,n),n.dispatch=t,[e,t]},useMemoCache:cs,useCacheRefresh:function(){return rs().memoizedState=ic.bind(null,Ro)},useEffectEvent:function(e){var t=rs(),n={impl:e};return t.memoizedState=n,function(){if($u&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},mc={readContext:ba,use:ss,useCallback:Ks,useContext:ba,useEffect:Rs,useImperativeHandle:Ws,useInsertionEffect:Vs,useLayoutEffect:Hs,useMemo:qs,useReducer:us,useRef:Ps,useState:function(){return us(ls)},useDebugValue:Gs,useDeferredValue:function(e,t){return Ys(is(),zo.memoizedState,e,t)},useTransition:function(){var e=us(ls)[0],t=is().memoizedState;return[typeof e==`boolean`?e:os(e),t]},useSyncExternalStore:ps,useId:nc,useHostTransitionStatus:tc,useFormState:ks,useActionState:ks,useOptimistic:function(e,t){return bs(is(),zo,e,t)},useMemoCache:cs,useCacheRefresh:rc,useEffectEvent:Bs},hc={readContext:ba,use:ss,useCallback:Ks,useContext:ba,useEffect:Rs,useImperativeHandle:Ws,useInsertionEffect:Vs,useLayoutEffect:Hs,useMemo:qs,useReducer:fs,useRef:Ps,useState:function(){return fs(ls)},useDebugValue:Gs,useDeferredValue:function(e,t){var n=is();return zo===null?Js(n,e,t):Ys(n,zo.memoizedState,e,t)},useTransition:function(){var e=fs(ls)[0],t=is().memoizedState;return[typeof e==`boolean`?e:os(e),t]},useSyncExternalStore:ps,useId:nc,useHostTransitionStatus:tc,useFormState:Ms,useActionState:Ms,useOptimistic:function(e,t){var n=is();return zo===null?(n.baseState=e,[e,n.queue.dispatch]):bs(n,zo,e,t)},useMemoCache:cs,useCacheRefresh:rc,useEffectEvent:Bs};function gc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var _c={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Fd(),i=fo(r);i.payload=t,n!=null&&(i.callback=n),t=po(e,i,r),t!==null&&(Rd(t,e,r),mo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Fd(),i=fo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=po(e,i,r),t!==null&&(Rd(t,e,r),mo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Fd(),r=fo(n);r.tag=2,t!=null&&(r.callback=t),t=po(e,r,n),t!==null&&(Rd(t,e,n),mo(t,e,n))}};function vc(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?!Rr(n,r)||!Rr(i,a):!0}function yc(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&&_c.enqueueReplaceState(t,t.state,null)}function bc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function xc(e){gi(e)}function Sc(e){console.error(e)}function Cc(e){gi(e)}function wc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Tc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ec(e,t,n){return n=fo(n),n.tag=3,n.payload={element:null},n.callback=function(){wc(e,t)},n}function Dc(e){return e=fo(e),e.tag=3,e}function Oc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Tc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Tc(t,n,r),typeof i!=`function`&&(Sd===null?Sd=new Set([this]):Sd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function kc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&_a(t,n,a,!0),n=Eo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Do===null?Xd():n.alternate===null&&ld===0&&(ld=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===qa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),yf(e,r,a)),!1;case 22:return n.flags|=65536,r===qa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),yf(e,r,a)),!1}throw Error(i(435,n.tag))}return yf(e,r,a),Xd(),!1}if($i)return t=Eo.current,t===null?(r!==na&&(t=Error(i(423),{cause:r}),la(Ii(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ii(r,n),a=Ec(e.stateNode,r,a),ho(e,a),ld!==4&&(ld=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==na&&(e=Error(i(422),{cause:r}),la(Ii(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ii(o,n),hd===null?hd=[o]:hd.push(o),ld!==4&&(ld=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ec(n.stateNode,r,e),ho(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Sd===null||!Sd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Dc(a),Oc(a,e,n,r),ho(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Ac=Error(i(461)),jc=!1;function Mc(e,t,n,r){t.child=e===null?so(t,null,n,r):oo(t,e.child,n,r)}function Nc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ya(t),r=Xo(e,t,n,o,a,i),s=es(),e!==null&&!jc?(ts(e,t,i),sl(e,t,i)):($i&&s&&Ji(t),t.flags|=1,Mc(e,t,r,i),t.child)}function Pc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!G(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Fc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!cl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Rr:n,n(o,r)&&e.ref===t.ref)return sl(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Fc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Rr(a,r)&&e.ref===t.ref){if(jc=!1,t.pendingProps=r=a,cl(e,i))e.flags&131072&&(jc=!0);else return t.lanes=e.lanes,sl(e,t,i)}}return Uc(e,t,n,r,i)}function Ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ha(t,a===null?null:a.cachePool),a===null?wo():Co(t,a),Ao(t);else return r=t.lanes=536870912,Rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ha(t,null),wo(),jo()):(Ha(t,a.cachePool),Co(t,a),jo(),t.memoizedState=null);return Mc(e,t,i,n),t.child}function Lc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Rc(e,t,n,r,i){var a=Va();return a=a===null?null:{parent:Ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ha(t,null),wo(),Ao(t),e!==null&&_a(e,t,r,!0),t.childLanes=i,null}function zc(e,t){return t=Qc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Bc(e,t,n){return oo(t,e.child,null,n),e=zc(t,t.pendingProps),e.flags|=2,Mo(t),t.memoizedState=null,e}function Vc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if($i){if(r.mode===`hidden`)return e=zc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Lc(null,e);if(ko(t),(e=Qi)?(e=fm(e,ta),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Zi=t,Qi=null)):e=null,e===null)throw ra(t);return t.lanes=536870912,null}return zc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ko(t),a){if(t.flags&256)t.flags&=-257,t=Bc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(jc||_a(e,t,n,!1),a=(n&e.childLanes)!==0,jc||a){if(xo.current===null){if(r=ed,r!==null&&(s=dt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ci(e,s),Rd(r,e,s),Ac;Xd()}t=Bc(e,t,n)}else e=o.treeContext,Qi=gm(s.nextSibling),Zi=t,$i=!0,ea=null,ta=!1,e!==null&&Xi(t,e),t=zc(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Uc(e,t,n,r,i){return ya(t),n=Xo(e,t,n,r,void 0,i),r=es(),e!==null&&!jc?(ts(e,t,i),sl(e,t,i)):($i&&r&&Ji(t),t.flags|=1,Mc(e,t,n,i),t.child)}function Wc(e,t,n,r,i,a){return ya(t),t.updateQueue=null,n=Qo(t,r,n,i),Zo(e),r=es(),e!==null&&!jc?(ts(e,t,a),sl(e,t,a)):($i&&r&&Ji(t),t.flags|=1,Mc(e,t,n,a),t.child)}function Gc(e,t,n,r,i){if(ya(t),t.stateNode===null){var a=Ti,o=n.contextType;typeof o==`object`&&o&&(a=ba(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=_c,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},lo(t),o=n.contextType,a.context=typeof o==`object`&&o?ba(o):Ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(gc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&_c.enqueueReplaceState(a,a.state,null),vo(t,r,a,i),_o(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=bc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ti,typeof u==`object`&&u&&(o=ba(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&yc(t,a,r,o),co=!1;var f=t.memoizedState;a.state=f,vo(t,r,a,i),_o(),l=t.memoizedState,s||f!==l||co?(typeof d==`function`&&(gc(t,n,d,r),l=t.memoizedState),(c=co||vc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,uo(e,t),o=t.memoizedProps,u=bc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ti,typeof l==`object`&&l&&(c=ba(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&yc(t,a,r,c),co=!1,f=t.memoizedState,a.state=f,vo(t,r,a,i),_o();var p=t.memoizedState;o!==d||f!==p||co||e!==null&&e.dependencies!==null&&va(e.dependencies)?(typeof s==`function`&&(gc(t,n,s,r),p=t.memoizedState),(u=co||vc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&va(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Hc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=oo(t,e.child,null,i),t.child=oo(t,null,n,i)):Mc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=sl(e,t,i),e}function Kc(e,t,n,r){return sa(),t.flags|=256,Mc(e,t,n,r),t.child}var qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jc(e){return{baseLanes:e,cachePool:Ua()}}function Yc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=pd),e}function Xc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(No.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if($i){if(i?Oo(t):jo(),(e=Qi)?(e=fm(e,ta),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Zi=t,Qi=null)):e=null,e===null)throw ra(t);return t.lanes=mm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(jo(),i=t.mode,a=Qc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Jc(n),r.childLanes=Yc(e,o,n),t.memoizedState=qc,Lc(null,r)):(Oo(t),Zc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return el(e,t,a,o,r,c,s,n)}return i?(jo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Lc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Jc(n):(a=i.cachePool,a===null?a=Ua():(s=Ea._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Yc(e,o,n),t.memoizedState=qc,Lc(e.child,r)):(Oo(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Zc(e,t){return t=Qc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Qc(e,t){return e=Di(22,e,null,t),e.lanes=0,e}function $c(e,t,n){return oo(t,e.child,null,n),e=Zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function el(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Oo(t),t.flags&=-257,$c(e,t,c)):t.memoizedState===null?(jo(),o=a.fallback,s=t.mode,a=Qc({mode:`visible`,children:a.children},s),o=ji(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,oo(t,e.child,null,c),a=t.child,a.memoizedState=Jc(c),a.childLanes=Yc(e,r,c),t.memoizedState=qc,Lc(null,a)):(jo(),t.child=e.child,t.flags|=128,null);if(Oo(t),mm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,la({value:a,source:null,stack:null})),$c(e,t,c)}if(jc||_a(e,t,c,!1),r=(c&e.childLanes)!==0,jc||r){if(xo.current!==null)return $c(e,t,c);if(r=ed,r!==null&&(a=dt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Ci(e,a),Rd(r,e,a),Ac;return pm(o)||Xd(),$c(e,t,c)}return pm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Qi=gm(o.nextSibling),Zi=t,$i=!0,ea=null,ta=!1,e!==null&&Xi(t,e),t=Zc(t,a.children),t.flags|=134221824,t)}function tl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ha(e.return,t,n)}function nl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Io(n)===null&&(t=e),e=e.sibling}return t}function rl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function il(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function al(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=No.current;if(t.flags&128)return Po(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Po(t,o),i===`backwards`&&e!==null?(il(e),Mc(e,t,r,n),il(e)):Mc(e,t,r,n),r=$i?Bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tl(e,n,t);else if(e.tag===19)tl(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}switch(i){case`backwards`:n=nl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,il(t)),rl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rl(t,!0,n,null,a,r);break;case`together`:rl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=nl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rl(t,!1,i,n,a,r)}return t.child}function ol(e,t,n){var r=t.pendingProps;return pa(t,t.type,r.value),Mc(e,t,r.children,n),t.child}function sl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ud|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(_a(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function cl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&va(e)))}function ll(e,t,n){switch(t.tag){case 3:_e(t,t.stateNode.containerInfo),pa(t,Ea,e.memoizedState.cache),sa();break;case 27:case 5:ye(t);break;case 4:_e(t,t.stateNode.containerInfo);break;case 10:pa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ko(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Oo(t),t.flags|=128,null;r=_a(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Xc(e,t,n):(Oo(t),e=sl(e,t,n),e===null?null:e.sibling)}Oo(t);break;case 19:if(t.flags&128)return al(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(_a(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return al(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Po(t,No.current),r)break;return null;case 22:return t.lanes=0,Ic(e,t,n,t.pendingProps);case 24:pa(t,Ea,e.memoizedState.cache)}return sl(e,t,n)}function ul(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)jc=!0;else{if(!cl(e,n)&&!(t.flags&128))return jc=!1,ll(e,t,n);jc=!!(e.flags&131072)}}else jc=!1,$i&&t.flags&1048576&&qi(t,Bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Xa(t.elementType),t.type=e,typeof e==`function`)G(e)?(r=bc(e,r),t.tag=1,t=Gc(null,t,e,r,n)):(t.tag=0,t=Uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===P){t.tag=11,t=Nc(null,t,e,r,n);break a}if(a===L){t.tag=14,t=Pc(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=ol(null,t,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return Uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=bc(r,t.pendingProps),Gc(e,t,r,a,n);case 3:a:{if(_e(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,uo(e,t),vo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,pa(t,Ea,r),r!==o.cache&&ga(t,[Ea],n,!0),_o(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Kc(e,t,r,n);break a}if(r!==a){a=Ii(Error(i(424)),t),la(a),t=Kc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Qi=gm(e.firstChild),Zi=t,$i=!0,ea=null,ta=!0,n=so(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(sa(),r===a){t=sl(e,t,n);break a}Mc(e,t,r,n)}t=t.child}return t;case 26:return Hc(e,t),e===null?(n=Bm(t.type,null,t.pendingProps,null))?t.memoizedState=n:$i||(t.stateNode=yp(t.type,t.pendingProps,he.current,t)):t.memoizedState=Bm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ye(t),e===null&&$i&&(r=t.stateNode=Sm(t.type,t.pendingProps,he.current),Zi=t,ta=!0,a=Qi,kp(t.type)?(_m=a,Qi=gm(r.firstChild)):Qi=a),Mc(e,t,t.pendingProps.children,n),Hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&$i&&((a=r=Qi)&&(r=um(r,t.type,t.pendingProps,ta),r===null?a=!1:(t.stateNode=r,Zi=t,Qi=gm(r.firstChild),ta=!1,a=!0)),a||ra(t)),ye(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,bp(a,o)?r=null:s!==null&&bp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Xo(e,t,$o,null,null,n),mh._currentValue=a),Hc(e,t),Mc(e,t,r,n),t.child;case 6:return e===null&&$i&&((e=n=Qi)&&(n=dm(n,t.pendingProps,ta),n===null?e=!1:(t.stateNode=n,Zi=t,Qi=null,e=!0)),e||ra(t)),null;case 13:return Xc(e,t,n);case 4:return _e(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=oo(t,null,r,n):Mc(e,t,r,n),t.child;case 11:return Nc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Hc(e,t),Mc(e,t,r,n),t.child;case 8:return Mc(e,t,t.pendingProps.children,n),t.child;case 12:return Mc(e,t,t.pendingProps.children,n),t.child;case 10:return ol(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,ya(t),a=ba(a),r=r(a),t.flags|=1,Mc(e,t,r,n),t.child;case 14:return Pc(e,t,t.type,t.pendingProps,n);case 15:return Fc(e,t,t.type,t.pendingProps,n);case 19:return al(e,t,n);case 31:return Vc(e,t,n);case 22:return Ic(e,t,n,t.pendingProps);case 24:return ya(t),r=ba(Ea),e===null?(a=Va(),a===null&&(a=ed,o=Da(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},lo(t),pa(t,Ea,a)):((e.lanes&n)!==0&&(uo(e,t),vo(t,null,null,n),_o()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,pa(t,Ea,r),r!==a.cache&&ga(t,[Ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),pa(t,Ea,r))),Mc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:$i&&Ji(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Hc(e,t),Mc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function dl(e){e.flags|=4}function fl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?th(t,r):th(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(qd())e.flags|=8192;else throw Za=qa,Ga}}else e.flags&=-16777217}function pl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!nh(t)){if(qd())e.flags|=8192;else throw Za=qa,Ga}}function ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:at(),e.lanes|=t,md|=t)}function hl(e,t){if(!$i)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function gl(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&1206910976,r|=i.flags&1206910976,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 _l(e,t,n){var r=t.pendingProps;switch(Yi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gl(t),null;case 1:return gl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ma(Ea),ve(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(oa(t)?dl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ca())),gl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(dl(t),o===null?(gl(t),fl(t,a,null,r,n)):(gl(t),pl(t,o))):o?o===e.memoizedState?(gl(t),t.flags&=-16777217):(dl(t),gl(t),pl(t,o)):(e=e.memoizedProps,e!==r&&dl(t),gl(t),fl(t,a,e,r,n)),null;case 27:if(be(t),n=he.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&dl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return gl(t),t.subtreeFlags&=-33554433,null}e=pe.current,oa(t)?ia(t,e):(e=Sm(a,r,n),t.stateNode=e,dl(t))}return gl(t),t.subtreeFlags&=-33554433,null;case 5:if(be(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&dl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return gl(t),t.subtreeFlags&=-33554433,null}if(o=pe.current,oa(t))ia(t,o);else{var s=gp(he.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[_t]=t,o[vt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(lp(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&dl(t)}}return gl(t),t.subtreeFlags&=-33554433,fl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&dl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,oa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Zi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[_t]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||op(e.nodeValue,n)),e||ra(t,!0)}else e=gp(e).createTextNode(r),e[_t]=t,t.stateNode=e}return gl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=oa(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[_t]=t}else sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;gl(t),e=!1}else n=ca(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Mo(t),t):(Mo(t),null);if(t.flags&128)throw Error(i(558))}return gl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=oa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[_t]=t}else sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;gl(t),a=!1}else a=ca(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Mo(t),t):(Mo(t),null)}return Mo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ml(t,t.updateQueue),gl(t),null);case 4:return ve(),e===null&&Xf(t.stateNode.containerInfo),t.flags|=67108864,gl(t),null;case 10:return ma(t.type),gl(t),null;case 19:if(Fo(t),r=t.memoizedState,r===null)return gl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)hl(r,!1);else{if(ld!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Io(e),o!==null){for(t.flags|=128,hl(r,!1),e=o.updateQueue,t.updateQueue=e,ml(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return Po(t,No.current&1|2),$i&&Ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ne()>bd&&(t.flags|=128,a=!0,hl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,ml(t,e),hl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!$i)return gl(t),null}else 2*Ne()-r.renderingStartTime>bd&&n!==536870912&&(t.flags|=128,a=!0,hl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ne(),e.sibling=null,o=No.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||$i?Po(t,o):(n=o,fe(Eo,t),fe(No,n),Do===null&&(Do=t)),$i&&Ki(t,r.treeForkCount),e}return gl(t),null;case 22:case 23:return Mo(t),To(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(gl(t),t.subtreeFlags&6&&(t.flags|=8192)):gl(t),n=t.updateQueue,n!==null&&ml(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&de(Ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ma(Ea),gl(t),null;case 25:return null;case 30:return t.flags|=33554432,gl(t),null}throw Error(i(156,t.tag))}function vl(e,t){switch(Yi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ma(Ea),ve(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(Mo(t),t.alternate===null)throw Error(i(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Mo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ve(),null;case 10:return ma(t.type),null;case 22:case 23:return Mo(t),To(),e!==null&&de(Ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ma(Ea),null;case 25:return null;default:return null}}function yl(e,t){switch(Yi(t),t.tag){case 3:ma(Ea),ve();break;case 26:case 27:case 5:be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&Mo(t);break;case 13:Mo(t);break;case 19:Fo(t);break;case 10:ma(t.type);break;case 22:case 23:Mo(t),To(),e!==null&&de(Ba);break;case 24:ma(Ea)}}function bl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){vf(t,t.return,e)}}function xl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){vf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){vf(t,t.return,e)}}function Sl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{bo(t,n)}catch(t){vf(e,e.return,t)}}}function Cl(e,t,n){n.props=bc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){vf(e,t,n)}}function wl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=pi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Vp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Hp(e);f(e.child,!1,am,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){vf(e,t,n)}}function Tl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){vf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){vf(e,t,n)}else n.current=null}}function El(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)sm(e.stateNode,t[n])}function Dl(e){for(var t=e.return;t!==null&&(Al(t)&&sm(e.stateNode,t.stateNode),!kl(t));)t=t.return}function Ol(e){for(var t=e.return;t!==null&&(Al(t)&&cm(e.stateNode,t.stateNode),!kl(t));)t=t.return}function kl(e){return e.tag===5||e.tag===3||e.tag===27}function Al(e){return e&&e.tag===7&&e.stateNode!==null}function jl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){vf(e,e.return,t)}}function Ml(e,t,n){try{var r=e.stateNode;dp(r,e.type,n,t),r[vt]=t}catch(t){vf(e,e.return,t)}}function Nl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&kp(e.type)||e.tag===4}function Pl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Nl(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.tag===27&&kp(e.type)||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 Fl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=mn)),El(e,r),Vt=!0;else if(i!==4&&(i===27&&(El(e,r),r=null,kp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Fl(e,t,n,r),e=e.sibling;e!==null;)Fl(e,t,n,r),e=e.sibling}function Il(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),El(e,r),Vt=!0;else if(i!==4&&(i===27&&(El(e,r),r=null,kp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Il(e,t,n,r),e=e.sibling;e!==null;)Il(e,t,n,r),e=e.sibling}function Ll(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);lp(t,r,n),t[_t]=e,t[vt]=n}catch(t){vf(e,e.return,t)}}var Rl=!1,zl=null;function Bl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Rl=!0)}var Vl=null;function Hl(){var e=Vl;return Vl=null,e}var Ul=0;function Wl(e,t,n,r,i){return Ul=0,Gl(e.child,t,n,r,i)}function Gl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Fp(o);r.push(s),s.view&&(a=!0)}else a||Fp(o).view&&(a=!0);Rl=!0,Mp(o,Ul===0?t:t+`_`+Ul,n),Ul++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Gl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Kl(e,t){for(;e!==null;)e.tag===5?Np(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Kl(e.child,t),e=e.sibling}function ql(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(ql(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=hi(t.default,t.share),t!==`none`&&(Wl(e,n,t,null,!1)||Kl(e.child,!1))}e=e.sibling}}function Jl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=pi(r,n),a=hi(r.default,n.paired?r.share:r.enter);a===`none`?ql(e):Wl(e,i,a,null,!1)?(ql(e),n.paired||t||Ld(e,r.onEnter)):Kl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Jl(e,t),e=e.sibling;else ql(e)}function Yl(e){if(zl!==null&&zl.size!==0){var t=zl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=hi(n.default,n.share);if(a!==`none`&&(Wl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ld(e,n.onShare)):Kl(e.child,!1)),t.delete(r),t.size===0)break}}}Yl(e)}e=e.sibling}}}function Xl(e){if(e.tag===30){var t=e.memoizedProps,n=pi(t,e.stateNode),r=zl===null?void 0:zl.get(n),i=hi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Wl(e,n,i,null,!1)?r===void 0?Ld(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,zl.delete(n),Ld(e,t.onShare)):Kl(e.child,!1)),zl!==null&&Yl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Xl(e),e=e.sibling;else zl!==null&&Yl(e)}function Zl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=pi(t,e.stateNode);t=hi(t.default,t.update),e.flags&=-5,t!==`none`&&Wl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Zl(e);e=e.sibling}}function Ql(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Kl(e.child,!1))}Ql(e)}e=e.sibling}}function $l(e){if(e.tag===30)e.stateNode.paired=null,Kl(e.child,!1),Ql(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)$l(e),e=e.sibling;else Ql(e)}function eu(e){for(e=e.child;e!==null;)e.tag===30?Kl(e.child,!1):e.subtreeFlags&33554432&&eu(e),e=e.sibling}function tu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Ul<a.length){var l=a[Ul],u=Fp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Mp(c,Ul===0?n:n+`_`+Ul,i),s&&e.flags&4||(Vl===null&&(Vl=[]),Vl.push(c,Ul===0?r:r+`_`+Ul,t.memoizedProps)),Ul++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:tu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function nu(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=pi(n,r),a=hi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ip)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Ul=0,i=tu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ld(e,n.onUpdate))}else e.subtreeFlags&33554432&&nu(e,t);e=e.sibling}}var ru=!1,iu=!1,au=!1,ou=!1,su=typeof WeakSet==`function`?WeakSet:Set,cu=null,lu=!1,uu=!1,du=!1,fu=!1;function pu(e,t,n){if(e=e.containerInfo,mp=Ch,e=Ur(e),Wr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||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===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(hp={focusedElem:e,selectionRange:r},Ch=!1,n=(n&335544064)===n,cu=t,t=n?9270:1024;cu!==null;){if(e=cu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Xl(r[a]);if(e.alternate===null&&e.flags&2)n&&Bl(e),mu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Xl(r),mu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Bl(e),mu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,cu=r):(n&&Zl(e),mu(n))}}zl=null}function mu(e){for(;cu!==null;){var t=cu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=bc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){vf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)lm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:lm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=pi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=hi(a.default,a.update),a!==`none`&&Wl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,cu=r;break}cu=t.return}}function hu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Pu(e,n),r&4&&bl(5,n);break;case 1:if(Pu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){vf(n,n.return,e)}else{var i=bc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){vf(n,n.return,e)}}}r&64&&Sl(n),r&512&&wl(n,n.return);break;case 3:if(Pu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{bo(e,t)}catch(e){vf(n,n.return,e)}}break;case 27:t===null&&r&4&&Ll(n);case 26:case 5:Pu(e,n),t===null&&r&4&&jl(n),r&512&&wl(n,n.return);break;case 12:Pu(e,n);break;case 31:Pu(e,n),r&4&&Cu(e,n);break;case 13:Pu(e,n),r&4&&wu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Sf.bind(null,n),hm(e,n))));break;case 22:if(r=n.memoizedState!==null||ru,!r){var a=t!==null&&t.memoizedState!==null||iu;t=ru,i=iu,ru=r,(iu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Iu(e,n,r)):Pu(e,n),ru=t,iu=i}break;case 30:Pu(e,n),r&512&&wl(n,n.return);break;case 7:r&512&&wl(n,n.return);default:Pu(e,n)}}function gu(e,t){for(e=e.child;e!==null;)_u(e,t),e=e.sibling}function _u(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){vf(e,e.return,t)}vu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Vt=!0}catch(t){vf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?jp(s,!0):jp(e.stateNode,!1)}catch(t){vf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&gu(e,t);break;default:gu(e,t)}}function vu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:_u(n,r);break a;case 22:n.memoizedState===null&&vu(n,r);break a;default:vu(n,r)}}e=e.sibling}}function yu(e){var t=e.alternate;t!==null&&(e.alternate=null,yu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Et(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var bu=null,K=!1;function xu(e,t,n){for(n=n.child;n!==null;)Su(e,t,n),n=n.sibling}function Su(e,t,n){if(Ue&&typeof Ue.onCommitFiberUnmount==`function`)try{Ue.onCommitFiberUnmount(He,n)}catch{}switch(n.tag){case 26:iu||Tl(n,t),xu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!iu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:iu||Tl(n,t),Ol(n);var r=bu,i=K;kp(n.type)&&(bu=n.stateNode,K=!1),xu(e,t,n),Cm(n.stateNode,n.type,n.memoizedProps),bu=r,K=i;break;case 5:iu||Tl(n,t),Ol(n);case 6:if(n.tag===6&&Ol(n),r=bu,i=K,bu=null,xu(e,t,n),bu=r,K=i,bu!==null){if(K)try{(bu.nodeType===9?bu.body:bu.nodeName===`HTML`?bu.ownerDocument.body:bu).removeChild(n.stateNode),Vt=!0}catch(e){vf(n,t,e)}else try{bu.removeChild(n.stateNode),Vt=!0}catch(e){vf(n,t,e)}}break;case 18:bu!==null&&(K?(e=bu,Ap(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Yh(e)):Ap(bu,n.stateNode));break;case 4:r=bu,i=K,bu=n.stateNode.containerInfo,K=!0,xu(e,t,n),bu=r,K=i;break;case 0:case 11:case 14:case 15:xl(2,n,t),iu||xl(4,n,t),xu(e,t,n);break;case 1:iu||(Tl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Cl(n,t,r)),xu(e,t,n);break;case 21:xu(e,t,n);break;case 22:iu=(r=iu)||n.memoizedState!==null,xu(e,t,n),iu=r;break;case 30:Tl(n,t),xu(e,t,n);break;case 7:iu||Tl(n,t),xu(e,t,n);break;default:xu(e,t,n)}}function Cu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Yh(e)}catch(e){vf(t,t.return,e)}}}function wu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Yh(e)}catch(e){vf(t,t.return,e)}}function Tu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new su),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new su),t;default:throw Error(i(435,e.tag))}}function Eu(e,t){var n=Tu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Cf.bind(null,e,t);t.then(r,r)}})}function Du(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(kp(l.type)){bu=l.stateNode,K=!1;break a}break;case 5:bu=l.stateNode,K=!1;break a;case 3:case 4:bu=l.stateNode.containerInfo,K=!0;break a}l=l.return}if(bu===null)throw Error(i(160));Su(s,c,o),bu=null,K=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ku(t,e,n),t=t.sibling}var Ou=null;function ku(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Du(t,e,n),Au(e),a&4&&(xl(3,e,e.return),bl(3,e),xl(5,e,e.return));break;case 1:Du(t,e,n),Au(e),a&512&&(iu||r===null||Tl(r,r.return)),a&64&&ru&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Ou,Du(t,e,n),Au(e),a&512&&(iu||r===null||Tl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(ru)e.stateNode=yp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[wt]||r[_t]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),lp(r,t,n),r[_t]=e,jt(r),t=r;break a;case`link`:if(o=Qm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),lp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Qm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),lp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[_t]=e,jt(r),t=r}e.stateNode=t}}else ru||$m(o,e.type,e.stateNode)}else e.stateNode=qm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Ml(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||iu||t.parentNode.removeChild(t)):a.count--,n===null?ru||$m(o,e.type,e.stateNode):qm(o,n,e.memoizedProps))}break;case 27:Du(t,e,n),Au(e),a&512&&(iu||r===null||Tl(r,r.return)),r!==null&&a&4&&Ml(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=au,au=!1,Du(t,e,n),au=o,Au(e),a&512&&(iu||r===null||Tl(r,r.return)),e.flags&32){t=e.stateNode;try{on(t,``),Vt=!0}catch(t){vf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Ml(e,t,r===null?t:r.memoizedProps)),a&1024&&(ou=!0);break;case 6:if(Du(t,e,n),Au(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Vt=!0}catch(t){vf(e,e.return,t)}}break;case 3:if(Vt=!1,Zm=null,o=Ou,Ou=Dm(t.containerInfo),Du(t,e,n),Ou=o,Au(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Yh(t.containerInfo)}catch(t){vf(e,e.return,t)}ou&&(ou=!1,ju(e)),Vt=!1;break;case 4:a=au,au=ru,r=Ht(),o=Ou,Ou=Dm(e.stateNode.containerInfo),Du(t,e,n),Au(e),Ou=o,Vt&&uu&&(du=!0),Vt=r,au=a;break;case 12:Du(t,e,n),Au(e);break;case 31:Du(t,e,n),Au(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Eu(e,t)));break;case 13:Du(t,e,n),Au(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(vd=Ne()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Eu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=ru,l=iu,u=au;ru=c||o,au=u||o,iu=l||s,Du(t,e,n),iu=l,au=u,ru=c,Au(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||ru||iu||(t=s||iu,n=ru,r=iu,ru=o||ru,iu=t,Fu(e,2),ru=n,iu=r),!o&&au||gu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Eu(e,n))));break;case 19:Du(t,e,n),Au(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Eu(e,t)));break;case 30:a&512&&(iu||r===null||Tl(r,r.return)),a=Ht(),o=uu,s=(n&335544064)===n,c=e.memoizedProps,uu=s&&hi(c.default,c.update)!==`none`,Du(t,e,n),Au(e),s&&r!==null&&Vt&&(e.flags|=4),uu=o,Vt=a;break;case 21:break;case 7:a&512&&(iu||r===null||Tl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Du(t,e,n),Au(e)}}function Au(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Nl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Al(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(kl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Il(e,Pl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(on(l,``),n.flags&=-33),Il(e,Pl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Fl(e,Pl(e),u,s);break;default:throw Error(i(161))}}catch(t){vf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ju(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ju(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ch=!0,t.reset(),Ch=!1),e=e.sibling}}function Mu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Nu(t,e),t=t.sibling;else nu(t,!1)}function Nu(e,t){var n=e.alternate;if(n===null)Jl(e,!1);else switch(e.tag){case 3:if(fu=lu=!1,Hl(),Mu(t,e),!lu&&!du){if(e=Vl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Np(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),fu=!0}Vl=null;break;case 5:Mu(t,e);break;case 4:r=lu,lu=!1,Mu(t,e),lu&&(du=!0),lu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Mu(t,e):Jl(e,!1));break;case 30:r=lu,i=Hl(),lu=!1,Mu(t,e),lu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=pi(a,o),o=pi(n.memoizedProps,o);var s=hi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Ul=0,t=tu(e,n,t,o,s,a,!0),Ul!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ld(e,e.memoizedProps.onUpdate),Vl=i):i!==null&&(i.push.apply(i,Vl),Vl=i),lu=e.flags&32?!0:r;break;default:Mu(t,e)}}function Pu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)hu(e,t.alternate,t),t=t.sibling}function Fu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:xl(4,n,n.return),Fu(n,r);break;case 1:Tl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Cl(n,n.return,i),Fu(n,r);break;case 27:r&2&&Cm(n.stateNode,n.type,n.memoizedProps);case 5:Tl(n,n.return),n.tag!==5&&n.tag!==27||Ol(n),Fu(n,r);break;case 6:Ol(n);break;case 26:Tl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||iu||i.parentNode.removeChild(i),Fu(n,r);break;case 22:n.memoizedState===null&&Fu(n,r);break;case 30:Tl(n,n.return),Fu(n,r);break;case 7:Tl(n,n.return);default:Fu(n,r)}e=e.sibling}}function Iu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Iu(i,a,n),bl(4,a);break;case 1:if(Iu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){vf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)yo(l[i],c)}catch(e){vf(r,r.return,e)}}s&&o&64&&Sl(a),wl(a,a.return);break;case 27:n&2&&Ll(a);case 5:a.tag!==5&&a.tag!==27||Dl(a),Iu(i,a,n),s&&r===null&&o&4&&jl(a),wl(a,a.return);break;case 6:Dl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||ru||$m(Dm(c.ownerDocument),a.type,c),Iu(i,a,n),s&&r===null&&o&4&&jl(a),wl(a,a.return);break;case 12:Iu(i,a,n);break;case 31:Iu(i,a,n),s&&o&4&&Cu(i,a);break;case 13:Iu(i,a,n),s&&o&4&&wu(i,a);break;case 22:a.memoizedState===null&&Iu(i,a,n),wl(a,a.return);break;case 30:Iu(i,a,n),wl(a,a.return);break;case 7:wl(a,a.return);default:Iu(i,a,n)}t=t.sibling}}function Lu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Oa(n))}function Ru(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Oa(e))}function zu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Bu(e,t,n,r),t=t.sibling;else i&&eu(t)}function Bu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&$l(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:zu(e,t,n,r),a&2048&&bl(9,t);break;case 1:zu(e,t,n,r);break;case 3:zu(e,t,n,r),i&&fu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Oa(a)));break;case 12:if(a&2048){zu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){vf(t,t.return,e)}}else zu(e,t,n,r);break;case 31:zu(e,t,n,r);break;case 13:zu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&$l(t),o._visibility&2?zu(e,t,n,r):(o._visibility|=2,Vu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&$l(s),o._visibility&2?zu(e,t,n,r):Hu(e,t)),a&2048&&Lu(s,t);break;case 24:zu(e,t,n,r),a&2048&&Ru(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Kl(a.child,!0),Kl(t.child,!0))),zu(e,t,n,r);break;default:zu(e,t,n,r)}}function Vu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Vu(a,o,s,c,i),bl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Vu(a,o,s,c,i)):u._visibility&2?Vu(a,o,s,c,i):Hu(a,o),i&&l&2048&&Lu(o.alternate,o);break;case 24:Vu(a,o,s,c,i),i&&l&2048&&Ru(o.alternate,o);break;default:Vu(a,o,s,c,i)}t=t.sibling}}function Hu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Hu(n,r),i&2048&&Lu(r.alternate,r);break;case 24:Hu(n,r),i&2048&&Ru(r.alternate,r);break;default:Hu(n,r)}t=t.sibling}}var Uu=8192;function Wu(e,t,n){if(e.subtreeFlags&Uu)for(e=e.child;e!==null;)Gu(e,t,n),e=e.sibling}function Gu(e,t,n){switch(e.tag){case 26:Wu(e,t,n),e.flags&Uu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&ih(n,e)):ah(n,Ou,e.memoizedState,e.memoizedProps));break;case 5:Wu(e,t,n),e.flags&Uu&&(e=e.stateNode,(t&335544128)===t&&ih(n,e));break;case 3:case 4:var r=Ou;Ou=Dm(e.stateNode.containerInfo),Wu(e,t,n),Ou=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Uu,Uu=16777216,Wu(e,t,n),Uu=r):Wu(e,t,n));break;case 30:if((e.flags&Uu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,zl===null&&(zl=new Map),zl.set(r,i)}Wu(e,t,n);break;default:Wu(e,t,n)}}function Ku(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cu=r,Xu(r,e)}Ku(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ju(e),e=e.sibling}function Ju(e){switch(e.tag){case 0:case 11:case 15:qu(e),e.flags&2048&&xl(9,e,e.return);break;case 3:qu(e);break;case 12:qu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Yu(e)):qu(e);break;default:qu(e)}}function Yu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cu=r,Xu(r,e)}Ku(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:xl(8,t,t.return),Yu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Yu(t));break;default:Yu(t)}e=e.sibling}}function Xu(e,t){for(;cu!==null;){var n=cu;switch(n.tag){case 0:case 11:case 15:xl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Oa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cu=r;else a:for(n=e;cu!==null;){r=cu;var i=r.sibling,a=r.return;if(yu(r),r===n){cu=null;break a}if(i!==null){i.return=a,cu=i;break a}cu=a}}}var Zu={getCacheForType:function(e){var t=ba(Ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ba(Ea).controller.signal}},Qu=typeof WeakMap==`function`?WeakMap:Map,$u=0,ed=null,td=null,nd=0,rd=0,id=null,ad=!1,od=!1,sd=!1,cd=0,ld=0,ud=0,dd=0,fd=0,pd=0,md=0,hd=null,gd=null,_d=!1,vd=0,yd=0,bd=1/0,xd=null,Sd=null,Cd=0,wd=null,Td=null,Ed=0,Dd=0,Od=null,kd=null,Ad=null,jd=null,Md=null,Nd=0,Pd=null;function Fd(){return $u&2&&nd!==0?nd&-nd:U.T===null?mt():zf()}function Id(){if(pd===0){if(!(nd&536870912)||$i){var e=Ze;Ze<<=1,!(Ze&3932160)&&(Ze=262144),pd=e}else pd=536870912}return e=Eo.current,e!==null&&(e.flags|=32),pd}function Ld(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Vp(pi(e.memoizedProps,n))),jd===null&&(jd=[]),jd.push(t.bind(null,r))}}function Rd(e,t,n){(e===ed&&(rd===2||rd===9)||e.cancelPendingCommit!==null)&&(Gd(e,0),Hd(e,nd,pd,!1)),st(e,n),$u&2&&e===ed||(e===ed&&(!($u&2)&&(dd|=n),ld===4&&Hd(e,nd,pd,!1)),jf(e))}function zd(e,t,n){if($u&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||nt(e,t),a=r?$d(e,t):Zd(e,t,!0),o=r;do{if(a===0){od&&!r&&Hd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Vd(n))a=Zd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=hd;var l=c.current.memoizedState.isDehydrated;if(l&&(Gd(c,s).flags|=256),s=Zd(c,s,!1),s!==2&&s!==6){if(sd&&!l){c.errorRecoveryDisabledLanes|=o,dd|=o,a=4;break a}o=gd,gd=a,o!==null&&(gd===null?gd=o:gd.push.apply(gd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Gd(e,0),Hd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Hd(r,t,pd,!ad);break a;case 2:gd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=vd+300-Ne(),10<a)){if(Hd(r,t,pd,!ad),tt(r,0,!0)!==0)break a;Ed=t,r.timeoutHandle=Cp(Bd.bind(null,r,n,gd,xd,_d,t,pd,dd,md,ad,o,`Throttled`,-0,0),a);break a}Bd(r,n,gd,xd,_d,t,pd,dd,md,ad,o,null,-0,0)}break}}while(1);jf(e)}function Bd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:mn},zl=null,Gu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=lh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?vd-Ne():(a&4194048)===a?yd-Ne():0,m=sh(d,m),m!==null)?(Ed=a,e.cancelPendingCommit=m(sf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Hd(e,a,o,!l)):sf(e,t,a,n,r,i,o,s,c,l,u,d)}function Vd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,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(!Lr(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 Hd(e,t,n,r){t=rt(e,t),t&=~fd,t&=~dd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ge(i),o=1<<a;r[a]=-1,i&=~o}n!==0&<(e,n,t)}function Ud(){return $u&6?!0:(Mf(0,!1),!1)}function Wd(){if(td!==null){if(rd===0)var e=td.return;else e=td,fa=da=null,ns(e),eo=null,to=0,e=td;for(;e!==null;)yl(e.alternate,e),e=e.return;td=null}}function Gd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,wp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ed=0,Wd(),ed=e,td=n=Oi(e.current,null),nd=t,rd=0,id=null,ad=!1,od=nt(e,t),sd=!1,md=pd=fd=dd=ud=ld=0,gd=hd=null,_d=!1,cd=rt(e,t),bi(),n}function Kd(e,t){Ro=null,U.H=fc,t===Wa||t===Ka?(t=Qa(),rd=3):t===Ga?(t=Qa(),rd=4):rd=t===Ac?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,id=t,td===null&&(ld=1,wc(e,Ii(t,e.current)))}function qd(){var e=Eo.current;return e===null?!0:(nd&4194048)===nd?Do===null:(nd&62914560)===nd||nd&536870912?e===Do:!1}function Jd(){var e=U.H;return U.H=fc,e===null?fc:e}function Yd(){var e=U.A;return U.A=Zu,e}function Xd(){ld=4,ad||(nd&4194048)!==nd&&Eo.current!==null||(od=!0),!(ud&134217727)&&!(dd&134217727)||ed===null||Hd(ed,nd,pd,!1)}function Zd(e,t,n){var r=$u;$u|=2;var i=Jd(),a=Yd();(ed!==e||nd!==t)&&(xd=null,Gd(e,t)),t=!1;var o=ld;a:do try{if(rd!==0&&td!==null){var s=td,c=id;switch(rd){case 8:Wd(),o=6;break a;case 3:case 2:case 9:case 6:Eo.current===null&&(t=!0);var l=rd;if(rd=0,id=null,rf(e,s,c,l),n&&od){o=0;break a}break;default:l=rd,rd=0,id=null,rf(e,s,c,l)}}Qd(),o=ld;break}catch(t){Kd(e,t)}while(1);return t&&e.shellSuspendCounter++,fa=da=null,$u=r,U.H=i,U.A=a,td===null&&(ed=null,nd=0,bi()),o}function Qd(){for(;td!==null;)tf(td)}function $d(e,t){var n=$u;$u|=2;var r=Jd(),a=Yd();ed!==e||nd!==t?(xd=null,bd=Ne()+500,Gd(e,t)):od=nt(e,t);a:do try{if(rd!==0&&td!==null){t=td;var o=id;b:switch(rd){case 1:rd=0,id=null,rf(e,t,o,1);break;case 2:case 9:if(Ja(o)){rd=0,id=null,nf(t);break}t=function(){rd!==2&&rd!==9||ed!==e||(rd=7),jf(e)},o.then(t,t);break a;case 3:rd=7;break a;case 4:rd=5;break a;case 7:Ja(o)?(rd=0,id=null,nf(t)):(rd=0,id=null,rf(e,t,o,7));break;case 5:var s=null;switch(td.tag){case 26:s=td.memoizedState;case 5:case 27:var c=td;if(s?nh(s):c.stateNode.complete){rd=0,id=null;var l=c.sibling;if(l!==null)td=l;else{var u=c.return;u===null?td=null:(td=u,af(u))}break b}}rd=0,id=null,rf(e,t,o,5);break;case 6:rd=0,id=null,rf(e,t,o,6);break;case 8:Wd(),ld=6;break a;default:throw Error(i(462))}}ef();break}catch(t){Kd(e,t)}while(1);return fa=da=null,U.H=r,U.A=a,$u=n,td===null?(ed=null,nd=0,bi(),ld):0}function ef(){for(;td!==null&&!je();)tf(td)}function tf(e){var t=ul(e.alternate,e,cd);e.memoizedProps=e.pendingProps,t===null?af(e):td=t}function nf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Wc(n,t,t.pendingProps,t.type,void 0,nd);break;case 11:t=Wc(n,t,t.pendingProps,t.type.render,t.ref,nd);break;case 5:ns(t);var r=t;r===Zi&&($i?(aa(r),r.tag===5&&r.stateNode!=null&&(Qi=r.stateNode)):(aa(r),$i=!0));default:yl(n,t),t=td=ki(t,cd),t=ul(n,t,cd)}e.memoizedProps=e.pendingProps,t===null?af(e):td=t}function rf(e,t,n,r){fa=da=null,ns(t),eo=null,to=0;var i=t.return;try{if(kc(e,i,t,n,nd)){ld=1,wc(e,Ii(n,e.current)),td=null;return}}catch(t){if(i!==null)throw td=i,t;ld=1,wc(e,Ii(n,e.current)),td=null;return}t.flags&32768?($i||r===1?e=!0:od||nd&536870912?e=!1:(ad=e=!0,(r===2||r===9||r===3||r===6)&&(r=Eo.current,r!==null&&r.tag===13&&(r.flags|=16384))),of(t,e)):af(t)}function af(e){var t=e;do{if(t.flags&32768){of(t,ad);return}e=t.return;var n=_l(t.alternate,t,cd);if(n!==null){td=n;return}if(t=t.sibling,t!==null){td=t;return}td=t=e}while(t!==null);ld===0&&(ld=5)}function of(e,t){do{var n=vl(e.alternate,e);if(n!==null){n.flags&=32767,td=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){td=e;return}td=e=n}while(e!==null);ld=6,td=null}function sf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do hf();while(Cd!==0);if($u&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===ed&&(td=ed=null,nd=0),Td=t,wd=e,Ed=n,Od=a,kd=r,cf(e,t,n,s,c,l,f)}}function cf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Dd=s,s|=yi,ct(e,n,s,r,i,a),jd=null,(n&335544064)===n?(Md=ja(e),r=10262):(Md=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,wf(Le,function(){return gf(),null})):(e.callbackNode=null,e.callbackPriority=0),Rl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=U.T,U.T=null,i=oe.p,oe.p=2,a=$u,$u|=4;try{pu(e,t,n)}finally{$u=a,oe.p=i,U.T=r}}Cd=1,Rl?Ad=zp(o,e.containerInfo,Md,df,ff,uf,pf,gf,lf,null,null):(df(),ff(),pf())}function lf(e){if(Cd!==0){var t=wd.onRecoverableError;t(e,{componentStack:null})}}function uf(){Cd===3&&(Cd=0,Nu(Td,wd),Cd=4)}function df(){if(Cd===1){Cd=0;var e=wd,t=Td,n=Ed,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=U.T,U.T=null;var i=oe.p;oe.p=2;var a=$u;$u|=4;try{uu=du=!1,ku(t,e,n),n=hp;var o=Ur(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Hr(s.ownerDocument.documentElement,s)){if(c!==null&&Wr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Vr(s,h),v=Vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Ch=!!mp,hp=mp=null}finally{$u=a,oe.p=i,U.T=r}}e.current=t,Cd=2}}function ff(){if(Cd===2){Cd=0;var e=wd,t=Td,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=U.T,U.T=null;var r=oe.p;oe.p=2;var i=$u;$u|=4;try{hu(e,t.alternate,t)}finally{$u=i,oe.p=r,U.T=n}}Cd=3}}function pf(){if(Cd===4||Cd===3){Cd=0;var e=Ad;Ad=null,Me();var t=wd,n=Td,r=Ed,i=kd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Cd=5:(Cd=0,Td=wd=null,mf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Sd=null),pt(r),n=n.stateNode,Ue&&typeof Ue.onCommitFiberRoot==`function`)try{Ue.onCommitFiberRoot(He,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=U.T,a=oe.p,oe.p=2,U.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{U.T=n,oe.p=a}}if(i=jd,o=Md,Md=null,i!==null&&(jd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Ed&3&&hf(),jf(t),a=t.pendingLanes,r&261930&&a&42?t===Pd?Nd++:(Nd=0,Pd=t):(Nd=0,Pd=null),Mf(0,!1)}}function mf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Oa(t)))}function hf(){return Ad!==null&&(Ad.skipTransition(),Ad=null),df(),ff(),pf(),gf()}function gf(){if(Cd!==5)return!1;var e=wd,t=Dd;Dd=0;var n=pt(Ed),r=U.T,a=oe.p;try{oe.p=32>n?32:n,U.T=null,n=Od,Od=null;var o=wd,s=Ed;if(Cd=0,Td=wd=null,Ed=0,$u&6)throw Error(i(331));var c=$u;if($u|=4,Ju(o.current),Bu(o,o.current,s,n),$u=c,Mf(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot==`function`)try{Ue.onPostCommitFiberRoot(He,o)}catch{}return!0}finally{oe.p=a,U.T=r,mf(e,t)}}function _f(e,t,n){t=Ii(n,t),t=Ec(e.stateNode,t,2),e=po(e,t,2),e!==null&&(st(e,2),jf(e))}function vf(e,t,n){if(e.tag===3)_f(e,e,n);else for(;t!==null;){if(t.tag===3){_f(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Sd===null||!Sd.has(r))){e=Ii(n,e),n=Dc(2),r=po(t,n,2),r!==null&&(Oc(n,r,t,e),st(r,2),jf(r));break}}t=t.return}}function yf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Qu;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)||(sd=!0,i.add(n),e=bf.bind(null,e,t,n),t.then(e,e))}function bf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ed===e&&(nd&n)===n&&(ld===4||ld===3&&(nd&62914560)===nd&&300>Ne()-vd?$u&2?fd|=n:Gd(e,0):fd|=n,md===nd&&(md=0)),jf(e)}function xf(e,t){t===0&&(t=at()),e=Ci(e,t),e!==null&&(st(e,t),jf(e))}function Sf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xf(e,n)}function Cf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),xf(e,n)}function wf(e,t){return ke(e,t)}var Tf=null,Ef=null,Df=!1,Of=!1,kf=!1,Af=0;function jf(e){e!==Ef&&e.next===null&&(Ef===null?Tf=Ef=e:Ef=Ef.next=e),Of=!0,Df||(Df=!0,Rf())}function Mf(e,t){if(!kf&&Of){kf=!0;do for(var n=!1,r=Tf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ge(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Lf(r,a))}else a=nd,a=tt(r,r===ed?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||nt(r,a)||(n=!0,Lf(r,a))}r=r.next}while(n);kf=!1}}function Nf(){Pf()}function Pf(){Of=Df=!1;var e=0;Af!==0&&Sp()&&(e=Af);for(var t=Ne(),n=null,r=Tf;r!==null;){var i=r.next,a=Ff(r,t);a===0?(r.next=null,n===null?Tf=i:n.next=i,i===null&&(Ef=n)):(n=r,(e!==0||a&3)&&(Of=!0)),r=i}Cd!==0&&Cd!==5||Mf(e,!1),Af!==0&&(Af=0)}function Ff(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ge(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=it(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ed,n=nd,n=tt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(rd===2||rd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ae(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||nt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ae(r),pt(n)){case 2:case 8:n=Ie;break;case 32:n=Le;break;case 268435456:n=ze;break;default:n=Le}return r=If.bind(null,e),n=ke(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ae(r),e.callbackPriority=2,e.callbackNode=null,2}function If(e,t){if(Cd!==0&&Cd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(hf()&&e.callbackNode!==n)return null;var r=nd;return r=tt(e,e===ed?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(zd(e,r,t),Ff(e,Ne()),e.callbackNode!=null&&e.callbackNode===n?If.bind(null,e):null)}function Lf(e,t){if(hf())return null;zd(e,t,!0)}function Rf(){Dp(function(){$u&6?ke(Fe,Nf):Pf()})}function zf(){if(Af===0){var e=Pa;e===0&&(e=Ye,Ye<<=1,!(Ye&261888)&&(Ye=256)),Af=e}return Af}function Bf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:pn(e)}function Vf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Bf((i[vt]||null).action),o=r.submitter;o&&(t=(t=o[vt]||null)?Bf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Fn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Af!==0){var e=new FormData(i,o);Qs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Qs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Hf=0;Hf<ui.length;Hf++){var Uf=ui[Hf];di(Uf.toLowerCase(),`on`+(Uf[0].toUpperCase()+Uf.slice(1)))}di(ni,`onAnimationEnd`),di(ri,`onAnimationIteration`),di(ii,`onAnimationStart`),di(`dblclick`,`onDoubleClick`),di(`focusin`,`onFocus`),di(`focusout`,`onBlur`),di(ai,`onTransitionRun`),di(oi,`onTransitionStart`),di(si,`onTransitionCancel`),di(ci,`onTransitionEnd`),It(`onMouseEnter`,[`mouseout`,`mouseover`]),It(`onMouseLeave`,[`mouseout`,`mouseover`]),It(`onPointerEnter`,[`pointerout`,`pointerover`]),It(`onPointerLeave`,[`pointerout`,`pointerover`]),Ft(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ft(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ft(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ft(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ft(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ft(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Wf=`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(` `),Gf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Wf));function Kf(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;a=s,i.currentTarget=l;try{a(i)}catch(e){gi(e)}i.currentTarget=null,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;a=s,i.currentTarget=l;try{a(i)}catch(e){gi(e)}i.currentTarget=null,a=c}}}}function qf(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var r=e+`__bubble`;n.has(r)||(Zf(t,e,2,!1),n.add(r))}function Jf(e,t,n){var r=0;t&&(r|=4),Zf(n,e,r,t)}var Yf=`_reactListening`+Math.random().toString(36).slice(2);function Xf(e){if(!e[Yf]){e[Yf]=!0,Nt.forEach(function(t){t!==`selectionchange`&&(Gf.has(t)||Jf(t,!1,e),Jf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yf]||(t[Yf]=!0,Jf(`selectionchange`,!1,t))}}function Zf(e,t,n,r){switch(Ah(t)){case 2:var i=wh;break;case 8:i=Th;break;default:i=Eh}n=i.bind(null,t,n,e),i=void 0,!wn||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 Qf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Dt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}xn(function(){var r=a,i=gn(n),s=[];a:{var c=li.get(e);if(c!==void 0){var l=Fn,u=e;switch(e){case`keypress`:if(An(n)===0)break a;case`keydown`:case`keyup`:l=$n;break;case`focusin`:u=`focus`,l=Wn;break;case`focusout`:u=`blur`,l=Wn;break;case`beforeblur`:case`afterblur`:l=Wn;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`:l=Hn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Un;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=nr;break;case ni:case ri:case ii:l=Gn;break;case ci:l=rr;break;case`scroll`:case`scrollend`:l=Ln;break;case`wheel`:l=ir;break;case`copy`:case`cut`:case`paste`:l=Kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=er;break;case`submit`:l=tr;break;case`toggle`:case`beforetoggle`:l=ar}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Sn(m,p),g!=null&&d.push($f(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==hn&&(u=n.relatedTarget||n.fromElement)&&(Dt(u)||u[yt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Dt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Hn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=er,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:kt(c),h=l==null?u:kt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Dt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,tp):null,c!==null&&np(s,u,c,d,!1),l!==null&&f!==null&&np(s,f,l,d,!0)))}a:{if(c=r?kt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Tr;else if(yr(c)){if(Er)_=Fr;else{_=Nr;var v=Mr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&un(r.elementType)&&(_=Tr):_=Pr;if(_&&=_(e,r)){br(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?kt(r):window,e){case`focusin`:(yr(v)||v.contentEditable===`true`)&&(Kr=v,qr=r,Jr=null);break;case`focusout`:Jr=qr=Kr=null;break;case`mousedown`:Yr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Yr=!1,Xr(s,n,i);break;case`selectionchange`:if(Gr)break;case`keydown`:case`keyup`:Xr(s,n,i)}var y;if(sr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else hr?pr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(ur&&n.locale!==`ko`&&(hr||b!==`onCompositionStart`?b===`onCompositionEnd`&&hr&&(y=kn()):(En=i,Dn=`value`in En?En.value:En.textContent,hr=!0)),v=ep(r,b),0<v.length&&(b=new qn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=mr(n),y!==null&&(b.data=y)))),(y=lr?gr(e,n):_r(e,n))&&(b=ep(r,`onBeforeInput`),0<b.length&&(v=new qn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Vf(s,e,r,n,i)}Kf(s,t)})}function $f(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ep(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Sn(e,n),i!=null&&r.unshift($f(e,i,a)),i=Sn(e,t),i!=null&&r.push($f(e,i,a))),e.tag===3)return r;e=e.return}return[]}function tp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function np(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(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Sn(n,a),l!=null&&o.unshift($f(n,l,c))):i||(l=Sn(n,a),l!=null&&o.push($f(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var rp=/\r\n?/g,ip=/\u0000|\uFFFD/g;function ap(e){return(typeof e==`string`?e:``+e).replace(rp,`
|
|
10
|
+
`).replace(ip,``)}function op(e,t){return t=ap(t),ap(e)===t}function sp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||on(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&on(e,``+r);else return;break;case`className`:Wt(e,`class`,r);break;case`tabIndex`:Wt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Wt(e,n,r);break;case`style`:ln(e,r,o);return;case`data`:if(t!==`object`){Wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=pn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&sp(e,t,`name`,a.name,a,null),sp(e,t,`formEncType`,a.formEncType,a,null),sp(e,t,`formMethod`,a.formMethod,a,null),sp(e,t,`formTarget`,a.formTarget,a,null)):(sp(e,t,`encType`,a.encType,a,null),sp(e,t,`method`,a.method,a,null),sp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=pn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=mn);return;case`onScroll`:r!=null&&qf(`scroll`,e);return;case`onScrollEnd`:r!=null&&qf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=pn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:qf(`beforetoggle`,e),qf(`toggle`,e),Ut(e,`popover`,r);break;case`xlinkActuate`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ut(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=dn.get(n)||n,Ut(e,n,r);else return}Vt=!0}function cp(e,t,n,r,a,o){switch(n){case`style`:ln(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)on(e,r);else if(typeof r==`number`||typeof r==`bigint`)on(e,``+r);else return;break;case`onScroll`:r!=null&&qf(`scroll`,e);return;case`onScrollEnd`:r!=null&&qf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=mn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Pt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[vt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Vt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ut(e,n,r)}return}Vt=!0}function lp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:qf(`error`,e),qf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:sp(e,t,o,s,n,null)}}a&&sp(e,t,`srcSet`,n.srcSet,n,null),r&&sp(e,t,`src`,n.src,n,null);return;case`input`:qf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:sp(e,t,r,d,n,null)}}en(e,o,c,l,u,s,a,!1);return;case`select`:for(a in qf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:sp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&nn(e,!!r,n,!0):nn(e,!!r,t,!1);return;case`textarea`:for(s in qf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:sp(e,t,s,c,n,null)}an(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:sp(e,t,l,r,n,null)}return;case`dialog`:qf(`beforetoggle`,e),qf(`toggle`,e),qf(`cancel`,e),qf(`close`,e);break;case`iframe`:case`object`:qf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Wf.length;r++)qf(Wf[r],e);break;case`image`:qf(`error`,e),qf(`load`,e);break;case`details`:qf(`toggle`,e);break;case`embed`:case`source`:case`link`:qf(`error`,e),qf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:sp(e,t,u,r,n,null)}return;default:if(un(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&cp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&sp(e,t,c,r,n,null))}var up={};function dp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||sp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Vt=!0),o=m;break;case`name`:m!==f&&(Vt=!0),a=m;break;case`checked`:m!==f&&(Vt=!0),u=m;break;case`defaultChecked`:m!==f&&(Vt=!0),d=m;break;case`value`:m!==f&&(Vt=!0),s=m;break;case`defaultValue`:m!==f&&(Vt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&sp(e,t,p,m,r,f)}}$t(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||sp(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Vt=!0),p=o;break;case`defaultValue`:o!==l&&(Vt=!0),c=o;break;case`multiple`:o!==l&&(Vt=!0),s=o;default:o!==l&&sp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?nn(e,!!n,n?[]:``,!1):nn(e,!!n,t,!0)):nn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:sp(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Vt=!0),p=a;break;case`defaultValue`:a!==o&&(Vt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&sp(e,t,s,a,r,o)}rn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:sp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Vt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:sp(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&sp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:sp(e,t,u,p,r,m)}return;default:if(un(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&cp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||cp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&sp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||sp(e,t,f,p,r,m)}function fp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function pp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&fp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&fp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var mp=null,hp=null;function gp(e){return e.nodeType===9?e:e.ownerDocument}function _p(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function vp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function yp(e,t,n,r){return n=gp(n).createElement(e),n[_t]=r,n[vt]=t,lp(n,e,t),jt(n),n}function bp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var xp=null;function Sp(){var e=window.event;return e&&e.type===`popstate`?e!==xp&&(xp=e,!0):(xp=null,!1)}var Cp=typeof setTimeout==`function`?setTimeout:void 0,wp=typeof clearTimeout==`function`?clearTimeout:void 0,Tp=typeof Promise==`function`?Promise:void 0,Ep=typeof requestAnimationFrame==`function`?requestAnimationFrame:Cp,Dp=typeof queueMicrotask==`function`?queueMicrotask:Tp===void 0?Cp:function(e){return Tp.resolve(null).then(e).catch(Op)};function Op(e){setTimeout(function(){throw e})}function kp(e){return e===`head`}function Ap(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===`/$`||n===`/&`){if(r===0){e.removeChild(i),Yh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)wm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,wm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[wt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&wm(e.ownerDocument.body)}n=i}while(n);Yh(t)}function jp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Mp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Np(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Pp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Fp(e){return Pp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ip(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Pp(t,n,e)}function Lp(e){return e.documentElement.clientHeight}function Rp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function zp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Lp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=rh(f),u>oh){s.length=o;break}f=new Promise(Rp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Bp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Bp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Bp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Bp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Vp(e){return{name:e,group:new Bp(`group`,e),imagePair:new Bp(`image-pair`,e),old:new Bp(`old`,e),new:new Bp(`new`,e)}}function Hp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Hp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(qp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Gp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Up,e,s,r)}this._eventListeners=a}};function Up(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Hp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=qp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Gp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Wp,e,n,i),r.splice(t,1),a!==null&&a()}};function Wp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Gp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Kp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function qp(e,t,n,r){if(e.length===0)return-1;r=Kp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Kp(a.optionsOrUseCapture)===r)return i}return-1}Hp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Gp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Gp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Hp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Jp,e,void 0,void 0)};function Jp(e,t){return e.tag!==6&&(e=_(e),bm(e,t))}Hp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Yp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Jp(t[n],e);n--);};function Yp(e,t){return t.push(e),!1}Hp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=gp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Xp,e,void 0,void 0))};function Xp(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Hp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Zp,e,void 0,void 0)};function Zp(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Hp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Qp,e,void 0,void 0);for(var n=t=0;n<$p.length;n++){var r=$p[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):$p[t++]=r}$p.length=t}};function Qp(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var $p=[],em=!1;function tm(e,t,n){$p.push({fragmentInstance:e,observer:t,instance:n}),em||(em=!0,xm(function(){em=!1;var e=$p;$p=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Hp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,nm,e,void 0,void 0),e};function nm(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}Hp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Hp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Yp,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||rm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function rm(e,t,n,r,i){var a=Dt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(f(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(f(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function im(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Hp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Yp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),im(e,n);return}if(r=_(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=_(a),im(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function am(e,t){return e=_(e),om(e,t),!1}function om(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function sm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Gp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<$p.length;i++){var a=$p[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&($p[r++]=a)}$p.length=r,n.observe(e)}),om(e,t))}function cm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Gp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?tm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function lm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:lm(n),Et(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function um(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[wt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gm(e.nextSibling),e===null)break}return null}function dm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gm(e.nextSibling),e===null))return null;return e}function fm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gm(e.nextSibling),e===null))return null;return e}function pm(e){return e.data===`$?`||e.data===`$~`}function mm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function gm(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var _m=null;function vm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function ym(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function bm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function xm(e){Ep(function(){Ep(function(t){return e(t)})})}function Sm(e,t,n){switch(t=gp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Cm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&sp(e,t,r,null,up,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===mn&&(e.onclick=null),Et(e)}function wm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Et(e)}var Tm=new Map,Em=new Set;function Dm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Om=oe.d;oe.d={f:km,r:Am,D:Nm,C:Pm,L:Fm,m:Im,X:Rm,S:Lm,M:zm};function km(){var e=Om.f(),t=Ud();return e||t}function Am(e){var t=Ot(e);t!==null&&t.tag===5&&t.type===`form`?ec(t):Om.r(e)}var jm=typeof document>`u`?null:document;function Mm(e,t,n){var r=jm;if(r&&typeof t==`string`&&t){var i=Qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Em.has(i)||(Em.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),lp(t,`link`,e),jt(t),r.head.appendChild(t)))}}function Nm(e){Om.D(e),Mm(`dns-prefetch`,e,null)}function Pm(e,t){Om.C(e,t),Mm(`preconnect`,e,t)}function Fm(e,t,n){Om.L(e,t,n);var r=jm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Qt(n.imageSizes)+`"]`)):i+=`[href="`+Qt(e)+`"]`;var a=i;switch(t){case`style`:a=Vm(e);break;case`script`:a=Gm(e)}if(!(Tm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Tm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Hm(a))||t===`script`&&r.querySelector(Km(a))))){var o=r.createElement(`link`);lp(o,`link`,e),t===`style`&&(o[Tt]=!0,o.onload=o.onerror=function(){Mt(o)}),jt(o),r.head.appendChild(o)}}}function Im(e,t){Om.m(e,t);var n=jm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Qt(r)+`"][href="`+Qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Gm(e)}if(!Tm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),Tm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Km(a)))return}r=n.createElement(`link`),lp(r,`link`,e),jt(r),n.head.appendChild(r)}}}function Lm(e,t,n){Om.S(e,t,n);var r=jm;if(r&&e){var i=At(r).hoistableStyles,a=Vm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Hm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Tm.get(a))&&Ym(e,n);var c=o=r.createElement(`link`);jt(c),lp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Jm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Rm(e,t){Om.X(e,t);var n=jm;if(n&&e){var r=At(n).hoistableScripts,i=Gm(e),a=r.get(i);a||(a=n.querySelector(Km(i)),a||(e=T({src:e,async:!0},t),(t=Tm.get(i))&&Xm(e,t),a=n.createElement(`script`),jt(a),lp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zm(e,t){Om.M(e,t);var n=jm;if(n&&e){var r=At(n).hoistableScripts,i=Gm(e),a=r.get(i);a||(a=n.querySelector(Km(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=Tm.get(i))&&Xm(e,t),a=n.createElement(`script`),jt(a),lp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bm(e,t,n,r){var a=(a=he.current)?Dm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Vm(n.href),t=At(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Vm(n.href);var o=At(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Hm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Tm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tm.set(e,o)),Wm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Gm(n),t=At(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Vm(e){return`href="`+Qt(e)+`"`}function Hm(e){return`link[rel="stylesheet"][`+e+`]`}function Um(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Wm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Tt]){r.loading=1;return}}else t=e.createElement(`link`),t[Tt]=!0,t.onload=t.onerror=Mt.bind(null,t),lp(t,`link`,n),jt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Gm(e){return`[src="`+Qt(e)+`"]`}function Km(e){return`script[async]`+e}function qm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Qt(n.href)+`"]`);if(r)return t.instance=r,jt(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),jt(r),lp(r,`style`,a),Jm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Vm(n.href);var o=e.querySelector(Hm(a));if(o)return t.state.loading|=4,t.instance=o,jt(o),o;r=Um(n),(a=Tm.get(a))&&Ym(r,a),o=(e.ownerDocument||e).createElement(`link`),jt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),lp(o,`link`,r),t.state.loading|=4,Jm(o,n.precedence,e),t.instance=o;case`script`:return o=Gm(n.src),(a=e.querySelector(Km(o)))?(t.instance=a,jt(a),a):(r=n,(a=Tm.get(o))&&(r=T({},n),Xm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),jt(a),lp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Jm(r,n.precedence,e));return t.instance}function Jm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Ym(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Xm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Zm=null;function Qm(e,t,n){if(Zm===null){var r=new Map,i=Zm=new Map;i.set(n,r)}else i=Zm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[wt]||a[_t]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function $m(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function eh(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function th(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function nh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function ih(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=rh(t),e.suspenseyImages.push(t)),e=uh.bind(e),t.decode().then(e,e))}function ah(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Vm(r.href),a=t.querySelector(Hm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=lh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,jt(a);return}a=t.ownerDocument||t,r=Um(r),(i=Tm.get(i))&&Ym(r,i),a=a.createElement(`link`),jt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),lp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=lh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var oh=0;function sh(e,t){return e.stylesheets&&e.count===0&&fh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&fh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&oh===0&&(oh=62500*pp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>oh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ch(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)fh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function lh(){this.count--,ch(this)}function uh(){this.imgCount--,ch(this)}var dh=null;function fh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dh=new Map,t.forEach(ph,e),dh=null,lh.call(e))}function ph(e,t){if(!(t.state.loading&4)){var n=dh.get(e);if(n)var r=n.get(null);else{n=new Map,dh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=lh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var mh={$$typeof:N,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function hh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ot(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ot(0),this.hiddenUpdates=ot(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function gh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new hh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Di(3,null,null,t),e.current=a,a.stateNode=e,t=Da(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},lo(a),e}function _h(e){return e?(e=Ti,e):Ti}function vh(e,t,n,r,i,a){i=_h(i),r.context===null?r.context=i:r.pendingContext=i,r=fo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=po(e,r,t),n!==null&&(Rd(n,e,t),mo(n,e,t))}function yh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bh(e,t){yh(e,t),(e=e.alternate)&&yh(e,t)}function xh(e){if(e.tag===13||e.tag===31){var t=Ci(e,67108864);t!==null&&Rd(t,e,67108864),bh(e,67108864)}}function Sh(e){if(e.tag===13||e.tag===31){var t=Fd();t=ft(t);var n=Ci(e,t);n!==null&&Rd(n,e,t),bh(e,t)}}var Ch=!0;function wh(e,t,n,r){var i=U.T;U.T=null;var a=oe.p;try{oe.p=2,Eh(e,t,n,r)}finally{oe.p=a,U.T=i}}function Th(e,t,n,r){var i=U.T;U.T=null;var a=oe.p;try{oe.p=8,Eh(e,t,n,r)}finally{oe.p=a,U.T=i}}function Eh(e,t,n,r){if(Ch){var i=Dh(r);if(i===null)Qf(e,t,r,Oh,n),zh(e,r);else if(Vh(i,e,t,n,r))r.stopPropagation();else if(zh(e,r),t&4&&-1<Rh.indexOf(e)){for(;i!==null;){var a=Ot(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=et(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ge(o);s.entanglements[1]|=c,o&=~c}jf(a),!($u&6)&&(bd=Ne()+500,Mf(0,!1))}}break;case 31:case 13:s=Ci(a,2),s!==null&&Rd(s,a,2),Ud(),bh(a,2)}if(a=Dh(r),a===null&&Qf(e,t,r,Oh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Qf(e,t,r,null,n)}}function Dh(e){return e=gn(e),kh(e)}var Oh=null;function kh(e){if(Oh=null,e=Dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 Oh=e,null}function Ah(e){switch(e){case`beforetoggle`: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`seeked`:case`submit`:case`toggle`: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`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Pe()){case Fe:return 2;case Ie:return 8;case Le:case Re:return 32;case ze:return 268435456;default:return 32}default:return 32}}var jh=!1,Mh=null,Nh=null,Ph=null,Fh=new Map,Ih=new Map,Lh=[],Rh=`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`.split(` `);function zh(e,t){switch(e){case`focusin`:case`focusout`:Mh=null;break;case`dragenter`:case`dragleave`:Nh=null;break;case`mouseover`:case`mouseout`:Ph=null;break;case`pointerover`:case`pointerout`:Fh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ih.delete(t.pointerId)}}function Bh(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=Ot(t),t!==null&&xh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Vh(e,t,n,r,i){switch(t){case`focusin`:return Mh=Bh(Mh,e,t,n,r,i),!0;case`dragenter`:return Nh=Bh(Nh,e,t,n,r,i),!0;case`mouseover`:return Ph=Bh(Ph,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Fh.set(a,Bh(Fh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ih.set(a,Bh(Ih.get(a)||null,e,t,n,r,i)),!0}return!1}function Hh(e){var t=Dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ht(e.priority,function(){Sh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ht(e.priority,function(){Sh(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 Uh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Dh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);hn=r,n.target.dispatchEvent(r),hn=null}else return t=Ot(n),t!==null&&xh(t),e.blockedOn=n,!1;t.shift()}return!0}function Wh(e,t,n){Uh(e)&&n.delete(t)}function Gh(){jh=!1,Mh!==null&&Uh(Mh)&&(Mh=null),Nh!==null&&Uh(Nh)&&(Nh=null),Ph!==null&&Uh(Ph)&&(Ph=null),Fh.forEach(Wh),Ih.forEach(Wh)}function Kh(e,n){e.blockedOn===n&&(e.blockedOn=null,jh||(jh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Gh)))}var qh=null;function Jh(e){qh!==e&&(qh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){qh===e&&(qh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(kh(r||n)===null)continue;break}var a=Ot(n);a!==null&&(e.splice(t,3),t-=3,Qs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Yh(e){function t(t){return Kh(t,e)}Mh!==null&&Kh(Mh,e),Nh!==null&&Kh(Nh,e),Ph!==null&&Kh(Ph,e),Fh.forEach(t),Ih.forEach(t);for(var n=0;n<Lh.length;n++){var r=Lh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Lh.length&&(n=Lh[0],n.blockedOn===null);)Hh(n),n.blockedOn===null&&Lh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[vt]||null;if(typeof a==`function`)o||Jh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[vt]||null)s=o.formAction;else if(kh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Jh(n)}}}function Xh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Zh(e){this._internalRoot=e}Qh.prototype.render=Zh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;vh(n,Fd(),e,t,null,null)},Qh.prototype.unmount=Zh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vh(e.current,2,null,e,null,null),Ud(),t[yt]=null}};function Qh(e){this._internalRoot=e}Qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=mt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lh.length&&t!==0&&t<Lh[n].priority;n++);Lh.splice(n,0,e),n===0&&Hh(e)}};var $h=n.version;if($h!==`19.3.1`)throw Error(i(527,$h,`19.3.1`));oe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var eg={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:U,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var tg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tg.isDisabled&&tg.supportsFiber)try{He=tg.inject(eg),Ue=tg}catch{}}e.hydrateRoot=function(e,t,n){if(!a(e))throw Error(i(299));var r=!1,o=``,s=xc,c=Sc,l=Cc,u=null;return n!=null&&(!0===n.unstable_strictMode&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(c=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(u=n.formState)),t=gh(e,1,!0,t,n??null,r,o,u,s,c,l,Xh),t.context=_h(null),n=t.current,r=Fd(),r=ft(r),o=fo(r),o.callback=null,po(n,o,r),n=r,t.current.lanes=n,st(t,n),jf(t),e[yt]=t.current,Xf(e),new Qh(t)}})),et=n(((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=$e()}));function tt(e){return e.replaceAll(`/`,`#`)}function nt(e){return e[e.length-1]}function rt(e,t){return typeof e==`function`?e(t):e}var it=Object.prototype.hasOwnProperty;function at(e){for(let t in e)if(it.call(e,t))return!0;return!1}var ot=()=>Object.create(null),st=(e,t)=>ct(e,t,!0);function ct(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(lt(e)&<(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&nt(a)!==`${o-1}`||c&&nt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?ct(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?ct(d,o,n,r):o,i&&=u===d&&(a[l]===f||it.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?ot():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?ct(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function lt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function ut(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!ut(a,o,n,r))return!1}return!0}if(lt(e)&<(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!ut(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!ut(e[a],t[a],n,r)))return!1;return i===0}return!1}function dt(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var ft=/[\x00-\x1f\x7f"<>`{}]/g;function pt(e){return e.replace(ft,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function mt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return pt(t)}var ht=[`http:`,`https:`,`mailto:`,`tel:`];function gt(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var _t=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function vt(e,t){if(!e)return!1;if(_t.test(e))return!0;let n=gt(e);return n?!t.has(n):!1}var yt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},bt=/[&><\u2028\u2029]/g;function xt(e){return e.replace(bt,e=>yt[e])}function St(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=mt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=mt(r?e.slice(r):e)}return t}function Ct(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function wt(e,t){if(e===t)return!0;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 Tt(e){return e.replace(/\/{2,}/g,`/`)}function Et(e){return e===`/`?e:e.replace(/^\/+/,``)}function Dt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Ot(e){return Dt(Et(e))}function kt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function At(e,t,n=`never`,r){if(t.includes(`//`)&&(t=Tt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=Tt(e)),o=e.split(`/`);o.length>1&&nt(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(nt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?Tt(s):s)||`/`;return a&&r&&r.set(a,c),c}function jt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function Mt(e){return e==null||e===``}function Nt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Pt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&Mt(f)){if(c===`/`&&!d)continue;f=``}o+=c+Nt(s,f,r)+(d||``)}}return o+a||`/`}function Ft(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var It=4,Lt=5;function Rt(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function zt(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function Bt(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=nt(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=zt(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=Ht(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.slice(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=Ht(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.slice(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Ht(r,Lt);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=Ht(r,It);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function Vt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ht(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Ut(e,t){let n=Ht(),r=[];function i(e,t,n,a){let[o,s,c]=Bt(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Vt);t.masksTree=n,t.flatCache=Ft(1e3)}function Wt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Jt(e,t.masksTree);return t.flatCache.set(e,r),r}function Gt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ht(),Bt(t,{from:e},1,o),i.singleCache.set(a,o)),Jt(r,o,n)}function Kt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Jt(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Xt(a.route)),t.matchCache.set(r,a),a}function qt(e,t=!1){let n=Ht(),r=[],i={},o={},s=0;function c(e,n,l,u){if(e.init(s),e.id in i&&a(),i[e.id]=e,s!==0&&e.path){let t=Dt(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++;let[d,f,p]=Bt(t,e,n,l,r,u);if(e._interpolation=p,e.children)for(let t of e.children)c(t,f,d,p)}c(e,1,n);for(let e of r)e.sort(Vt);return{processedTree:{segmentTree:n,singleCache:Ft(1e3),matchCache:Ft(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:o}}function Jt(e,t,n=!1){let r=e.split(`/`),i=Qt(e,r,t,n);if(!i)return null;let[a]=Yt(e,r,i);return{route:i.node.route,rawParams:a}}function Yt(e,t,n){let r=Zt(n.node),i=n.node.data&&Rt(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===It)break;if(u.kind===Lt){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Xt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Zt(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Qt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!nt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!nn(l,n))continue;if(i.parse){if(!tn(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==It&&nn(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===It||i.kind===2)&&nn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(tn(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&en(f,o))return n;nn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+$t(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+$t(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+$t(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+$t(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function $t(e,t){return 2**(e-t-1)}function en(e,t){return e===2**(t-1)-1}function tn(e,t,n){let r,i;try{[r,i]=Yt(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function nn(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===It)>(e.node.kind===It)||t.node.kind===It==(e.node.kind===It)&&t.node.depth>e.node.depth)))}function rn(){try{return sessionStorage}catch{return}}var an=`tsr-scroll-restoration-v1_3`,on=rn();function sn(){try{return JSON.parse(on?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var cn=sn(),ln=`data-scroll-restoration-id`,un=e=>e.state.__TSR_key||e.href;function dn(e){let t=e.getAttribute(ln);if(t)return`[${ln}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var fn=!1,pn=`window`;function mn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function hn(e){let t=new Set;for(let n of e){if(n===pn)continue;let e=mn(n);e&&t.add(e)}return t}function gn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||un,a=new Set,o=e=>{let t=cn[e]||={};for(let e of a)e===document?t[pn]={scrollX,scrollY}:e.isConnected&&(t[dn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,fn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{fn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{on?.setItem(an,JSON.stringify(cn))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),r.r||(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=cn[d];if(e){let t=cn[u];for(let n in e){if(n===pn){if(s)continue}else{let e=mn(n);if(!e||s&&o&&(l??=hn(o),l.has(e)))continue}t||=cn[u]={},t[n]??=e[n]}}}fn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=hn(o));let t=e&&i&&c,s=r.e?cn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===pn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=mn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{fn=!1}}))}var _n=/^(?:\s|["[{\d-]|fa|nu|tr)/,vn=bn(JSON.parse),yn=xn(JSON.stringify,JSON.parse);function bn(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=D(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!_n.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function xn(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!_n.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=be(e,r);return t?`?${t}`:``}}var Sn=`__root__`;function Cn(e,t,n){let r=Ot(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=Tt(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>wn(n,s.input({url:e})),output:({url:e})=>s.output({url:Tn(n,e)})}:s}function wn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Tn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function En(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{wt(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Dn=`__TSR_index`,On=`popstate`,kn=`beforeunload`,An=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function jn(e){let t=An.exec(e);return t?`/`+e.slice(t[0].length):e}function Mn(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
11
|
+
\r`.includes(e)?``:encodeURIComponent(e))),jn(e)}function Nn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=In(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Dn];i=Pn(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Dn];i=Pn(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Dn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function Pn(e,t){let n=Ln();return{...t,key:n,__TSR_key:n,[Dn]:e}}function Fn(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>Mn(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>In(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Ln();t.history.replaceState({[Dn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=In(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[Dn]-l.state[Dn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=Nn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(kn,x,{capture:!0}),t.removeEventListener(On,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(kn,x,{capture:!0}),t.addEventListener(On,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function In(e,t){let n=Mn(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Ln();t={[Dn]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function Ln(){return(Math.random()+1).toString(36).slice(7)}function Rn(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function zn(e){return e.pathname+e.search+e.hash}function Bn(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Vn(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function Hn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Un({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Wn(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Gn(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var Kn=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Fn()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&Ot(n)?Cn(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=En(this.latestLocation,e),gn(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=qt(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Ut(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:Ft(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:St(e),external:!1,searchStr:o,search:st(t?.search,i),hash:St(r.slice(1)),state:ct(t?.state,a)}}let o=wn(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:St(jn(o.pathname)),external:!!this.rewrite&&Rn(o,this.origin),searchStr:c,search:st(t?.search,s),hash:St(o.hash.slice(1)),state:ct(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Kt(Dt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=In(n.href,{});n={...n,to:wn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,c=At(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[Dt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Xt(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??Bt(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=Zn(n.params,e),!at(p))break;p===e&&(p=Object.assign(ot(),p));try{Object.assign(p,t(p))}catch{}}}p??=Zn(n.params,Qn(n.params,f)?o()[3]:$n);let m=e.leaveParams?c:jn(St(f?Pt(c,f,p,this.pathParamsDecoder):c)),h=er(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,Xn(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?tr(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||$n,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:$n,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Tn(this.rewrite,e);C=zn(e),Rn(n,t)?(w=n.href,T=!0):w=jn(zn(n))}else C=Ct(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Wt(r.pathname,this.processedTree);if(t){let i=Object.assign(ot(),t.rawParams),{from:a,params:o,...s}=t.route,c=Zn(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return qn(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Dt(this.latestLocation.href)===Dt(n.href)&&ut(Un(n.state),Un(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?gt(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return qn(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Yr(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Hn(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Bn(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(_t.test(n)||(r=gt(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:Rn(e,this.origin)||(n=zn(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=or,this.preloadRoute=e=>Xr(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?At(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Gt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ut(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?ut(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=jt(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??yn,parseSearch:e.parseSearch??vn,protocolAllowlist:e.protocolAllowlist??ht}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=Bt(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:Dt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?nr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=Xn(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof Jn||(r=new Jn(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let g=ot(),_=i._interpolation?Pt(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{rr(i,d)}catch(e){if(x=T(e)||ve(e)?e:new Yn(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:st(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Bn(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?st(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?ct(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?st(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=nt(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=nt(a),c={...e.search};for(let e of a)try{Object.assign(c,Xn(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=o;for(let t of a)try{rr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function qn(e,t,{replace:n,ignoreBlocker:r}){if(!vt(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Jn=class extends Error{},Yn=class extends Error{};function Xn(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Jn(`Async validation not supported`);if(n.issues)throw new Jn(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Zn(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function Qn(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!it.call(e,t[1]))}var $n=Object.freeze({});function er(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=Xn(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function tr(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=rt(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function nr(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Sn}function rr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function ir(e,t){return e.options[t]?.preload?.()}function ar(e,t){let n=ir(e,`component`),r=ir(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function or(e,t,n){let r=()=>t===!1?void 0:t?ir(e,t):ar(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function sr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function cr(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}function lr(e){let t=e.length;for(let n=0;n<t;n++){let r=e[n];if(r._assetEnd!==void 0)t=Math.min(t,Math.max(n+1,r._assetEnd));else if(r.status!==`success`||r._notFound){t=n+1;break}}return t<e.length?e.slice(0,t):e}var ur=0,dr=1,fr=2,pr=3,mr=[4];function hr(e){return typeof e[0]==`number`}function gr(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function _r(e,t){return e.routesById[t.routeId]}function vr(e,t,n){return ve(e)?[pr,e]:T(e)?(e.routeId||=n,[fr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[dr,e]):[ur,e]}function yr(e,t){let n=vr(t,!0,e.id);if(n[0]!==dr)return n;try{e.options.onError?.(n[1])}catch(t){n=vr(t,!0,e.id)}return n}function br(e,t,n,r,i){return i[0].signal.aborted?mr:Ir(e,t,n,yr(n,r),i)}async function xr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=_r(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Cr(e,r),[i,br(e,t,u,a,n)]}if(c.aborted)return[i,mr];let p=r.paramsError??r.searchError;if(p!==void 0)return Cr(e,r),[i,br(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Er(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?gr(a,c):a);if(c.aborted)return[i,mr];let s=Ir(e,t,u,vr(o,!1,u.id),n);if(s[0]!==ur)return Cr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Cr(e,r),[i,br(e,t,u,a,n)]}finally{r.status=h,Er(e,r,!1,n[0])}}i()}function Sr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Cr(e,t){let n=t._flight;t._flight=void 0,Sr(e,t,n)?.abort()}function wr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Sr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Tr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Er(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Dr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Or(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return mr;if(!i)return[ur,void 0];let l=n._flight;Er(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Dr(e,t,n,r,s,a,!!o[3]))).then(e=>vr(e,!1,r.id),e=>vr(e,!0,r.id)).then(t=>(t[0]!==ur&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===dr&&l[2]?yr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Ir(e,t,r,await gr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Cr(e,n),mr}finally{Er(e,n,!1,s)}}function kr(e,t,n){t[0]!==pr&&(e.status=`success`,e.error=void 0,t[0]===ur?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Ar(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Cr(e,r)}function jr(e,t){return t[0]===dr||t[0]===fr?{...e,status:t[0]===dr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Mr(e,t,n,r,i,a,o){let s=t[1][n],c=_r(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Dr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=mr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Cr(e,s),p=br(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Sr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Or(e,t,s,c,g,i,a).then(t=>(kr(s,t,l),t[0]===ur&&(m&&!a[0].signal.aborted&&Ar(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[ur,s.loaderData]),T=(async()=>{try{let e=or(c,void 0,C);e&&await gr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,br(e,t,c,r,a)]}let r=await w;x&&r[0]===ur&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>jr(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Or(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,kr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>jr(E,e))}async function Nr(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=_r(e,t[n]);try{let e=or(i,!1);e&&await gr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Pr(e,t){t[2]&&=(wr(e,t[2].map(e=>e[3])),void 0)}async function Fr(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=pr)throw[a,t];!i&&t[0]!==ur&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===pr)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Ir(e,t,n,r,i,a){for(;r[0]===pr;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[pr,t]:[pr,t,a]}return[pr,o,n]}catch(e){r=a?[dr,e]:yr(n,e),a=!0}}return r}async function Lr(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===fr?Nr(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=pr)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==ur&&t[0]<pr&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=pr){let n=s[1];if(n[0]!==pr||n[1].options.reloadDocument||n[2])return Pr(e,t),n;c=!0,s=[0,[dr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===dr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=_r(e,u);try{await gr(i?Promise.resolve().then(()=>or(m,l===dr?`errorComponent`:`notFoundComponent`)):Promise.all([or(m),or(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Pr(e,t),mr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Pr(e,t),wr(e,o),p()):u.status=`success`}return t}async function Rr(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=_r(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await gr(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function zr(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Nr(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Mr(e,i,t,u,f,r,l)},m=await xr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===fr){let t=await Nr(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=pr&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Lr(e,i,u,r[0],Fr(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Fr(i[2],void 0,void 0,h.then(e=>hr(e)?0:sr(n).length,()=>0))),o=await h}catch(t){if(Pr(e,i),t===a&&a.aborted)return mr;throw t}return hr(o)?o:Rr(e,o,a,r[6]===n.length?r[6]:0)}function Br(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=_r(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Br(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Vr(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function Hr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!sr(t[3]).some(e=>e.id===n[1]))return;let i;try{await gr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Ur(e,t){e._committed=t,e.stores.setMatches(t)}function Wr(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=sr(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=_r(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=Wn(n);Ur(e,n),wr(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Gn(e,i,n,a,l,t)}async function Gr(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Kr(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function qr(e,t,n,r,i){let a=n.map(e=>({...e}));Tr(a);for(let t of r)Cr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Lr(e,o,r,t[0],i)}catch(t){throw wr(e,a),t}if(hr(s))wr(e,a),s[0]===pr&&e._tx===t&&e._committed===n&&await Kr(e,t,s);else if(await Rr(e,s,t[0].signal),e._tx!==t||e._committed!==n)wr(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Cr(e,n))}Ur(e,a),wr(e,n,a)}}async function Jr(e,t,n,r,i,a){let o=await zr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(hr(o)){let n=o[0]===pr&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Vr(e,t),wr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Vr(e,t);return}await Kr(e,t,o);return}let s=o[1];if(e._tx===t&&await Hr(e,t),e._tx!==t){Vr(e,t),wr(e,s),Pr(e,o);return}let c=t[2],l=Hn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Hr(e,t),e._tx!==t){Vr(e,t),wr(e,s),Pr(e,o);return}let n=await e.startTransition(()=>{Vr(e,t),Wr(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&qr(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):Pr(e,o)})}async function Yr(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Hn(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Gr(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Tr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){wr(e,m),await Gr(e,n);return}e._preflight=void 0;let g,_=()=>Jr(e,y,f,()=>Br(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>Gr(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Er(e,t,!1)}n[0].abort(),wr(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Br(e,y),g?.(_()),await y[5]):(wr(e,y[3]),y[3]=[],g?.(),await Gr(e,y))}async function Xr(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Tr(a),o=(e._preloads??=new Map).set(i,a),s=await zr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),wr(e,a)),i.abort()}if(!hr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){T(e)||console.error(e);return}}}async function Zr(e){let t=window.$_TSR,n=e.options.serializationAdapters;n?.length&&(t.t=new Map(n.map(e=>[e.key,e.fromSerializable])),t.buffer.forEach(e=>e())),t.initialized=!0;let r=t.router;e.ssr={manifest:r.manifest},e.options.ssr={nonce:document.querySelector(`meta[property="csp-nonce"]`)?.content};let i=r.matches,a=new AbortController,o=e._preflight;e._preflight=a,o?.abort();let s=()=>e._preflight===a,c,l,u,d;try{if(await gr(e.options.hydrate?.(r.dehydratedData),a.signal),!s())return;let t=e.history.location;u=t.href,d=t.state,e.updateLatestLocation(),c=e.latestLocation,e.stores.location.set(c),l=e.matchRoutes(c,{_controller:a})}catch(t){if(s()&&(e._preflight=void 0),a.abort(t),t!==a.signal)throw t}if(!s())return;let f=[],p,m=0,h=t=>{m=Math.min(m,t+1);let n=f.splice(t);for(let t of n)_r(e,t).options.loader&&(t.status===`success`||!t.invalid&&`loaderData`in t)&&Ar(e,{...t,status:`success`,error:void 0,preload:!0},e._cache.get(t.id));wr(e,n)},g=i.length>l.length?l.findIndex(e=>e._notFound)+1:i.length,_=!1;for(let t=0;t<g;t++){let n=l[t],r=i[t];if(r.i!==tt(n.id)){p??=t;break}m=t+1;let a=_r(e,n);if((`l`in r||r.s===`success`&&r.e===void 0&&a.options.loader)&&(n.loaderData=r.l),n.status=r.s,n.ssr=r.ssr,a.options.ssr=n.ssr,n.updatedAt=r.u,n.error=r.e,n._notFound||=r.g,n.status===`error`||n.status===`notFound`||n._notFound){_=!0,f.push(n),(n.ssr===!1||n.ssr===`data-only`)&&(p??=t);break}if(n.status===`pending`){p??=t;break}f.push(n),n.ssr===`data-only`&&(p??=t)}!_&&f.length===g&&g<l.length&&(p=g);let v=f.map(async t=>{try{let n=_r(e,t);return await(t._notFound?Promise.all([or(n),or(n,`notFoundComponent`)]):or(n,t.status===`error`?`errorComponent`:t.status===`notFound`?`notFoundComponent`:void 0)),!0}catch{return!1}}),y=0;try{for(;y<v.length&&await gr(v[y],a.signal);)y++}catch{return}if(!s())return;y<f.length&&h(y);let b=Math.max(p===f.length?f.length+1:f.length,y<v.length?y:m);for(let t=0;t<b;t++){let n=l[t],r=_r(e,n),o=l[t-1]?.context??e.options.context??{},u;if(r.options.context){try{u=n._ctx=r.options.context({deps:n.loaderDeps,params:n.params,context:o,location:c,navigate:t=>e.navigate({...t,_fromLocation:c}),buildLocation:e.buildLocation,cause:n.cause,abortController:a,preload:!1,matches:l,routeId:r.id})||{}}catch{if(!s())return;if(n.status!==`error`&&n.status!==`notFound`&&!n._notFound){p=Math.min(p??t,t),h(t);break}}if(!s())return}n.context={...o,...u,...f[t]&&i[t].b}}if(await Rr(e,[c,l],a.signal,0,m),!s())return;let x=p!==void 0||f.length<g,S=_&&f.length===g?l:f,C=x?l:S,w;if(x&&p!==void 0){let e=C[p];w=e.ssr===`data-only`&&m>p+1?m:void 0,C=C.slice(),C[p]={...e,status:`pending`,ssr:e.ssr===`data-only`&&`data-only`,_assetEnd:w}}let T=()=>{let t=e.history.location;return x&&!e._tx&&t.href===u&&t.state===d&&e._committed===S&&S.length&&!a.signal.aborted?a:void 0},E=[T,t=>{if(e._handoff!==E)return;e._handoff=void 0;let n=S.length;if(!t||!T()||S.some((e,n)=>e.id!==t[n]?.id)){a.abort();return}let r=w;if(r!==void 0){for(let e=n;e<r;e++)if(l[e]?.id!==t[e]?.id){r=e>p+1?e:void 0;break}}let i=S.map(e=>({...e}));r!==void 0&&(i[p]._assetEnd=r),wr(e,t.splice(0,n,...i));for(let e=n;e<t.length;e++){let n=t[e],r=l[e];r?.id===n.id&&r._ctx&&(n._ctx=r._ctx),n.abortController=a}return n}];e._committed=S,e._lifecycleEnd=Wn(S),e._handoff=E,e._preflight=void 0,e.batch(()=>{e.stores.setMatches(C),e.stores.status.set(`idle`),x||e.stores.resolvedLocation.set(e.stores.location.get())})}var Qr=Symbol.for(`TSR_DEFERRED_PROMISE`);function $r(e,t){let n=e;return n[Qr]||(n[Qr]={status:`pending`},n.then(e=>{n[Qr].status=`success`,n[Qr].data=e}).catch(e=>{n[Qr].status=`error`,n[Qr].error={data:(t?.serializeError??Vn)(e),__isServerError:!0}})),n}var ei=`Error preloading route! ☝️`;function ti(e,t){if(e)return typeof e==`string`?e:e[t]}function ni(e){return e?.scriptFormat??`module`}function ri(e,t,n){let r=ii(t),i=ti(n,`script`)??r.crossOrigin;return{...ni(e)===`iife`?{rel:`preload`,as:`script`}:{rel:`modulepreload`},href:r.href,fetchPriority:`low`,...i?{crossOrigin:i}:{}}}function ii(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}function ai(e,t){if(t.length===0)return;if(t.length===1){e.push(t[0]);return}let n=new Set;for(let r of t){let t=JSON.stringify(r);n.has(t)||(n.add(t),e.push(r))}}function oi(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}function si(e,t,n,r){let i=lr(e),a=[],o=[];for(let e of i)for(let t of Array.isArray(e.scripts)?e.scripts:[]){if(!t)continue;let{children:e,...i}=t;a.push({tag:`script`,attrs:{...i,...r,nonce:n},children:e})}if(t)for(let e of i)for(let r of t.routes[e.routeId]?.scripts??[])o.push({tag:`script`,attrs:{...r.attrs,nonce:n},children:r.children});return[a,o]}function ci([e,t],n){return n?[...n.before,...e,...t,n.boundary]:[...e,...t]}var li=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Sn:this.parentRoute||a();let r=n?Sn:t?.path;r&&r!==`/`&&(r=Et(r));let i=t?.id||r,o=n?Sn:Tt((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let s=o===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Tt(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=o,this._fullPath=s,this._to=Dt(s)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>C({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ui=class{constructor({id:e}){this.notFound=e=>k({routeId:this.id,...e}),this.redirect=e=>C({from:this.id,...e}),this.id=e}},di=class extends li{constructor(e){super(e)}};function fi(e){return e}var pi=fi({key:`$TSS/serverfn`,test:e=>typeof e!=`function`||!(m in e)?!1:!!e[m],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>u(e)});function mi(e){let t;if(e.then(e=>(t=e,e),Ve)?.catch?.(Ve),t!==void 0)return{data:t}}function hi(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?mi(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l,...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l}});c&&!d&&!h&&!g&&l>m.state.dataUpdatedAt&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(Ve)})}var gi=class extends Oe{#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||_i(),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=Fe({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})}this.state.isPaused&&r.canStart()&&t();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),Se.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function _i(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var vi=class extends se{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new gi({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=yi(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=yi(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=yi(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=yi(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Se.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>fe(t,e))}findAll(e={}){return this.getAll().filter(t=>fe(e,t))}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Se.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ve))))}};function yi(e){return e.options.scope?.id}var bi=class extends se{#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),Ge(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ae(t.mutationKey)!==Ae(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??_i();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){Se.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},xi=class extends se{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??we(r,t),a=this.get(i);return a||(a=new ne({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){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Se.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=>ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ee(e,t)):t}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Se.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Se.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Si=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new xi,this.#t=e.mutationCache||new vi,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ze.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=U.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(ie(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=ue(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Se.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;Se.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Se.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=Se.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return Se.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=Se.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(Ve)),r?Promise.resolve():t}));return Promise.all(r).then(Ve)}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(ie(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(ie(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}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(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return U.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(Ae(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{qe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ae(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{qe(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||=we(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===c&&(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()}};function Ci(e,t){return Ee({...e,enabled:!0,suspense:!0,throwOnError:Ne,placeholderData:void 0},ge,t)}var W=t(v(),1);function wi(e,t){let n=F(t),r=n.getQueryCache();return W.useSyncExternalStore(W.useCallback(e=>r.subscribe(Se.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function Ti(e,t){let n=F(t),[r]=W.useState(()=>new bi(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(Se.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(Ve)},[r]);if(i.error&&N(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Ei=W.use,Di=W.useLayoutEffect,G=f();function Oi({promise:e}){if(Ei)return Ei(e);let t=$r(e);if(t[Qr].status===`pending`)throw t;if(t[Qr].status===`error`)throw t[Qr].error;return t[Qr].data}function ki(e){let t=(0,G.jsx)(Ai,{...e});return e.fallback?(0,G.jsx)(W.Suspense,{fallback:e.fallback,children:t}):t}function Ai(e){let t=Oi(e);return e.children(t)}var ji=class extends W.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?W.createElement(this.props.errorComponent??Mi,{error:e[0],reset:this.reset}):this.props.children}};function Mi({error:e}){let[t,n]=W.useState(!1);return(0,G.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,G.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,G.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,G.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,G.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,G.jsx)(`div`,{children:(0,G.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,G.jsx)(`code`,{children:e.message}):null})}):null]})}var Ni=()=>!0,Pi=()=>!1;function Fi({children:e,fallback:t=null}){return(0,G.jsx)(W.Fragment,{children:Ii()?e:t})}function Ii(e=!0){return W.useSyncExternalStore(Li,Ni,e?Pi:Ni)}function Li(){return()=>{}}var Ri=W.createContext(null);function zi(e){return W.useContext(Ri)}function Bi(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{cr(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var Vi=W.createContext(void 0),Hi=W.createContext(void 0);function Ui({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;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}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(1)}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 Wi(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 Gi=[],Ki=0,{link:qi,unlink:Ji,propagate:Yi,checkDirty:Xi,shallowPropagate:Zi}=Ui({update(e){return e._update()},notify(e){Gi[$i++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,ra(e))}}),Qi=0,$i=0,ea,ta=0;function na(e){try{++ta,e()}finally{--ta||ia()}}function ra(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ji(n,e)}function ia(){if(!(ta>0)){for(;Qi<$i;){let e=Gi[Qi];Gi[Qi++]=void 0,e.notify()}Qi=0,$i=0}}function aa(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 ea!==void 0&&qi(i,ea,Ki),i._snapshot},subscribe(e){let t=Wi(e),n={current:!1},r=oa(()=>{i.get(),n.current?(ea=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=ea,o=t?.compare??Object.is;if(n)ea=i,++Ki,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{ea=a,n&&(i.flags&=-5),ra(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Xi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Zi(e)}}else e&32&&(i.flags=e&-33);return ea!==void 0&&qi(i,ea,Ki),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Yi(e),Zi(e),ia())}},i}function oa(e){let t=()=>{let t=ea;ea=n,++Ki,n.depsTail=void 0,n.flags=6;try{return e()}finally{ea=t,n.flags&=-5,ra(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&&Xi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,ra(this)}};return t(),n}var sa=class{constructor(e,t){this.atom=aa(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(Wi(e))}},ca=class{constructor(e){this.atom=aa(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Wi(e))}};function la(e,t){return typeof e==`function`?new ca(e):t?new sa(e,t):new sa(e)}function ua(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;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}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=da(e);if(n.length!==da(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function da(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var fa={};function pa(e,t){let n=W.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ct(n.current,i):i}}function ma(e){let t=zi(),n=W.useContext(e.from?Hi:Vi),r=e.from??n,i=t.stores.getMatchStore(r),o=pa(e,t),s=A(i,e=>e?o(e):fa);if(s!==fa)return s;(e.shouldThrow??!0)&&a()}function ha(e){return ma({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function ga(e){let{select:t,...n}=e;return ma({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function _a(e){return ma({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function va(e){return ma({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function ya(e){let t=zi();return W.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ba(e){return ma({...e,select:t=>e.select?e.select(t.context):t.context})}function xa(...e){let t=W.useRef(e),n=t.current;return e.forEach((e,t)=>{ut(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Sa(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(ei)})}function Ca(e,t){let n=typeof e==`string`&>(e);if(n)return t.has(n)?e:null}function wa(e,t,n,r){let i=kt(e.pathname,r),a=kt(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!ut(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function Ta(e,t,n){let r=zi(),i=W.useRef(null),a=W.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[v,y,b]=xa(e.search,e.params,o),x=W.useContext(Vi),S=(r.stores._linkScopes??={})[x]??=Bi(r,x),[C,w,T]=W.useMemo(()=>{let t=Ca(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=S[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=Na(t,r,u),s=u||o&&!gt(o)?wa(e,t,b,r.basepath):void 0;a&&a[0]===o&&a[1]===s||(a=[o,s]),i=e}return a};return[n,c,b?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,S,e.from,e.hash,e.href,s,v,y,e.state,e.mask,e.unsafeRelative,b,u]),[E,D]=W.useSyncExternalStore(S[1],w,T||w),O=D===void 0&&E,k=u||E===void 0,A=W.useRef(!1),j=e.reloadDocument||O||k?!1:c??r.options.defaultPreload,M=l??r.options.defaultPreloadDelay??0,N=W.useCallback(e=>{let t=e?.isIntersecting;t??j===`intent`?M?i.t??=setTimeout(()=>{i.t=void 0,Sa(r,C)},M):Sa(r,C):t===!1&&ja(i)},[r,C,i,j,M]);W.useEffect(()=>{if(!j)return;j===`render`&&!A.current&&(A.current=!0,Sa(r,C));let e=!0,t;return j===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&N(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),ja(i)}},[r,C,j,N,i]);let P=ka(e,n);if(P.ref=t?a:i,O)return P.href=O,P;let F=t=>{let n=d??t.currentTarget.getAttribute(`target`);k||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||n&&n!==`_self`||t.button!==0||(t.preventDefault(),ja(i),r.navigate({...e,_fromLocation:C._fromLocation}))},I=()=>{j===`intent`&&Sa(r,C)},L=()=>{j===`intent`&&ja(i)};return P.onClick=Ma(f,F),P.onBlur=Ma(p,L),P.onFocus=Ma(m,N),P.onMouseEnter=Ma(h,N),P.onMouseLeave=Ma(g,L),P.onTouchStart=Ma(_,I),Aa(P,e,D,E,k,n)}var Ea={},Da={className:`active`},Oa=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function ka(e,t){let n={};for(let r in e)Oa.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Aa(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=rt(n?o:s,{})??(n?Da:Ea);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var ja=e=>{clearTimeout(e.t),e.t=void 0},Ma=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function Na(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!vt(i,t.protocolAllowlist))return i}var Pa=W.memo(W.forwardRef((e,t)=>{let n=e._asChild||`a`,r=Ta(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return W.createElement(n,r,i)}),Fa);function Fa(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Oa.has(r)||!ut(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}function Ia(e){return new La({id:e})}var La=class extends ui{constructor({id:e}){super({id:e}),this.useMatch=e=>ma({...e,from:this.id}),this.useRouteContext=e=>ba({...e,from:this.id}),this.useSearch=e=>va({...e,from:this.id}),this.useParams=e=>_a({...e,from:this.id}),this.useLoaderDeps=e=>ga({...e,from:this.id,strict:!1}),this.useLoaderData=e=>ha({...e,from:this.id,strict:!1}),this.useNavigate=()=>ya({from:zi().routesById[this.id].fullPath}),this.notFound=e=>k({routeId:this.id,...e}),this.Link=W.forwardRef((e,t)=>{let n=zi().routesById[this.id].fullPath;return(0,G.jsx)(Pa,{ref:t,from:n,...e})})}},Ra=class extends li{constructor(e){super(e),this.useMatch=e=>ma({...e,from:this.id}),this.useRouteContext=e=>ba({...e,from:this.id}),this.useSearch=e=>va({...e,from:this.id}),this.useParams=e=>_a({...e,from:this.id}),this.useLoaderDeps=e=>ga({...e,from:this.id}),this.useLoaderData=e=>ha({...e,from:this.id}),this.useNavigate=()=>ya({from:this.fullPath}),this.Link=W.forwardRef((e,t)=>(0,G.jsx)(Pa,{ref:t,from:this.fullPath,...e}))}};function za(e){return new Ra(e)}function Ba(){return e=>Ha(e)}var Va=class extends di{constructor(e){super(e),this.useMatch=e=>ma({...e,from:this.id}),this.useRouteContext=e=>ba({...e,from:this.id}),this.useSearch=e=>va({...e,from:this.id}),this.useParams=e=>_a({...e,from:this.id}),this.useLoaderDeps=e=>ga({...e,from:this.id}),this.useLoaderData=e=>ha({...e,from:this.id}),this.useNavigate=()=>ya({from:this.fullPath}),this.Link=W.forwardRef((e,t)=>(0,G.jsx)(Pa,{ref:t,from:this.fullPath,...e}))}};function Ha(e){return new Va(e)}function Ua(e){return e=>{let t=za(e);return t.isRoot=!1,t}}function Wa(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(dt(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(Ei)Ei(a());else throw a()}return W.createElement(r,e)};return o.preload=a,o}function Ga(e){let t=zi(),n=`not-found-${A(t.stores.location,e=>e.pathname)}-${A(t.stores.status)}`;return(0,G.jsx)(ji,{getResetKey:()=>n,onCatch:(t,n)=>{if(T(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(T(t))return e.fallback?.(t);throw t},children:e.children})}function Ka(){return(0,G.jsx)(`p`,{children:`Not Found`})}function qa(e,t,n){return t.options.notFoundComponent?(0,G.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,G.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,G.jsx)(Ka,{})}function Ja(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,G.jsx)(n,{}):null}var Ya=(e,t)=>e[0]===t[0]&&e[1]===t[1],Xa=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Za=W.memo(function({routeId:e}){let t=zi(),n=t.stores.getMatchStore(e);return Qa(t,A(n))});function Qa(e,t){let n=e.routesById[t.routeId],r=Ja(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Xa(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,G.jsx)($a,{match:t});s&&(l=(0,G.jsx)(Fi,{fallback:r,children:l})),o&&(l=(0,G.jsx)(Ga,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return W.createElement(o,e)},children:l})),i&&(l=(0,G.jsx)(ji,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(T(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,G.jsx)(W.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,G.jsx)(Vi.Provider,{value:t.routeId,children:(0,G.jsxs)(u,{children:[l,null]})}):(0,G.jsxs)(Vi.Provider,{value:t.routeId,children:[l,null]})}var $a=W.memo(function({match:e}){let t=zi(),n=e.routeId,r=t.routesById[n],i=W.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=W.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,G.jsx)(e,{},i):(0,G.jsx)(eo,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Xa(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Ja(t,r)}if(e.status===`notFound`)return qa(t,r,e.error);if(e.status===`error`)throw e.error;return a}),eo=W.memo(function(){let e=zi(),t=W.useContext(Vi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=A(a,e=>[!!e._notFound,e.error],{compare:Ya}),i=A(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return qa(e,e.routesById[t],r);if(!i)return null;let a=(0,G.jsx)(Za,{routeId:i});return t===`__root__`?(0,G.jsx)(W.Suspense,{fallback:Ja(e),children:a}):a});function to(e,t){let n=e[1];e.length=0,n?.(t)}function no({t:e}){let t=zi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{to(n,!1),n.push(i,a),e(t),W.startTransition(r)}),Di(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Dt(r.publicHref)!==Dt(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Hn(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ro(){let e=zi(),t=e.routesById[Sn],n=Ja(e,t),r=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(no,{t:W.useState()[1]}),e.ssr?(0,G.jsx)(io,{}):(0,G.jsx)(W.Suspense,{fallback:n,children:(0,G.jsx)(io,{})})]});return e.options.InnerWrap?(0,G.jsx)(e.options.InnerWrap,{children:r}):r}function io(){let e=zi(),t=e._rendered,n=A(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Di(()=>{t[0]===n&&to(t,!0)},[t,n]);let a=i?(0,G.jsx)(Za,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,G.jsx)(ji,{getResetKey:()=>r,onCatch:void 0,children:a})}var ao=e=>({createMutableStore:aa,createReadonlyStore:aa,batch:na}),oo=e=>new so(e),so=class extends Kn{constructor(e){super(e,ao)}};function co({router:e,children:t,...n}){at(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,G.jsx)(Ri.Provider,{value:e,children:t});return e.options.Wrap?(0,G.jsx)(e.options.Wrap,{children:r}):r}function lo({router:e,...t}){return(0,G.jsx)(co,{router:e,...t,children:(0,G.jsx)(ro,{})})}function uo(e){let t=zi({warn:e?.router===void 0}),n=e?.router||t;return A(n.stores.__store,pa(e,n))}function fo(e,t){if(t)for(let[n,r]of Object.entries(t))n!==`suppressHydrationWarning`&&r!==void 0&&r!==!1&&e.setAttribute(n,typeof r==`boolean`?``:String(r))}function po(e){let{attrs:t,children:n,nonce:r,preventScriptHoist:i}=e,a=W.useMemo(()=>n===void 0?void 0:{__html:n},[n]);switch(e.tag){case`title`:return(0,G.jsx)(`title`,{...t,suppressHydrationWarning:!0,children:n});case`meta`:return(0,G.jsx)(`meta`,{...t,suppressHydrationWarning:!0});case`link`:return(0,G.jsx)(`link`,{...t,precedence:t?.precedence??(t?.rel===`stylesheet`?`default`:void 0),nonce:r,suppressHydrationWarning:!0});case`style`:return e.inlineCss,(0,G.jsx)(`style`,{...t,dangerouslySetInnerHTML:a,nonce:r});case`script`:return(0,G.jsx)(mo,{attrs:t,preventScriptHoist:i,children:n});default:return null}}function mo({attrs:e,children:t,preventScriptHoist:n}){zi();let r=Ii(),i=W.useMemo(()=>t===void 0?void 0:{__html:t},[t]),a=typeof e?.type==`string`&&e.type!==``&&e.type!==`text/javascript`&&e.type!==`module`;if(W.useEffect(()=>{if(!a){if(e?.src){let t=document.createElement(`a`);t.href=e.src;let n=t.href;for(let e of document.scripts)if(e.src===n)return;let r=document.createElement(`script`);return fo(r,e),document.head.appendChild(r),()=>r.remove()}if(typeof t==`string`){let n=typeof e?.type==`string`?e.type:`text/javascript`,r=typeof e?.nonce==`string`?e.nonce:void 0;for(let e of document.scripts){if(e.hasAttribute(`src`))continue;let i=e.getAttribute(`type`)??`text/javascript`,a=e.getAttribute(`nonce`)??void 0;if(e.textContent===t&&i===n&&a===r)return}let i=document.createElement(`script`);return i.textContent=t,fo(i,e),document.head.appendChild(i),()=>i.remove()}}},[e,t,a]),a&&typeof t==`string`)return(0,G.jsx)(`script`,{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:i});if(!r){if(e?.src)return(0,G.jsx)(`script`,{...e,suppressHydrationWarning:!0});if(typeof t==`string`)return(0,G.jsx)(`script`,{...e,dangerouslySetInnerHTML:i,suppressHydrationWarning:!0})}return null}function ho(e,t,n,r){n=lr(n);let i=n.map(e=>e.meta).filter(e=>e!==void 0),a=[],o={},s;for(let e=i.length-1;e>=0;e--){let n=i[e];for(let e=n.length-1;e>=0;e--){let r=n[e];if(r){if(r.title)s||={tag:`title`,children:r.title};else if(`script:ld+json`in r)try{let e=JSON.stringify(r[`script:ld+json`]);a.push({tag:`script`,attrs:{type:`application/ld+json`},children:xt(e)})}catch{}else{let e=r.name??r.property;if(e){if(o[e])continue;o[e]=!0}a.push({tag:`meta`,attrs:{...r,nonce:t}})}}}}s&&a.push(s),t&&a.push({tag:`meta`,attrs:{property:`csp-nonce`,content:t}}),a.reverse();let c=n.flatMap(e=>e.links??[]).filter(e=>e!==void 0).map(e=>({tag:`link`,attrs:{...e,nonce:t}})),l=e.ssr?.manifest,u=[];l&&(n.forEach(e=>{(l.routes[e.routeId]?.css)?.forEach(e=>{let n=oi(e);u.push({tag:`link`,attrs:{rel:`stylesheet`,...n,crossOrigin:ti(r,`stylesheet`)??n.crossOrigin,suppressHydrationWarning:!0,nonce:t}})})}),l.inlineStyle&&u.push({tag:`style`,attrs:{...l.inlineStyle.attrs,nonce:t},children:l.inlineStyle.children,inlineCss:!0}));let d=[];l&&n.forEach(e=>{l.routes[e.routeId]?.preloads?.forEach(e=>{d.push({tag:`link`,attrs:{...ri(l,e,r),nonce:t}})})});let f=n.flatMap(e=>e.styles??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`style`,attrs:{...n,nonce:t},children:e})),p=n.flatMap(e=>e.headScripts??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`script`,attrs:{...n,nonce:t},children:e})),m=[];return ai(m,a),m.push(...d),ai(m,c),m.push(...u),ai(m,f),ai(m,p),m}var go=e=>{let t=zi(),n=t.options.ssr?.nonce,r=W.useCallback(r=>ho(t,n,r,e),[e,n,t]);return A(t.stores.matches,r,{compare:ut})};function _o(e){let t=go(e.assetCrossOrigin),n=zi().options.ssr?.nonce;return(0,G.jsx)(G.Fragment,{children:t.map(e=>(0,W.createElement)(po,{...e,key:`tsr-meta-${JSON.stringify(e)}`,nonce:n}))})}var vo={suppressHydrationWarning:!0},yo=()=>{let e=zi(),t=e.options.ssr?.nonce,n=n=>{let r=si(n,e.ssr?.manifest,t,vo);for(let e of r[1])if(typeof e.attrs?.src==`string`){let t=e;t.preventScriptHoist=!0}return r};return bo(A(e.stores.matches,e=>ci(n(e)),{compare:ut}))};function bo(e){return(0,G.jsx)(G.Fragment,{children:e.map((e,t)=>(0,W.createElement)(po,{...e,key:`tsr-scripts-${e.tag}-${t}`}))})}function xo({router:e,queryClient:t,dehydrateOptions:n,hydrateOptions:r,handleRedirects:i=!0}){let a=e.options.hydrate;if(e.options.hydrate=async e=>{let n=e.query;try{await a?.(e),n.initial&&hi(t,{queries:n.initial},r)}catch(e){throw n.stream.cancel(e).catch(()=>{}),e}let i=n.stream.getReader();(async()=>{try{for(;;){let{done:e,value:n}=await i.read();if(e)return;hi(t,{queries:n},r)}}catch(e){console.error(`Error reading query stream:`,e),i.cancel(e).catch(()=>{})}finally{i.releaseLock()}})()},i){let n=t.getMutationCache().config;t.getMutationCache().config={...n,onError:(t,...r)=>ve(t)?(t.options._fromLocation=e.stores.location.get(),e.navigate(e.resolveRedirect(t).options)):n.onError?.(t,...r)};let r=t.getQueryCache().config;t.getQueryCache().config={...r,onError:(t,...n)=>ve(t)?(t.options._fromLocation=e.stores.location.get(),e.navigate(e.resolveRedirect(t).options)):r.onError?.(t,...n)}}}function So(e){if(xo(e),e.wrapQueryClient===!1)return;let t=e.router.options.Wrap||W.Fragment;e.router.options.Wrap=({children:n})=>(0,G.jsx)(Ue,{client:e.queryClient,children:(0,G.jsx)(t,{children:n})})}var Co={bg:`var(--x1bd2iaf)`,surface:`var(--xgiwmlq)`,raised:`var(--x1sj141n)`,hover:`var(--x55kj9k)`,active:`var(--x1ko5s2s)`,border:`var(--x1ljawrx)`,borderStrong:`var(--x1wmecsq)`,primary:`var(--x1b1m92g)`,primaryHover:`var(--x1djyeca)`,onPrimary:`var(--xz3jkde)`,text:`var(--xh1mtfv)`,muted:`var(--x1eegxt8)`,faint:`var(--x1y3jqnt)`,danger:`var(--x1rsrbe2)`,dangerBg:`var(--xzklvxa)`,success:`var(--x56xjt1)`,selection:`var(--x3itj7)`,synKeyword:`var(--x1oxlabo)`,synString:`var(--x54wwie)`,synNumber:`var(--x1j22127)`,synComment:`var(--x1jyogra)`,synFunction:`var(--x1ab7c27)`,synType:`var(--x1sy0dl7)`,tintRest:`var(--x189l5c3)`,tintHover:`var(--xcqutt3)`,tintActive:`var(--x2arnpg)`,backdrop:`var(--x1hemmdd)`,shadow:`var(--x1f48itt)`,__varGroupHash__:`x3qmmre`},wo={x3qmmre:`x14e64gp x3qmmre`,$$css:!0},To={x3qmmre:`xcehgk8 x3qmmre`,$$css:!0},Eo={sm:`var(--x1mekqhl)`,md:`var(--xt4ypks)`,lg:`var(--xgb9uqg)`,xl:`var(--xhrzkwl)`,full:`var(--x16stf2z)`,__varGroupHash__:`x1x9b9mp`},Do={xs:`var(--x79uhsr)`,sm:`var(--xt6hdbs)`,md:`var(--x1bjvsbq)`,__varGroupHash__:`xe1lwr3`},Oo={sans:`var(--x1q1zo9x)`,mono:`var(--x1p6nkrd)`,__varGroupHash__:`x1aipckl`},ko=V();function Ao(){let e=(0,ko.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{role:`status`,"aria-label":`Loading`,className:`x98rzlu x78zum5 xdt5ytf x883omv x1tamke2`,children:[(0,G.jsx)(`div`,{className:`xn7wf0q x14fh20 x1tbzl01 x1sbju2s x4hg4is xa4qsjk x16grhtn xmix8c7`}),(0,G.jsx)(`div`,{className:`x1v9usgg xn7wf0q x14fh20 x1tbzl01 x1sbju2s x4hg4is xa4qsjk xh8yej3`}),(0,G.jsx)(`div`,{className:`x1v9usgg xn7wf0q x14fh20 x1tbzl01 x1sbju2s x4hg4is xa4qsjk xh8yej3`}),(0,G.jsx)(`div`,{className:`x1v9usgg xn7wf0q x14fh20 x1tbzl01 x1sbju2s x4hg4is xa4qsjk x65xoit`}),(0,G.jsx)(`div`,{className:`x1v9usgg xn7wf0q x14fh20 x1tbzl01 x1sbju2s x4hg4is xa4qsjk xinu3np`})]}),e[0]=t):t=e[0],t}var jo={},Mo;function No(){if(Mo)return jo;Mo=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.styleq=void 0;var e=new WeakMap,t=`$$css`;function n(n){var r,i,a;return n!=null&&(r=n.disableCache===!0,i=n.disableMix===!0,a=n.transform),function(){for(var n=[],o=``,s=null,c=``,l=r?null:e,u=Array(arguments.length),d=0;d<arguments.length;d++)u[d]=arguments[d];for(;u.length>0;){var f=u.pop();if(f!=null&&f!==!1){if(Array.isArray(f))for(var p=0;p<f.length;p++)u.push(f[p]);else{var m=a==null?f:a(f);if(m.$$css!=null){var h=``;if(l!=null&&l.has(m)){var g=l.get(m);g!=null&&(h=g[0],c=g[2],n.push.apply(n,g[1]),l=g[3])}else{var _=[];for(var v in m){var y=m[v];if(v===t){var b=m[v];b!==!0&&(c=c?b+`; `+c:b)}else typeof y==`string`||y===null?n.includes(v)||(n.push(v),l!=null&&_.push(v),typeof y==`string`&&(h+=h?` `+y:y)):console.error(`styleq: ${v} typeof ${String(y)} is not "string" or "null".`)}if(l!=null){var x=new WeakMap;l.set(m,[h,_,c,x]),l=x}}h&&(o=o?h+` `+o:h)}else if(i)s??={},s=Object.assign({},m,s);else{var S=null;for(var C in m){var w=m[C];w!==void 0&&(n.includes(C)||(w!=null&&(s??={},S??={},S[C]=w),n.push(C),l=null))}S!=null&&(s=Object.assign(S,s))}}}}return[o,s,c]}}var r=jo.styleq=n();return r.factory=n,jo}var Po=No();function Fo(...e){let[t,n,r]=Po.styleq(e),i={};return t!=null&&t!==``&&(i.className=t),n!=null&&Object.keys(n).length>0&&(i.style=n),r!=null&&r!==``&&(i[`data-style-src`]=r),i}Object.freeze({});var Io={tabs:[],activeTabId:null,revision:0};function Lo(){return Le(i()).data??Io}function Ro(){let e=(0,ko.c)(1),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1},e[0]=t):t=e[0];let{tabId:n}=_a(t);return Lo().tabs.find(e=>e.id===n)??null}function zo(){let e=(0,ko.c)(1),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1},e[0]=t):t=e[0];let{connectionId:n}=_a(t);return Ro()?.target.connectionId??n??null}function Bo(){let e=(0,ko.c)(39),t=F(),n=ya(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1},e[0]=r):r=e[0];let{tabId:a}=_a(r),o;e[1]===t?o=e[2]:(o=e=>t.setQueryData(i().queryKey,e),e[1]=t,e[2]=o);let s=o,c;e[3]===t?c=e[4]:(c=e=>t.setQueryData(i().queryKey,t=>t&&e(t)),e[3]=t,e[4]=c);let l=c,u;e[5]===t?u=e[6]:(u=async e=>{try{await e()}catch{await t.invalidateQueries({queryKey:i().queryKey})}},e[5]=t,e[6]=u);let d=u,f;e[7]!==n||e[8]!==s?(f=async(e,t)=>{let{workspace:r,tabId:i}=await Je({data:{target:e,...t===void 0?{}:t}});s(r),await n({to:`/t/$tabId`,params:{tabId:i}})},e[7]=n,e[8]=s,e[9]=f):f=e[9];let p=f,m;e[10]===n?m=e[11]:(m=e=>n({to:`/t/$tabId`,params:{tabId:e}}),e[10]=n,e[11]=m);let h,g,_;e[12]===p?(h=e[13],g=e[14],_=e[15]):(h=(e,t,n)=>p({kind:`table`,connectionId:e,database:t,table:n}),g=e=>p({kind:`sql`,connectionId:e,database:null}),_=e=>p({kind:`sql`,connectionId:e.target.connectionId,database:e.target.database},{sql:e.sql,after:e.id}),e[12]=p,e[13]=h,e[14]=g,e[15]=_);let v;e[16]!==n||e[17]!==s||e[18]!==a?(v=async(e,t)=>{let r=await _e({data:{ids:e,prefer:t}});s(r),a!==void 0&&!r.tabs.some(e=>e.id===a)&&await n(r.activeTabId?{to:`/t/$tabId`,params:{tabId:r.activeTabId}}:{to:`/`})},e[16]=n,e[17]=s,e[18]=a,e[19]=v):v=e[19];let y;e[20]!==l||e[21]!==s||e[22]!==d?(y=async e=>{let t=new Map(e.map(Ho));l(e=>({...e,tabs:e.tabs.map(e=>({...e,position:t.get(e.id)??e.position})).toSorted(Vo)})),await d(async()=>s(await L({data:{ids:e}})))},e[20]=l,e[21]=s,e[22]=d,e[23]=y):y=e[23];let b,x,S;e[24]!==l||e[25]!==d?(b=async(e,t)=>{l(n=>({...n,tabs:n.tabs.map(n=>n.id===e&&n.target.kind===`sql`?{...n,target:{...n.target,database:t}}:n)})),await d(()=>R({data:{id:e,database:t}}))},x=async(e,t)=>{l(n=>({...n,tabs:n.tabs.map(n=>n.id===e?{...n,sql:t}:n)})),await d(()=>B({data:{id:e,sql:t}}))},S=async e=>{l(t=>({...t,activeTabId:e})),await d(()=>I({data:{id:e}}))},e[24]=l,e[25]=d,e[26]=b,e[27]=x,e[28]=S):(b=e[26],x=e[27],S=e[28]);let C;return e[29]!==y||e[30]!==b||e[31]!==x||e[32]!==S||e[33]!==m||e[34]!==h||e[35]!==g||e[36]!==_||e[37]!==v?(C={activate:m,openTable:h,openSql:g,duplicate:_,close:v,reorder:y,setDatabase:b,saveDraft:x,markActive:S},e[29]=y,e[30]=b,e[31]=x,e[32]=S,e[33]=m,e[34]=h,e[35]=g,e[36]=_,e[37]=v,e[38]=C):C=e[38],C}function Vo(e,t){return e.position-t.position}function Ho(e,t){return[e,t]}var Uo=[`Control`,`Alt`,`Shift`,`Meta`],Wo={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};Array.from({length:24},(e,t)=>`F${t+1}`);var Go={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Quote:`'`,Semicolon:`;`,Slash:`/`};function Ko(e){return/^\p{Letter}$/u.test(e)}function qo(e){if(!e)return``;if(Ko(e)){let t=e.toUpperCase();return t.length===1?t:e}return e===` `?`Space`:e}var Jo=/^(?:Node\.js\/|Deno\/|Bun\/|Cloudflare-Workers)/;function Yo(){return typeof navigator>`u`||Jo.test(String(navigator.userAgent))}function Xo(e){let t=``,n=e;if(n==null){if(Yo())return`linux`;t=navigator.platform?.toLowerCase()??``,n=navigator.userAgent??``}return n=n.toLowerCase(),t.includes(`mac`)||n.includes(`mac`)?`mac`:t.includes(`win`)||n.includes(`win`)?`windows`:`linux`}function Zo(e,t=Xo()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}function Qo(e,t){let n=!1;try{n=t!==`mac`&&typeof e.getModifierState==`function`&&e.getModifierState(`AltGraph`)}catch{}let r=(e.key||``).normalize(`NFC`),i=qo(r),a=t===`windows`&&n&&!es({key:i,altGraph:n});return{key:i,code:e.code||``,ctrl:a||!!e.ctrlKey,shift:!!e.shiftKey,alt:a||!!e.altKey,meta:!!e.metaKey,altGraph:n&&!a,location:e.location,isComposing:!!e.isComposing||e.keyCode===229||r===`Process`||r===`Unidentified`}}function $o(e){if(/^Key[A-Z]$/i.test(e))return e.slice(3).toUpperCase();if(/^Digit[0-9]$/i.test(e))return e.slice(5);if(/^Numpad[0-9]$/i.test(e))return e.slice(6);if(Object.hasOwn(Go,e))return Go[e];let t={NumpadAdd:`+`,NumpadSubtract:`-`,NumpadMultiply:`*`,NumpadDivide:`/`,NumpadDecimal:`.`,NumpadEnter:`Enter`,Space:`Space`};return Object.hasOwn(t,e)?t[e]:void 0}function es(e){return e.altGraph?e.key===`Dead`||ts(e.key)&&!/^[A-Za-z0-9]$/.test(e.key):!1}function ts(e){return e!==``&&Array.from(e).length===1}function ns(e){let t=e.toLowerCase();return Object.hasOwn(Wo,t)?Wo[t]:void 0}function rs(e){return/^[A-Za-z][A-Za-z0-9]*$/.test(e)}function is(e){return e.startsWith(`[`)&&e.endsWith(`]`)&&rs(e.slice(1,-1))?e.slice(1,-1):void 0}function as(e){if(!e.endsWith(`+`))return e.split(`+`);let t=e.slice(0,-1).split(`+`);return t.at(-1)===``&&t.pop(),t.push(`+`),t}function os(e){return/^[A-Za-z]$/.test(e)}function ss(e){return/^\p{Script_Extensions=Latin}$/u.test(e)}var cs;function ls(e,t){return e===t?!0:/^\p{Letter}$/u.test(e)&&/^\p{Letter}$/u.test(t)?(cs??=new Intl.Collator(void 0,{sensitivity:`accent`}),cs.compare(e,t)===0):!1}function us(e){if(/^\[.*\]$/s.test(e.trim()))throw Error(`Logical key must not contain a bracketed physical code. Use the code field instead.`)}function ds(e,t,n,r,i){let a={Control:t,Alt:r,Shift:n,Meta:i};return{...e,ctrl:t,shift:n,alt:r,meta:i,modifiers:Uo.filter(e=>a[e])}}function fs(e){return Array.isArray(e)}function ps(e){return fs(e)&&e.length===1?e[0]:e}function ms(e,t){let n=as(e),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=qo(a);else{let e=ns(a);if(e){let n=Zo(e,t);r.add(n)}else n.length===1&&(i=qo(a))}}!i&&n.length>0&&(i=qo(n[n.length-1].trim()));let a=is(i);return ds(a===void 0?{key:i}:{code:a},r.has(`Control`),r.has(`Shift`),r.has(`Alt`),r.has(`Meta`))}function hs(e,t){e.code===void 0&&us(e.key);let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;return e.mod&&(Zo(`Mod`,t)===`Control`?n=!0:a=!0),ds(e.code===void 0?{key:qo(e.key)}:{code:e.code},n,r,i,a)}function gs(e,t){return typeof e==`string`?ms(e,t):hs(e,t)}function _s(e,t){e.code===void 0&&us(e.key);let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of Uo)e.modifiers.includes(t)&&r.push(t);return r.push(e.code===void 0?qo(e.key):`[${e.code}]`),r.join(`+`)}function vs(e,t=Xo()){return Array.isArray(e)?e.map(e=>gs(e,t)):gs(e,t)}function ys(e,t=Xo()){if(Array.isArray(e)){let n=e.map(e=>_s(gs(e,t),t));return n.length===1?n[0]:n}return _s(gs(e,t),t)}function bs(e){return ns(e)!==void 0}function xs(e){return Array.isArray(e)?e.map(e=>Ss(e)):Ss(e)}function Ss(e){e.code===void 0&&us(e.key);let t=[];for(let n of Uo)e.modifiers.includes(n)&&t.push(n);return t.push(e.code===void 0?e.key:`[${e.code}]`),t.join(`+`)}function Cs(e,t,n=Xo()){let r=typeof t==`string`?vs(t,n):t,i=Qo(e,n),a={matched:!1,score:0};if(i.isComposing||i.altGraph&&(r.ctrl||r.alt)||i.altGraph&&!es(i))return a;if(r.code!==void 0)return i.altGraph||!Ts(i,r,!1)?a:i.code===r.code?l(`code`,3):a;let o=ls(i.key,r.key),s=o&&ts(i.key)&&!/^\p{Letter}$/u.test(i.key)&&!r.shift;if(o&&Ts(i,r,s))return l(`key`,s?2:3);if(!ws(i)||i.altGraph||!Ts(i,r,!1))return a;let c=$o(i.code);return c!==void 0&&ls(c,r.key)?l(`fallback`,1):a;function l(e,t){return{matched:!0,score:t,source:e,identity:{key:i.key,code:i.code}}}}function ws({key:e,code:t,ctrl:n,meta:r,shift:i,alt:a}){return e!==`Dead`&&!ts(e)?!1:t.startsWith(`Digit`)?!0:os(e)?!1:/^[!-~]$/.test(e)?i:!ss(e)||a?!0:(n||r)&&!t.startsWith(`Key`)}function Ts(e,t,n){let r=!e.altGraph&&e.ctrl,i=!e.altGraph&&e.alt;return r!==t.ctrl||i!==t.alt||e.meta!==t.meta?!1:e.shift===t.shift||n&&e.shift}function Es(e,t){return e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift&&e.meta===t.meta&&(e.code!==void 0||t.code!==void 0?e.code===t.code:ls(e.key,t.key))}var Ds=`global`,Os={capture:!1,preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:`auto`,conflictBehavior:`warn`,scope:Ds};function ks(...e){let t={};for(let n of e)if(n)for(let e of Object.keys(n)){let r=n[e];r!==void 0&&(t[e]=r)}return t}function As(e){return!!(e.code||e.key)}function js(e){return!(e.ctrl||e.meta||e.key===`Escape`||e.code===`Escape`)}function Ms(e,t,n,r){if(n!==`allow`&&n!==`warn`){if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}function Ns(e,t){let n=e,r=t,i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>e===`meta`&&n[e]&&r[e]?Ns(n[e],r[e]):Object.is(n[e],r[e]))}function Ps(e,t,n=Xo()){let r=fs(e)?e:[e],i=fs(t)?t:[t];return r.length===i.length&&r.every((e,t)=>Es(vs(e,n),vs(i[t],n)))}var Fs=1e3;function Is(e){return e?.nodeType===1}function Ls(e){return`document`in e||e.nodeType===9}function Rs(e){return`document`in e?e.document:e.ownerDocument??e}function zs(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Bs(e){return e.assignedSlot??e.parentNode??(e.host||null)}function Vs(e){if(Ls(e))return!0;for(let t=zs(e.ownerDocument);t;t=Bs(t))if(t===e)return!0;return!1}var Hs=[`ArrowUp`,`ArrowDown`],Us=[`ArrowLeft`,`ArrowRight`],Ws=[`Enter`],Gs=[`Space`],Ks=[`Enter`,`Space`],qs=`typeahead`,Js=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`Enter`,`Space`,qs],Ys=[`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,`Space`,qs],Xs=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,`Space`],Zs=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Space`],Qs=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`],$s=[`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`],ec=[`ArrowLeft`,`ArrowRight`,`Home`,`End`],tc={button:Ks,submit:Ks,reset:Ks,image:Ks,color:Ks,file:Ks,checkbox:Gs,radio:Zs,range:Qs};function nc(e){return e.getAttribute(`role`)?.trim().split(/\s+/)[0]}function rc(e){if(!Is(e))return!1;switch(e.localName){case`input`:{let t=e;return!tc[t.type]&&!t.readOnly}case`textarea`:return!e.readOnly;case`select`:return!0}let t=nc(e);return t===`textbox`||t===`searchbox`||e.isContentEditable}function ic(e){return e.localName.includes(`-`)?e.constructor.formAssociated===!0?!e.hasAttribute(`role`):!e.hasAttribute(`tabindex`):!1}function ac(e){let t=e.getAttribute(`aria-orientation`);switch(nc(e)){case`button`:case`tab`:case`option`:case`treeitem`:case`menuitem`:case`menuitemcheckbox`:case`menuitemradio`:return Ks;case`link`:return Ws;case`checkbox`:case`switch`:case`radio`:return Gs;case`menu`:case`menubar`:case`tree`:return Js;case`listbox`:return[...t===`horizontal`?Us:Hs,`Home`,`End`,`Enter`,`Space`,qs];case`combobox`:return Ys;case`tablist`:return[...t===`vertical`?Hs:Us,`Home`,`End`,`Enter`,`Space`];case`toolbar`:return[...t===`vertical`?Hs:Us,`Home`,`End`];case`grid`:case`treegrid`:return Xs;case`radiogroup`:return Zs;case`slider`:return Qs;case`spinbutton`:return $s}switch(e.localName){case`button`:case`summary`:return Ks;case`input`:return tc[e.type]??ec;case`textarea`:return Qs;case`a`:case`area`:return e.hasAttribute(`href`)?Ws:[]}return[]}function oc(e,t,n){if(t.ctrlKey||t.metaKey||t.altKey)return!1;let r=ac(e);return n===`Enter`||n===`Space`?!t.shiftKey&&r.includes(n):r.includes(n)||r.includes(qs)&&/^.$/u.test(t.key)}function sc(e,t,n){let r=zs(t),i=[];for(let e=r;e;e=Bs(e))Is(e)&&i.push(e);let a=e.composedPath()[0];Is(a)&&!i.includes(a)&&(i=e.composedPath().filter(Is));let o=i.findIndex(e=>n(e)||e===r&&ic(e));return{elements:i,index:o}}function cc({elements:e,index:t},n){return t>=0&&(Ls(n)||t<e.indexOf(n))}var lc=new WeakMap;function uc(e,t){if(e.type!==`keydown`||e.key!==`Escape`)return!1;let n=lc.get(e);if(!n){let r=[];for(let e of[`dialog:modal`,`:popover-open`])try{r.push(...Rs(t).querySelectorAll(e))}catch{}n=r.filter(e=>e.popover!==`manual`),lc.set(e,n)}return n.some(e=>{for(let n=Ls(t)?null:t;n;n=Bs(n))if(n===e)return!1;return!0})}var dc=new WeakMap;function fc(e,t){let n=dc.get(e);if(!n){let r=qo(e.key);n=sc(e,Rs(t),t=>rc(t)||oc(t,e,r)),dc.set(e,n)}return cc(n,t)}var pc=new Set;function mc(e){for(let t of e)pc.add(t);for(let e of pc)pc.delete(e),e()}function hc(e){let t=e,n=new Set;return{get state(){return t},get:()=>t,setState(e){let r=e(t);Object.is(t,r)||(t=r,mc(n))},subscribe(e){let r=()=>{typeof e==`function`?e(t):e.next?.(t)};return n.add(r),{unsubscribe(){n.delete(r),pc.delete(r)}}}}}var gc=class{dispatch;#e=new Map;#t=new WeakMap;constructor(e){this.dispatch=e}add(e,t,n,r=!1){if(typeof document>`u`)return;let i=this.#e.get(e)??new Map,a=i.get(t);if(a&&r)for(let n of[`keydown`,`keyup`])e.removeEventListener(n,a[n],t),e.addEventListener(n,a[n],t);if(!a){let n=new Set,r=r=>i=>{let a=i,o=this.#t.get(a),s=!o||o.groups.has(n);(!o||s)&&(o={ids:new Set,groups:new Set},this.#t.set(a,o)),o.groups.add(n);let c=new Set;for(let e of n)o.ids.has(e)||(o.ids.add(e),c.add(e));this.dispatch(a,e,r,t,c,s)};a={ids:n,keydown:r(`keydown`),keyup:r(`keyup`)},e.addEventListener(`keydown`,a.keydown,t),e.addEventListener(`keyup`,a.keyup,t),i.set(t,a),this.#e.set(e,i)}a.ids.add(n)}remove(e,t,n){let r=this.#e.get(e),i=r?.get(t);i&&(i.ids.delete(n),i.ids.size===0&&(e.removeEventListener(`keydown`,i.keydown,t),e.removeEventListener(`keyup`,i.keyup,t),r.delete(t),r.size===0&&this.#e.delete(e)))}destroy(){for(let[e,t]of this.#e)for(let[n,r]of t)e.removeEventListener(`keydown`,r.keydown,n),e.removeEventListener(`keyup`,r.keyup,n);this.#e.clear(),this.#t=new WeakMap}},_c={current:null},vc=new Set,yc=new WeakSet,bc=new Map,xc=e=>e.code||`key:${e.key}`;function Sc(e){return vc.size>0||yc.has(e)||bc.has(xc(e))}function Cc(e,t){return e.enabled===!1?`disabled`:t?.isScopeActive(e.scope)===!1?`suspended`:`active`}var wc=0;function Tc(e,t){return typeof e==`string`?e:xs(t)}function Ec(){return`hotkey_${++wc}`}function Dc(e){let t=e;return{id:Ec(),unregister:()=>{},get callback(){return t},set callback(e){t=e},setOptions:()=>{},get isActive(){return!1}}}function Oc(e){return{...Os,...e===`sequence`?{timeout:Fs}:{requireReset:!1}}}function kc(e,t){if(e===`chord`){let{timeout:e,...n}=t;return n}let{requireReset:n,...r}=t;return r}function Ac({target:e,options:t}){if(!t.afterDelegatedHandlers||t.capture||Ls(e))return e;let n=e.getRootNode();for(;`host`in n&&n.mode===`open`;)n=n.host.getRootNode();return n}function jc(e){return!!e.afterDelegatedHandlers&&!e.capture}function Mc(e){return e.kind===`chord`?[e.parsedChord]:e.parsedSequence}function Nc(e){let{ignoreInputs:t=`auto`}=e.options;return t===`auto`?js(Mc(e)[0]):t}function Pc(e,t){return e.length===t.length&&e.every((e,n)=>Es(e,t[n]))}function Fc(e){return fs(e)?e.join(` `):e}var Ic=class e{registrations=hc(new Map);appHotkeys=hc(null);scopes=hc({active:[],exclusive:null,allowed:[],suspended:[]});#e;#t=new Set;#n=0;#r=[];#i=null;#a=new gc((...e)=>this.#S(...e));#o=new Map;#s=new WeakMap;#c=new Map;#l=new WeakSet;#u=new Set;#d=new Map;constructor(){this.#e=Xo()}static getInstance(){return _c.current??=new e}static resetInstance(){_c.current?.destroy(),_c.current=null}activateScope(e,t={}){if(e===`global`)return()=>{};let{exclusive:n}=t,r=n?n===!0?[]:n.allow:null,i={scope:e,parent:t.parent??`global`,allow:r,order:++this.#n};return this.#t.add(i),this.#p(),()=>{this.#t.delete(i)&&this.#p()}}isScopeActive(e=Ds){return this.#i?this.#i.has(e):e===`global`||this.#r.includes(e)}#f(e=Ds){return this.#r.indexOf(e)+1}#p(){let e=new Map,t=new Map;for(let n of this.#t)n.parent!==n.scope&&e.set(n.scope,n.parent),t.set(n.scope,Math.max(t.get(n.scope)??0,n.order));let n=t=>{let n=0,r=new Set;for(let i=e.get(t);i!==void 0&&!r.has(i);i=e.get(i))r.add(i),n++;return n},r=new Map;for(let[n,i]of t){let a=new Set;for(let o=n;o!==void 0&&!a.has(o);o=e.get(o)){a.add(o);let e=t.get(o);e!==void 0&&r.set(o,Math.min(r.get(o)??e,i))}}let i=(e,i)=>r.get(e)-r.get(i)||n(e)-n(i)||t.get(e)-t.get(i);this.#r=[...t.keys()].sort(i);let a=[...this.#t].filter(e=>e.allow).sort((e,t)=>i(e.scope,t.scope)||e.order-t.order).pop(),o=[Ds,...this.#r],s=[];if(this.#i=null,a?.allow){let{allow:t}=a,n=t=>{let n=new Set;for(let r=t;r!==void 0&&!n.has(r);r=e.get(r)){if(r===a.scope)return!0;n.add(r)}return!1};s=o.filter(e=>!n(e)&&t.includes(e)),this.#i=new Set([...o.filter(n),...s])}let c=this.#i;this.scopes.setState(()=>({active:this.#r,exclusive:a?.scope??null,allowed:s,suspended:c?o.filter(e=>!c.has(e)):[]})),this.#g()}#m(e){return Cc(e.options,this)===`active`}#h(e,t){let n=e.composedPath();for(let r of this.registrations.state.values())if(!(!this.#m(r)||r.options.eventType!==t||this.#k(r,e)||!n.includes(r.target)||Nc(r)&&fc(e,r.target))&&(r.kind===`chord`?[r.parsedChord]:[r.parsedSequence[r.currentIndex],r.parsedSequence[0]]).some(t=>Cs(e,t,r.options.platform).matched))return!0;return!1}#g(){this.registrations.setState(e=>new Map(e))}register(e,t,n={}){let r=ps(e);if(r==null||fs(r)&&r.length===0||typeof document>`u`&&!n.target)return Dc(t);let i=Ec(),a=n.platform??this.#e,o=n.target??document,s=fs(r),c=s?`sequence`:`chord`,l={id:i,callback:t,options:{...Oc(c),...kc(c,ks(n)),platform:a},target:o,triggerCount:0,hasFired:!1},u;if(s){let e=vs(r,a);u={...l,kind:`sequence`,hotkey:r.map((t,n)=>Tc(t,e[n])),parsedSequence:e,currentIndex:0,lastKeyTime:0}}else{let e=vs(r,a);u={...l,kind:`chord`,hotkey:Tc(r,e),parsedChord:e}}if(!(u.kind===`sequence`?u.parsedSequence:[u.parsedChord]).every(As))return Dc(t);let d=this.#N(u);d&&Ms(d.id,Fc(u.hotkey),n.conflictBehavior??`warn`,e=>this.#_(e));let f=Ac(u);this.#a.add(f,!!u.options.capture,i,jc(u.options)),this.#o.set(i,f),this.registrations.setState(e=>new Map(e).set(i,u));let p=this;return{get id(){return i},unregister:()=>{p.#_(i)},get callback(){return p.registrations.state.get(i)?.callback??t},set callback(e){let t=p.registrations.state.get(i);t&&(t.callback=e)},setOptions:e=>{p.registrations.setState(t=>{let n=t.get(i);if(!n)return t;let r={...Oc(n.kind),platform:n.options.platform},a={...n.options},o=Object.entries(kc(n.kind,e));for(let[e,t]of o)t===void 0?e in r?a[e]=r[e]:delete a[e]:a[e]=t;if(Ns(n.options,a))return t;let s=!!n.options.capture,c=p.#o.get(i)??n.target,l=Ac({target:n.target,options:a});return s!==!!a.capture||c!==l?(p.#a.remove(c,s,i),p.#a.add(l,!!a.capture,i,jc(a)),p.#o.set(i,l)):jc(a)&&!jc(n.options)&&p.#a.add(l,s,i,!0),new Map(t).set(i,{...n,options:a})})},get isActive(){return p.registrations.state.has(i)}}}#_(e){let t=this.registrations.state.get(e);t&&(this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n}),this.#a.remove(this.#o.get(e)??t.target,!!t.options.capture,e),this.#o.delete(e),this.#c.delete(e),this.#y(e))}#v(e,t){this.#y(e),this.#d.set(e,setTimeout(()=>{this.#d.delete(e);let t=this.registrations.state.get(e);if(t?.kind!==`sequence`||t.currentIndex===0)return;let n=t.options.timeout??1e3,r=t.lastKeyTime+n-Date.now();r>=0?this.#v(e,r+1):(t.currentIndex=0,t.lastKeyTime=0,this.#g())},t))}#y(e){let t=this.#d.get(e);t!==void 0&&(clearTimeout(t),this.#d.delete(e))}#b(e,t,n){let r=[];for(let i of e){let e=this.registrations.state.get(i);e?.kind===n&&!!e.options.capture===t&&r.push(e)}return r}#x(e,t){let n=this.registrations.state.get(e.id);return n&&!!n.options.capture===t?n:void 0}#S(e,t,n,r,i,a){if(a&&this.#s.set(e,this.#T(e,n)),r){this.#C(e,t,n,r,i);return}let o=new Map;for(let e of i){let t=this.registrations.state.get(e);if(!t)continue;let n=o.get(t.target)??new Set;o.set(t.target,n.add(e))}let s=o.size>1||!o.has(t)?e.composedPath():[],c=[...o.keys()].filter(e=>e===t||s.includes(e)).sort((e,n)=>e===t?1:n===t?-1:s.indexOf(e)-s.indexOf(n)),l=e.cancelBubble;for(let t of c){let i=new Set;for(let n of o.get(t)){let t=this.registrations.state.get(n)?.options.afterDelegatedHandlers;(!e.cancelBubble||!t&&l)&&i.add(n)}this.#C(e,t,n,r,i)}}#C(e,t,n,r,i){this.#w(e,t,n,r,this.#b(i,r,`chord`)),this.#D(e,t,n,r,this.#b(i,r,`sequence`))}#w(e,t,n,r,i){if(n===`keyup`)for(let t of i)t.hasFired&&this.#P(t,e)&&(t.hasFired=!1,t.activeMatch=void 0);if(n===`keydown`&&!e.repeat)for(let{id:e}of i)this.#c.get(e)&&this.#c.set(e,null);if(Sc(e)||this.#s.get(e))return;let a=new Map,o=0,s=!1,c=qo(e.key);for(let r of i){let i=this.#m(r),{eventType:l,preventDefault:u}=r.options,d=n===`keydown`&&l===`keyup`,f=this.#k(r,e),{parsedChord:p,id:m}=r,{platform:h}=r.options,g,_;if(n===`keyup`&&l===`keyup`&&this.#c.has(m)&&(g=Cs(e,p,h),(g.matched||p.modifiers.includes(c)&&!e.getModifierState(c))&&(_=this.#c.get(m),this.#c.delete(m))),!(!i&&u!==`always`||l!==n&&!d||Nc(r)&&fc(e,t))){if(g??=Cs(e,p,h),d)g.matched&&(f?this.#c.set(m,null):(u&&this.#O(e),i&&this.#c.set(m,g)));else{if(_!==void 0){if(!_||f)continue;g.matched||(g=_)}!f&&g.matched&&(i?(a.set(r.id,g),o=Math.max(o,g.score)):s=!0)}}}s&&a.size===0&&!this.#h(e,n)&&this.#O(e);let l=-1;for(let e of i)a.get(e.id)?.score===o&&(l=Math.max(l,this.#f(e.options.scope)));for(let t of i){let i=a.get(t.id);if(!i?.matched||i.score!==o||this.#f(t.options.scope)!==l)continue;let s=this.#x(t,r);s&&(this.#A(s,e),n===`keyup`?this.#j(s,e):s.options.requireReset&&s.hasFired&&e.repeat||(s.options.requireReset&&(s.hasFired=!0,s.activeMatch=i.identity),this.#j(s,e)))}}#T(e,t){let n=e.code||qo(e.key);if(t===`keyup`){let r=this.#u.delete(n);return this.#E(e,t)||r}if(e.repeat)return this.#u.has(n);let r=this.#E(e,t);return r?this.#u.add(n):this.#u.delete(n),r}#E(e,t){if(Sc(e)||Qo(e).isComposing||bs(qo(e.key)))return!1;let n=e.composedPath(),r=Date.now();for(let i of this.registrations.state.values()){if(i.kind!==`sequence`||i.currentIndex===0||!this.#m(i)||i.options.eventType!==t||this.#k(i,e)||r-i.lastKeyTime>(i.options.timeout??1e3))continue;let a=i.target;if(n.includes(Ls(a)?Rs(a):a)&&!(Nc(i)&&fc(e,a))&&Cs(e,i.parsedSequence[i.currentIndex],i.options.platform).matched)return!0}return!1}#D(e,t,n,r,i){if(i.length===0)return;if(Sc(e)){let e=!1;for(let t of i)t.currentIndex>0&&(t.currentIndex=0,this.#y(t.id),e=!0);e&&this.#g();return}if(e.type===`keydown`&&e.repeat||Qo(e).isComposing||bs(qo(e.key)))return;let a=Date.now(),o=!1,s=new Map,c=0;for(let r of i){if(!this.#m(r)||Nc(r)&&fc(e,t)||r.options.eventType!==n||this.#k(r,e))continue;let i=r.options.timeout??1e3;r.currentIndex>0&&a-r.lastKeyTime>i&&(r.currentIndex=0,o=!0);let l=r.parsedSequence[r.currentIndex];if(!l)continue;let u=Cs(e,l,r.options.platform),d=r.currentIndex+1;!u.matched&&r.currentIndex>0&&(u=Cs(e,r.parsedSequence[0],r.options.platform),d=1),s.set(r.id,{score:u.score,nextIndex:d}),c=Math.max(c,u.score)}let l=[];for(let t of i){let n=s.get(t.id);n&&(n.score>0&&n.score===c?(t.lastKeyTime=a,t.currentIndex=n.nextIndex,o=!0,t.currentIndex>=t.parsedSequence.length?(this.#A(t,e),t.currentIndex=0,l.push(t)):t.options.preventDefault&&this.#O(e)):t.currentIndex>0&&(t.currentIndex=0,o=!0))}for(let e of i)if(s.has(e.id)){if(e.currentIndex>0){let t=e.options.timeout??1e3;this.#v(e.id,t+1)}else this.#y(e.id)}o&&l.length===0&&this.#g();for(let t of l){let n=this.#x(t,r);n&&this.#j(n,e)}}#O(e){e.defaultPrevented||this.#l.add(e),e.preventDefault()}#k(e,t){return uc(t,e.target)||!!e.options.ignoreDefaultPrevented&&t.defaultPrevented&&!this.#l.has(t)}#A(e,t){e.options.preventDefault&&this.#O(t),e.options.stopPropagation&&t.stopPropagation()}#j(e,t,n=this.#M(e)){e.triggerCount++,e.kind===`sequence`&&(e.hasFired=!0),this.#g();let r=t.defaultPrevented;e.callback(t,n),!r&&t.defaultPrevented&&this.#l.add(t)}#M(e){return e.kind===`chord`?{kind:`chord`,hotkey:e.hotkey,parsedChord:e.parsedChord}:{kind:`sequence`,hotkey:e.hotkey,parsedSequence:e.parsedSequence}}#N(e){let t=Mc(e);for(let n of this.registrations.state.values())if(n.target===e.target&&n.options.scope===e.options.scope&&n.options.eventType===e.options.eventType&&Pc(Mc(n),t))return n;return null}#P(e,t){let n=e.parsedChord,r=qo(t.key);return e.activeMatch?.code&&t.code===e.activeMatch.code?!0:(n.code===void 0?ls(r,n.key):t.code===n.code)||n.modifiers.includes(r)}resetSequenceProgress(){for(let e of this.registrations.state.values())e.kind===`sequence`&&(e.currentIndex=0,e.lastKeyTime=0);for(let e of this.#d.values())clearTimeout(e);this.#d.clear(),this.#g()}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(Ps(n.hotkey,e,n.options.platform)&&(t===void 0||n.target===t))return!0;return!1}hasActiveRegistration(e){if(!e)return!1;let t=typeof e==`object`&&`~appHotkey`in e?e.id:void 0;for(let n of this.registrations.state.values())if(this.#m(n)&&Vs(n.target)&&(t===void 0?Ps(n.hotkey,e,n.options.platform):n.options.appHotkeyId===t))return!0;return!1}destroy(){for(let e of this.#d.values())clearTimeout(e);this.#d.clear(),this.#a.destroy(),this.#o.clear(),this.registrations.setState(()=>new Map),this.appHotkeys.setState(()=>null)}};function Lc(){return Ic.getInstance()}function Rc(e){return typeof e==`object`&&!!e&&e[`~appHotkey`]===!0}function zc(e,t){return t?.get(e.id)??e}function Bc(e){return{...e.options,...e.scope!==void 0&&{scope:e.scope},meta:e.meta,appHotkeyId:e.id}}function Vc(e={}){let t=new Map;return{update(n,r={}){let i=[];n.forEach((t,n)=>{let a=ks(r,t.options),o={...Os,...a,...e,target:`target`in a?a.target??null:typeof document>`u`?null:document,platform:a.platform??Xo()};if(!o.target||!t.hotkey||fs(t.hotkey)&&t.hotkey.length===0)return;let s=vs(t.hotkey,o.platform);if(!(Array.isArray(s)?s:[s]).every(As))return;let c=ys(s,o.platform);fs(c)?delete o.requireReset:delete o.timeout,i.push({key:`${n}:${fs(c)?c.join(` `):c}`,callback:t.callback,options:o,register:()=>Lc().register(c,t.callback,o)})});let a=new Set(i.map(e=>e.key));for(let[e,n]of t)a.has(e)||(n.handle.unregister(),t.delete(e));for(let e of i){let n=t.get(e.key),{target:r,platform:i}=e.options;if(n?.handle.isActive&&n.target===r&&n.platform===i){n.handle.callback=e.callback;let t=Object.fromEntries(Object.keys(n.options).map(e=>[e,void 0]));n.handle.setOptions({...t,...e.options}),n.options=e.options}else n?.handle.unregister(),t.set(e.key,{handle:e.register(),target:r,platform:i,options:e.options})}},destroy(){for(let{handle:e}of t.values())e.unregister();t.clear()}}}function Hc(e,t={}){return e.map(e=>{let n=e.hotkey,r={};if(Rc(n)){let e=zc(n,t.appHotkeysStore);r=Bc(e),n=e.hotkey??[]}let{target:i,...a}=ks(t.defaults,r,t.commonOptions,e.options),o=i===void 0?void 0:t.resolveTarget?t.resolveTarget(i):i;return{hotkey:n,callback:e.callback,options:o===void 0?a:{...a,target:o}}})}var Uc=(0,W.createContext)(null);function Wc(){return(0,W.useContext)(Uc)}function Gc(e,t){let n=(0,W.useCallback)(t=>e.subscribe(t).unsubscribe,[e]),r=(0,W.useRef)(null),i=()=>{let n=e.get(),i=r.current;return i&&i.selector===t&&Object.is(i.state,n)?i.selected:(r.current={state:n,selector:t,selected:t(n)},r.current.selected)};return(0,W.useSyncExternalStore)(n,i,i)}var Kc=hc(null);function qc(){let e=Wc()?.appHotkeysStore??null;return Gc(e?.store??Kc,e=>e),e}function Jc(e){return typeof e==`object`&&!!e&&`current`in e}function Yc(e){return Jc(e)?e.current:e}function Xc(e,t={}){let n=Wc()?.defaultOptions.hotkey,r=qc(),i=(0,W.useRef)({hotkeys:e,commonOptions:t,defaults:n,appHotkeysStore:r});i.current={hotkeys:e,commonOptions:t,defaults:n,appHotkeysStore:r};let a=(0,W.useRef)(null);(0,W.useEffect)(()=>{a.current??=Vc({afterDelegatedHandlers:!0});let{hotkeys:e,...t}=i.current;a.current.update(Hc(e,{...t,resolveTarget:Yc}))}),(0,W.useEffect)(()=>()=>{a.current?.destroy(),a.current=null},[])}function Zc(e,t,n){Xc([{hotkey:e,callback:t,options:n}])}var Qc={sidebarOpen:!0,sidebarWidth:264,explorerWidth:248},$c=`dbp-layout`,el=z({method:`GET`}).handler(u(`767e3c79a7a604bea062fbfee2e3cdeed9ee8c108dce8db65bf989a96985f89a`));function tl(e){document.cookie=`${$c}=${encodeURIComponent(JSON.stringify(e))}; path=/; max-age=31536000; samesite=lax`}var nl=(0,W.createContext)(null);function rl(e){let t=(0,ko.c)(8),{initial:n,children:r}=e,[i,a]=(0,W.useState)(n),o;t[0]===i?o=t[1]:(o=(e,t)=>{let n=t===void 0||t,r={...i,...e};a(r),n&&tl(r)},t[0]=i,t[1]=o);let s=o,c;t[2]!==i||t[3]!==s?(c={layout:i,update:s},t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;return t[5]!==r||t[6]!==c?(l=(0,G.jsx)(nl,{value:c,children:r}),t[5]=r,t[6]=c,t[7]=l):l=t[7],l}function il(){let e=(0,W.use)(nl);if(!e)throw Error(`useLayout needs a LayoutProvider`);return e}function al(){let e=(0,ko.c)(28),t=F(),n;e[0]===t?n=e[1]:(n=()=>Promise.all([t.invalidateQueries({queryKey:[`folders`]}),t.invalidateQueries({queryKey:[`connections`]})]),e[0]=t,e[1]=n);let r=n,a;e[2]===r?a=e[3]:(a={mutationFn:w,onSuccess:r},e[2]=r,e[3]=a);let o=Ti(a),s;e[4]===r?s=e[5]:(s={mutationFn:je,onSuccess:r},e[4]=r,e[5]=s);let c=Ti(s),l;e[6]===r?l=e[7]:(l={mutationFn:p,onSuccess:r},e[6]=r,e[7]=l);let u=Ti(l),d;e[8]===r?d=e[9]:(d={mutationFn:S,onSuccess:r},e[8]=r,e[9]=d);let f=Ti(d),m;e[10]!==t||e[11]!==r?(m={mutationFn:b,onSuccess:async(e,n)=>{await r(),await t.invalidateQueries({queryKey:[`databases`,n.data.id]}),await t.invalidateQueries({queryKey:[`tables`,n.data.id]}),await t.invalidateQueries({queryKey:[`sqlSchema`,n.data.id]}),await t.invalidateQueries({queryKey:[`schema`,n.data.id]}),await t.invalidateQueries({queryKey:[`rows`,n.data.id]})}},e[10]=t,e[11]=r,e[12]=m):m=e[12];let g=Ti(m),_;e[13]===r?_=e[14]:(_={mutationFn:j,onSuccess:r},e[13]=r,e[14]=_);let v=Ti(_),y;e[15]!==t||e[16]!==r?(y={mutationFn:O,onSuccess:async(e,n)=>{t.removeQueries({queryKey:[`databases`,n.data.id]}),await Promise.all([r(),t.invalidateQueries({queryKey:i().queryKey})])}},e[15]=t,e[16]=r,e[17]=y):y=e[17];let x=Ti(y),C;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(C={mutationFn:h},e[18]=C):C=e[18];let T=Ti(C),E;return e[19]!==g||e[20]!==v||e[21]!==x||e[22]!==T||e[23]!==o||e[24]!==c||e[25]!==u||e[26]!==f?(E={createFolder:o,updateFolder:c,deleteFolder:u,createConnection:f,updateConnection:g,moveConnection:v,deleteConnection:x,testConnection:T},e[19]=g,e[20]=v,e[21]=x,e[22]=T,e[23]=o,e[24]=c,e[25]=u,e[26]=f,e[27]=E):E=e[27],E}function ol(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 sl(e,t=`|`){return e.map(e=>Nl(e)).join(t)}function cl(e,t){return typeof t==`bigint`?t.toString():t}var ll=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ul(e){return new ll(e)}function dl(e){return e==null}function fl(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pl(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ml(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hl(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function gl(e){return hl(e._zod.def)??e._zod.def.shape}function _l(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ml(this,t,e),e},enumerable:!0,configurable:!0})}function vl(e,t,n){t in e?ml(e,t,n):e[t]=n}function yl(e,t,n,r){let i=gl(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?_l(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):vl(e,a,r?r(n.value,a):n.value))}}function bl(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?_l(e,n,()=>t[n]):vl(e,n,r.value))}}function xl(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Sl(e){return JSON.stringify(e)}function Cl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var wl=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Tl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var El=ul(()=>{if(Cu.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Dl(e){if(Tl(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Tl(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ol(e){return Dl(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var kl=new Set([`string`,`number`,`symbol`]);function Al(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function jl(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Ml(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 Nl(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Pl(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Fl={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Il={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ll(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`);let i={};return yl(i,e,Rl(e,t)),jl(e,xl(n,{shape:i,checks:[]}))}function Rl(e,t){let n=gl(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function zl(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`);let i=new Set(Rl(e,t)),a={};return yl(a,e,Reflect.ownKeys(gl(e)).filter(e=>!i.has(e))),jl(e,xl(n,{shape:a,checks:[]}))}function Bl(e,t){if(!Dl(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=gl(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return jl(e,xl(e._zod.def,{shape:Vl(e,t)}))}function Vl(e,t){let n={};return yl(n,e,Reflect.ownKeys(gl(e))),bl(n,t),n}function Hl(e,t){if(!Dl(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return jl(e,xl(e._zod.def,{shape:Vl(e,t)}))}function Ul(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return yl(n,e,Reflect.ownKeys(gl(e))),yl(n,t,Reflect.ownKeys(gl(t))),jl(e,xl(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Wl(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Rl(t,n)):void 0,o={};return yl(o,t,Reflect.ownKeys(gl(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),jl(t,xl(t._zod.def,{shape:o,checks:[]}))}function Gl(e,t,n){let r=n?new Set(Rl(t,n)):void 0,i={};return yl(i,t,Reflect.ownKeys(gl(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),jl(t,xl(t._zod.def,{shape:i}))}function Kl(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 ql(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 Jl(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Yl(e){return typeof e==`string`?e:e?.message}function Xl(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Zl(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ql(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Yl(e.inst?._zod.def?.error?.(e))??Yl(a?.(e))??Yl(t?.error?.(e))??Yl(n.customError?.(e))??Yl(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var $l=/[\uD800-\uDBFF]/;function eu(e){let t=e.length;if(!$l.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function tu(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function nu(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function ru(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function iu(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):cu(e,n,r.value)}}function au(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ou(e,t,n){return au(e,t,n,!1)}function su(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return au(this,n,r(this))},set(e){au(this,n,e)}})}return t}function cu(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:au(this,t,n.bind(this))},set(e){au(this,t,e)}})}function lu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var uu,du=!1,fu={configurable:!0,get(){du=!0}};function pu(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&uu!==e._zod?uu=void 0:(uu=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,fu);let e=du;du=!1;try{let r=n(this);return du?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),du||=e,r}catch(n){throw delete this[t],du||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function mu(e,t,n,r){let i=lu(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var hu=`~constantCatch`;function gu(e){let t=()=>e;return t[hu]=!0,t}var _u,vu={value:void 0,enumerable:!1},yu=`captureStackTrace`in Error?Error:null;function bu(e){let t=yu;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return yu=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function K(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){vu.value=new a(r);try{Object.defineProperty(n,"_zod",vu)}finally{vu.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),iu(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?bu(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var xu=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Su=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(_u=globalThis).__zod_globalConfig??(_u.__zod_globalConfig={});var Cu=globalThis.__zod_globalConfig;function wu(e){return e&&Object.assign(Cu,e),Cu}function Tu(){let e=this._zod;return e.message??=JSON.stringify(e.def,cl,2),e.message}function Eu(e){this._zod.message=e}var Du={get:Tu,set:Eu,enumerable:!0,configurable:!0},Ou={value:void 0,enumerable:!1},ku=new WeakSet([Object.prototype,Error.prototype]),Au=K(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Ou.value=t,Object.defineProperty(e,"issues",Ou),Ou.value=void 0,Object.defineProperty(e,"message",Du);let n=Object.getPrototypeOf(e);ku.has(n)||(ku.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function ju(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Mu(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ju(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Nu(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],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Pu(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Fu=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new xu;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ql(e,o,wu())));throw wl(n,a?.callee??t),n}return s.value};return t},Iu=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ql(e,o,wu())));throw wl(n,a?.callee??t),n}return s.value};return t},Lu=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 xu;return a.issues.length?Ru(e,a.issues,i):{success:!0,data:a.value}};function Ru(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ql(e,n,wu()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var zu=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?Ru(e,a.issues,i):{success:!0,data:a.value}},Bu=Symbol.for(`zod.compile.invalid`),Vu=Symbol.for(`zod.compile.fallback`),Hu=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Bu)return!0;if(r.definite===!0&&n===void 0)return!1}return Uu(e,t,n)});function Uu(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Vu]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new xu;return a.issues.length===0}var Wu=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Gu=e=>{let t=Fu(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Pu(n,a))};return n},Ku=e=>{let t=Fu(e),n=(e,r,i,a)=>t(e,r,i,Pu(n,a));return n},qu=e=>{let t=Iu(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Pu(n,a))};return n},Ju=e=>{let t=Iu(e),n=async(e,r,i,a)=>await t(e,r,i,Pu(n,a));return n},Yu=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Lu(e)(t,n,i)},Xu=e=>(t,n,r)=>Lu(e)(t,n,r),Zu=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return zu(e)(t,n,i)},Qu=e=>async(t,n,r)=>zu(e)(t,n,r),$u=/^[cC][0-9a-z]{6,}$/,ed=/^[0-9a-z]+$/,td=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,nd=/^[0-9a-vA-V]{20}$/,rd=/^[A-Za-z0-9]{27}$/,id=/^[a-zA-Z0-9_-]{21}$/;function ad(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var od=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sd=/^([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})$/,cd=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)$/,ld=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ud=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function dd(){return new RegExp(ud,`u`)}var fd=/^(?:(?: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])$/,pd=/^(([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}|:))$/,md=/^((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])$/,hd=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_d=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,vd=/^https?$/,yd=/^\+[1-9]\d{6,14}$/,bd=`(?:(?:\\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])))`;function xd(e){return RegExp(`^${e}$`)}var Sd=xd(bd);function Cd(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wd(e){return RegExp(`^${Cd(e)}$`)}function Td(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Cd({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Cd({precision:e.precision})}`:n;return RegExp(`^${bd}T(?:${r})$`)}var Ed=/^[\s\S]{0,}$/,Dd=/^-?\d+(?:\.\d+)?$/,Od=/^(?:true|false)$/i,kd=/^[^A-Z]*$/,Ad=/^[^a-z]*$/,jd=K(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Md=e=>{let t=e.value;return!dl(t)&&t.length!==void 0},Nd={number:`number`,bigint:`bigint`,object:`date`},Pd=K(`$ZodCheckLessThan`,(e,t)=>{jd.init(e,t);let n=Nd[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Nd[typeof r.value]??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})}}),Fd=K(`$ZodCheckGreaterThan`,(e,t)=>{jd.init(e,t);let n=Nd[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Nd[typeof r.value]??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})}}),Id=K(`$ZodCheckMultipleOf`,(e,t)=>{jd.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):pl(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})}}),Ld=K(`$ZodCheckNumberFormat`,(e,t)=>{jd.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Fl[t.format];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})}}),Rd=K(`$ZodCheckMaxLength`,(e,t)=>{var n;jd.init(e,t),(n=e._zod.def).when??(n.when=Md),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?eu(r):i)<=t.maximum)return;let a=tu(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),zd=K(`$ZodCheckMinLength`,(e,t)=>{var n;jd.init(e,t),(n=e._zod.def).when??(n.when=Md),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?eu(r):i)>=t.minimum)return;let a=tu(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bd=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;jd.init(e,t),(n=e._zod.def).when??(n.when=Md),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?eu(r):i;if(a===t.length)return;let o=tu(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Vd=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;jd.init(e,t),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=()=>{})}),Hd=K(`$ZodCheckRegex`,(e,t)=>{Vd.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})}}),Ud=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kd,Vd.init(e,t)}),Wd=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ad,Vd.init(e,t)}),Gd=K(`$ZodCheckIncludes`,(e,t)=>{jd.init(e,t);let n=Al(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Kd=K(`$ZodCheckStartsWith`,(e,t)=>{jd.init(e,t);let n=RegExp(`^${Al(t.prefix)}.*`);t.pattern??=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})}}),qd=K(`$ZodCheckEndsWith`,(e,t)=>{jd.init(e,t);let n=RegExp(`.*${Al(t.suffix)}$`);t.pattern??=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})}}),Jd=K(`$ZodCheckOverwrite`,(e,t)=>{jd.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Yd=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
12
|
+
`).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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
13
|
+
`)}\n};`)(...Object.values(this.closed))}},Xd={major:4,minor:6,patch:7},Zd=K(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Xd;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Kl(t),a;for(let o of n){if(o._zod.def.when){if(ql(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new xu;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Zl(t.issues,n,e),i||=Kl(t,n))});else{if(t.issues.length===n)continue;Zl(t.issues,n,e),i||=Kl(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Kl(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new xu;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new xu;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ou(this,`~standard`,ef(this))},set"~standard"(e){au(this,`~standard`,e)}}),Qd=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ql(e,t,wu()))}:{value:e.value};async function $d(e,t){let n={async:!0};return Qd(await e._zod.run({value:t,issues:[]},n),n)}function ef(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Qd(r,n)}catch{}return $d(e,t)},vendor:`zod`,version:1}}var tf=K(`$ZodString`,(e,t)=>{Zd.init(e,t),e._zod.pattern=t.pattern??Ed,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}}),nf=K(`$ZodStringFormat`,(e,t)=>{Vd.init(e,t),tf.init(e,t)}),rf=K(`$ZodGUID`,(e,t)=>{t.pattern??=sd,nf.init(e,t)}),af=K(`$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??=cd(e)}else t.pattern??=cd();nf.init(e,t)}),of=K(`$ZodEmail`,(e,t)=>{t.pattern??=ld,nf.init(e,t)});function sf(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function cf(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?sf(e)||2:lf(e,t)}function lf(e,t){if(!t.normalize&&t.protocol?.source===vd.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var uf=/[\t\n\r]/g;function df(e){return e.replace(uf,``)}function ff(e,t){return t.lastIndex=0,t.test(e.hostname)}function pf(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var mf=K(`$ZodURL`,(e,t)=>{nf.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=cf(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=df(r);return}t.hostname&&!ff(i,t.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&&!pf(i,t.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:df(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),hf=K(`$ZodEmoji`,(e,t)=>{t.pattern??=dd(),nf.init(e,t)}),gf=K(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?id:ad(t.length),nf.init(e,t)}),_f=K(`$ZodCUID`,(e,t)=>{t.pattern??=$u,nf.init(e,t)}),vf=K(`$ZodCUID2`,(e,t)=>{t.pattern??=ed,nf.init(e,t)}),yf=K(`$ZodULID`,(e,t)=>{t.pattern??=td,nf.init(e,t)}),bf=K(`$ZodXID`,(e,t)=>{t.pattern??=nd,nf.init(e,t)}),xf=K(`$ZodKSUID`,(e,t)=>{t.pattern??=rd,nf.init(e,t)}),Sf=K(`$ZodISODateTime`,(e,t)=>{t.pattern??=Td(t),nf.init(e,t)}),Cf=K(`$ZodISODate`,(e,t)=>{t.pattern??=Sd,nf.init(e,t)}),wf=K(`$ZodISOTime`,(e,t)=>{t.pattern??=wd(t),nf.init(e,t)}),Tf=K(`$ZodISODuration`,(e,t)=>{t.pattern??=od,nf.init(e,t)}),Ef=K(`$ZodIPv4`,(e,t)=>{t.pattern??=fd,nf.init(e,t)}),Df=/^[0-9a-fA-F:.]+$/;function Of(e){return Df.test(e)?sf(`http://[${e}]`):!1}var kf=K(`$ZodIPv6`,(e,t)=>{t.pattern??=pd,nf.init(e,t),e._zod.check=n=>{Of(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Af=K(`$ZodCIDRv4`,(e,t)=>{t.pattern??=md,nf.init(e,t)});function jf(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Of(n)}var Mf=K(`$ZodCIDRv6`,(e,t)=>{t.pattern??=hd,nf.init(e,t),e._zod.check=n=>{jf(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Nf(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Pf=/^[0-9a-zA-Z+/]*={0,2}$/,Ff=K(`$ZodBase64`,(e,t)=>{t.pattern??=Pf,nf.init(e,t),e._zod.check=n=>{Nf(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),If=/^[A-Za-z0-9_-]*$/;function Lf(e){if(!If.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Nf(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Rf=K(`$ZodBase64URL`,(e,t)=>{t.pattern??=If,nf.init(e,t),e._zod.check=n=>{Lf(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),zf=K(`$ZodE164`,(e,t)=>{t.pattern??=yd,nf.init(e,t)});function Bf(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 Vf=K(`$ZodJWT`,(e,t)=>{nf.init(e,t),e._zod.check=n=>{Bf(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Hf=K(`$ZodNumber`,(e,t)=>{Zd.init(e,t),e._zod.pattern=Dd,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Uf=K(`$ZodNumberFormat`,(e,t)=>{Ld.init(e,t),Hf.init(e,t)}),Wf=K(`$ZodBoolean`,(e,t)=>{Zd.init(e,t),e._zod.pattern=Od,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}}),Gf=K(`$ZodUnknown`,(e,t)=>{Zd.init(e,t),e._zod.parse=e=>e}),Kf=K(`$ZodNever`,(e,t)=>{Zd.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function qf(e,t){let n=Xl(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Xl(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Zl(n.issues,t,e),n}}return i(n,a)}}var Jf=e=>Array.isArray(e)?e.length:-1;function Yf(e,t,n){e.issues.length&&t.issues.push(...Jl(n,e.issues)),t.value[n]=e.value}var Xf=K(`$ZodArray`,(e,t)=>{Zd.init(e,t);let n=Cu.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Yf(t,r,e)));else if(Yf(c,r,e),s&&c.issues.length!==0&&Kl(c))break}return o.length?Promise.all(o).then(()=>r):r},qf(e,Jf)});function Zf(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Jl(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Qf=[];function $f(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Qf,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Pl(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ep(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Kl(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Zf(e,n,i,t,d,f))):Zf(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var tp=K(`$ZodObject`,(e,t)=>{Zd.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ul(()=>$f(t));pu(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ml(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Tl,o=t.catchall,s,c=Cu.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Kl(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Zf(n,t,e,r,a,o))):Zf(s,t,e,r,a,o)}return o?ep(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),np=K(`$ZodObjectJIT`,(e,t)=>{tp.init(e,t);let n=e._zod.parse,r=ul(()=>$f(t)),i=Cu.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Yd([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
14
|
+
let ${e}_ab = false;
|
|
15
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
16
|
+
const iss = ${e}.issues[i];
|
|
17
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
18
|
+
payload.issues.push(iss);
|
|
19
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
20
|
+
}
|
|
21
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
22
|
+
payload.value = newResult;
|
|
23
|
+
return payload;
|
|
24
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Sl(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
25
|
+
const ${n}_present = ${i};
|
|
26
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
27
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${e}) {
|
|
31
|
+
newResult[${r}] = ${n}.value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
`)}else f?(o.write(`
|
|
36
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
37
|
+
}
|
|
38
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
39
|
+
if (${n}.value !== undefined || ${i}) {
|
|
40
|
+
newResult[${r}] = ${n}.value;
|
|
41
|
+
}
|
|
42
|
+
`)):o.write(`
|
|
43
|
+
const ${n}_present = ${i};
|
|
44
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
45
|
+
}
|
|
46
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
47
|
+
payload.issues.push({
|
|
48
|
+
code: "invalid_type",
|
|
49
|
+
expected: "nonoptional",
|
|
50
|
+
input: undefined,
|
|
51
|
+
path: [${r}]
|
|
52
|
+
});
|
|
53
|
+
if (ctx && ctx.abortEarly) {
|
|
54
|
+
payload.value = newResult;
|
|
55
|
+
return payload;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (${n}_present) {
|
|
60
|
+
newResult[${r}] = ${n}.value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Tl,c=!Cu.jitless,l=c&&El.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ep([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function rp(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=>!Kl(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=>Ql(e,r,wu())))}),t)}var ip=K(`$ZodUnion`,(e,t)=>{Zd.init(e,t),pu(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),pu(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),pu(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),pu(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>fl(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=>rp(t,r,e,i)):rp(o,r,e,i)}});function ap(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var op=K(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ip.init(e,t);let n=e._zod.parse;pu(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||ml(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=hl(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ul(()=>ap(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Tl(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._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()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),sp=K(`$ZodIntersection`,(e,t)=>{Zd.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])=>lp(e,t,n)):lp(e,i,a)}});function cp(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Dl(e)&&Dl(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=cp(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=cp(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 lp(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=cp(t.value,n.value);if(!c.valid){if(Kl(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var up=K(`$ZodEnum`,(e,t)=>{Zd.init(e,t);let n=ol(t.entries),r=new Set(n);e._zod.values=r,pu(e,`pattern`,e=>{let t=ol(e.def.entries).filter(e=>kl.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Al(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),dp=K(`$ZodLiteral`,(e,t)=>{Zd.init(e,t);let n=new Set(t.values);e._zod.values=n,pu(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Al(e):e?Al(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),fp=K(`$ZodTransform`,(e,t)=>{Zd.init(e,t),e._zod.optin=`optional`,Cu.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Su(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));if(i instanceof Promise)throw new xu;return n.value=i,n}});function pp(e,t){return e.value=t.issues.length?void 0:t.value,e}var mp=K(`$ZodOptional`,(e,t)=>{Zd.init(e,t),pu(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,pu(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),pu(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fl(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>pp(e,t)):pp(e,r)}return t.innerType._zod.run(e,n)}}),hp=K(`$ZodExactOptional`,(e,t)=>{mp.init(e,t),pu(e,`values`,e=>e.def.innerType._zod.values),pu(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),gp=K(`$ZodNullable`,(e,t)=>{Zd.init(e,t),pu(e,`optin`,e=>e.def.innerType._zod.optin),pu(e,`optout`,e=>e.def.innerType._zod.optout),pu(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fl(t.source)}|null)$`):void 0}),pu(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),_p=K(`$ZodDefault`,(e,t)=>{Zd.init(e,t),e._zod.optin=`defaulted`,pu(e,`values`,e=>e.def.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=>vp(e,t)):vp(r,t)}});function vp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var yp=K(`$ZodPrefault`,(e,t)=>{Zd.init(e,t),e._zod.optin=`defaulted`,pu(e,`values`,e=>e.def.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))}),bp=K(`$ZodNonOptional`,(e,t)=>{Zd.init(e,t),pu(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>xp(t,e)):xp(i,e)}});function xp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Sp(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ql(e,r,wu()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Cp=K(`$ZodCatch`,(e,t)=>{Zd.init(e,t),pu(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),pu(e,`optout`,e=>e.def.innerType._zod.optout),pu(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Sp(e,r,t,n)):Sp(e,r,t,n)}}),wp=K(`$ZodPipe`,(e,t)=>{Zd.init(e,t),pu(e,`values`,e=>e.def.in._zod.values),pu(e,`optin`,e=>e.def.in._zod.optin),pu(e,`optout`,e=>e.def.out._zod.optout),pu(e,`propValues`,e=>e.def.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=>Tp(e,t.in,n)):Tp(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Tp(e,t.out,n)):Tp(r,t.out,n)}});function Tp(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ep=K(`$ZodReadonly`,(e,t)=>{Zd.init(e,t),pu(e,`propValues`,e=>e.def.innerType._zod.propValues),pu(e,`values`,e=>e.def.innerType._zod.values),pu(e,`optin`,e=>e.def.innerType?._zod?.optin),pu(e,`optout`,e=>e.def.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(Dp):Dp(r)}});function Dp(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Op=K(`$ZodCustom`,(e,t)=>{jd.init(e,t),Zd.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=>kp(t,n,r,e));kp(i,n,r,e)}});function kp(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(ru(e))}}var Ap=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},jp=`~memo`,Mp=[];function Np(e){return typeof e==`object`&&!!e}function Pp(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Fp=new WeakMap,Ip=0,Lp=1,Rp=2;function zp(e,t,n){let r=Fp.get(e);if(r!==void 0)return r?Rp:Ip;if(t.has(e))return Rp;t.add(e);let i=Ip,a=e=>{if(i!==Rp&&e?._zod){let r=zp(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ip;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Lp:o.value?._zod?zp(o.value,t,n):Ip;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=hl(c);s(e?o(e,!0):Lp),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?zp(r,t,!1):Lp);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Bp(e,i)}function Bp(e,t){return t!==Lp&&Fp.set(e,t===Rp),t}function Vp(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Hp,Up=[],Wp={alloc(e,t,n){let r=Hp;if(!r)return n;Hp=void 0;let i={value:n,issues:null};return r.set(t.value,i),Up.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Kp(n,e.value))throw new Ap;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=zp(e,new Set,!1);if(i===Ip)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Rp||r?n=!0:r=!0}let l=s.value;if(!Np(l))return t(s,c);let u=c[jp];u||(u={buckets:new WeakMap,backEdges:void 0},c[jp]=u);let d;i===c?d=a:(d=Vp(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Pp(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Hp=d;let p=Up.length,m=t(s,c);Hp=void 0;let h=Up.length>p?Up.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Pp(e.issues):Mp),e)):(h&&(h.issues=m.issues.length?Pp(m.issues):Mp),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Gp(){return Wp}function Kp(e,t){let n=e[jp]?.backEdges;return n!==void 0&&Np(t)&&n.has(t)}var qp=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(nu(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Nl(e.values[0])}`:`Invalid option: expected one of ${sl(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${sl(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Jp(){return{localeError:qp()}}var Yp,Xp=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 Zp(){return new Xp}(Yp=globalThis).__zod_globalRegistry??(Yp.__zod_globalRegistry=Zp());var Qp=globalThis.__zod_globalRegistry;function $p(e){return e.checks&&=[...e.checks],e}function em(e,t){return new e($p({type:`string`,...Ml(t)}))}function tm(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Ml(t)})}function nm(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Ml(t)})}function rm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Ml(t)})}function im(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Ml(t)})}function am(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Ml(t)})}function om(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Ml(t)})}function sm(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Ml(t)})}function cm(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Ml(t)})}function lm(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Ml(t)})}function um(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Ml(t)})}function dm(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Ml(t)})}function fm(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Ml(t)})}function pm(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Ml(t)})}function mm(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Ml(t)})}function hm(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Ml(t)})}function gm(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Ml(t)})}function _m(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Ml(t)})}function vm(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Ml(t)})}function ym(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Ml(t)})}function bm(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Ml(t)})}function xm(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Ml(t)})}function Sm(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Ml(t)})}function Cm(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Ml(t)})}function wm(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Ml(t)})}function Tm(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Ml(t)})}function Em(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Ml(t)})}function Dm(e,t){return new e($p({type:`number`,checks:[],...Ml(t)}))}function Om(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Ml(t)})}function km(e,t){return new e({type:`boolean`,...Ml(t)})}function Am(e){return new e({type:`unknown`})}function jm(e,t){return new e({type:`never`,...Ml(t)})}function Mm(e,t){return new Pd({check:`less_than`,...Ml(t),value:e,inclusive:!1})}function Nm(e,t){return new Pd({check:`less_than`,...Ml(t),value:e,inclusive:!0})}function Pm(e,t){return new Fd({check:`greater_than`,...Ml(t),value:e,inclusive:!1})}function Fm(e,t){return new Fd({check:`greater_than`,...Ml(t),value:e,inclusive:!0})}function Im(e,t){return new Id({check:`multiple_of`,...Ml(t),value:e})}function Lm(e,t){return new Rd({check:`max_length`,...Ml(t),maximum:e})}function Rm(e,t){return new zd({check:`min_length`,...Ml(t),minimum:e})}function zm(e,t){return new Bd({check:`length_equals`,...Ml(t),length:e})}function Bm(e,t){return new Hd({check:`string_format`,format:`regex`,...Ml(t),pattern:e})}function Vm(e){return new Ud({check:`string_format`,format:`lowercase`,...Ml(e)})}function Hm(e){return new Wd({check:`string_format`,format:`uppercase`,...Ml(e)})}function Um(e,t){return new Gd({check:`string_format`,format:`includes`,...Ml(t),includes:e})}function Wm(e,t){return new Kd({check:`string_format`,format:`starts_with`,...Ml(t),prefix:e})}function Gm(e,t){return new qd({check:`string_format`,format:`ends_with`,...Ml(t),suffix:e})}function Km(e){return new Jd({check:`overwrite`,tx:e})}function qm(e){return Km(t=>t.normalize(e))}function Jm(){return Km(e=>e.trim())}function Ym(){return Km(e=>e.toLowerCase())}function Xm(){return Km(e=>e.toUpperCase())}function Zm(){return Km(e=>Cl(e))}function Qm(e,t,n){return new e({type:`array`,element:t,...Ml(n)})}function $m(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Ml(n)})}function eh(e,t){let n=th(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ru(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ru(r))}},e(t.value,t)),t);return n}function th(e,t){let n=new jd({check:`custom`,...Ml(t)});return n._zod.check=e,n}function nh(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ml(e,t,n[t]);return e}function rh(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??Qp,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ih(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function ah(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,ah(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&nh(o.schema,c),t.io===`input`&&hh(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 oh(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function sh(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${oh(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+oh(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
64
|
+
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function ch(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ch(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var lh=new Set([`type`,`properties`,`required`,`additionalProperties`]),uh=[`oneOf`,`anyOf`];function dh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function fh(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!lh.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??dh(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ml(n,r,e.length===1?e[0]:fh(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=dh(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function ph(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of lh)if(t in e)return;let n=t.filter(e=>uh.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=fh(t);else{let e=n[0],i=uh.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>fh([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,nh(e,r))}function mh(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)):nh(i,s),nh(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ch(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])ph(e)}}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)}nh(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ml(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:_h(t,`input`,e.processors),output:_h(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function hh(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 hh(r.element,n);if(r.type===`set`)return hh(r.valueType,n);if(r.type===`lazy`)return hh(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`||r.type===`catch`)return hh(r.innerType,n);if(r.type===`intersection`)return hh(r.left,n)||hh(r.right,n);if(r.type===`record`||r.type===`map`)return hh(r.keyType,n)||hh(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:hh(r.in,n)||hh(r.out,n);if(r.type===`object`){for(let e in r.shape)if(hh(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(hh(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(hh(e,n))return!0;return!!(r.rest&&hh(r.rest,n))}return!1}var gh=(e,t={})=>n=>{let r=rh({...n,processors:t});return ah(e,r),sh(r,e),mh(r,e)},_h=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=rh({...i??{},target:a,io:t,processors:n});return ah(e,o),sh(o,e),mh(o,e)},vh=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},yh=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},bh=(e,t)=>{vh(e,`minimum`,t),yh(e,`maximum`,t)},xh=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Sh=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ch=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},wh=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Th=(e,t)=>vh(e,`minimum`,t.minimum),Eh=(e,t)=>yh(e,`maximum`,t.maximum),Dh=e=>(t,n)=>{wh(t,n.format);let[r,i]=e[n.format];vh(t,`minimum`,r),yh(t,`maximum`,i)},Oh={greater_than:(e,t)=>vh(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>yh(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>xh(e,t.value),number_format:Dh(Fl),bigint_format:Dh(Il),min_length:Th,max_length:Eh,length_equals:(e,t)=>bh(e,t.length),min_size:Th,max_size:Eh,size_equals:(e,t)=>bh(e,t.size),string_format:(e,t)=>{wh(e,t.format),t.pattern&&Sh(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ch(e,t.mime)};function kh(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Oh[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&vh(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&vh(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&yh(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&yh(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&xh(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ch(t,i.mime);for(let e of i.patterns??[])Sh(t,e);return t}var Ah={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},jh=new Map([[Pf,gd],[If,_d]]),Mh=e=>jh.get(e)??e,Nh=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=kh(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ah[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Mh);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}))])}},Ph=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=kh(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):ih(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Fh=(e,t,n,r)=>{n.type=`boolean`},Ih=(e,t,n,r)=>{n.not={}},Lh=(e,t,n,r)=>{let i=e._zod.def,a=ol(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Rh=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(ih(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(ih(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},zh=(e,t,n,r)=>{ih(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Bh=(e,t,n,r)=>{ih(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Vh=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=kh(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ah(a.element,t,{...r,path:[...r.path,`items`]})};function Hh(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Hh(t.out):t.type===`catch`?Hh(t.innerType):e._zod.optin}var Uh=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ih(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ml(i.properties,e,ah(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Hh(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ah(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Wh=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ah(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Gh=(e,t,n,r)=>{let i=e._zod.def,a=ah(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ah(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Kh=(e,t,n,r)=>{let i=e._zod.def,a=ah(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`}]},qh=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Jh=Symbol();function Yh(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ih(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Jh):JSON.parse(o)}var Xh=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Yh(i.defaultValue,e,t,n,r);o!==Jh&&(n.default=o)},Zh=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Yh(i.defaultValue,e,t,n,r);o!==Jh&&(n._prefault=o)},Qh=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ih(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},$h=(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;ah(o,t,r);let s=t.seen.get(e);s.ref=o},eg=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},tg=(e,t,n,r)=>{let i=e._zod.def;ah(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ng=new WeakSet([Object.prototype,Error.prototype]);function rg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var ig=K(`ZodError`,(e,t)=>{Au.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ng.has(n)||(ng.add(n),rg(n,`format`,e=>t=>Nu(e,t)),rg(n,`flatten`,e=>t=>Mu(e,t)),rg(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cl,2)}),rg(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cl,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ag=Fu(ig),og=Iu(ig),sg=Lu(ig),cg=zu(ig),lg=Gu(ig),ug=Ku(ig),dg=qu(ig),fg=Ju(ig),pg=Yu(ig),mg=Xu(ig),hg=Zu(ig),gg=Qu(ig);function _g(){Cu.localeError||wu(Jp())}function vg(){Cu.memoizer||wu({memoizer:Gp()})}var yg=K(`ZodType`,(e,t)=>(_g(),Zd.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(xl(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 jl(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(R_(e,t))},superRefine(e,t){return this.check(z_(e,t))},overwrite(e){return this.check(Km(e))},optional(){return b_(this)},exactOptional(){return S_(this)},nullable(){return w_(this)},nullish(){return b_(w_(this))},nonoptional(e){return A_(this,e)},array(){return i_(this)},or(e){return c_([this,e])},and(e){return f_(this,e)},transform(e){return P_(this,v_(e))},default(e){return E_(this,e)},prefault(e){return O_(this,e)},catch(e){return M_(this,e)},pipe(e){return P_(this,e)},readonly(){return I_(this)},describe(e){let t=this.clone();return Qp.add(t,{description:e}),t},meta(...e){if(e.length===0)return Qp.get(this);let t=this.clone();return Qp.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ou(this,`~standard`,{...ef(this),jsonSchema:{input:_h(this,`input`),output:_h(this,`output`)}})},set"~standard"(e){au(this,`~standard`,e)},parse:function e(t,n){return ag(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await og(this,t,n,{callee:e})},safeParse(e,t){return sg(this,e,t)},async safeParseAsync(e,t){return cg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){au(this,`spa`,e)},validate(e,t){return Hu(this,e,t)},validateAsync(e,t){return Wu(this,e,t)},encode:function e(t,n){return lg(this,t,n,{callee:e})},decode:function e(t,n){return ug(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await dg(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await fg(this,t,n,{callee:e})},safeEncode(e,t){return pg(this,e,t)},safeDecode(e,t){return mg(this,e,t)},async safeEncodeAsync(e,t){return hg(this,e,t)},async safeDecodeAsync(e,t){return gg(this,e,t)},toJSONSchema(e){return gh(this,{})(e)},get description(){return Qp.get(this)?.description},get _def(){return this._zod.def}}),bg=K(`_ZodString`,(e,t)=>{tf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nh(e,t,n,r)},su({format:e=>kh(e).format??null,minLength:e=>kh(e).minimum??null,maxLength:e=>kh(e).maximum??null},{regex(...e){return this.check(Bm(...e))},includes(...e){return this.check(Um(...e))},startsWith(...e){return this.check(Wm(...e))},endsWith(...e){return this.check(Gm(...e))},min(...e){return this.check(Rm(...e))},max(...e){return this.check(Lm(...e))},length(...e){return this.check(zm(...e))},nonempty(...e){return this.check(Rm(1,...e))},lowercase(e){return this.check(Vm(e))},uppercase(e){return this.check(Hm(e))},trim(){return this.check(Jm())},normalize(...e){return this.check(qm(...e))},toLowerCase(){return this.check(Ym())},toUpperCase(){return this.check(Xm())},slugify(){return this.check(Zm())}})),xg=K(`ZodString`,(e,t)=>{tf.init(e,t),bg.init(e,t)},{email(e){return this.check(tm(Og,e))},url(e){return this.check(sm(jg,e))},jwt(e){return this.check(Sm(Kg,e))},emoji(e){return this.check(cm(Mg,e))},guid(e){return this.check(nm(kg,e))},uuid(e){return this.check(rm(Ag,e))},uuidv4(e){return this.check(im(Ag,e))},uuidv6(e){return this.check(am(Ag,e))},uuidv7(e){return this.check(om(Ag,e))},nanoid(e){return this.check(lm(Ng,e))},cuid(e){return this.check(um(Pg,e))},cuid2(e){return this.check(dm(Fg,e))},ulid(e){return this.check(fm(Ig,e))},base64(e){return this.check(ym(Ug,e))},base64url(e){return this.check(bm(Wg,e))},xid(e){return this.check(pm(Lg,e))},ksuid(e){return this.check(mm(Rg,e))},ipv4(e){return this.check(hm(zg,e))},ipv6(e){return this.check(gm(Bg,e))},cidrv4(e){return this.check(_m(Vg,e))},cidrv6(e){return this.check(vm(Hg,e))},e164(e){return this.check(xm(Gg,e))},datetime(e){return this.check(Cm(wg,e))},date(e){return this.check(wm(Tg,e))},time(e){return this.check(Tm(Eg,e))},duration(e){return this.check(Em(Dg,e))}});function Sg(e){return em(xg,e)}var Cg=K(`ZodStringFormat`,(e,t)=>{nf.init(e,t),bg.init(e,t)}),wg=K(`ZodISODateTime`,(e,t)=>{Sf.init(e,t),Cg.init(e,t)}),Tg=K(`ZodISODate`,(e,t)=>{Cf.init(e,t),Cg.init(e,t)}),Eg=K(`ZodISOTime`,(e,t)=>{wf.init(e,t),Cg.init(e,t)}),Dg=K(`ZodISODuration`,(e,t)=>{Tf.init(e,t),Cg.init(e,t)}),Og=K(`ZodEmail`,(e,t)=>{of.init(e,t),Cg.init(e,t)}),kg=K(`ZodGUID`,(e,t)=>{rf.init(e,t),Cg.init(e,t)}),Ag=K(`ZodUUID`,(e,t)=>{af.init(e,t),Cg.init(e,t)}),jg=K(`ZodURL`,(e,t)=>{mf.init(e,t),Cg.init(e,t)}),Mg=K(`ZodEmoji`,(e,t)=>{hf.init(e,t),Cg.init(e,t)}),Ng=K(`ZodNanoID`,(e,t)=>{gf.init(e,t),Cg.init(e,t)}),Pg=K(`ZodCUID`,(e,t)=>{_f.init(e,t),Cg.init(e,t)}),Fg=K(`ZodCUID2`,(e,t)=>{vf.init(e,t),Cg.init(e,t)}),Ig=K(`ZodULID`,(e,t)=>{yf.init(e,t),Cg.init(e,t)}),Lg=K(`ZodXID`,(e,t)=>{bf.init(e,t),Cg.init(e,t)}),Rg=K(`ZodKSUID`,(e,t)=>{xf.init(e,t),Cg.init(e,t)}),zg=K(`ZodIPv4`,(e,t)=>{Ef.init(e,t),Cg.init(e,t)}),Bg=K(`ZodIPv6`,(e,t)=>{kf.init(e,t),Cg.init(e,t)}),Vg=K(`ZodCIDRv4`,(e,t)=>{Af.init(e,t),Cg.init(e,t)}),Hg=K(`ZodCIDRv6`,(e,t)=>{Mf.init(e,t),Cg.init(e,t)}),Ug=K(`ZodBase64`,(e,t)=>{Ff.init(e,t),Cg.init(e,t)}),Wg=K(`ZodBase64URL`,(e,t)=>{Rf.init(e,t),Cg.init(e,t)}),Gg=K(`ZodE164`,(e,t)=>{zf.init(e,t),Cg.init(e,t)}),Kg=K(`ZodJWT`,(e,t)=>{Vf.init(e,t),Cg.init(e,t)}),qg=K(`ZodNumber`,(e,t)=>{Hf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ph(e,t,n,r),e.isFinite=!0},su({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=kh(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=kh(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=kh(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>kh(e).format??null},{gt(e,t){return this.check(Pm(e,t))},gte(e,t){return this.check(Fm(e,t))},min(e,t){return this.check(Fm(e,t))},lt(e,t){return this.check(Mm(e,t))},lte(e,t){return this.check(Nm(e,t))},max(e,t){return this.check(Nm(e,t))},int(e){return this.check(Xg(e))},safe(e){return this.check(Xg(e))},positive(e){return this.check(Pm(0,e))},nonnegative(e){return this.check(Fm(0,e))},negative(e){return this.check(Mm(0,e))},nonpositive(e){return this.check(Nm(0,e))},multipleOf(e,t){return this.check(Im(e,t))},step(e,t){return this.check(Im(e,t))},finite(){return this}}));function Jg(e){return Dm(qg,e)}var Yg=K(`ZodNumberFormat`,(e,t)=>{Uf.init(e,t),qg.init(e,t)});function Xg(e){return Om(Yg,e)}var Zg=K(`ZodBoolean`,(e,t)=>{Wf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fh(e,t,n,r)});function Qg(e){return km(Zg,e)}var $g=K(`ZodUnknown`,(e,t)=>{Gf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function e_(){return Am($g)}var t_=K(`ZodNever`,(e,t)=>{Kf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ih(e,t,n,r)});function n_(e){return jm(t_,e)}var r_=K(`ZodArray`,(e,t)=>{vg(),Xf.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vh(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Rm(e,t))},nonempty(e){return this.check(Rm(1,e))},max(e,t){return this.check(Lm(e,t))},length(e,t){return this.check(zm(e,t))},unwrap(){return this.element}});function i_(e,t){return Qm(r_,e,t)}var a_=K(`ZodObject`,(e,t)=>{vg(),np.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uh(e,t,n,r),mu(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return m_(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(xl(this._zod.def,{catchall:e}))},passthrough(){return this.clone(xl(this._zod.def,{catchall:e_()}))},loose(){return this.clone(xl(this._zod.def,{catchall:e_()}))},strict(){return this.clone(xl(this._zod.def,{catchall:n_()}))},strip(){return this.clone(xl(this._zod.def,{catchall:void 0}))},extend(e){return Bl(this,e)},safeExtend(e){return Hl(this,e)},merge(e){return Ul(this,e)},pick(e){return Ll(this,e)},omit(e){return zl(this,e)},partial(...e){return Wl(y_,this,e[0])},exactPartial(...e){return Wl(x_,this,e[0],`exactPartial`)},required(...e){return Gl(k_,this,e[0])}});function o_(e,t){return new a_({type:`object`,shape:e??{},...Ml(t)})}var s_=K(`ZodUnion`,(e,t)=>{ip.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wh(e,t,n,r),e.options=t.options});function c_(e,t){return new s_({type:`union`,options:e,...Ml(t)})}var l_=K(`ZodDiscriminatedUnion`,(e,t)=>{s_.init(e,t),op.init(e,t)});function u_(e,t,n){return new l_({type:`union`,options:t,discriminator:e,...Ml(n)})}var d_=K(`ZodIntersection`,(e,t)=>{sp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gh(e,t,n,r)});function f_(e,t){return new d_({type:`intersection`,left:e,right:t})}var p_=K(`ZodEnum`,(e,t)=>{up.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lh(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 p_({...t,checks:[],...Ml(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 p_({...t,checks:[],...Ml(r),entries:i})}});function m_(e,t){return new p_({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Ml(t)})}var h_=K(`ZodLiteral`,(e,t)=>{dp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rh(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 g_(e,t){return new h_({type:`literal`,values:Array.isArray(e)?e:[e],...Ml(t)})}var __=K(`ZodTransform`,(e,t)=>{vg(),fp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bh(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Su(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ru(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(ru(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function v_(e){return new __({type:`transform`,transform:e})}var y_=K(`ZodOptional`,(e,t)=>{mp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function b_(e){return new y_({type:`optional`,innerType:e})}var x_=K(`ZodExactOptional`,(e,t)=>{hp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function S_(e){return new x_({type:`optional`,innerType:e})}var C_=K(`ZodNullable`,(e,t)=>{gp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function w_(e){return new C_({type:`nullable`,innerType:e})}var T_=K(`ZodDefault`,(e,t)=>{_p.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function E_(e,t){return new T_({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ol(t)}})}var D_=K(`ZodPrefault`,(e,t)=>{yp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function O_(e,t){return new D_({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ol(t)}})}var k_=K(`ZodNonOptional`,(e,t)=>{bp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function A_(e,t){return new k_({type:`nonoptional`,innerType:e,...Ml(t)})}var j_=K(`ZodCatch`,(e,t)=>{Cp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function M_(e,t){return new j_({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:gu(t)})}var N_=K(`ZodPipe`,(e,t)=>{wp.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$h(e,t,n,r),e.in=t.in,e.out=t.out});function P_(e,t){return new N_({type:`pipe`,in:e,out:t})}var F_=K(`ZodReadonly`,(e,t)=>{Ep.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function I_(e){return new F_({type:`readonly`,innerType:e})}var L_=K(`ZodCustom`,(e,t)=>{Op.init(e,t),yg.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zh(e,t,n,r)});function R_(e,t={}){return $m(L_,e,t)}function z_(e,t){return eh(e,t)}var B_=[`mysql`,`clickhouse`],V_={mysql:{label:`MySQL`,defaultPort:3306},clickhouse:{label:`ClickHouse`,defaultPort:8123}},H_={gray:`#8a8a8a`,red:`#ef4444`,orange:`#f97316`,yellow:`#eab308`,green:`#22c55e`,teal:`#14b8a6`,blue:`#3b82f6`,purple:`#a855f7`},U_=Object.keys(H_),W_=o_({name:Sg().trim().min(1,`Name is required`).max(60),color:m_(U_)}),G_=o_({folderId:Sg().nullable(),name:Sg().trim().min(1,`Name is required`).max(80),kind:m_(B_),host:Sg().trim().min(1,`Host is required`),port:Jg().int().min(1).max(65535),user:Sg().trim().min(1,`User is required`),password:Sg(),database:Sg().trim().nullable(),secure:Qg()});u_(`kind`,[o_({kind:g_(`sql`),connectionId:Sg().min(1),database:Sg().min(1).nullable()}),o_({kind:g_(`table`),connectionId:Sg().min(1),database:Sg().min(1),table:Sg().min(1)})]);function K_(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}function q_(e){return e instanceof Error?e.message:String(e)}function J_(){return typeof window<`u`}function Y_(e){return Q_(e)?(e.nodeName||``).toLowerCase():`#document`}function X_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Z_(e){return((Q_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Q_(e){return J_()?e instanceof Node||e instanceof X_(e).Node:!1}function $_(e){return J_()?e instanceof Element||e instanceof X_(e).Element:!1}function ev(e){return J_()?e instanceof HTMLElement||e instanceof X_(e).HTMLElement:!1}function tv(e){return!J_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof X_(e).ShadowRoot}function nv(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=pv(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function rv(e){return/^(table|td|th)$/.test(Y_(e))}function iv(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var av=/transform|translate|scale|rotate|perspective|filter/,ov=/paint|layout|strict|content/,sv=e=>!!e&&e!==`none`,cv;function lv(e){let t=$_(e)?pv(e):e;return sv(t.transform)||sv(t.translate)||sv(t.scale)||sv(t.rotate)||sv(t.perspective)||!dv()&&(sv(t.backdropFilter)||sv(t.filter))||av.test(t.willChange||``)||ov.test(t.contain||``)}function uv(e){let t=hv(e);for(;ev(t)&&!fv(t);){if(lv(t))return t;if(iv(t))return null;t=hv(t)}return null}function dv(){return cv??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),cv}function fv(e){return/^(html|body|#document)$/.test(Y_(e))}function pv(e){return X_(e).getComputedStyle(e)}function mv(e){return $_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hv(e){if(Y_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||tv(e)&&e.host||Z_(e);return tv(t)?t.host:t}function gv(e){let t=hv(e);return fv(t)?(e.ownerDocument||e).body:ev(t)&&nv(t)?t:gv(t)}function _v(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gv(e),i=r===e.ownerDocument?.body,a=X_(r);if(i){let e=vv(a);return t.concat(a,a.visualViewport||[],nv(r)?r:[],e&&n?_v(e):[])}return t.concat(r,_v(r,[],n))}function vv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var yv={...W},bv={};function xv(e,t){let n=W.useRef(bv);return n.current===bv&&(n.current=e(t)),n}var Sv=yv.useInsertionEffect,Cv=Sv&&Sv!==yv.useLayoutEffect?Sv:e=>e();function q(e){let t=xv(wv).current;return t.next=e,Cv(t.effect),t.trampoline}function wv(){let e={next:void 0,callback:Tv,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Tv(){}var J=typeof document<`u`?W.useLayoutEffect:()=>{};function Ev(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Dv={};function Ov(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Av(t);let a=Av(e);return t&&(a=jv(a,t)),n&&(a=jv(a,n)),r&&(a=jv(a,r)),i&&(a=jv(a,i)),a}function kv(e){if(e.length===0)return Dv;if(e.length===1)return Av(e[0]);let t=Av(e[0]);for(let n=1;n<e.length;n+=1)t=jv(t,e[n]);return t}function Av(e){return Fv(e)?{...e(Dv)}:Mv(e)}function jv(e,t){return Fv(t)?t(e):Nv(e,t)}function Mv(e){let t={...e};for(let e in t){let n=t[e];Pv(e,n)&&(t[e]=Lv(n))}return t}function Nv(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Ev(e.style,r);break;case`className`:e[n]=zv(e.className,r);break;default:e[n]=Pv(n,r)?Iv(e[n],r):r}}return e}function Pv(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 Fv(e){return typeof e==`function`}function Iv(e,t){return t?e?(...n)=>{let r=n[0];if(Bv(r)){let i=r;Rv(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Lv(t):e}function Lv(e){return e&&((...t)=>{let n=t[0];return Bv(n)&&Rv(n),e(...t)})}function Rv(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zv(e,t){return t?e?t+` `+e:t:e}function Bv(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Vv(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 Hv=Vv(`https://base-ui.com/production-error`,`Base UI`),Uv=W.createContext(void 0);function Wv(e=!1){let t=W.useContext(Uv);if(t===void 0&&!e)throw Error(Hv(16));return t}function Gv(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:W.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 Kv(e){return e?.ownerDocument||document}function qv(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(X_(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 Jv(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=W.useRef(null),s=Wv(!0),c=a??s!==void 0,{props:l}=Gv({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=W.useCallback(()=>{let e=o.current;Yv(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return J(u,[u]),{getButtonProps:W.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Ov({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Rv(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Yv(r),s=!i&&Xv(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(),qv(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),qv(r,e)))},onKeyUp(e){t||(Rv(e),a?.(e),e.target===e.currentTarget&&i&&c&&Yv(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),qv(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:q(e=>{o.current=e,u()})}}function Yv(e){return ev(e)&&e.tagName===`BUTTON`}function Xv(e){return ev(e)&&e.tagName===`A`&&!!e.href}function Zv(e,t,n,r){let i=xv($v).current;return ey(i,e,t,n,r)&&ny(i,[e,t,n,r]),i.callback}function Qv(e){let t=xv($v).current;return ty(t,e)&&ny(t,e),t.callback}function $v(){return{callback:null,cleanup:null,refs:[]}}function ey(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function ty(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function ny(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null: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 ry=19;function iy(e){return ry>=e}function ay(e){if(!W.isValidElement(e))return null;let t=e,n=t.props;return(iy(19)?n?.ref:t.ref)??null}function oy(){}var sy=Object.freeze([]),cy=Object.freeze({});function ly(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)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function uy(e,t){return typeof e==`function`?e(t):e}function dy(e,t){return typeof e==`function`?e(t):e}function fy(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=gy(r));let i=py(t,n,r);if(n.enabled===!1)return null;let a=n.state??cy;return _y(e,r,i,a)}function py(e,t,n){let{className:r,style:i}=e,{state:a=cy,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?uy(r,a):void 0,d=l?dy(i,a):void 0,f=l?ly(a,c):cy,p=l&&s?my(s):void 0,m=l?Ev(f,p)??{}:cy;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Qv([m.ref,ay(n),...o]):Zv(m.ref,ay(n),o):Zv(null,null)),l?(u!==void 0&&(m.className=zv(m.className,u)),d!==void 0&&(m.style=Ev(m.style,d)),m):cy}function my(e){return Array.isArray(e)?kv(e):Ov(void 0,e)}var hy=Symbol.for(`react.lazy`);function gy(e){if(e?.$$typeof!==hy)return e;let t=W.Children.toArray(e)[0];return W.isValidElement(t)?t:e}function _y(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Ov(n,t.props);return e.ref=n.ref,W.cloneElement(t,e)}return vy(e,n)}function vy(e,t){return e===`button`?(0,W.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,W.createElement)(`img`,{alt:``,...t,key:t.key}):W.createElement(e,t)}var yy=W.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=Jv({disabled:i,focusableWhenDisabled:a,native:o});return fy(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),by={base:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`x17d4w8g`,kZKoxP:`x1jgo0hl`,kg3NbH:`x1awh872`,kMv6JI:`x134rb1s`,kGuDYH:`xqtwvag`,k63SB2:`xk50ysn`,kaIpWk:`xvjf9rd`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kkrTdU:`x1ypdohk xtgyt42`,khDVqt:`xuxw1ft`,kfSwDN:`x87ps6o`,k1ekBW:`xv65o4f`,kIyJzY:`x1qfwjxi`,kAMwcw:`x6setmy`,k3aq6I:`x1c071of x15qbw3q`,kI3sdo:`x1a2a7pz xn0s4wz`,kInvED:`x1y3gkto`,kSiTet:`x1hc1fzr x1t5pwa4`,$$css:!0},primary:{kWkggS:`xq83s4c xds5qq0`,kVAM5u:`xxuvl4d`,kMwMTN:`x18x1ra`,$$css:!0},secondary:{kWkggS:`x14fh20 x17ec2s3`,kVAM5u:`x4s12hp`,kMwMTN:`x122w267`,$$css:!0},ghost:{kWkggS:`xjbqb8w x1ncw40y xgb2fgl`,kVAM5u:`x9r1u3d`,kMwMTN:`x122w267`,$$css:!0},danger:{kWkggS:`x185or1n x1am0jh4`,kVAM5u:`xb1jnos`,kMwMTN:`xb0vdwp`,$$css:!0},icon:{kzqmXN:`x1a5d0zf`,kg3NbH:`xnjsko4`,$$css:!0},small:{kZKoxP:`x11cxg1j`,kg3NbH:`xdqyycr`,$$css:!0},smallIcon:{kzqmXN:`x5tfkcl`,kg3NbH:`xnjsko4`,$$css:!0},fill:{kzqmXN:`xh8yej3`,$$css:!0}};function xy(e){let t=(0,ko.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({variant:o,icon:r,small:a,fill:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`secondary`:o,c;t[6]!==n||t[7]!==r||t[8]!==a||t[9]!==s?(c=Fo(by.base,by[s],a&&by.small,r&&(a?by.smallIcon:by.icon),n&&by.fill),t[6]=n,t[7]=r,t[8]=a,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==i||t[12]!==c?(l=(0,G.jsx)(yy,{...i,...c}),t[11]=i,t[12]=c,t[13]=l):l=t[13],l}var Sy=W.createContext(void 0);function Cy(e){let t=W.useContext(Sy);if(!e&&t===void 0)throw Error(Hv(27));return t}var wy=`data-starting-style`,Ty=`data-ending-style`,Ey={[wy]:``},Dy={[Ty]:``},Oy={transitionStatus(e){return e===`starting`?Ey:e===`ending`?Dy:null}},ky=`data-open`,Ay=`data-closed`,jy=`data-anchor-hidden`,My=`data-popup-open`,Ny=`data-pressed`,Py={[My]:``},Fy={[My]:``,[Ny]:``},Iy={[ky]:``},Ly={[Ay]:``},Ry={[jy]:``},zy={open(e){return e?Py:null}},By={open(e){return e?Fy:null}},Vy={open(e){return e?Iy:Ly},anchorHidden(e){return e?Ry:null}},Hy={...Vy,...Oy},Uy=W.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Cy(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return fy(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Hy,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})});function Wy(e,t,n,r){let i=!1,a=!1,o=r??cy;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 Gy(e,t,n){let r=n??cy;return{reason:e,event:t??new Event(`base-ui`),...r}}var Ky=`none`,qy=`trigger-press`,Jy=`trigger-hover`,Yy=`trigger-focus`,Xy=`outside-press`,Zy=`item-press`,Qy=`clear-press`,$y=`input-change`,eb=`input-clear`,tb=`focus-out`,nb=`escape-key`,rb=`list-navigation`,ib=`keyboard`,ab=`pointer`,ob=`popup-close`,sb=`cancel-open`,cb=`sibling-open`,lb=`disabled`,ub=`missing`,db=`initial`,fb=`imperative-action`,pb=`window-resize`;function mb(){let[,e]=W.useState({});return W.useCallback(()=>{e({})},[])}var hb=0;function gb(e,t=`mui`){let n=W.useRef(void 0),r=mb(),i=e??n.current;return W.useEffect(()=>{n.current??(hb+=1,n.current=`${t}-${hb}`,e??r())},[e,t,r]),i}var _b=yv.useId;function vb(e,t){if(_b!==void 0){let n=_b();return e??(t?`${t}-${n}`:n)}return gb(e,t)}function yb(e){return vb(e,`base-ui`)}function bb(e){W.useEffect(e,sy)}var xb=0,Sb=class e{static create(){return new e}currentId=xb;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=xb,t()},e)}isStarted(){return this.currentId!==xb}clear=()=>{this.currentId!==xb&&(clearTimeout(this.currentId),this.currentId=xb)};disposeEffect=()=>this.clear};function Cb(){let e=xv(Sb.create).current;return bb(e.disposeEffect),e}function wb(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Tb,platform:Eb,maxTouchPoints:Db}=wb(),Ob=Tb.toLowerCase(),kb=Eb.toLowerCase(),Ab=/^i(os$|p)/.test(kb)||kb===`macintel`&&Db>1,jb=`android`,Mb=kb===jb||Ob.includes(jb),Nb=!Ab&&kb.startsWith(`mac`);kb.startsWith(`win`),!Mb&&/^(linux|chrome os)/.test(kb);var Pb=Nb||Ab,Fb=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Fb&&Ob.includes(`firefox`),!Fb&&Ob.includes(`chrom`);var Ib=Pb,Lb=/jsdom|happydom/.test(Ob);function Rb(e){e.preventDefault(),e.stopPropagation()}function zb(e){return`nativeEvent`in e}function Bb(e){return e.pointerType===``&&e.isTrusted?!0:Mb&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Vb(e){return Lb?!1:!Mb&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(Mb||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Hb(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Ub(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Wb(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Y(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&tv(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Gb(e,t){let n=e;for(;n;){if($_(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(tv(n)?n.host:null)}return null}function Kb(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var qb=`data-base-ui-focusable`,Jb=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Yb=`ArrowLeft`,Xb=`ArrowRight`,Zb=`ArrowUp`,Qb=`ArrowDown`,$b=`data-trigger-disabled`;function ex(e,t){if(!$_(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute($b);for(let[,e]of t.entries())if(Y(e,n))return!e.hasAttribute($b);return!1}function tx(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 nx(e){return e.matches(`html,body`)}function rx(e){return ev(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function ix(e){return Gb(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Jb}`)!=null}function ax(e){return e?e.getAttribute(`role`)===`combobox`&&rx(e):!1}function ox(e){if(!e||Lb)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function sx(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function cx(e,t){return t!=null&&!Hb(t)?0:typeof e==`function`?e():e}function lx(e,t,n){let r=cx(e,n);return typeof r==`number`?r:r?.[t]}function ux(e){return typeof e==`function`?e():e}function dx(e,t){return t||e===`click`||e===`mousedown`}function fx(e){return e?.includes(`mouse`)&&e!==`mousedown`}var px=W.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Sb,currentIdRef:{current:null},currentContextRef:{current:null}});function mx(e,t){e.current=t.current}function hx(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=W.useRef(n),a=W.useRef(n),o=W.useRef(null),s=W.useRef(null),c=Cb();return J(()=>{a.current=n,o.current?i.current={open:lx(i.current,`open`),close:lx(n,`close`)}:i.current=n},[n,o,i,a]),(0,G.jsx)(px.Provider,{value:W.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function gx(e,t={open:!1}){let{open:n}=t,r=e.useState(`floatingId`),{currentIdRef:i,delayRef:a,timeoutMs:o,initialDelayRef:s,currentContextRef:c,hasProvider:l,timeout:u}=W.useContext(px),[d,f]=W.useState(!1),p=W.useRef(n);return J(()=>{p.current=n},[n]),J(()=>{function t(){c.current?.setIsInstantPhase(!1),i.current=null,c.current=null,a.current=s.current,u.clear()}if(i.current&&!n&&i.current===r){if(f(!1),o){let n=r;return u.start(o,()=>{e.select(`open`)||i.current&&i.current!==n||t()}),()=>{(p.current||i.current!==n)&&u.clear()}}t()}},[n,r,i,a,o,s,c,u,e]),J(()=>{if(!n)return;let t=c.current,o=i.current;u.clear(),c.current={onOpenChange:e.setOpen,setIsInstantPhase:f},i.current=r,a.current={open:0,close:lx(s.current,`close`)},o!==null&&o!==r?(f(!0),t?.setIsInstantPhase(!0),t?.onOpenChange(!1,Wy(Ky))):(f(!1),t?.setIsInstantPhase(!1))},[n,r,e,i,a,s,c,u]),J(()=>()=>{if(i.current===r){if(c.current=null,!p.current)return;i.current=null,mx(a,s),u.clear()}},[c,i,a,r,s,u]),W.useMemo(()=>({activeIdRef:i,hasProvider:l,delayRef:a,isInstantPhase:d}),[i,l,a,d])}function _x(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function vx(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function yx(e){let t=xv(bx,e).current;return t.next=e,J(t.effect),t}function bx(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var xx=null;globalThis.requestAnimationFrame;var Sx=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)}},Cx=class e{static create(){return new e}static request(e){return Sx.request(e)}static cancel(e){return Sx.cancel(e)}currentId=xx;request(e){this.cancel(),this.currentId=Sx.request(()=>{this.currentId=xx,e()})}cancel=()=>{this.currentId!==xx&&(Sx.cancel(this.currentId),this.currentId=xx)};disposeEffect=()=>this.cancel};function wx(){let e=xv(Cx.create).current;return bb(e.disposeEffect),e}var Tx={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Ex={...Tx,position:`fixed`,margin:0,top:0,left:0},Dx={...Tx,position:`absolute`},Ox=W.forwardRef(function(e,t){let[n,r]=W.useState();J(()=>{Ib&&Fb&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,G.jsx)(`span`,{...e,ref:t,style:Ex,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),kx=Math.min,Ax=Math.max,jx=Math.round,Mx=Math.floor,Nx=e=>({x:e,y:e}),Px={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Fx(e,t,n){return Ax(e,kx(t,n))}function Ix(e,t){return typeof e==`function`?e(t):e}function Lx(e){return e.split(`-`)[0]}function Rx(e){return e.split(`-`)[1]}function zx(e){return e===`x`?`y`:`x`}function Bx(e){return e===`y`?`height`:`width`}function Vx(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Hx(e){return zx(Vx(e))}function Ux(e,t,n){n===void 0&&(n=!1);let r=Rx(e),i=Hx(e),a=Bx(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Qx(o)),[o,Qx(o)]}function Wx(e){let t=Qx(e);return[Gx(e),t,Gx(t)]}function Gx(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Kx=[`left`,`right`],qx=[`right`,`left`],Jx=[`top`,`bottom`],Yx=[`bottom`,`top`];function Xx(e,t,n){switch(e){case`top`:case`bottom`:return n?t?qx:Kx:t?Kx:qx;case`left`:case`right`:return t?Jx:Yx;default:return[]}}function Zx(e,t,n,r){let i=Rx(e),a=Xx(Lx(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Gx)))),a}function Qx(e){let t=Lx(e);return Px[t]+e.slice(t.length)}function $x(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function eS(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:$x(e)}function tS(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 nS(e,t){return t<0||t>=e.length}function rS(e,t){return oS(e.current,{disabledIndices:t})}function iS(e,t){return oS(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function aS(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>oS(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:nS(e,u)?-1:u,wrapped:d}}function oS(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&&sS(e,a,r));return a}function sS(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!lS(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function cS(e){return e.visibility===`hidden`||e.visibility===`collapse`}function lS(e,t=e?pv(e):null){return!e||!e.isConnected||!t||cS(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var uS=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function dS(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return tv(n)?n.host:null}function fS(e){for(let t of Array.from(e.children))if(Y_(t)===`summary`)return t;return null}function pS(e,t){let n=fS(t);return!!n&&(e===n||Y(n,e))}function mS(e){let t=e?Y_(e):``;return e!=null&&e.matches(uS)&&(t!==`summary`||e.parentElement!=null&&Y_(e.parentElement)===`details`&&fS(e.parentElement)===e)&&(t!==`details`||fS(e)==null)&&(t!==`input`||e.type!==`hidden`)}function hS(e){if(!mS(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=dS(t)){let n=t!==e,r=Y_(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Y_(t)===`details`&&!t.open&&!pS(e,t)||t.hasAttribute(`hidden`)||!r&&!gS(t,n))return!1}return!0}function gS(e,t){let n=pv(e);return t?n.display!==`none`:lS(e,n)}function _S(e){let t=e.tabIndex;if(t<0){let t=Y_(e);if(t===`details`||t===`audio`||t===`video`||ev(e)&&e.isContentEditable)return 0}return t}function vS(e){if(Y_(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function yS(e,t){let n=vS(e);if(!n)return!0;let r=t.find(e=>{let t=vS(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=vS(e);return t?.name===n.name&&t.form===n.form})===n}function bS(e){if(ev(e)&&Y_(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return ev(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function xS(e,t){bS(e).forEach(e=>{mS(e)&&t.push(e),xS(e,t)})}function SS(e,t,n){bS(e).forEach(e=>{ev(e)&&e.matches(t)&&n.push(e),SS(e,t,n)})}function CS(e){return hS(e)&&_S(e)>=0}function wS(e){let t=[];return xS(e,t),t.filter(hS)}function TS(e){let t=wS(e);return t.filter(e=>_S(e)>=0&&yS(e,t))}function ES(e,t){let n=TS(e),r=n.length;if(r===0)return;let i=Wb(Kv(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function DS(e){return ES(Kv(e).body,1)||e}function OS(e){return ES(Kv(e).body,-1)||e}function kS(e,t,n){if(!e)return null;let r=[];xS(Kv(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(hS);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Y(n,o)&&CS(o)&&yS(o,a))return o}return r[i]}function AS(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Y(n,r)}function jS(e){TS(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function MS(e){let t=[];SS(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function NS(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...NS(e,t.id,n)])}function PS(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 FS(e){return`data-base-ui-${e}`}var IS=0;function LS(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(IS);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),oy;let o=requestAnimationFrame(a);return IS=o,()=>{IS===o&&(cancelAnimationFrame(o),IS=0)}}var RS=`data-base-ui-inert`,zS=new WeakMap,BS=new WeakSet,VS=new WeakMap,HS=0;function US(e){return e?tv(e)?e.host:US(e.parentNode):null}var WS=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=US(t);return e.contains(n)?n:null}).filter(e=>e!=null),GS=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},KS=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{Y_(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function qS(e,t,n,{mark:r=!0}){let i=WS(t,e),a=r?KS(t,GS(i),new Set(i)):[],o=[],s=[];if(n){let e=WS(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);KS(t,GS(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(zS.get(e)||0)+1;zS.set(e,r),o.push(e),r===1&&n&&BS.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(VS.get(e)||0)+1;VS.set(e,t),s.push(e),t===1&&e.setAttribute(RS,``)}),HS+=1,()=>{o.forEach(e=>{let t=(zS.get(e)||0)-1;zS.set(e,t),t||(BS.has(e)||e.removeAttribute(`aria-hidden`),BS.delete(e))}),r&&s.forEach(e=>{let t=(VS.get(e)||0)-1;VS.set(e,t),t||e.removeAttribute(RS)}),--HS,HS||(zS=new WeakMap,BS=new WeakSet,VS=new WeakMap)}}function JS(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=Kv(e[0]).body;return qS(e,i,n,{mark:r})}var YS={style:{transition:`none`}},XS={fallbackAxisSide:`none`},ZS={fallbackAxisSide:`end`},QS={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},$S=t(Qe(),1),eC=W.createContext(null),tC=()=>W.useContext(eC),nC=FS(`portal`);function rC(e={}){let{ref:t,container:n,componentProps:r=cy,elementProps:i}=e,a=vb(),o=tC()?.portalNode,[s,c]=W.useState(null),[l,u]=W.useState(null),d=q(e=>{e!==null&&u(e)}),f=W.useRef(null);J(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(Q_(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=fy(`div`,r,{ref:[t,d],props:[{id:a,[nC]:``},i]}),m=s&&p?$S.createPortal(p,s):null;return{node:l,nodeId:W.isValidElement(p)?p.props.id:void 0,subtree:m}}var iC=W.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}=rC({container:o,ref:t,componentProps:e,elementProps:c}),f=W.useRef(null),p=W.useRef(null),m=W.useRef(null),h=W.useRef(null),[g,_]=W.useState(null),v=W.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;W.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&AS(e)&&(e.type===`focusin`?v.current&&=(MS(l),!1):(jS(l),v.current=!0))}return vx(_x(l,`focusin`,e,!0),_x(l,`focusout`,e,!0))},[l,y]),J(()=>{l&&b===!0&&v.current&&(MS(l),v.current=!1)},[b,l]);let S=W.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,G.jsxs)(W.Fragment,{children:[d,(0,G.jsxs)(eC.Provider,{value:S,children:[x&&l&&(0,G.jsx)(Ox,{"data-type":`outside`,ref:f,onFocus:e=>{AS(e,l)?m.current?.focus():OS(g?g.domReference:null)?.focus()}}),x&&l&&(0,G.jsx)(`span`,{role:s,"aria-owns":u,style:QS}),l&&$S.createPortal(a,l),x&&l&&(0,G.jsx)(Ox,{"data-type":`outside`,ref:p,onFocus:e=>{AS(e,l)?h.current?.focus():(DS(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Wy(`focus-out`,e.nativeEvent)))}})]})]})});function aC(){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 oC=class{nodesRef={current:[]};events=aC();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)}},sC=W.createContext(null),cC=W.createContext(null),lC=()=>W.useContext(sC)?.id||null,uC=e=>{let t=W.useContext(cC);return e??t};function dC(e){let t=vb(),n=uC(e),r=lC();return J(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function fC(e){let{children:t,id:n}=e,r=lC();return(0,G.jsx)(sC.Provider,{value:W.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function pC(e){let{children:t,externalTree:n}=e,r=xv(()=>n??new oC).current;return(0,G.jsx)(cC.Provider,{value:r,children:t})}function mC(e){return e==null?e:`current`in e?e.current:e}function hC(e,t){let n=X_(Kb(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(Bb(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var gC=20,_C=[];function vC(){_C=_C.filter(e=>e.deref()?.isConnected)}function yC(e){vC(),e&&Y_(e)!==`body`&&(_C.push(new WeakRef(e)),_C.length>gC&&(_C=_C.slice(-20)))}function bC(){return vC(),_C[_C.length-1]?.deref()}function xC(e){return e?CS(e)?e:TS(e)[0]||e:null}function SC(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=wS(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return CS(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 CC(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=q(()=>b.current.floatingContext?.nodeId),S=i===!1,C=ax(_)&&S,w=yx(i),T=yx(a),E=yx(o),D=yx(u),O=yx(g),k=uC(m),A=tC(),j=W.useRef(!1),M=W.useRef(!1),N=W.useRef(!1),P=W.useRef(null),F=W.useRef(``),I=W.useRef(``),L=W.useRef(null),R=W.useRef(null),z=Zv(L,p,A?.beforeInsideRef),B=Zv(R,A?.afterInsideRef),V=Cb(),H=Cb(),ee=wx(),te=A!=null,ne=sx(v),re=q((e=ne)=>e?TS(e):[]),ie=q(()=>h?.().filter(e=>e!=null)??[]);W.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Y(ne,Wb(Kv(ne)))&&re().length===0&&!C&&Rb(e)}return _x(Kv(ne),`keydown`,e)},[r,ne,c,C,re]),W.useEffect(()=>{if(r||!g)return;let e=Kv(ne);function t(){N.current=!1}function n(e){let t=Kb(e),n=ie(),r=Y(v,t)||Y(_,t)||Y(A?.portalNode,t)||n.some(e=>e===t||Y(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,Gb(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,H.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return vx(_x(e,`pointerdown`,n,!0),_x(e,`pointerup`,t,!0),_x(e,`pointercancel`,t,!0),_x(e,`keydown`,i,!0),t)},[r,v,_,ne,g,A,H,ie]),W.useEffect(()=>{if(r||!l)return;let e=Kv(ne);function n(){M.current=!0,H.start(0,()=>{M.current=!1})}function i(e){let t=Kb(e);CS(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=Kb(n);c&&r==null&&a!=null&&Y(v,a)&&yC(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ie(),p=r?.hasAttribute(FS(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,mC(f),mC(d)].includes(r),m=!(Y(_,r)||Y(v,r)||Y(r,v)||Y(A?.portalNode,r)||u.some(e=>e===r||Y(e,r))||l.hasMatchingElement(e=>Y(e,r))||p||k&&(NS(k.nodesRef.current,o).find(e=>Y(e.context?.elements.floating,r)||Y(e.context?.elements.domReference,r))||PS(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,sx(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&ne&&SC(ne),s&&i!==_&&!lS(a)&&Wb(e)===e.body){if(ev(ne)&&(ne.focus(),s===`popup`)){ee.request(()=>{ne.focus()});return}let e=re(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ne;ev(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!c)&&r&&m&&!M.current&&(C||r!==bC())&&(j.current=!0,t.setOpen(!1,Wy(tb,n)))})}function o(){N.current||(b.current.insideReactTree=!0,V.start(0,()=>{b.current.insideReactTree=!1}))}let u=ev(_)?_:null;if(v||u)return vx(u&&_x(u,`focusout`,a),u&&_x(u,`pointerdown`,n),v&&_x(v,`focusin`,i),v&&_x(v,`focusout`,a),v&&A&&_x(v,`focusout`,o,!0))},[r,_,v,ne,c,k,A,t,l,s,re,C,x,b,V,H,ee,d,f,ie]),W.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${FS(`portal`)}]`)||[]),t=(k?PS(k.nodesRef.current,x()):[]).find(e=>ax(e.context?.elements.domReference||null))?.context?.elements.domReference,n=JS([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ie(),t,mC(f),mC(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=JS([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ie]),J(()=>{if(!g||r||!ev(ne))return;F.current=``,I.current=``;let e=Kv(ne),t=Wb(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||Y(ne,t))return;let i=null,a=()=>(i??=re(ne),i[0]||ne),o;o=r===!0||r===null?a():mC(r),o||=a();let s=Y(ne,Wb(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&Bb(c);LS(o,{sync:l,preventScroll:o===ne,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=Wb(e);return!(t!==o&&Y(ne,t))}})})},[r,g,ne,re,w,D,O,b]);let ae=W.useRef(null);J(()=>{if(r||!ne){ae.current=null;return}ae.current&&=(ae.current.cancelled=!0,null);let e=Kv(ne),t=Wb(e),n=D.current==null;yC(t);function i(e){if(e.open||(F.current=hC(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(FS(`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(Bb(e.nativeEvent)||Vb(e.nativeEvent))j.current=!1;else{let e=!1;Kv(ne).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&&Y_(t)!==`body`?t:null,s=n?o||a:a||o;return s||=bC()||null,typeof i==`boolean`?s:mC(i)||s||null}return()=>{y.off(`openchange`,i);let t=Wb(e),n=ie(),r=Y(v,t)||n.some(e=>e===t||Y(e,t))||k&&NS(k.nodesRef.current,x(),!1).some(e=>Y(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ae.current=l,queueMicrotask(()=>{ae.current===l&&(ae.current=null);let n=xC(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&ev(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,ne,T,E,D,y,k,_,x,ie]),J(()=>{if(!Fb||g||!v)return;let e=Wb(Kv(v));ev(e)&&rx(e)&&Y(v,e)&&e.blur()},[g,v]),J(()=>{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,_]),J(()=>{if(!r&&ne)return SC(ne),()=>{queueMicrotask(vC)}},[r,ne]);let U=!r&&(!c||!C)&&(te||c);return(0,G.jsxs)(W.Fragment,{children:[U&&(0,G.jsx)(Ox,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=re();LS(e[e.length-1])}else A?.portalNode&&(j.current=!1,AS(e,A.portalNode)?DS(_)?.focus():mC(f??A.beforeOutsideRef)?.focus())}}),n,U&&(0,G.jsx)(Ox,{"data-type":`inside`,ref:B,onFocus:e=>{c?LS(re()[0]):A?.portalNode&&(l&&(j.current=!0),AS(e,A.portalNode)?OS(_)?.focus():mC(d??A.afterOutsideRef)?.focus())}})]})}function wC(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=qy}=t,l=e.context.dataRef,u=W.useRef(void 0),d=wx(),f=Cb(),p=W.useMemo(()=>{function t(t,n,r,i){let a=Wy(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=Hb(e.pointerType,!0)&&Vb(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||Hb(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=Kb(s),p=rx(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;r===`mousedown`&&o?u.current=void 0:Hb(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 W.useMemo(()=>n?{reference:p}:cy,[n,p])}function TC(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,(!i||c)&&(d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function EC(e){return e!=null&&e.clientX!=null}function DC(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=e.useState(`open`),a=e.useState(`floatingElement`),o=e.useState(`domReferenceElement`),s=e.context.dataRef,c=W.useRef(!1),l=W.useRef(null),[u,d]=W.useState(),[f,p]=W.useState([]),m=q(t=>{e.set(`positionReference`,t)}),h=q((t,n,i)=>{c.current||(!s.current.openEvent||EC(s.current.openEvent))&&e.set(`positionReference`,TC(i??o,{x:t,y:n,axis:r,dataRef:s,pointerType:u}))}),g=q(e=>{i?l.current||(h(e.clientX,e.clientY,e.currentTarget),p([])):h(e.clientX,e.clientY,e.currentTarget)}),_=Hb(u)?a:i;W.useEffect(()=>{if(!n){m(o);return}if(!_)return;function e(){l.current?.(),l.current=null}let t=X_(a);function r(t){let n=Kb(t);Y(a,n)?e():h(t.clientX,t.clientY)}return!s.current.openEvent||EC(s.current.openEvent)?l.current=_x(t,`mousemove`,r):m(o),e},[_,n,a,s,o,e,h,m,f]),W.useEffect(()=>()=>{e.set(`positionReference`,null)},[e]),W.useEffect(()=>{n&&!a&&(c.current=!1)},[n,a]),W.useEffect(()=>{!n&&i&&(c.current=!0)},[n,i]);let v=W.useMemo(()=>{function e(e){d(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return W.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function OC(){return!1}function kC(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function AC(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=OC,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=uC(c),m=q(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=q(()=>a),{escapeKey:v,outsidePress:y}=kC(s),b=W.useRef(!1),x=W.useRef(!1),S=W.useRef(!1),C=W.useRef(!1),w=W.useRef(!1),T=W.useRef(``),E=W.useRef(null),D=Cb(),O=Cb(),k=Cb(),A=q(()=>{O.clear(),d.current.insideReactTree=!1}),j=q(e=>{let t=d.current.floatingContext?.nodeId;return(p?NS(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=q(t=>tx(t,e.select(`floatingElement`))||tx(t,e.select(`domReferenceElement`))),N=q(t=>{o()&&e.setOpen(!1,Wy(qy,t.nativeEvent))}),P=q(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=zb(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=Wy(nb,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=q(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=q(t=>{if(!l||!n||t.button!==0)return;let r=Kb(t.nativeEvent);Y(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=q(e=>{l&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});W.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),W.useEffect(()=>A,[A]),W.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 Sb,i=Kv(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(Fb?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&&NS(p.nodesRef.current,t).some(t=>tx(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=Kb(n),i=`[${FS(`inert`)}]`,a=$_(r)?r.getRootNode():null,o=Array.from((tv(a)?a:Kv(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Y(e,r))))return;let c=$_(r)?r:null;for(;c&&!fv(c);){let e=hv(c);if(fv(e)||!$_(e))break;c=e}if(!(o.length&&$_(r)&&!nx(r)&&!Y(r,e.select(`floatingElement`))&&o.every(e=>!Y(c,e)))){if(ev(r)&&!(`touches`in n)){let e=fv(r),t=pv(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&&!Bb(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,Wy(Xy,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=Kb(e);if(!n)return;let r=_x(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 B(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;c(),f()===`intentional`&&(e.type===`pointercancel`?n&&s():O(e)||(n?s():(typeof h!=`function`||h(e))&&(t.clear(),S.current=!0,A())))}function V(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 H(e){L(e,V)}function ee(e){f()===`sloppy`&&E.current&&!M(e)&&(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function te(e){L(e,ee)}let ne=vx(r&&vx(_x(i,`keydown`,P),_x(i,`compositionstart`,a),_x(i,`compositionend`,o)),g&&vx(_x(i,`click`,z,!0),_x(i,`pointerdown`,z,!0),_x(i,`pointerup`,B,!0),_x(i,`pointercancel`,B,!0),_x(i,`mousedown`,z,!0),_x(i,`mouseup`,B,!0),_x(i,`touchstart`,R,{capture:!0,passive:!0}),_x(i,`touchmove`,H,{capture:!0,passive:!0}),_x(i,`touchend`,te,{capture:!0,passive:!0})));return()=>{ne(),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=W.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=W.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 W.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}var jC=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(Hv(99,this.componentName,e,this.componentName));t.setOpen(!0,Wy(fb,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,Wy(fb))}};function MC(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),J(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};$_(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 NC(e,t=!1,n=!1,r=!1){let[i,a]=W.useState(e&&t?`idle`:void 0),[o,s]=W.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),J(()=>{if(!e&&o&&i!==`ending`&&n){let e=Cx.request(()=>{a(`ending`)});return()=>{Cx.cancel(e)}}},[e,o,i,n]),J(()=>{if(!e||t||i===void 0)return;let n=Cx.request(()=>{a(void 0)});return()=>{Cx.cancel(n)}},[t,e,i]),J(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Cx.request(()=>{a(`idle`)});return()=>{Cx.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function PC(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var FC=null;function IC(e){if(!FC){let e=[];FC=e,queueMicrotask(()=>{FC=null,$S.flushSync(()=>{for(let t of e)t()})})}FC.push(e)}function LC(e,t=!1,n=!1){let r=wx();return q((i,a=null)=>{r.cancel();let o=mC(e);if(o==null)return;let s=o,c=()=>{n?IC(()=>{a?.aborted||i()}):$S.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(PC(s).map(e=>e.finished.then(oy))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(PC(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=wy;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})}else r.request(l)})}function RC(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=q(a),s=LC(r,n,i);W.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function zC(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=q(i),{mounted:c,setMounted:l,transitionStatus:u}=NC(t,!1,!1,o),d=!t&&r;J(()=>{t&&s(!1)},[t,s]);let f=W.useRef(c),p=W.useRef(!1),m=mb(),h=()=>{f.current=!1,l(!1),a()};J(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=q(()=>{f.current&&(t?(p.current=!0,m()):h())});return RC({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var BC={tabIndex:-1,[qb]:``};function VC(e){return t=>t!==`touch`||e.current}function HC(e,t=!1){let n=vb(),r=lC()!=null,i=xv(()=>e(n,r)).current;return MC({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function UC({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function WC(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function GC(e,t){let n=W.useRef(null);return q(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),WC(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),WC(t))})}function KC(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 qC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function JC(e,t,n,r={}){let i=n.reason,a=i===Jy,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=qC(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=KC(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?$S.flushSync(l):l()}function YC(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=GC(e,n),o=q(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=q(e=>{a(e),e&&o(e)});return J(()=>(s(t.current),()=>s(null)),[s,t,n,e]),J(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function XC(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=W.useRef(null),i=e.useState(`open`);J(()=>{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=Wy(Ky);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 ZC(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=zC({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 xv(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function QC(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:cy,inactiveTriggerProps:cy,popupProps:cy})},[e])}function $C(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var ew=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}},tw=[],nw=void 0;function rw(){return nw}function iw(e){tw.push(e)}function aw(e){let t=(t,n)=>{let r=xv(sw).current,i;try{nw=r;for(let e of tw)e.before(r);i=e(t,n);for(let e of tw)e.after(r);r.didInitialize=!0}finally{nw=void 0}return i};return t.displayName=e.displayName||e.name,t}function ow(e){return W.forwardRef(aw(e))}function sw(){return{didInitialize:!1}}var cw=ce(),lw=r(),uw=iy(19)?pw:mw;function dw(e,t,n,r,i){return uw(e,t,n,r,i)}function fw(e,t,n,r,i){let a=W.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,cw.useSyncExternalStore)(e.subscribe,a,a)}iw({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,cw.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pw(e,t,n,r,i){let a=rw();if(!a)return fw(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 mw(e,t,n,r,i){return(0,lw.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var hw=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 dw(this,e,t,n,r)}},gw=class extends hw{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){W.useDebugValue(e);let n=this;J(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;J(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;J(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){W.useDebugValue(e);let n=this,r=t!==void 0;J(()=>{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 W.useDebugValue(e),dw(this,this.selectors[e],t,n,r)}useContextCallback(e,t){W.useDebugValue(e);let n=q(t??oy);this.context[e]=n}useStateSetter(e){let t=W.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)}})}},_w={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},vw=class extends gw{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:aC(),nested:n,triggerElements:i},_w),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Ub(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)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function yw(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new vw({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:cy,inactiveTriggerProps:cy,popupProps:cy}}var bw=e=>e.triggerIdProp??e.activeTriggerId,xw=e=>e.openProp??e.open,Sw=e=>(e.popupElement?.id??e.floatingId)||void 0;function Cw(e,t){return t!==void 0&&xw(e)&&bw(e)===t}function ww(e,t){return Cw(e,t)?!0:t!==void 0&&xw(e)&&bw(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var Tw={open:xw,mounted:e=>e.mounted,transitionStatus:e=>xw(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:bw,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Sw,isTriggerActive:(e,t)=>t!==void 0&&bw(e)===t,isOpenedByTrigger:(e,t)=>Cw(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&bw(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ww(e,t)?Sw(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Ew(e){let t=W.useCallback(t=>e===void 0?oy:e.subscribeStore(t),[e]),n=W.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,cw.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Dw(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=vb(),a=lC()!=null,o=xv(()=>new vw({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ew,floatingId:i,syncOnly:!1,nested:a})).current;return J(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=$_(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Ow=Nb&&Fb;function kw(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=W.useRef(!1),s=W.useRef(null),c=W.useRef(!0),l=Cb();W.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=X_(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&ev(t)&&t===Wb(Kv(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return vx(_x(r,`blur`,i),Ow&&_x(r,`keydown`,a,!0),Ow&&_x(r,`pointerdown`,l,!0))},[e,n]),W.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);$_(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=W.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=Kb(n.nativeEvent);if($_(a)){if(Ow&&!n.relatedTarget){if(!c.current&&!rx(a))return}else if(!ox(a))return}let u=ex(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;e.select(`open`)&&u||!r?e.setOpen(!0,Wy(Yy,d,f)):l.start(r,()=>{o.current||e.setOpen(!0,Wy(Yy,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=$_(r)&&r.hasAttribute(FS(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=Wb(Kv(t));!r&&n===t||Y(a.current.floatingContext?.refs.floating.current,n)||Y(t,n)||o||ex(r??n,e.context.triggerElements)||e.setOpen(!1,Wy(Yy,i))})}}},[a,r,e,l]);return W.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var Aw=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new Sb;restTimeout=new Sb;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},jw=new WeakMap;function Mw(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&jw.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),jw.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Nw(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=jw.get(n);a&&a!==e&&Mw(a),Mw(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,jw.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Pw(e){let t=e.context.dataRef.current,n=xv(()=>t.hoverInteractionState??Aw.create()).current;return t.hoverInteractionState||=n,bb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Fw(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=uC(),u=lC(),d=Pw(e),f=Cb(),p=q(()=>dx(c.current.openEvent?.type,d.interactedInside)),m=q(()=>fx(c.current.openEvent?.type)),h=q(()=>{Mw(d)});J(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),W.useEffect(()=>h,[h]),J(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&$_(s)&&o){let e=s,t=o,n=Kv(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??Gb(e,`[data-rootownerid]`)??n.body;return Nw(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),W.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&NS(l.nodesRef.current,u).length>0)}function a(t){let n=lx(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,Wy(Jy,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=Kb(e);ix(t)?d.interactedInside=Gb(t,`[aria-haspopup]`)!=null:d.interactedInside=!1}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(ex(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;l&&r&&$_(o)&&NS(l.nodesRef.current,r,!1).some(e=>Y(e.context?.elements.floating,o))||(d.handler?d.handler(n):(h(),m()&&!p()&&a(n)))}function v(n){l&&u&&!t()&&f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,Wy(Jy,n)),l.events.emit(`floating.closed`,n)})}let y=o;return vx(y&&_x(y,`mouseenter`,g),y&&_x(y,`mouseleave`,_),y&&_x(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var Iw={current:null};function Lw(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Iw,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=uC(l),v=Pw(e),y=W.useRef(!1),b=yx(i),x=yx(r),S=yx(o),C=yx(n),w=yx(p),T=yx(f),E=q(()=>dx(h.current.openEvent?.type,v.interactedInside)),D=q(()=>w.current?.()!==!1),O=q((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!Y(t,n);if(!$_(r))return!1;let a=r;return i.hasMatchingElement(e=>Y(e,a))&&(!t||!Y(t,a))}),k=q(()=>{v.handler&&=(Kv(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=q(()=>{Mw(v)});return u&&(v.handleCloseOptions=i?.__options),W.useEffect(()=>k,[k]),W.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===Jy,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]),W.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=lx(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,Wy(Jy,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,Wy(Jy,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!$_(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Hb(v.pointerType))return;let n=ux(S.current),r=lx(x.current,`open`,v.pointerType),i=Kb(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if($_(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Y(t,i)){c=t;break}}$_(o)&&$_(s)&&!e.context.triggerElements.hasElement(o)&&Y(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&&$_(c)&&$_(s)&&Y(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;h?D()&&e.setOpen(!0,Wy(Jy,t,c)):m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,Wy(Jy,t,c))}):g&&D()&&e.setOpen(!0,Wy(Jy,t,c)))}function o(n){if(E()){A();return}k();let r=Kv(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!ex(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)}else v.pointerType===`touch`&&Y(e.select(`floatingElement`),n.relatedTarget)||t(n)}}function l(e){Y(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?_x(r,`mouseout`,l):void 0;return s?vx(_x(r,`mousemove`,i,{once:!0}),_x(r,`mouseenter`,i),_x(r,`mouseleave`,o),f):vx(_x(r,`mouseenter`,i),_x(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),W.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&&!Hb(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;Nw(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=ux(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,Wy(Jy,n,r))}v.pointerType===`touch`?$S.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function Rw(e){return Fb&&e.movementX===0&&e.movementY===0}function zw(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Bw(e,t){return zw(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Vw(e,t,n){return zw(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Hw(e,t,n){return zw(t,n?e===Yb:e===Xb,e===Qb)}function Uw(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:zw(t,n?e===Xb:e===Yb,e===Zb)}function Ww(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=sx(E),A=ax(D),j=yx(k),M=lC(),N=uC(x),P=W.useRef(f),F=W.useRef(o??-1),I=W.useRef(null),L=W.useRef(!0),R=q(e=>{i(F.current===-1?null:F.current,e)}),z=W.useRef(!!E),B=W.useRef(T),V=W.useRef(!1),H=W.useRef(!1),ee=W.useRef(null),te=yx(h),ne=yx(T),re=yx(o),ie=yx(b),ae=wx(),U=wx(),oe=q(()=>{ae.cancel();function e(e){d||(ee.current=LS(e,{sync:V.current,preventScroll:!0}))}let t=n.current[F.current],r=H.current;t&&e(t),(V.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),fe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});J(()=>{O.current.orientation=g},[O,g]),J(()=>{T||(I.current=null),T&&f===`auto`||(P.current=f)},[T,f]),J(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(H.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),J(()=>{if(a){if(!T)V.current=!1;else if(E){if(r==null){if(V.current=!1,re.current!=null)return;if(z.current&&(F.current=-1,oe()),(!B.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=>U.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||Vw(I.current,_,u)||l?rS(n):iS(n),I.current=null,R())};t()}}else nS(n.current,r)||(F.current=r,oe(),H.current=!1)}}},[a,T,E,r,re,l,n,_,u,R,oe,U]),J(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Wb(Kv(D??t??null)),r=e.some(e=>e.context&&Y(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),J(()=>{B.current=T,z.current=!!E});let se=r!=null,ce=q(e=>{if(!ne.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),le=q(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ue=q(()=>rS(n,te.current)),de=q(t=>{if(L.current=!1,V.current=!0,t.which===229||!ne.current&&t.currentTarget===j.current)return;if(l&&Uw(t.key,g,u,w)){Bw(t.key,le())||Rb(t),e.setOpen(!1,Wy(rb,t.nativeEvent));let n=S?.current??D;ev(n)&&n.focus();return}r!=null&&r!==F.current&&!nS(n.current,r)&&(F.current=r);let i=F.current,a=rS(n,h),o=iS(n,h);if(A||(t.key===`Home`&&(Rb(t),F.current=a,R(t)),t.key===`End`&&(Rb(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(Bw(t.key,g)){Rb(t);let e=Wb(t.currentTarget.ownerDocument);if(T&&!d&&Y(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Y(t,e))){F.current=Vw(t.key,g,u)?a:o,R(t),r===F.current&&oe();return}let{index:l,wrapped:f}=aS(n.current,i,{decrement:!Vw(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(V.current=!1),F.current=l,R(t)}}),fe=W.useMemo(()=>({onFocus(e){V.current=!0,ce(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){Rw(e)||(V.current=!0,H.current=!1,p&&ce(e))},onPointerLeave(e){if(!ne.current||!L.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ie.current&&(ee.current?.(),ee.current=null,F.current=-1,R(e),!d)){let e=j.current,t=Wb(Kv(e));e&&Y(e,t)&&e.focus({preventScroll:!0})}}}),[ce,ne,j,p,n,R,ie,d]),pe=W.useMemo(()=>d&&T&&se&&{"aria-activedescendant":`${y}-${r}`},[d,T,se,y,r]),me=W.useMemo(()=>({...A?{}:pe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=Kb(t.nativeEvent);if(n&&!Y(j.current,n))return;Rb(t);let r=Wy(tb,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&ev(i)&&i.focus()}else de(t)},onPointerMove(e){Rw(e)||(L.current=!0)}}),[pe,de,j,A,e,T,d,D,S]),he=W.useMemo(()=>{function t(t){e.setOpen(!0,Wy(rb,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&Bb(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&Vb(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=Hw(n.key,le(),u),o=Bw(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||rx(n.currentTarget)))return de(n);if(r||m||!i){if(s){let e=Bw(n.key,le());I.current=l&&e?null:n.key}l?a&&(Rb(n),r?(F.current=ue(),R(n),d&&j.current?.focus()):t(n)):o&&(re.current!=null&&(F.current=re.current),Rb(n),!r&&m?t(n):de(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}},[de,f,ue,l,R,e,m,g,_,le,u,re,d,j]),ge=W.useMemo(()=>({...pe,...he}),[pe,he]);return W.useMemo(()=>a?{reference:ge,floating:me,item:fe,trigger:he}:{},[a,ge,me,he,fe])}function Gw(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=q(s),f=e.useState(`open`),p=Cb(),m=W.useRef(``),h=W.useRef(u??i??-1),g=W.useRef(null),_=q(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!lS(n)||n?.matches(`:disabled`)?!1:o==null||!sS(sy,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===` `&&(Rb(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!==` `&&(Rb(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=q(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);Y(r,n)||Y(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});J(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=W.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return W.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var Kw=.1,qw=Kw*Kw,Jw=.5;function Yw(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Xw(e,t,n,r,i,a,o,s,c,l){let u=!1;return Yw(e,t,n,r,i,a)&&(u=!u),Yw(e,t,i,a,o,s)&&(u=!u),Yw(e,t,o,s,c,l)&&(u=!u),Yw(e,t,c,l,n,r)&&(u=!u),u}function Zw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Qw(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 $w(e={}){let{blockPointerEvents:t=!1}=e,n=new Sb,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*qw;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=Kb(r),g=r.type===`mouseleave`,_=Y(u,h),v=Y(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&$_(r.relatedTarget)&&Y(u,r.relatedTarget))return;function y(){return!!(s&&NS(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=Qw(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Qw(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Qw(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Qw(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Zw(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Jw/2:Jw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Jw+1,o=C||T?S.bottom-Jw:S.top,s=C?T?S.bottom-Jw:S.top:S.bottom-Jw;M=Xw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Jw/2:Jw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Jw,o=C||T?S.top+Jw:S.bottom,s=C?T?S.top+Jw:S.bottom:S.top+Jw;M=Xw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Jw/2:Jw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Jw+1,o=w||E?S.right-Jw:S.left,s=w?E?S.right-Jw:S.left:S.right-Jw;M=Xw(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Jw/2:Jw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Jw,o=w||E?S.left+Jw:S.right,s=w?E?S.left+Jw:S.right:S.left+Jw;M=Xw(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 eT(e,t,n){let{reference:r,floating:i}=e,a=Vx(t),o=Hx(t),s=Bx(o),c=Lx(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=Rx(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function tT(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}=Ix(t,e),p=eS(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=tS(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=tS(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 nT=50,rT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:tT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=eT(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<nT&&(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}=eT(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},iT=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}=Ix(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Lx(r),_=Vx(o),v=Lx(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Qx(o)]:Wx(o)),x=p!==`none`;!d&&x&&b.push(...Zx(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=Ux(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`||_===Vx(t)||T.every(e=>Vx(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=Vx(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{}}}},aT=new Set([`left`,`top`]);async function oT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Lx(n),s=Rx(n),c=Vx(n)===`y`,l=aT.has(o)?-1:1,u=a&&c?-1:1,d=Ix(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 sT=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 oT(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}}}}},cT=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}=Ix(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Vx(i),p=zx(f),m=u[p],h=u[f],g=(e,t)=>Fx(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}}}}}},lT=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}=Ix(e,t),u={x:n,y:r},d=Vx(i),f=zx(d),p=u[f],m=u[d],h=Ix(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=aT.has(Lx(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}}}},uT=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}=Ix(e,t),c=await i.detectOverflow(t,s),l=Lx(n),u=Rx(n),d=Vx(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=kx(p-c[m],g),y=kx(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*Ax(c.left,c.right):S=p-2*Ax(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 dT(e){let t=pv(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ev(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=jx(n)!==a||jx(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fT(e){return $_(e)?e:e.contextElement}function pT(e){let t=fT(e);if(!ev(t))return Nx(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dT(t),o=(a?jx(n.width):n.width)/r,s=(a?jx(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var mT=Nx(0);function hT(e){let t=X_(e);return!dv()||!t.visualViewport?mT:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gT(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===X_(e)}function _T(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fT(e),o=Nx(1);t&&(r?$_(r)&&(o=pT(r)):o=pT(e));let s=gT(a,n,r)?hT(a):Nx(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=X_(a),t=$_(r)?X_(r):r,n=e,i=vv(n);for(;i&&t!==n;){let e=pT(i),t=i.getBoundingClientRect(),r=pv(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=X_(i),i=vv(n)}}return tS({width:u,height:d,x:c,y:l})}function vT(e,t){let n=mv(e).scrollLeft;return t?t.left+n:_T(Z_(e)).left+n}function yT(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vT(e,n),y:n.top+t.scrollTop}}function bT(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Z_(r),s=t?iv(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Nx(1),u=Nx(0),d=ev(r);if((d||!a)&&((Y_(r)!==`body`||nv(o))&&(c=mv(r)),d)){let e=_T(r);l=pT(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yT(o,c):Nx(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 xT(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ST(e){let t=mv(e),n=e.ownerDocument.body,r=Ax(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Ax(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vT(e),o=-t.scrollTop;return pv(n).direction===`rtl`&&(a+=Ax(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var CT=25;function wT(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=X_(e),a=Z_(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!dv()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vT(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<=CT&&(s-=o)}return{width:s,height:c,x:l,y:u}}function TT(e,t){let n=_T(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=pT(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ET(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=wT(e,n,t);else if(t===`document`)r=ST(Z_(e));else if($_(t))r=TT(t,n);else{let n=hT(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return tS(r)}function DT(e,t){let n=t.get(e);if(n)return n;let r=_v(e,[],!1).filter(e=>$_(e)&&Y_(e)!==`body`),i=null,a=pv(e).position===`fixed`,o=a?hv(e):e;for(;$_(o)&&!fv(o);){let e=pv(o),t=lv(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=hv(o)}return t.set(e,r),r}function OT(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?iv(t)?[]:DT(t,this._c):[].concat(n),r],o=ET(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=ET(t,a[e],i);s=Ax(n.top,s),c=kx(n.right,c),l=kx(n.bottom,l),u=Ax(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function kT(e){let{width:t,height:n}=dT(e);return{width:t,height:n}}function AT(e,t,n){let r=ev(t),i=Z_(t),a=n===`fixed`,o=_T(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Nx(0);if((r||!a)&&((Y_(t)!==`body`||nv(i))&&(s=mv(t)),r)){let e=_T(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vT(i));let l=i&&!r&&!a?yT(i,s):Nx(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 jT(e){return pv(e).position===`static`}function MT(e,t){if(!ev(e)||pv(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Z_(e)===n&&(n=n.ownerDocument.body),n}function NT(e,t){let n=X_(e);if(iv(e))return n;if(!ev(e)){let t=hv(e);for(;t&&!fv(t);){if($_(t)&&!jT(t))return t;t=hv(t)}return n}let r=MT(e,t);for(;r&&rv(r)&&jT(r);)r=MT(r,t);return r&&fv(r)&&jT(r)&&!lv(r)?n:r||uv(e)||n}var PT=async function(e){let t=this.getOffsetParent||NT,n=this.getDimensions,r=await n(e.floating);return{reference:AT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function FT(e){return pv(e).direction===`rtl`}var IT={convertOffsetParentRelativeRectToViewportRelativeRect:bT,getDocumentElement:Z_,getClippingRect:OT,getOffsetParent:NT,getElementRects:PT,getClientRects:xT,getDimensions:kT,getScale:pT,isElement:$_,isRTL:FT};function LT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function RT(e,t,n){let r=null,i,a=Z_(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=Mx(d),h=Mx(a.clientWidth-(u+f)),g=Mx(a.clientHeight-(d+p)),_=Mx(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ax(0,kx(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!LT(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=X_(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function zT(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=fT(e),u=i||a?[...l?_v(l):[],...t?_v(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?RT(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?_T(e):null;c&&g();function g(){let t=_T(e);h&&!LT(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 BT=sT,VT=cT,HT=iT,UT=uT,WT=lT,GT=(e,t,n)=>{let r=new Map,i=n??{},a={...IT,...i.platform,_c:r};return rT(e,t,{...i,platform:a})},KT=typeof document<`u`?W.useLayoutEffect:function(){};function qT(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(!qT(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)&&!qT(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function JT(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YT(e,t){let n=JT(e);return Math.round(t*n)/n}function XT(e){let t=W.useRef(e);return KT(()=>{t.current=e}),t}function ZT(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]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=W.useState(r);qT(f,r)||p(r);let[m,h]=W.useState(null),[g,_]=W.useState(null),v=W.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=W.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=W.useRef(null),C=W.useRef(null),w=W.useRef(u),T=c!=null,E=XT(c),D=XT(i),O=XT(l),k=W.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),GT(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!qT(w.current,t)&&(w.current=t,$S.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);KT(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=W.useRef(!1);KT(()=>(A.current=!0,()=>{A.current=!1}),[]),KT(()=>{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=W.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=W.useMemo(()=>({reference:b,floating:x}),[b,x]),N=W.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=YT(M.floating,u.x),r=YT(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...JT(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var QT=(e,t)=>{let n=BT(e);return{name:n.name,fn:n.fn,options:[e,t]}},$T=(e,t)=>{let n=VT(e);return{name:n.name,fn:n.fn,options:[e,t]}},eE=(e,t)=>({fn:WT(e).fn,options:[e,t]}),tE=(e,t)=>{let n=HT(e);return{name:n.name,fn:n.fn,options:[e,t]}},nE=(e,t)=>{let n=UT(e);return{name:n.name,fn:n.fn,options:[e,t]}},rE=W.createContext(void 0);function iE(){let e=W.useContext(rE);if(e===void 0)throw Error(Hv(26));return e}var aE=`ArrowUp`,oE=`ArrowDown`,sE=`ArrowLeft`,cE=`ArrowRight`,lE=new Set([aE,oE,sE,cE,`Home`,`End`]),uE=`Shift`,dE=[uE,`Control`,`Alt`,`Meta`];function fE(e){return ev(e)&&e.tagName===`INPUT`}function pE(e){return!!(fE(e)&&e.selectionStart!=null||ev(e)&&e.tagName===`TEXTAREA`)}function mE(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=hE(e,t,`left`),a=gE(e),o=gE(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=hE(e,t,`top`),r=gE(e),i=gE(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function hE(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function gE(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var _E=`--nested-dialogs`,vE=`data-nested-dialog-open`,yE={...Vy,...Oy,nestedDialogOpen(e){return e?{[vE]:``}:null}},bE=W.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Cy(),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`);iE(),RC({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?VC(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=fy(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...BC,hidden:!m,onKeyDown(e){lE.has(e.key)&&e.stopPropagation()},style:{[_E]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:yE});return(0,G.jsx)(CC,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function xE(e){return iy(19)?e:e?`true`:void 0}var SE=W.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,G.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),CE=W.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Cy(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,G.jsx)(rE.Provider,{value:n,children:(0,G.jsxs)(iC,{ref:t,...r,children:[a&&o===!0&&(0,G.jsx)(SE,{ref:i.context.internalBackdropRef,inert:xE(!s)}),e.children]})}):null}),wE={},TE={},EE=``;function DE(e,t){return nv(e)?e:t}function OE(e,t,n){return/hidden|clip/.test(e.getComputedStyle(DE(t,n)).overflowY)}function kE(e){if(typeof document>`u`)return!1;let t=Kv(e);return X_(t).innerWidth-t.documentElement.clientWidth>0}function AE(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Kv(e),n=t.documentElement,r=t.body,i=DE(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 jE(e){let t=Kv(e),n=t.documentElement,r=t.body,i=DE(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 ME(e){let t=Kv(e),n=t.documentElement,r=t.body,i=X_(n),a=0,o=0,s=!1,c=Cx.create();if(Fb&&(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,wE={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},EE=n.style.scrollBehavior,TE={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=DE(n,r);s=AE(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(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,wE),Object.assign(r.style,TE),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=EE)}function d(){u(),c.request(l)}l();let f=_x(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var NE=new class{lockCount=0;restore=null;timeoutLock=Sb.create();timeoutUnlock=Sb.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=Kv(e),n=t.documentElement,r=t.body,i=X_(n);if(OE(i,n,r)){let t=new i.MutationObserver(()=>{OE(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=Ab||!kE(e);this.restore=a?jE(e):ME(e)}};function PE(e=!0,t=null){J(()=>{if(e)return NE.acquire(t)},[e,t])}function FE({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]=W.useState(0),[d,f]=W.useState(0),p=l===0,m=AC(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=Kb(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Y(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return PE(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(u(t),f(n))}),J(()=>{!r&&!i&&(u(0),f(0))},[r,i]),J(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),QC(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var IE=class extends gw{setState(e){}update(e){}set(e,t){}notifyAll(){}},LE={...Tw,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},RE=class extends gw{constructor(e,t,n){let r=new ew,i=zE(e,r,t,n);super(i,BE(r),LE)}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(KC(this.state,e,t.trigger)))}};function zE(e,t,n,r=!1){return{...yw(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 BE(e){return{popupRef:W.createRef(),backdropRef:W.createRef(),internalBackdropRef:W.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function VE(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=Cy(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=HC((e,t)=>new RE({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`);$C(b,x),XC(b);let{forceUnmount:w}=ZC(x,b);W.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,Wy(fb))}),[w,b]);let T=x||S||u!=null;return(0,G.jsxs)(Sy.Provider,{value:b,children:[u&&(0,G.jsx)(UC,{handle:u,store:b}),T&&(0,G.jsx)(FE,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var HE=aw(function(e){return VE(`dialog`,e)}),UE=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Cy(),c=yb(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),fy(`h2`,e,{ref:t,props:[{id:c},o]})});function WE(e){let t=W.useRef(``),n=W.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:W.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function GE(e,t){let n=W.useRef(e),r=q(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function KE(e,t){let{onClick:n,onPointerDown:r}=WE(q((n,r)=>{(typeof e==`function`?e():e)||t(r||(Ab?`touch`:``))}));return W.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function qE(e){let[t,n]=W.useState(null),r=KE(e,n);return GE(e,t=>{t&&!e&&n(null)}),W.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function JE(e){let t=(0,ko.c)(18),{open:n,onOpenChange:r,title:i,wide:a,children:o}=e,[s,c]=(0,W.useState)(!1),l=n&&!s,u;t[0]===r?u=t[1]:(u=e=>e?r(!0):c(!0),t[0]=r,t[1]=u);let d;t[2]!==s||t[3]!==r?(d=e=>{!e&&s&&r(!1)},t[2]=s,t[3]=r,t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(Uy,{className:`xixxii4 x10a8y8t xa9119d x1spjluv x1hc1fzr x1hw7zpd xiyypsa x19991ni xv3hhg7 x1ya1k7h x6setmy`}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p={0:{className:`xixxii4 x10a8y8t x1bpp3o7 xg7h5cd xfa8aoj xsjcku0 x1xoggjn x1odjw0f x1qhigcl x14fh20 xbg4agz xmkeg23 x1y0btm7 x4s12hp x125ndz9 x1a2a7pz x1g0ag68 x1hc1fzr x1hw7zpd xiyypsa xvvkyix xy54nku x1hoy9cc x6o7n8i xv3hhg7 x1ya1k7h x6setmy`},1:{className:`xixxii4 x10a8y8t x1bpp3o7 xg7h5cd xfa8aoj x1xoggjn x1odjw0f x1qhigcl x14fh20 xbg4agz xmkeg23 x1y0btm7 x4s12hp x125ndz9 x1a2a7pz x1g0ag68 x1hc1fzr x1hw7zpd xiyypsa xvvkyix xy54nku x1hoy9cc x6o7n8i xv3hhg7 x1ya1k7h x6setmy xpn72k7`}},t[6]=p):p=t[6];let m=p[!!a|0],h;t[7]===i?h=t[8]:(h=(0,G.jsx)(UE,{className:`x1ghz6dp x1yztbdb x19u1y1h x1s688f`,children:i}),t[7]=i,t[8]=h);let g;t[9]!==o||t[10]!==m||t[11]!==h?(g=(0,G.jsxs)(CE,{children:[f,(0,G.jsxs)(bE,{...m,children:[h,o]})]}),t[9]=o,t[10]=m,t[11]=h,t[12]=g):g=t[12];let _;return t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==g?(_=(0,G.jsx)(HE,{open:l,onOpenChange:u,onOpenChangeComplete:d,children:g}),t[13]=l,t[14]=u,t[15]=d,t[16]=g,t[17]=_):_=t[17],_}function YE(e){let t=(0,ko.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`div`,{className:`x78zum5 x13a6bvl x167g77z x1sy10c2`,children:n}),t[0]=n,t[1]=r),r}function XE(e){let t=(0,ko.c)(25),{title:n,message:r,confirmLabel:i,busy:a,onConfirm:o,onCancel:s}=e,[c,l]=(0,W.useState)(null),u;t[0]===o?u=t[1]:(u=async()=>{l(null);try{await o()}catch(e){l(q_(e))}},t[0]=o,t[1]=u);let d=u,f;t[2]===s?f=t[3]:(f=e=>!e&&s(),t[2]=s,t[3]=f);let p;t[4]===r?p=t[5]:(p=(0,G.jsx)(`p`,{className:`x1ghz6dp xfifm61 x1evy7pa`,children:r}),t[4]=r,t[5]=p);let m;t[6]===c?m=t[7]:(m=c?(0,G.jsx)(`div`,{role:`alert`,className:`x1jp4ehj xfifm61 xb0vdwp x13faqbe`,children:c}):null,t[6]=c,t[7]=m);let h;t[8]===s?h=t[9]:(h=(0,G.jsx)(xy,{onClick:s,children:`Cancel`}),t[8]=s,t[9]=h);let g;t[10]===d?g=t[11]:(g=()=>void d(),t[10]=d,t[11]=g);let _;t[12]!==a||t[13]!==i||t[14]!==g?(_=(0,G.jsx)(xy,{variant:`danger`,disabled:a,onClick:g,children:i}),t[12]=a,t[13]=i,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==h||t[17]!==_?(v=(0,G.jsxs)(YE,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==f||t[20]!==p||t[21]!==m||t[22]!==v||t[23]!==n?(y=(0,G.jsxs)(JE,{open:!0,onOpenChange:f,title:n,children:[p,m,v]}),t[19]=f,t[20]=p,t[21]=m,t[22]=v,t[23]=n,t[24]=y):y=t[24],y}var ZE=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 QE(e,t){return new ZE(e,t).maybeExecute}var $E=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=()=>{this.#c<this.#l?(this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{})):(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);else 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`);else 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());else 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)}},eD=new class extends $E{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function tD(e,t){return typeof e==`function`?e(t):e}function nD(e,t){return uD(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function rD(e,t,n){let r=uD(t);function i(e){if(!r.length)return tD(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 iD(e,t){let n=uD(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 aD=46,oD=91,sD=93,cD=48,lD=57;function uD(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)===oD),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===aD||s===oD||s===sD){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==cD),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!==sD&&(a!==-1||s!==sD)&&(a!==s||s!==aD&&s!==oD)&&n.push(``);r=o+1,i=!0}else(s<cD||s>lD)&&(i=!1);a=s}return n.length||n.push(``),n}function dD(e){return!(Array.isArray(e)&&e.length===0)}function fD(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 pD(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 mD=e=>!!e&&typeof e==`object`&&`fields`in e;function hD(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)||!hD(e[i],t[i]))return!1;return!0}var gD=({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},_D=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function vD(e,t){return e==null?t:{...e,...t}}for(var yD=256,bD=[],xD;yD--;)bD[yD]=(yD+256).toString(16).substring(1);function SD(){let e=0,t,n=``;if(!xD||yD+16>256){for(xD=Array(256),e=256;e--;)xD[e]=256*Math.random()|0;e=0,yD=0}for(;e<16;e++)t=xD[yD+e],n+=e===6?bD[t&15|64]:e===8?bD[t&63|128]:bD[t],e&1&&e>1&&e<11&&(n+=`-`);return yD++,n}var CD=QE(e=>eD.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function wD(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]=wD(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,wD(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(wD(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=wD(e[n]));return t}function TD(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var ED=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 DD(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 OD=(e,t)=>{let n=DD(e,t);return{form:n,fields:n}},kD={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:OD(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:OD(r.issues,e)}},AD=e=>!!e&&`~standard`in e,jD={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function MD(e){function t(t){let n=e.getFieldMeta(t)??jD;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=()=>jD;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function ND(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 PD=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{CD(this)}),t=eD.on(`request-form-state`,e=>{e.payload.id===this._formId&&eD.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=eD.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=eD.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(),eD.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return eD.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&&!hD(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!hD(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(na(()=>{this.baseStore.setState(()=>ND(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=MD(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}eD.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=rD(t,e.instance.name,e.instance.options.defaultValue))}),ND({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return na(()=>{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 na(()=>{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=fD(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||ED}),r=!1,i={};return na(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=FD(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=ID(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)??jD,r=a?.[e],{newErrorValue:s,newSource:c}=gD({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=jD)=>({...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=ID(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=ID(`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=pD(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||ED});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=ID(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}=FD(r);s&&(i=i?{...i,...s}:s);let c=ID(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)??jD,r=i?.[e],{newErrorValue:a,newSource:o}=gD({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=jD)=>({...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})),na(()=>{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}),eD.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()});else if(await this.validate(`submit`),!this.state.isValid)n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),eD.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});else{na(()=>{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}),na(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),eD.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),eD.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}}},this.getFieldValue=e=>nD(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]:tD(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=jD,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;na(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:rD(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.startsWith(`${n}.`)||t.startsWith(`${n}[`)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=iD(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),MD(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],vD(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),MD(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),vD(r,{dontValidate:!0})),MD(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),vD(n,{dontValidate:!0})),MD(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 rD(rD(e,`${t}`,i),`${n}`,r)},vD(r,{dontValidate:!0})),MD(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},vD(r,{dontValidate:!0})),MD(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,[],vD(t,{dontValidate:!0})),MD(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=nD(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:jD},values:i===void 0?t.values:rD(t.values,e,i)}})},this.setErrorMap=e=>{na(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(mD(t)){let{formError:e,fieldErrors:r}=FD(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=>kD.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>kD.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??SD(),this._devtoolsSubmissionOverride=!1;let t=ND({...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&&mD(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=la(t);let n;this.fieldMetaDerived=la(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=nD(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=!dD(u),f=!o.isDirty,p=hD(l,this.getFieldInfo(a)?.instance?.options.defaultValue??nD(this.options.defaultValues,a));c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s?(i[a]=c,r++):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=la(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||!TD(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&&TD(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=la(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&&mD(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&&hD(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 AD(e.validate)?kD[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function FD(e){return e?mD(e)?{formError:FD(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function ID(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 LD=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]:{...jD,isTouched:e.fieldMetaBase[this.name]?.isTouched??jD.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??jD.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??jD.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||hD(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,vD(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,vD(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,vD(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,vD(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,vD(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,vD(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,vD(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,vD(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=fD(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ED}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=fD(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||ED});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;na(()=>{let e=(e,n)=>{let r=zD(n.cause),a=n.validate?RD(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}=_D({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=zD(`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=pD(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ED}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=pD(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||ED});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)));na(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=zD(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=RD(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=_D({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)),na(()=>{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=>TD(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[zD(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[zD(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=>kD.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>kD.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)TD(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=la(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...jD,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hD(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 AD(e.validate)?kD[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 RD(e){if(e)return e}function zD(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 BD(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function VD(e){return{...jD,...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 HD=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??BD({});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||hD(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,{...jD,...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]??BD({...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;WD(t)&&(n=t.group,r=t.fields);let i=UD(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]:BD({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,vD(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 LD&&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&&TD(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}=gD({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=jD)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=fD(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||ED}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=fD(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||ED});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;na(()=>{let t=(t,r)=>{let i=KD(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&&WD(s)&&(c=s.group,l=s.fields);let u=UD(c),d=n[i],{newErrorValue:f,newSource:p}=_D({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=KD(`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=pD(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||ED}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=pD(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||ED});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=KD(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&&WD(o)&&(l=o.group,u=o.fields);let d=UD(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=_D({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 na(()=>{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=>TD(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[KD(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>TD(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})),na(()=>{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});else 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});else{na(()=>{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}),na(()=>{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=la(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??VD(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hD(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(AD(e.validate)){let t=kD[e.type](e.value,e.validate);return e.type===`validate`?GD(t):t.then(GD)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function UD(e){if(e)return e}function WD(e){return!!e&&typeof e==`object`&&`fields`in e}function GD(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 KD(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 qD(e,t){if(!t)return;let n=Object.assign({},e,{state:wD(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 na(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var JD=typeof window<`u`?W.useLayoutEffect:W.useEffect;function YD(e){let[t,n]=(0,W.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,W.useState)(()=>new LD({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new LD({...e}),i(a),n({form:e.form,name:e.name}));let o=A(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=A(a.store,e=>e.meta.isTouched),c=A(a.store,e=>e.meta.isBlurred),l=A(a.store,e=>e.meta.isDirty),u=A(a.store,e=>e.meta.errorMap),d=A(a.store,e=>e.meta.errorSourceMap),f=A(a.store,e=>e.meta.isValidating),p=(0,W.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 JD(a.mount,[a]),JD(()=>{a.update(e)}),p}var XD=(({children:e,...t})=>{let n=YD(t),r=(0,W.useMemo)(()=>tD(e,n),[e,n]);return(0,G.jsx)(G.Fragment,{children:r})});function ZD(){return(0,W.useState)(()=>SD())[0]}var QD=W,$D=`19.3.1`.split(`.`)[0]===`17`?ZD:QD.useId;function eO(e){let[t,n]=(0,W.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,W.useState)(()=>new HD({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new HD({...e})),n({form:e.form,name:e.name}));let a=A(r.store,e=>e.value),o=A(r.store,e=>e.meta.isTouched),s=A(r.store,e=>e.meta.isBlurred),c=A(r.store,e=>e.meta.isDirty),l=A(r.store,e=>e.meta.errorMap),u=A(r.store,e=>e.meta.errorSourceMap),d=A(r.store,e=>e.meta.isValidating),f=A(r.store,e=>e.meta.isSubmitting),p=A(r.store,e=>e.meta.isSubmitted),m=A(r.store,e=>e.meta.submissionAttempts),h=A(r.store,e=>e.meta.isSubmitSuccessful),g=A(r.store,e=>e.meta.canSubmit),_=A(r.store,e=>e.meta.isValid),v=A(r.store,e=>e.meta.isFieldsValid),y=A(r.store,e=>e.meta.isFieldsValidating),b=A(r.store,e=>e.meta.isGroupValid),x=(0,W.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 JD(r.mount,[r]),JD(()=>{r.update(e)}),x}var tO=(({children:e,...t})=>{let n=eO(t),r=(0,W.useMemo)(()=>tD(e,n),[e,n]);return(0,G.jsx)(G.Fragment,{children:r})});function nO({form:e,selector:t=e=>e,children:n}){let r=A(e.store,t);return(0,G.jsx)(G.Fragment,{children:tD(n,r)})}function rO(e){let t=$D(),[n,r]=(0,W.useState)(e?.formId),[i,a]=(0,W.useState)(()=>new PD({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new PD({...e,formId:n})),r(n)}let o=(0,W.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,G.jsx)(XD,{...e,form:i})},e.FormGroup=function(e){return(0,G.jsx)(tO,{...e,form:i})},e.Subscribe=function(e){return(0,G.jsx)(nO,{form:i,selector:e.selector,children:e.children})},e},[i]);JD(i.mount,[]),JD(()=>{i.update(e)});let s=(0,W.useRef)(!1);return JD(()=>{s.current&&e?.transform&&qD(i,e.transform)},[i,e?.transform]),JD(()=>{s.current=!0}),o}function iO({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=W.useRef(e!==void 0),[a,o]=W.useState(()=>t);return[i&&e!==void 0?e:a,W.useCallback(e=>{i||o(e)},[])]}function aO(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var oO=`data-valid`,sO=`data-invalid`,cO={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},lO={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},uO={valid(e){return e===null?null:e?{[oO]:``}:{[sO]:``}}},dO=`data-checked`,fO=`data-unchecked`;function pO(e){return{checked(t){return e.indeterminate?{}:t?{[dO]:``}:{[fO]:``}},...uO}}var mO={invalid:void 0,name:void 0,validityData:{state:cO,errors:[],error:``,value:``,initialValue:null},setValidityData:oy,disabled:void 0,setTouched:oy,setDirty:oy,setFilled:oy,setFocused:oy,focusOwnerRef:{current:void 0},validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:lO,registerFieldControl:oy,validation:{getValidationProps:(e,t=cy)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:oy,getInputControl:()=>null,commit:async()=>{},change:oy}},hO=W.createContext(mO);function gO(e=!0){let t=W.useContext(hO);if(t.setValidityData===oy&&!e)throw Error(Hv(28));return t}function _O(e,t,n){let{setFocused:r,focusOwnerRef:i}=gO(),a=q(t=>{(t?!e:i.current===a)&&(i.current=t&&a,n?.(t),r(t))});return J(()=>{let e=t.current;return e?.getRootNode()?.activeElement===e&&a(!0),()=>a(!1)},[e,t,a]),a}function vO(e,t,n,r,i=!0,a){let{registerFieldControl:o}=gO(),s=xv(()=>Symbol());J(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),J(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var yO=W.createContext({disabled:!1});function bO(){return W.useContext(yO)}var xO=W.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:oy,validationMode:`onSubmit`,submitCountRef:{current:0}});function SO(){return W.useContext(xO)}var CO=W.createContext({controlId:void 0,registerControlId:oy,resetControlId:oy,labelId:void 0,setLabelId:oy,messageIds:[],setMessageIds:oy,getDescriptionProps:e=>e});function wO(){return W.useContext(CO)}function TO(e,t,n,r=!0,i,a){let[o,s]=W.useState(),c=yb(i?`${i}-label`:void 0),l=!!a?.trim(),u=e??(l?void 0:t)??o;return J(()=>{let i=e||t||l||!r?void 0:EO(n.current,c);o!==i&&s(i)}),u}function EO(e,t){let n=DO(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function DO(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function OO(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=wO(),o=yb(),s=xv(()=>Symbol()),c=W.useRef(!1),l=W.useRef(!1),u=q(()=>{c.current&&i!==oy&&(c.current=!1,i(s.current,void 0))});return J(()=>{if(!n||i===oy){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),J(()=>u,[u]),(n?r:void 0)??t??o}var kO=W.createContext(void 0);function AO(){return W.useContext(kO)}var jO=W.createContext(void 0);function MO(){let e=W.useContext(jO);if(e===void 0)throw Error(Hv(14));return e}var NO=`data-parent`,PO=W.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=SO(),{disabled:C,name:w,setDirty:T,setFilled:E,setTouched:D,state:O,validationMode:k,validityData:A,validation:j}=gO(),M=bO(),{labelId:N,registerControlId:P,getDescriptionProps:F}=wO(),I=AO(),L=I?.allValues===void 0?void 0:I.parent,R=L!==void 0,z=C||M.disabled||I?.disabled||o,B=w??d,V=v??B,H=yb(),ee=I?.registerControlId!==P,te=OO({id:c||void 0,enabled:ee}),ne=y?te:H,re={};R&&(p?re=L.getParentProps():V!==void 0&&(re=L.getChildProps(V)));let{checked:ie=n,indeterminate:ae=l,onCheckedChange:U,...oe}=re,se=I?.value,ce=W.useRef(null),le=_O(z,ce),{getButtonProps:ue,buttonRef:de}=Jv({disabled:z,native:y}),fe=I?.validation??j,[pe,me]=iO({controlled:V!==void 0&&se!==void 0&&!p?se.includes(V):ie,default:i,name:`Checkbox`,state:`checked`}),he=R?!!ie:pe,ge=R&&ae||l;vO(ce,H,pe,void 0,!I&&!z,d);let _e=L?.registerChildId,ve=W.useRef(null),ye=fe.registerInput,be=I?V:void 0,xe=W.useCallback(e=>ye(e,{controlRef:ce,value:be}),[ye,be]),Se=Zv(u,ve,p?void 0:xe),Ce=TO(a,N,ve,!y,te,x[`aria-label`]);J(()=>{ve.current&&(ve.current.indeterminate=ge),I||E(pe)},[pe,ge,I,E]),GE(pe,()=>{I||(S(B),T(pe!==A.initialValue),fe.change(pe))});let we=Ov({checked:pe,disabled:z,form:s,name:p?void 0:B,id:y?void 0:te,required:g,ref:Se,style:B?Dx:Ex,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=Wy(Ky,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(U?.(t,n),!n.isCanceled&&(me(t),V!==void 0&&I!==void 0&&!p&&!R))){let e=t?[...I.value,V]:I.value.filter(e=>e!==V);I.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ce.current?.focus()}},v===void 0?cy:{value:(I?pe&&v:v)||``},F,e=>fe.getValidationProps(z,e));W.useEffect(()=>{if(!L||V===void 0)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let Te=W.useMemo(()=>({...O,checked:he,disabled:z,readOnly:m,required:g,indeterminate:ge}),[O,he,z,m,g,ge]),Ee=pO(Te),De=fy(`span`,e,{state:Te,ref:[de,ce,t],props:[{id:ne,role:`checkbox`,"aria-checked":ge?`mixed`:he,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Ce,[NO]:p?``:void 0,onFocus(){le(!0)},onBlur(){let e=ve.current;e&&(D(!0),le(!1),k===`onBlur`&&fe.commit(I?se:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=ve.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),X_(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||aO(t)?.click()})},onClick(e){if(m||z)return;e.preventDefault();let t=ve.current;t&&qv(t,e)}},x,oe,ue,F,e=>fe.getValidationProps(z,e)],stateAttributesMapping:Ee}),Oe=De.props.id;return J(()=>{if(_e&&!p&&V!==void 0&&Oe!==void 0)return _e(V,Oe)},[_e,p,V,Oe]),(0,G.jsxs)(jO.Provider,{value:Te,children:[De,!pe&&!I&&B&&!p&&_!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:s,name:B,value:_,disabled:z}),(0,G.jsx)(`input`,{...we,suppressHydrationWarning:!0})]})}),FO=W.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=MO(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=NC(c),f=W.useRef(null),p={...s,transitionStatus:u};RC({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...pO(s),...Oy},h=a||l,g=fy(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function IO(e){let t=(0,ko.c)(8),{checked:n,onCheckedChange:r,label:i,ariaLabel:a}=e,o=a??i,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(FO,{children:(0,G.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:(0,G.jsx)(`path`,{d:`M2 5.2 4.2 7.4 8 2.8`})})}),t[0]=s):s=t[0];let c;t[1]!==n||t[2]!==r||t[3]!==o?(c=(0,G.jsx)(PO,{checked:n,onCheckedChange:r,"aria-label":o,className:`x3nfvp2 x6s0dn4 xl56j7k x1kky2od xlup9mm x1717udv xgwgzc4 xn7wf0q xmkeg23 x1y0btm7 xxuvl4d x7d8hld x1ypdohk`,children:s}),t[1]=n,t[2]=r,t[3]=o,t[4]=c):c=t[4];let l;return t[5]!==i||t[6]!==c?(l=(0,G.jsxs)(`label`,{className:`x3nfvp2 x6s0dn4 x167g77z xfifm61 x1ypdohk`,children:[c,i]}),t[5]=i,t[6]=c,t[7]=l):l=t[7],l}function LO(e){let t=(0,ko.c)(8),{label:n,error:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,G.jsx)(`span`,{className:`x1j6dyjg x1tviuuy`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,G.jsx)(`span`,{className:`x1j6dyjg xb0vdwp`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,G.jsxs)(`label`,{className:`x78zum5 xdt5ytf x1jnr06f xeuugli`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var RO=W.createContext(void 0);function zO(e=!1){let t=W.useContext(RO);if(!t&&!e)throw Error(Hv(86));return t}Object.keys(cO);function BO(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var VO=W.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFilled:y,validationMode:b,validation:x}=gO(),{clearErrors:S,elementRef:C,submitCountRef:w}=SO(),T=h||s,E=m??a,D={...p,disabled:T},{labelId:O}=wO(),k=OO({id:i}),A=o!==void 0,j=o==null?void 0:String(o),M=q(()=>x.inputRef.current?.value);vO(x.inputRef,k,j,M,!T,a),J(()=>{let e=j??x.inputRef.current?.value;e!==void 0&&y(e!==``)},[j,l,x.inputRef,y]),GE(j,()=>{j!==void 0&&(S(E),_(j!==(v.initialValue??``)),x.change(j))});let N=W.useRef(null),P=_O(T,N),F=Cb();return fy(`input`,e,{ref:[t,N],state:D,props:[{id:k,disabled:T,name:E,ref:x.inputRef,"aria-labelledby":O,autoFocus:u,...A?{value:o}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=Wy(Ky,e.nativeEvent);c?.(t,n),A||(_(t!==(v.initialValue??``)),y(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(S(E),x.change(t)))},onFocus(){P(!0)},onBlur(e){if(g(!0),P(!1),b===`onBlur`){let t=e.currentTarget.value;x.commit(t),A&&queueMicrotask(()=>{let e=x.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&x.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===C.current&&!e.defaultPrevented){let t=e.currentTarget,n=w.current;F.start(0,()=>{w.current===n&&x.commit(t.value)})}else x.commit(t)}}},f,e=>x.getValidationProps(T,e)],stateAttributesMapping:uO})}),HO=W.forwardRef(function(e,t){return(0,G.jsx)(VO,{ref:t,...e})});function UO(e){let t=(0,ko.c)(9),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({mono:r,inputRef:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a={0:{className:`xh8yej3 x1jgo0hl xdqyycr x134rb1s xqtwvag xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 x4s12hp x4mu1xn x1a2a7pz xq90yva x1qfwjxi x6setmy x1g6wmp5`},1:{className:`xh8yej3 x1jgo0hl xdqyycr xqtwvag xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 x4s12hp x4mu1xn x1a2a7pz xq90yva x1qfwjxi x6setmy x1g6wmp5 xxb57xf xss6m8b`}},t[4]=a):a=t[4];let o=a[!!r|0],s;return t[5]!==n||t[6]!==i||t[7]!==o?(s=(0,G.jsx)(HO,{ref:n,...i,...o}),t[5]=n,t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function WO(e){let t=W.useRef(!0);t.current&&(t.current=!1,e())}function GO(e){let[t,n]=W.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function KO(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var qO=W.createContext(void 0),JO=W.createContext(void 0);function YO(){let e=W.useContext(qO);if(e===void 0)throw Error(Hv(60));return e}function XO(){let e=W.useContext(JO);if(e===void 0)throw Error(Hv(61));return e}function ZO(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var QO=(e,t)=>Object.is(e,t);function $O(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ek(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!ZO(e,t,(e,t)=>$O(e,t,n)):e!==t}function tk(e,t,n){return e?e.some(e=>e!==void 0&&$O(t,e,n)):!1}function nk(e,t,n){return e?e.findIndex(e=>e!==void 0&&$O(e,t,n)):-1}function rk(e,t){if(t!==QO)return n=>tk(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function ik(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(rk(t,n)):nk(e,t,n);return i===-1?null:i}function ak(e,t,n,r,i,a){return tk(r,t,i)?a!=null&&e>a&&tk(r,n[a],i)?a:e:e===a?ik(n,r,i,!0):a}function ok(e,t,n){return e.filter(e=>!$O(t,e,n))}function sk(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function ck(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function lk(e){return ck(e?.[0])}function uk(e){return lk(e)?e.flatMap(e=>e.items):e}function dk(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(lk(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function fk(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return sk(e)}function pk(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?sk(e.value):sk(e)}function mk(e,t,n){function r(){return fk(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=uk(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function hk(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(W.Fragment,{children:mk(r,t,n)},i)),e),[])}var gk={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:pk(t,r)!==``},hasNullItemLabel:(e,t)=>t?dk(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>$O(t,e,n)):$O(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function _k(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function vk(e,t){return Math.max(0,e-t)}function yk(e,t){if(t<=0)return 0;let n=_k(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 bk(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=QO,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=SO(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=gO(),F=OO({id:t}),I=M||d,L=j??c,[R,z]=iO({controlled:n,default:y?r??sy:r,name:`Select`,state:`value`}),[B,V]=iO({controlled:a,default:o,name:`Select`,state:`open`}),H=W.useRef([]),ee=W.useRef([]),te=W.useRef(null),ne=W.useRef(null),re=W.useRef(0),ie=W.useRef(null),ae=W.useRef([]),U=W.useRef(!1),oe=W.useRef(null),se=W.useRef(null),ce=W.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),le=W.useRef(!1),ue=W.useRef(R),{openMethod:de,triggerProps:fe}=qE(B),pe=xv(()=>new gw({id:F,labelId:void 0,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:B,transitionStatus:void 0,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:cy,triggerProps:cy,itemRoot:{props:cy,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:oy,setOpen:oy,handleScrollArrowVisibility:oy,onOpenChangeComplete:oy,listRef:H,popupRef:te,scrollHandlerRef:ne,scrollArrowsMountedCountRef:re,valueRef:ie,valuesRef:ae,labelsRef:ee,typingRef:U,selectionRef:ce,firstItemTextRef:oe,selectedItemTextRef:se,alignItemWithTriggerActiveRef:le,initialValueRef:ue},gk)).current,[me,he]=W.useState(!1),{mounted:ge,transitionStatus:_e,forceUnmount:ve}=zC({open:B,ref:te,preventUnmountOnClose:me,setPreventUnmountOnClose:he,onUnmount(){pe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)}}),ye=pe.useState(`activeIndex`),be=pe.useState(`selectedIndex`),xe=pe.useState(`triggerElement`),Se=pe.useState(`positionerElement`),Ce=GO(de),we=de??Ce,Te=W.useMemo(()=>y?``:pk(R,x),[y,R,x]),Ee=W.useMemo(()=>y&&Array.isArray(R)?R.map(e=>pk(e,x)):pk(R,x),[y,R,x]);vO(yx(xe),F,R,q(()=>Ee),!I,c);let De=y?Array.isArray(R)&&R.length>0:R!=null&&Te!==``;J(()=>{A(De)},[De,A]),J(function(){let e=ik(ae.current,R,S,y);e===null&&(se.current=null),B||pe.set(`selectedIndex`,e)},[y,B,R,S,pe]),GE(R,()=>{T(L),E(ek(R,k.initialValue,S)),N.change(R)});let Oe=q((e,t)=>{let n=t,r=qC(n);s?.(e,n),t.isCanceled||(e||he(r()),V(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(D(!0),O(!1),P===`onBlur`&&N.commit(R)))});W.useImperativeHandle(h,()=>({unmount:ve,close:()=>{pe.state.open&&Oe(!1,Wy(fb))}}),[ve,Oe,pe]);let ke=q((e,t)=>{i?.(e,t),t.isCanceled||z(e)}),Ae=q(e=>{let t=vk(e.scrollHeight,e.clientHeight),n=yk(e.scrollTop,t),r=n>0,i=n<t;pe.set(`scrollUpArrowVisible`,r),pe.set(`scrollDownArrowVisible`,i)}),je=Dw({open:B,onOpenChange:Oe,elements:{reference:xe,floating:Se}}),Me=wC(je,{enabled:!I,event:`mousedown`}),Ne=AC(je),Pe=Ww(je,{enabled:!I,listRef:H,activeIndex:ye,selectedIndex:be,disabledIndices:sy,onNavigate(e){(e!==null||B)&&pe.set(`activeIndex`,e)},focusItemOnHover:C}),Fe=Gw(je,{enabled:!I&&(B||!f&&!y),listRef:ee,activeIndex:ye,selectedIndex:be,disabledIndices:e=>KO(H.current[e]),onMatch(e){B?pe.set(`activeIndex`,e):ke(ae.current[e],Wy(Ky))},onTyping(e){U.current=e}}),Ie=W.useMemo(()=>Ov(Fe.reference,Pe.reference,Ne.reference,Me.reference,fe),[Me.reference,Fe.reference,Pe.reference,Ne.reference,fe]),Le=W.useMemo(()=>Ov(BC,Fe.floating,Pe.floating,Ne.floating),[Fe.floating,Pe.floating,Ne.floating]),Re=Pe.item??cy,ze=W.useMemo(()=>({props:Re,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S}),[Re,y,I,f,S]);pe.useContextCallback(`setValue`,ke),pe.useContextCallback(`setOpen`,Oe),pe.useContextCallback(`handleScrollArrowVisibility`,Ae),pe.useContextCallback(`onOpenChangeComplete`,_),WO(()=>{pe.update({popupProps:Le,triggerProps:Ie,itemRoot:ze})}),pe.useSyncedValues({id:F,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,value:R,open:B,mounted:ge,transitionStatus:_e,popupProps:Le,triggerProps:Ie,itemRoot:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:we});let Be=Zv(g,N.inputRef),Ve=y?void 0:L,He=W.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=pk(e,x);return(0,G.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,G.jsxs)(qO.Provider,{value:pe,children:[(0,G.jsx)(JO.Provider,{value:je,children:w}),(0,G.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=Wy(Ky,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ae.current.findIndex(t=>pk(t,x).toLowerCase()===e||fk(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=ee.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&ke(i,n)}pe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ve==null?`${F}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Te,disabled:I,required:p&&!(y&&De),readOnly:f,ref:Be,style:L?Dx:Ex,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})}function xk(e,t){return e??t}var Sk=5;function Ck(e,t){let n=wk(t);return e.clientX>=n.left-Sk&&e.clientX<=n.right+Sk&&e.clientY>=n.top-Sk&&e.clientY<=n.bottom+Sk}function wk(e){let t=e.getBoundingClientRect(),n=X_(e);if(Lb)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}}var Tk=`data-popup-side`,Ek=400,Dk={...By,...uO,popupSide:e=>e?{[Tk]:e}:null,value:()=>null},Ok=W.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,validationMode:u,validation:d,state:f,disabled:p}=gO(),{labelId:m}=wO(),h=YO(),g=h.useState(`readOnly`),_=h.useState(`required`),v=h.useState(`disabled`),y=p||v||a,b=h.useState(`open`),x=h.useState(`mounted`),S=h.useState(`value`),C=h.useState(`triggerProps`),w=h.useState(`positionerElement`),T=h.useState(`listElement`),E=h.useState(`popupSide`),D=h.useState(`id`),O=h.useState(`labelId`),k=h.useState(`hasSelectedValue`),A=x&&w?E:null,j=i??D,M=xk(m,O);OO({id:i});let N=yx(w),P=W.useRef(null),F=_O(y,P),{getButtonProps:I,buttonRef:L}=Jv({disabled:y,native:o}),R=h.useStateSetter(`triggerElement`),z=Cb(),B=Cb(),V=Cb();W.useEffect(()=>{if(b)return V.start(Ek,()=>{h.context.selectionRef.current.allowUnselectedMouseUp=!0,h.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{V.clear()};h.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[b,h,B,V]);let H=Ov(C,{id:j,role:`combobox`,"aria-expanded":b,"aria-haspopup":`listbox`,"aria-controls":b?T?.id??sx(w)?.id:void 0,"aria-labelledby":M,"aria-readonly":g||void 0,"aria-required":_||void 0,tabIndex:y?-1:0,onFocus(e){F(!0),b&&h.context.alignItemWithTriggerActiveRef.current&&h.context.setOpen(!1,Wy(Ky,e.nativeEvent)),z.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){Y(w,e.relatedTarget)||(l(!0),F(!1),u===`onBlur`&&d.commit(S))},onMouseDown(e){if(b)return;let t=Kv(e.currentTarget);function n(e){if(!P.current)return;let t=e.target;Y(P.current,t)||Y(N.current,t)||Ck(e,P.current)||h.context.setOpen(!1,Wy(sb,e))}B.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),ee=d.getValidationProps(y,H);ee.role=`combobox`;let te={...f,open:b,disabled:y,value:S,readOnly:g,popupSide:A,placeholder:!k};return fy(`button`,e,{ref:[t,P,L,R],state:te,stateAttributesMapping:Dk,props:ee})}),kk={value:()=>null},Ak=W.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=YO(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?hk(l,u,d):mk(l,u,d)),fy(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:kk})}),jk=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return fy(`span`,e,{state:{open:YO().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:zy})}),Mk=W.forwardRef(function(e,t){let n=YO(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,G.jsx)(iC,{ref:t,...e}):null}),Nk=W.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Pk(){return W.useContext(Nk)}function Fk(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=q(i),[,o]=W.useState(0),s=xv(Lk).current,c=xv(Ik).current,l=W.useRef(0),u=W.useRef(!0),d=W.useRef(null),f=W.useRef(null),p=q(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=q((e,t)=>{c.set(e,t),p()}),h=q(e=>{c.delete(e),p()}),g=q(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(!Bk(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Vk(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=zk(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=q(()=>{let[e,t]=Rk(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))});J(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=q(e=>(s.add(e),()=>{s.delete(e)})),b=W.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,G.jsx)(Nk.Provider,{value:b,children:t})}function Ik(){return new Map}function Lk(){return new Set}function Rk(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)=>Vk(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 zk(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Bk(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 Vk(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Hk(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]=W.useState(null),d=W.useRef(null),f=uC(n),p=W.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=ZT({...e,elements:{...p,...l&&{reference:l}}}),h=W.useCallback(e=>{let t=$_(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=W.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=W.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=W.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 J(()=>{o&&(d.current=o)},[o]),J(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),W.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var Uk=W.createContext(void 0);function Wk(){return W.useContext(Uk)?.direction??`ltr`}var Gk=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}=Ix(e,t)||{};if(l==null)return{};let d=eS(u),f={x:n,y:r},p=Hx(i),m=Bx(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=Fx(D,k,O),j=!c.arrow&&Rx(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}}}),Kk=(e,t)=>{let{name:n,fn:r}=Gk(e);return{name:n,fn:r,options:[e,t]}},qk={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}}}},Jk={sideX:`left`,sideY:`top`},Yk=`--available-width`,Xk=`--available-height`,Zk=`--anchor-width`,Qk=`--anchor-height`,$k=`--transform-origin`,eA=`--positioner-width`,tA=`--positioner-height`,nA=Yk,rA=Xk;function iA(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 aA(e,t,n){let{rects:r,placement:i}=e;return{side:iA(t,Lx(i),n),align:Rx(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function oA(e){return sA(e,Hk)}function sA(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=q(O),A=O?k:n,j=yx(n),M=yx(g),N=Wk()===`rtl`,[P,F]=W.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?Lx(P):null,R=P&&I?Rx(P)||`center`:null,z=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],B=R||o,V=B===`center`?z:`${z}-${B}`,H=l;typeof H==`number`?H={top:H,right:H,bottom:H,left:H}:H&&={top:H.top||0,right:H.right||0,bottom:H.bottom||0,left:H.left||0};let ee=+(i===`bottom`),te=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:H},ae=W.useRef(null),U=yx(a),oe=yx(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(QT(e=>{let t=aA(e,i,N),n=typeof U.current==`function`?U.current(t):U.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,N,i]));let ue=w===`none`&&C!==`shift`,de=!ue&&(u||E||C===`shift`),fe=C===`none`?null:tE({...ie,padding:{top:H.top+1+ee,right:H.right+1+re,bottom:H.bottom+1+te,left:H.left+1+ne},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),pe=ue?null:$T({...ie,rootBoundary:D,mainAxis:w!==`none`,crossAxis:de,limiter:u||E?void 0:eE(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=Vx(Lx(e.placement)),i=r===`y`?t:n,a=r===`y`?H.left+H.right:H.top+H.bottom;return{offset:i/2+a/2}})},[ie,u,E,D,H,w]);C===`shift`||w===`shift`||B===`center`?le.push(pe,fe):le.push(fe,pe),le.push(nE({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(nA,`${t}px`),i.setProperty(rA,`${n}px`);let a=X_(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(Zk,`${u}px`),i.setProperty(Qk,`${d}px`)}}),Kk(e=>({element:ae.current||Kv(e.elements.floating).createElement(`div`),padding:ae.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=Lx(r),u=Rx(r),d=Vx(l)===`y`,f=ae.current,p=typeof a==`function`?a(aA(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 de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty($k,d?`${m} ${h}`:`${h} ${m}`),{}}},qk,b),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=W.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:V,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>zT(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||Jk,De=Ce?r:`fixed`,Oe=W.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[nA]=`100vw`,e[rA]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=W.useRef(null);J(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(cA(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,A,j]),W.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&cA(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,A,j]),W.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return zT(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=Lx(xe),je=iA(i,Ae,N),Me=Rx(xe)||`center`,Ne=!!ye.hide?.referenceHidden;J(()=>{x&&g&&Ce&&(Ae!==z||I&&Me!==B)&&F(xe)},[x,I,g,Ce,xe,Ae,Me,z,B]);let Pe=W.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return W.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ae,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ae,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function cA(e){return e!=null&&`current`in e}var lA=W.createContext(void 0);function uA(){let e=W.useContext(lA);if(!e)throw Error(Hv(59));return e}function dA(e,t){e&&Object.assign(e.style,t)}var fA={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function pA(e){return e===`starting`?YS:cy}function mA(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),fy(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},pA(r),i],stateAttributesMapping:Vy})}var hA=20;function gA(e,t,n,r){let[i,a]=W.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=Kv(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-hA)},[e,t,n]),PE(e&&(!t||i),r)}var _A={position:`fixed`},vA=W.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=XS,style:_,...v}=e,y=YO(),b=XO(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=W.useRef(null),j=W.useRef(null),[M,N]=W.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),W.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),gA((P||C)&&x,T===`touch`,E,D);let F=oA({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?_A:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};J(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let z=mA(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),B=W.useRef(0),V=q(e=>{if(y.context.valuesRef.current.length===0)return;let t=B.current;B.current=e.size;let n=Wy(Ky);if(t!==0&&!y.state.multiple&&w!==null&&nk(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&nk(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>nk(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};dA(E,e),dA(y.context.popupRef.current,e)}}),H=W.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,G.jsx)(Fk,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:V,children:(0,G.jsxs)(lA.Provider,{value:H,children:[S&&C&&(0,G.jsx)(SE,{inert:xE(!x),cutout:D}),z]})})}),yA=`base-ui-disable-scrollbar`,bA={className:yA,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:yA,precedence:`base-ui:low`,children:`.${yA}{scrollbar-width:none}.${yA}::-webkit-scrollbar{display:none}`})}},xA=W.createContext(void 0);function SA(e){let t=W.useContext(xA);if(t===void 0&&!e)throw Error(Hv(69));return t}var CA=W.createContext(void 0),wA={disableStyleElements:!1};function TA(){return W.useContext(CA)??wA}var EA=`--transform-origin`,DA={...Vy,...Oy},OA=W.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=YO(),c=s.useState(`multiple`),l=s.useState(`readOnly`),u=s.useState(`highlightItemOnHover`),d=XO(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=uA(),_=SA(!0)!=null,v=Wk(),{nonce:y,disableStyleElements:b}=TA(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=W.useRef(!1),j=W.useRef(!1),M=W.useRef({}),N=wx(),P=q(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=jA(O),i=MA(O.getBoundingClientRect().height,`y`,r),a=Kv(O),o=X_(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=kA(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=AA(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=_k(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=_k(g,0,AA(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});W.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),RC({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};J(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),J(()=>{S||m||(j.current=!1,A.current=!1,dA(O,M.current))},[S,m,O]),J(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(EA),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=FA(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=X_(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=Kv(D),c=jA(D),l=NA(D.getBoundingClientRect(),c),d=NA(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=kA(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=NA(n.getBoundingClientRect(),c);T=NA(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${_k(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=AA(p),z=I>=R-1;z&&(P=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&Fb;if(B||V){dA(O,M.current),g(!1);return}let H=Math.max(b,P);if(z){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=AA(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=_k(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(EA,`50% ${i}%`)}(H===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),W.useEffect(()=>{if(!m||!O||!S)return;let e=X_(O);function t(e){s.context.setOpen(!1,Wy(pb,e))}return _x(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&lE.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:fA},className:!k&&m?bA.className:void 0},L=fy(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:DA,props:[T,I,pA(E),o]});return(0,G.jsxs)(W.Fragment,{children:[!b&&bA.getElement(y),(0,G.jsx)(CC,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function kA(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function AA(e){return vk(e.scrollHeight,e.clientHeight)}function jA(e){return IT.getScale(e)}function MA(e,t,n){return e/n[t]}function NA(e,t){return tS({x:MA(e.x,`x`,t),y:MA(e.y,`y`,t),width:MA(e.width,`x`,t),height:MA(e.height,`y`,t)})}var PA=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function FA(e){let{style:t}=e,n={};for(let[e,r]of PA)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of PA){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}function IA(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Pk(),u=W.useRef(-1),[d,f]=W.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=W.useRef(null),h=W.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 J(()=>{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 LA=W.createContext(void 0);function RA(){let e=W.useContext(LA);if(!e)throw Error(Hv(57));return e}var zA=W.memo(W.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=W.useRef(null),d=IA({guess:!0,label:o,textRef:u}),f=YO(),{props:p,multiple:m,disabled:h,readOnly:g,isItemEqualToValue:_}=f.useState(`itemRoot`),v=h||s,y=f.useState(`isActive`,d.index),b=f.useState(`open`),x=f.useState(`isSelected`,a),S=f.useState(`isSelectedByFocus`,d.index),C=d.index,w=W.useRef(null);J(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),J(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=ak(C,a,f.context.valuesRef.current,e,_,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&$O(a,e,_),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,_,f,a]);let T=W.useRef(`mouse`),E=W.useRef(!1),{getButtonProps:D,buttonRef:O}=Jv({disabled:v,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:v,selected:x,highlighted:y};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=x?ok(n,a,_):[...n,a];f.context.setValue(r,Wy(Zy,e))}else f.context.setValue(a,Wy(Zy,e)),f.context.setOpen(!1,Wy(Zy,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":x,tabIndex:b&&y?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Bb(e.nativeEvent)&&(n!==void 0||y),i=t&&!r&&!E.current;E.current=!1,v||i||A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),v||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&x,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!x;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=fy(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=W.useMemo(()=>({selected:x,index:C,textRef:u,selectedByFocus:S}),[x,C,u,S]);return(0,G.jsx)(LA.Provider,{value:P,children:N})})),BA=W.memo(W.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=RA(),a=YO(),{render:o,className:s,style:c,...l}=e;return fy(`div`,e,{ref:[W.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),VA={positioner:{kY2c9j:`x1aciyhk`,$$css:!0},surface:{kmVPX3:`xfawy5m`,kWkggS:`x14fh20`,kaIpWk:`xr11lhz`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x4s12hp`,kGVxlE:`x165p7zc`,kI3sdo:`x1a2a7pz`,k3nNDw:`xctpfpq`,kSiTet:`x1hc1fzr x1hw7zpd xiyypsa`,k3aq6I:`x3oybdh x1qdyiyv x14up28i`,k1ekBW:`x6o7n8i`,kIyJzY:`x19jr8i9 x1ya1k7h`,kAMwcw:`x6setmy`,$$css:!0}},HA={popup:{k7Eaqz:`x80t9vs`,kskxy:`xq3t0pi`,kORKVm:`x1odjw0f`,$$css:!0}};function UA(e){let t=(0,ko.c)(18),{value:n,onValueChange:r,options:i,ariaLabel:a}=e,o;t[0]===r?o=t[1]:(o=e=>{e!==null&&r(e)},t[0]=r,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Ak,{}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(jk,{children:(0,G.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,G.jsx)(`path`,{d:`m2 3.5 3 3 3-3`})})}),t[3]=c):c=t[3];let l;t[4]===a?l=t[5]:(l=(0,G.jsxs)(Ok,{"aria-label":a,className:`x78zum5 x6s0dn4 x1qughib x167g77z xh8yej3 x1jgo0hl xdqyycr x134rb1s xqtwvag xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 x4s12hp x1ckbk5l x1a2a7pz x1ypdohk xshfolx x1qfwjxi x6setmy`,children:[s,c]}),t[4]=a,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=Fo(VA.positioner),t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=Fo(VA.surface,HA.popup),t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=i.map(WA),t[8]=i,t[9]=f);let p;t[10]===f?p=t[11]:(p=(0,G.jsx)(Mk,{children:(0,G.jsx)(vA,{sideOffset:4,...u,children:(0,G.jsx)(OA,{...d,children:f})})}),t[10]=f,t[11]=p);let m;return t[12]!==i||t[13]!==o||t[14]!==l||t[15]!==p||t[16]!==n?(m=(0,G.jsxs)(bk,{value:n,onValueChange:o,items:i,children:[l,p]}),t[12]=i,t[13]=o,t[14]=l,t[15]=p,t[16]=n,t[17]=m):m=t[17],m}function WA(e){return(0,G.jsx)(zA,{value:e.value,className:`x78zum5 x6s0dn4 x1jgo0hl xdqyycr xqtwvag xn7wf0q xt0e3qv x1a2a7pz xjbqb8w x1gjw99y`,children:(0,G.jsx)(BA,{children:e.label})},e.value)}var GA=`__ungrouped__`;function KA({connection:e,folderId:t,folders:n,onClose:r}){let i=al(),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),l=rO({defaultValues:e?{...e,password:``}:{folderId:t??null,name:``,kind:`mysql`,host:`127.0.0.1`,port:V_.mysql.defaultPort,user:``,password:``,database:null,secure:!1},validators:{onChange:G_},onSubmit:async({value:t})=>{c(null);try{e?await i.updateConnection.mutateAsync({data:{id:e.id,input:t}}):await i.createConnection.mutateAsync({data:t}),r()}catch(e){c(q_(e))}}}),u=async()=>{o({ok:!0,message:`Testing...`});try{let{version:t}=await i.testConnection.mutateAsync({data:{id:e?.id??null,input:l.state.values}});o({ok:!0,message:`Connected. Server version ${t}`})}catch(e){o({ok:!1,message:q_(e)})}},d=e=>e.isTouched?e.errors[0]?.message:void 0;return(0,G.jsx)(JE,{open:!0,onOpenChange:e=>!e&&r(),title:e?`Edit connection`:`New connection`,children:(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l.handleSubmit()},className:`x78zum5 xdt5ytf x1v2ro7d`,children:[(0,G.jsx)(l.Field,{name:`name`,children:e=>(0,G.jsx)(LO,{label:`Name`,error:d(e.state.meta),children:(0,G.jsx)(UO,{autoFocus:!0,name:`name`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)})})}),(0,G.jsxs)(`div`,{className:`xrvj5dj x1o61qjw x1v2ro7d`,children:[(0,G.jsx)(l.Field,{name:`kind`,children:e=>(0,G.jsx)(LO,{label:`Type`,children:(0,G.jsx)(UA,{ariaLabel:`Type`,value:e.state.value,options:B_.map(e=>({value:e,label:V_[e].label})),onValueChange:t=>{let n=V_[e.state.value].defaultPort;e.handleChange(t),l.getFieldValue(`port`)===n&&l.setFieldValue(`port`,V_[t].defaultPort)}})})}),(0,G.jsx)(l.Field,{name:`folderId`,children:e=>(0,G.jsx)(LO,{label:`Folder`,children:(0,G.jsx)(UA,{ariaLabel:`Folder`,value:e.state.value??GA,options:[{value:GA,label:`Ungrouped`},...n.map(e=>({value:e.id,label:e.name}))],onValueChange:t=>e.handleChange(t===GA?null:t)})})})]}),(0,G.jsxs)(`div`,{className:`xrvj5dj x9flyx0 x1v2ro7d`,children:[(0,G.jsx)(l.Field,{name:`host`,children:e=>(0,G.jsx)(LO,{label:`Host`,error:d(e.state.meta),children:(0,G.jsx)(UO,{name:`host`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)})})}),(0,G.jsx)(l.Field,{name:`port`,children:e=>(0,G.jsx)(LO,{label:`Port`,error:d(e.state.meta),children:(0,G.jsx)(UO,{name:`port`,mono:!0,inputMode:`numeric`,value:String(e.state.value),onBlur:e.handleBlur,onChange:t=>e.handleChange(Number(t.target.value.replace(/\D/g,``)))})})})]}),(0,G.jsxs)(`div`,{className:`xrvj5dj x1o61qjw x1v2ro7d`,children:[(0,G.jsx)(l.Field,{name:`user`,children:e=>(0,G.jsx)(LO,{label:`User`,error:d(e.state.meta),children:(0,G.jsx)(UO,{name:`user`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)})})}),(0,G.jsx)(l.Field,{name:`password`,children:t=>(0,G.jsx)(LO,{label:`Password`,children:(0,G.jsx)(UO,{name:`password`,type:`password`,autoComplete:`new-password`,placeholder:e?.hasPassword?`Unchanged`:``,value:t.state.value,onBlur:t.handleBlur,onChange:e=>t.handleChange(e.target.value)})})})]}),(0,G.jsx)(l.Field,{name:`database`,children:e=>(0,G.jsx)(LO,{label:`Default database (optional)`,children:(0,G.jsx)(UO,{name:`database`,value:e.state.value??``,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value||null)})})}),(0,G.jsx)(l.Field,{name:`secure`,children:e=>(0,G.jsx)(IO,{label:`Use TLS`,checked:e.state.value,onCheckedChange:e.handleChange})}),a?(0,G.jsx)(`div`,{role:`status`,...{0:{className:`xfifm61 xxb57xf x13faqbe xb0vdwp`},1:{className:`xfifm61 xxb57xf x13faqbe x1n8ird4`}}[!!a.ok|0],children:a.message}):null,s?(0,G.jsx)(`div`,{className:`xfifm61 xxb57xf x13faqbe xb0vdwp`,children:s}):null,(0,G.jsxs)(YE,{children:[(0,G.jsx)(xy,{type:`button`,onClick:u,disabled:i.testConnection.isPending,children:`Test connection`}),(0,G.jsx)(`div`,{className:`x98rzlu`}),(0,G.jsx)(xy,{type:`button`,onClick:r,children:`Cancel`}),(0,G.jsx)(l.Subscribe,{selector:e=>e.canSubmit&&!e.isSubmitting,children:t=>(0,G.jsx)(xy,{type:`submit`,variant:`primary`,disabled:!t,children:e?`Save`:`Create connection`})})]})]})})}var qA=`data-checked`,JA=`data-unchecked`,YA={checked(e){return e?{[qA]:``}:{[JA]:``}},...Oy,...uO},XA=`data-composite-item-active`;function ZA(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Wv(),{ref:i,index:a}=IA(e),o=n===a,s=W.useRef(null),c=Zv(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 QA(e){let{render:t,className:n,style:r,state:i=cy,props:a=sy,refs:o=sy,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=ZA({metadata:s});return fy(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var $A=W.createContext(void 0);function ej(){return W.useContext($A)}var tj=W.createContext(void 0),nj=W.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=ej(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=oy,setTouched:w=oy,registerInputRef:T=oy}=m??{},{setTouched:E,setFilled:D,state:O,disabled:k}=gO(),A=bO(),{labelId:j,getDescriptionProps:M}=wO(),N=k||A.disabled||h||i,P=g||a,F=_||o,I=v,L=m?y===c:c===``,R=W.useRef(null),z=_O(N,R),B=W.useRef(null),V=x?.registerInput,H=Zv(l,B,T,W.useCallback(e=>V?.(e,{controlRef:R,value:void 0}),[V]));J(()=>{B.current?.checked&&D(!0)},[D]),J(()=>{B.current&&T(N&&L?null:B.current)},[L,N,T]);let ee=yb(),te=OO({id:d}),ne=u?void 0:te,re={role:`radio`,"aria-checked":L,"aria-labelledby":TO(s,j,B,!u,ne,p[`aria-label`]),[XA]:L?``:void 0,id:u?te:ee,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||N||P)return;e.preventDefault();let t=B.current;t&&qv(t,e)},onFocus(e){z(!0),e.defaultPrevented||N||P||!b||(B.current?.click(),w(!1))},onBlur(){m||z(!1)}},{getButtonProps:ie,buttonRef:ae}=Jv({disabled:N,native:u,composite:!1}),U={type:`radio`,ref:H,form:I,id:ne,name:S,tabIndex:-1,style:S?Dx:Ex,"aria-hidden":!0,...c===void 0?cy:{value:sk(c)},disabled:N,checked:L,required:F,readOnly:P,onChange(e){if(e.nativeEvent.defaultPrevented||N||P||c===void 0)return;let t=Wy(Ky,e.nativeEvent);C(c,t),t.isCanceled||E(!0)},onClick(e){e.stopPropagation()},onFocus(){R.current?.focus()}},oe=W.useMemo(()=>({...O,required:F,disabled:N,readOnly:P,checked:L}),[O,N,P,L,F]),se=oe,ce=m!==void 0,le=[t,R,ae],ue=[re,p,ie,M,x?e=>x.getValidationProps(N,e):cy],de=fy(`span`,e,{enabled:!ce,state:oe,ref:le,props:ue,stateAttributesMapping:YA});return(0,G.jsxs)(tj.Provider,{value:se,children:[ce?(0,G.jsx)(QA,{tag:`span`,render:n,className:r,style:f,state:oe,refs:le,props:ue,stateAttributesMapping:YA}):de,(0,G.jsx)(`input`,{...U,suppressHydrationWarning:!0})]})});function rj(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=sy}=e,[p,m]=W.useState(0),h=r!=null,g=W.useRef(null),_=Zv(g,c),v=W.useRef([]),y=W.useRef(!1),b=W.useRef(null),x=o??p,S=q((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];mE(g.current,t,a,n)}}),C=q(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||sS(e,x,d)?S(ij(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(sS(t,x,d)){let e=oS(t,{disabledIndices:d});nS(t,e)||S(e)}mE(g.current,r,a,n)});J(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(sS(e,x,d)){let t=oS(e,{disabledIndices:d});nS(e,t)||S(t)}},[d,o,x,v,S]);let w=q((e,t,n)=>i?i(e,t,n,v):n),T=q(e=>{let o=e.key===`Home`||e.key===`End`;if(!lE.has(e.key)||!l&&o||aj(e,f)||!g.current)return;let s=a===`rtl`,c=s?sE:cE,p=s?cE:sE,m=n===`vertical`?oE:c,_=n===`vertical`?aE:p,y=Kb(e.nativeEvent);if(y!=null&&pE(y)&&!KO(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=rS(v,d),T=iS(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=oS(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!nS(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=Kb(e.nativeEvent);t&&n!=null&&pE(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function ij(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!sS(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function aj(e,t){for(let n of dE)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function oj(e){let{render:t,className:n,style:r,refs:i=sy,props:a=sy,state:o=cy,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=rj({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Wk(),disabledIndices:v,modifierKeys:y}),k=fy(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=W.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,G.jsx)(Uv.Provider,{value:A,children:(0,G.jsx)(Fk,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var sj=[uE],cj=W.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=gO(),{labelId:E}=wO(),{clearErrors:D,elementRef:O}=SO(),k=zO(!0),A=b||i,j=y??d,M=yb(p),[N,P]=iO({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[F,I]=W.useState(!1),L=q((e,t)=>{s?.(e,t),t.isCanceled||P(e)}),R=S.getInputControl,z=W.useMemo(()=>({get current(){return R()}}),[R]),B=W.useRef(null),V=W.useRef(null),H=Zv(B,f),ee=W.useRef(H),te=q(e=>{(B.current!==e||ee.current!==H)&&(ee.current=H,H?.(e))});J(()=>{te(B.current)},[H,te]);let ne=q(e=>{if(e){if(!e.disabled){V.current||=e;let t=B.current;(e.checked||t==null||t.disabled)&&te(e)}return()=>{V.current===e&&(V.current=null),B.current===e&&te(null)}}}),re=q(()=>{let e=O.current;if(!e)return N??null;for(let t of S.registeredInputs.keys())if(t.checked&&BO(t,e))return N??null;return null});vO(z,M,N??null,re,!A,d),GE(N,()=>{D(j),C(N!==T.initialValue),w(N!=null),S.change(N);let e=V.current;N==null&&e&&!e.disabled&&te(e)});let ie=E??k?.legendId,ae={...x,disabled:A??!1,required:o??!1,readOnly:a??!1},U=W.useMemo(()=>({checkedValue:N,disabled:A,form:u,validation:S,name:j,readOnly:a,registerInputRef:ne,required:o,setCheckedValue:L,setTouched:I,touched:F}),[N,A,u,S,j,a,ne,o,L,I,F]),oe={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":ie,onBlur(e){Y(e.currentTarget,e.relatedTarget)||(I(!1),g(!0),_(!1),v===`onBlur`&&S.commit(N))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&I(!0)}};return(0,G.jsx)($A.Provider,{value:U,children:(0,G.jsx)(oj,{render:n,className:r,style:m,state:ae,props:[oe,h,e=>S.getValidationProps(A??!1,e)],refs:[t],stateAttributesMapping:uO,enableHomeAndEndKeys:!1,modifierKeys:sj})})}),lj={kzqmXN:`x17z2i9w`,kZKoxP:`x17rw0jw`,kmVPX3:`x1717udv`,kaIpWk:`x16rqkct`,kMzoRj:`xdh2fpr`,ksu8eU:`x1y0btm7`,kVAM5u:`x9r1u3d`,kkrTdU:`x1ypdohk`,kI3sdo:`x1a2a7pz`,$$css:!0},uj={swatch:e=>[lj,{kWkggS:e==null?e:`xl8spv7`,$$css:!0},{"--x-backgroundColor":e??void 0}],checked:{kVAM5u:`x1b7y1cz`,$$css:!0}};function dj(e){let t=(0,ko.c)(8),{value:n,onValueChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>r(e),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=U_.map(e=>(0,G.jsx)(nj,{value:e,"aria-label":e,title:e,...Fo(uj.swatch(H_[e]),n===e&&uj.checked)},e)),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a||t[6]!==n?(o=(0,G.jsx)(cj,{value:n,onValueChange:i,"aria-label":`Folder color`,className:`x78zum5 x167g77z x1a02dak`,children:a}),t[4]=i,t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function fj(e){let t=(0,ko.c)(40),{folder:n,onClose:r}=e,i=al(),[a,o]=(0,W.useState)(null),s=n?.name??``,c=n?.color??`blue`,l;t[0]!==s||t[1]!==c?(l={name:s,color:c},t[0]=s,t[1]=c,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={onChange:W_},t[3]=d):d=t[3];let f;t[4]!==n||t[5]!==i||t[6]!==r?(f=async e=>{let{value:t}=e;o(null);try{n?await i.updateFolder.mutateAsync({data:{id:n.id,input:t}}):await i.createFolder.mutateAsync({data:t}),r()}catch(e){o(q_(e))}},t[4]=n,t[5]=i,t[6]=r,t[7]=f):f=t[7];let p;t[8]!==u||t[9]!==f?(p={defaultValues:u,validators:d,onSubmit:f},t[8]=u,t[9]=f,t[10]=p):p=t[10];let m=rO(p),h;t[11]===r?h=t[12]:(h=e=>!e&&r(),t[11]=r,t[12]=h);let g=n?`Edit folder`:`New folder`,_;t[13]===m?_=t[14]:(_=e=>{e.preventDefault(),m.handleSubmit()},t[13]=m,t[14]=_);let v,y;t[15]===m.Field?(v=t[16],y=t[17]):(v=(0,G.jsx)(m.Field,{name:`name`,children:hj}),y=(0,G.jsx)(m.Field,{name:`color`,children:mj}),t[15]=m.Field,t[16]=v,t[17]=y);let b;t[18]===a?b=t[19]:(b=a?(0,G.jsx)(`div`,{role:`alert`,className:`xfifm61 xb0vdwp x13faqbe`,children:a}):null,t[18]=a,t[19]=b);let x;t[20]===r?x=t[21]:(x=(0,G.jsx)(xy,{type:`button`,onClick:r,children:`Cancel`}),t[20]=r,t[21]=x);let S;t[22]===n?S=t[23]:(S=e=>(0,G.jsx)(xy,{type:`submit`,variant:`primary`,disabled:!e,children:n?`Save`:`Create folder`}),t[22]=n,t[23]=S);let C;t[24]!==m.Subscribe||t[25]!==S?(C=(0,G.jsx)(m.Subscribe,{selector:pj,children:S}),t[24]=m.Subscribe,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==x||t[28]!==C?(w=(0,G.jsxs)(YE,{children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;t[30]!==_||t[31]!==v||t[32]!==y||t[33]!==b||t[34]!==w?(T=(0,G.jsxs)(`form`,{onSubmit:_,className:`x78zum5 xdt5ytf x1af02g3`,children:[v,y,b,w]}),t[30]=_,t[31]=v,t[32]=y,t[33]=b,t[34]=w,t[35]=T):T=t[35];let E;return t[36]!==T||t[37]!==h||t[38]!==g?(E=(0,G.jsx)(JE,{open:!0,onOpenChange:h,title:g,children:T}),t[36]=T,t[37]=h,t[38]=g,t[39]=E):E=t[39],E}function pj(e){return e.canSubmit&&!e.isSubmitting}function mj(e){return(0,G.jsx)(LO,{label:`Color`,children:(0,G.jsx)(dj,{value:e.state.value,onValueChange:e.handleChange})})}function hj(e){return(0,G.jsx)(LO,{label:`Name`,error:e.state.meta.isTouched?e.state.meta.errors[0]?.message:void 0,children:(0,G.jsx)(UO,{autoFocus:!0,name:`name`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)})})}var gj=[`system`,`light`,`dark`],_j=z({method:`GET`}).handler(u(`71c8991fc9c515da010713bdaa6b8c785cb3e21a16557175130babcfd659f0d8`)),vj=z({method:`POST`}).handler(u(`08e380ba074146180cab5cf970c6269c0fa27aca786f3aa0c9288cb27cccefbf`)),yj=`•`.repeat(43),bj={idle:e=>e,copied:()=>`Copied`,failed:()=>`Copy failed`};function xj(e){let t=(0,ko.c)(15),{text:n,label:r,noun:i,caption:a,announce:o}=e,[s,c]=(0,W.useState)(`idle`),l;t[0]!==o||t[1]!==i||t[2]!==n?(l=async()=>{try{await navigator.clipboard.writeText(n),c(`copied`),o(`${i} copied`)}catch{c(`failed`),o(`${i} copy failed`)}setTimeout(()=>c(`idle`),1500)},t[0]=o,t[1]=i,t[2]=n,t[3]=l):l=t[3];let u=l,d=!a,f=s===`failed`?`${r} failed`:r,p;t[4]===u?p=t[5]:(p=()=>void u(),t[4]=u,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsx)(Pe,{}),t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==s?(h=a?bj[s](a):null,t[7]=a,t[8]=s,t[9]=h):h=t[9];let g;return t[10]!==d||t[11]!==f||t[12]!==p||t[13]!==h?(g=(0,G.jsxs)(xy,{small:!0,icon:d,"aria-label":f,onClick:p,children:[m,h]}),t[10]=d,t[11]=f,t[12]=p,t[13]=h,t[14]=g):g=t[14],g}function Sj(){let e=(0,ko.c)(55),t=F(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=P(),e[0]=n):n=e[0];let r=Le(n),i=r.data,[a,o]=(0,W.useState)(``),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{o(e),setTimeout(()=>o(``),1500)},e[1]=s):s=e[1];let c=s,[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),p;e[2]===t?p=e[3]:(p={mutationFn:Cj,onSuccess:e=>t.setQueryData(P().queryKey,e)},e[2]=t,e[3]=p);let m=Ti(p),h=typeof window>`u`?`/mcp`:`${window.location.origin}/mcp`,g;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>`claude mcp add --transport http db-player ${h} --header "Authorization: Bearer ${e}"`,e[4]=g):g=e[4];let _=g,v;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,G.jsx)(`h3`,{id:`mcp`,className:`x1ghz6dp xvj2dgp x1s688f`,children:`Agent access (MCP)`}),e[5]=v):v=e[5];let y;e[6]===a?y=e[7]:(y=(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`x10l6tqk x1i1rx1s xjm9jq1 xb3r6kr x1hyvwdk xuxw1ft`,children:a}),e[6]=a,e[7]=y);let b;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,G.jsx)(`p`,{className:`x1ghz6dp x9otpla xqtwvag x1tviuuy x1evy7pa`,children:`Lets AI agents list your connections and run read-only queries. Writes, DDL and multiple statements are refused. For production, use a connection whose database user is read-only.`}),e[8]=b):b=e[8];let x;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(`span`,{className:`xqtwvag x1tviuuy`,children:`URL`}),e[9]=x):x=e[9];let S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1mbf7id`,children:[x,(0,G.jsxs)(`div`,{className:`x78zum5 x1cy8zhl xbbb4fa`,children:[(0,G.jsx)(`code`,{"data-testid":`mcp-url`,className:`x98rzlu xeuugli xifx94n xu7byfh xxb57xf xqtwvag x1evy7pa xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 xpa2s8g xj0a0fe x126k92a xvrbanz`,children:h}),(0,G.jsx)(xj,{text:h,label:`Copy URL`,noun:`URL`,announce:c})]})]}),e[10]=S):S=e[10];let C;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(`span`,{className:`xqtwvag x1tviuuy`,children:`Token`}),e[11]=C):C=e[11];let w=i?l?i:yj:r.isError?`Token unavailable`:`Loading…`,T;e[12]===w?T=e[13]:(T=(0,G.jsx)(`code`,{"data-testid":`mcp-token`,className:`x98rzlu xeuugli xifx94n xu7byfh xxb57xf xqtwvag x1evy7pa xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 xpa2s8g xj0a0fe x126k92a xvrbanz`,children:w}),e[12]=w,e[13]=T);let E;e[14]!==i||e[15]!==r?(E=!i&&r.isError?(0,G.jsx)(xy,{small:!0,onClick:()=>void r.refetch(),disabled:r.isFetching,children:`Retry`}):null,e[14]=i,e[15]=r,e[16]=E):E=e[16];let D=l?`Hide token`:`Show token`,O=!i,k,A;e[17]===l?(k=e[18],A=e[19]):(k=()=>u(!l),A=l?(0,G.jsx)(oe,{}):(0,G.jsx)(Re,{}),e[17]=l,e[18]=k,e[19]=A);let j;e[20]!==D||e[21]!==O||e[22]!==k||e[23]!==A?(j=(0,G.jsx)(xy,{small:!0,icon:!0,"aria-label":D,disabled:O,onClick:k,children:A}),e[20]=D,e[21]=O,e[22]=k,e[23]=A,e[24]=j):j=e[24];let M;e[25]===i?M=e[26]:(M=i?(0,G.jsx)(xj,{text:i,label:`Copy token`,noun:`Token`,announce:c}):null,e[25]=i,e[26]=M);let N;e[27]!==T||e[28]!==E||e[29]!==j||e[30]!==M?(N=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1mbf7id`,children:[C,(0,G.jsxs)(`div`,{className:`x78zum5 x1cy8zhl xbbb4fa`,children:[T,E,j,M]})]}),e[27]=T,e[28]=E,e[29]=j,e[30]=M,e[31]=N):N=e[31];let I;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,G.jsx)(`span`,{className:`xqtwvag x1tviuuy`,children:`Add to Claude Code`}),e[32]=I):I=e[32];let L;e[33]!==l||e[34]!==i||e[35]!==r.isError?(L=i?_(l?i:yj).replace(` --header`,` \\
|
|
66
|
+
--header`):r.isError?`Token unavailable`:`Loading…`,e[33]=l,e[34]=i,e[35]=r.isError,e[36]=L):L=e[36];let R;e[37]===L?R=e[38]:(R=(0,G.jsx)(`code`,{"data-testid":`mcp-command`,className:`x98rzlu xeuugli xifx94n xu7byfh xxb57xf xqtwvag x1evy7pa xgwgzc4 x122w267 xvjf9rd xmkeg23 x1y0btm7 xpa2s8g xj0a0fe x126k92a xvrbanz`,children:L}),e[37]=L,e[38]=R);let z;e[39]===i?z=e[40]:(z=i?(0,G.jsx)(xj,{text:_(i),label:`Copy command`,noun:`Command`,caption:`Copy command`,announce:c}):null,e[39]=i,e[40]=z);let B;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,G.jsx)(xy,{small:!0,variant:`danger`,onClick:()=>f(!0),children:`Regenerate token`}),e[41]=B):B=e[41];let V;e[42]===z?V=e[43]:(V=(0,G.jsxs)(`div`,{className:`x78zum5 xbbb4fa`,children:[z,B]}),e[42]=z,e[43]=V);let H;e[44]!==R||e[45]!==V?(H=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1mbf7id`,children:[I,R,V]}),e[44]=R,e[45]=V,e[46]=H):H=e[46];let ee;e[47]!==d||e[48]!==m?(ee=d?(0,G.jsx)(XE,{title:`Regenerate token?`,message:`Every existing client stops working until you give it the new token.`,confirmLabel:`Regenerate`,busy:m.isPending,onCancel:()=>f(!1),onConfirm:async()=>{await m.mutateAsync(),f(!1)}}):null,e[47]=d,e[48]=m,e[49]=ee):ee=e[49];let te;return e[50]!==N||e[51]!==H||e[52]!==ee||e[53]!==y?(te=(0,G.jsxs)(`section`,{"aria-labelledby":`mcp`,className:`x78zum5 xdt5ytf x1n8io78 x6mll90`,children:[v,y,b,S,N,H,ee]}),e[50]=N,e[51]=H,e[52]=ee,e[53]=y,e[54]=te):te=e[54],te}function Cj(){return o()}var wj=Ia(`__root__`),Tj={system:`System`,light:`Light`,dark:`Dark`},Ej={kZKoxP:`x1ycjhwn`,kaIpWk:`x18zih8k`,kWkggS:`x1ezoecf`,$$css:!0},Dj={preview:{kVAEAm:`x1n2onr6`,kZKoxP:`x1peatla`,kVQacm:`xb3r6kr`,kaIpWk:`xvjf9rd`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`xpa2s8g`,kWkggS:`x185or1n`,$$css:!0},half:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,$$css:!0},left:{kz4h6p:`x1otnbfm`,$$css:!0},right:{kz4h6p:`xfh1k12`,$$css:!0},bar:e=>[Ej,{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],barStrong:{kWkggS:`x152q98y`,$$css:!0}};function Oj(){let e=(0,ko.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`xdqdh73 xgwgzc4 xs1s249 x32b0ac xl7466b x1vvogim x1xijbu4 x78zum5 xdt5ytf x1jnr06f`,children:[(0,G.jsx)(`div`,{...Fo(Dj.bar(`80%`),Dj.barStrong)}),(0,G.jsx)(`div`,{...Fo(Dj.bar(`60%`))}),(0,G.jsx)(`div`,{...Fo(Dj.bar(`70%`))})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(`div`,{className:`x78zum5 x5yr21d x185or1n`,children:[t,(0,G.jsxs)(`div`,{className:`x98rzlu xe8ttls x78zum5 xdt5ytf x1nejdyq`,children:[(0,G.jsx)(`div`,{...Fo(Dj.bar(`50%`),Dj.barStrong)}),(0,G.jsx)(`div`,{...Fo(Dj.bar(`90%`))}),(0,G.jsx)(`div`,{...Fo(Dj.bar(`75%`))}),(0,G.jsx)(`div`,{className:`xdk7pt xgd8bvy x18zih8k xq83s4c xr1yuqi`})]})]}),e[1]=n):n=e[1],n}function kj(e){let t=(0,ko.c)(6),{mode:n}=e;if(n===`system`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsxs)(`div`,{className:`x1n2onr6 x1peatla xb3r6kr xvjf9rd xmkeg23 x1y0btm7 xpa2s8g x185or1n`,children:[(0,G.jsx)(`div`,{...Fo(Dj.half,Dj.left,wo),children:(0,G.jsx)(Oj,{})}),(0,G.jsx)(`div`,{...Fo(Dj.half,Dj.right,To),children:(0,G.jsx)(Oj,{})})]}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=Fo(Dj.preview,n===`light`?wo:To),t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(Oj,{}),t[3]=i):i=t[3];let a;return t[4]===r?a=t[5]:(a=(0,G.jsx)(`div`,{...r,children:i}),t[4]=r,t[5]=a),a}function Aj(e){let t=(0,ko.c)(19),{onClose:n}=e,{theme:r}=wj.useLoaderData(),i=zi(),a;t[0]===i?a=t[1]:(a=async e=>{await vj({data:e}),await i.invalidate()},t[0]=i,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=e=>!e&&n(),t[2]=n,t[3]=s);let c,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(`h3`,{id:`appearance`,className:`x1ghz6dp xvj2dgp x1s688f`,children:`Appearance`}),l=(0,G.jsx)(`p`,{className:`x1ghz6dp x9otpla xqtwvag x1tviuuy`,children:`Choose how db-player looks. System follows your OS.`}),t[4]=c,t[5]=l):(c=t[4],l=t[5]);let u;t[6]===o?u=t[7]:(u=e=>void o(e),t[6]=o,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=gj.map(jj),t[8]=d):d=t[8];let f;t[9]!==u||t[10]!==r?(f=(0,G.jsxs)(`section`,{"aria-labelledby":`appearance`,className:`x78zum5 xdt5ytf x1n8io78`,children:[c,l,(0,G.jsx)(cj,{value:r,onValueChange:u,"aria-label":`Theme`,className:`xrvj5dj x1wlfl8j x1n8io78`,children:d})]}),t[9]=u,t[10]=r,t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,G.jsx)(Sj,{}),t[12]=p):p=t[12];let m;t[13]===n?m=t[14]:(m=(0,G.jsx)(YE,{children:(0,G.jsx)(xy,{onClick:n,children:`Done`})}),t[13]=n,t[14]=m);let h;return t[15]!==s||t[16]!==f||t[17]!==m?(h=(0,G.jsxs)(JE,{open:!0,onOpenChange:s,title:`Settings`,wide:!0,children:[f,p,m]}),t[15]=s,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function jj(e){return(0,G.jsxs)(nj,{value:e,"aria-label":Tj[e],className:`x78zum5 xdt5ytf xbbb4fa x1ruevkc x1o95cbt xgwgzc4 x122w267 xr11lhz xmkeg23 x1y0btm7 x4s12hp x1632hs x1cej5sy x1gnnqk1 xot0yp x1ypdohk x1a2a7pz x12lrzb7 x1hl8ikr x9vp5wv x1qfwjxi x6setmy x1c071of xk4oym4`,children:[(0,G.jsx)(kj,{mode:e}),(0,G.jsx)(`span`,{className:`xqtwvag xk50ysn x2b8uid`,children:Tj[e]})]},e)}function Mj(e){let t=(0,ko.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`kbd`,{className:`x3nfvp2 x6s0dn4 xlup9mm xfn1xvj x134rb1s x1j6dyjg xk50ysn x1tviuuy xn7wf0q xmkeg23 x1y0btm7 x4s12hp`,children:n}),t[0]=n,t[1]=r),r}var Nj=W.createContext(void 0);function Pj(e=!0){let t=W.useContext(Nj);if(t===void 0&&!e)throw Error(Hv(25));return t}var Fj=W.createContext(void 0);function Ij(e){let t=W.useContext(Fj);if(t===void 0&&!e)throw Error(Hv(33));return t}var Lj=W.createContext(void 0);function Rj(e){let t=W.useContext(Lj);if(t===void 0&&!e)throw Error(Hv(36));return t}var zj=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Rj(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=Ij(),f={open:o.useState(`open`),side:c,align:l,uncentered:u};return fy(`div`,e,{ref:[s,t],stateAttributesMapping:Vy,state:f,props:{style:d,"aria-hidden":!0,...a}})}),Bj=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Rj(),s=o.useState(`open`),c=o.useState(`mounted`),l=o.useState(`transitionStatus`),u=o.useState(`lastOpenChangeReason`),d=Pj(),f={open:s,transitionStatus:l};return fy(`div`,e,{ref:d?.backdropRef?[t,d.backdropRef]:t,state:f,stateAttributesMapping:Hy,props:[{role:`presentation`,hidden:!c,style:{pointerEvents:u===`trigger-hover`?`none`:void 0,userSelect:`none`,WebkitUserSelect:`none`}},a]})}),Vj=W.createContext(null);function Hj(e=`root`){let t=W.useContext(Vj),n=W.useContext(Lj);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}function Uj(e){if(Hj()===null)throw Error(Hv(104,e))}var Wj={visible:!0,ref:null};function Gj(){return Wj}function Kj(e,t,n=`root`){let r=Hj(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??Gj)({label:e.label,children:e.children,render:e.render}),a=Zv(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var qj=W.createContext(void 0);function Jj(){let e=W.useContext(qj);if(e===void 0)throw Error(Hv(30));return e}function Yj(e){e.preventDefault()}function Xj(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=Rj(),u=Pj(!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 W.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?Yj: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:Zy})},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&&!Nb&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&qv(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var Zj={type:`regular-item`};function Qj(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=W.useRef(null),{getButtonProps:d,buttonRef:f}=Jv({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Xj({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=W.useCallback(e=>Ov(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=Zv(u,f);return W.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var $j=`data-checked`,eM=`data-unchecked`,tM={checked(e){return e?{[$j]:``}:{[eM]:``}},...Oy},nM=W.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}=Rj(),m=IA({guess:!0,label:a}),h=yb(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}=Qj({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:Zj}),C=W.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=Wy(Zy,e.nativeEvent,void 0,{preventUnmountOnClose:oy});u?.(!l,t)}let T=fy(`div`,e,{state:C,stateAttributesMapping:tM,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,G.jsx)(qj.Provider,{value:C,children:T})}),rM=W.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=iO({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=Kj(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,G.jsx)(nM,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),iM=W.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Jj(),c=W.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=NC(s.checked);return RC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),fy(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:tM,props:{"aria-hidden":!0,...o},enabled:a||u})}),aM=W.createContext(void 0);function oM(){let e=W.useContext(aM);if(e===void 0)throw Error(Hv(31));return e}var sM=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=W.useState(void 0),c=fy(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,G.jsx)(aM.Provider,{value:s,children:c})}),cM=W.forwardRef(function(e,t){let n=Hj()?.Group??sM;return(0,G.jsx)(n,{...e,ref:t})}),lM=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=yb(a),c=oM();return J(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),fy(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),uM=W.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}=Rj(),f=IA({guess:!0,label:a}),p=yb(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}=Qj({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:Zj});return fy(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),dM=W.forwardRef(function(e,t){let n=Kj(e,t);return n.visible?(0,G.jsx)(uM,{...e,ref:n.ref}):null}),fM=W.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,closeOnClick:o=!1,style:s,...c}=e,{store:l}=Rj(),u=W.useRef(null),d=IA({guess:!0,label:a}),f=yb(i),p=l.useState(`isActive`,d.index),m=l.useState(`floatingNodeId`),h=l.useState(`itemProps`),g=l.context.typingRef,{getButtonProps:_,buttonRef:v}=Jv({native:!1,composite:!0}),y=Xj({closeOnClick:o,highlighted:p,id:f,nodeId:m,store:l,typingRef:g,itemRef:u,itemMetadata:Zj});function b(e){return Ov(y,e,_)}return fy(`a`,e,{state:{highlighted:p},props:[h,c,b],ref:[u,v,t,d.ref]})}),pM=W.forwardRef(function(e,t){let n=Kj(e,t);return n.visible?(0,G.jsx)(fM,{...e,ref:n.ref}):null}),mM=W.createContext(void 0);function hM(){return W.useContext(mM)}function gM(e,t){let n=gy(e.render);if(W.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function _M(e,t,n){let r=gM(e,t),i=r===t?void 0:r;return[r,W.useCallback(e=>n?.(e?i:void 0),[i,n])]}function vM(e,t,n){let r=gy(e.render),i=W.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 yM=W.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}=Rj(),m=hM(),{side:h,align:g}=Ij(),_=SA(!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]=_M(e,u,d),L=vM(e,C,N),R=w.type===`menu`?m:void 0,z=w.type===`context-menu`,B=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(B=()=>l.state.activeIndex===null&&P),RC({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),W.useEffect(()=>{function e(e){l.setOpen(!1,Wy(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),Fw(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let V=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:H,handleFocus:ee}=(W.useContext(Vj)?.useParentHandoff??xM)(l,w,v,f),te=fy(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,V,I],stateAttributesMapping:Hy,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&lE.has(e.key)&&e.stopPropagation()},onFocus:ee},pA(y),c,{"data-rootownerid":E}]}),ne=w.type===void 0||z;(C||w.type===`menubar`&&T!==`outside-press`)&&(ne=!0);let re=R?.getReturnElement??H;return(0,G.jsx)(CC,{context:D,openInteractionType:M,modal:z,disabled:!x,returnFocus:a??re??ne,explicitReturnFocus:a===void 0&&re?!1:void 0,initialFocus:B,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:te})}),bM={parentVirtualFocusRef:void 0,handleFocus:void 0};function xM(){return bM}var SM=W.forwardRef(function(e,t){let n=Hj()?.Popup??yM;return(0,G.jsx)(n,{...e,ref:t})}),CM=W.createContext(void 0);function wM(){let e=W.useContext(CM);if(e===void 0)throw Error(Hv(32));return e}var TM=W.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=Rj();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,G.jsx)(CM.Provider,{value:n,children:(0,G.jsx)(iC,{ref:t,...r,portalOwnerRole:o})})});function EM(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=W.useRef(null),o=W.useRef(null),s=LC(r);J(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),J(()=>{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])}var DM=W.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=XS,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=Rj(),x=wM(),S=Pj(!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,B=c,V=l,H=s,ee=h;C.type===`context-menu`&&(z=n??C.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let te=o,ne=H;C.type===`menu`?(te??=`inline-end`,ne??=`start`,ee=e.collisionAvoidance??ZS):C.type===`menubar`&&(te??=C.context.orientation===`vertical`?`inline-end`:`bottom`,ne??=`start`);let re=C.type===`context-menu`,ie=oA({anchor:z,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:te,sideOffset:B,align:ne,alignOffset:V,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ee,shift:re?{crossAxis:!(`side`in ee&&ee.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});W.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Wy(cb)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),W.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,Wy(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ae=Cb();W.useEffect(()=>{D||ae.clear()},[D,ae]),W.useEffect(()=>{function e(e){if(D&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,Wy(cb))}):v.setOpen(!1,Wy(cb))}else ae.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ae]),W.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),EM({store:v,domReference:R,positionerElement:M,open:D});let U={open:D,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:C.type===`menu`,instant:N},oe=C.type===`menubar`&&C.context.modal;gA(D&&(oe||O&&F!==`trigger-hover`),k===`touch`,M,A);let se=mA(e,U,{styles:ie.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),ce=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),le=null;return C.type===`menubar`?le=C.context.contentElement:C.type===void 0&&(le=A),(0,G.jsxs)(Fj.Provider,{value:ie,children:[ce&&(0,G.jsx)(SE,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:xE(!D),cutout:le}),(0,G.jsx)(fC,{id:I,children:(0,G.jsx)(Fk,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:se})})]})}),OM=W.createContext(void 0);function kM(){let e=W.useContext(OM);if(e===void 0)throw Error(Hv(34));return e}var AM=W.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=W.useState(void 0),[p,m]=iO({controlled:i,default:a,name:`MenuRadioGroup`}),h=q((e,t)=>{o?.(e,t),t.isCanceled||m(e)}),g=fy(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=W.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,G.jsx)(aM.Provider,{value:f,children:(0,G.jsx)(OM.Provider,{value:_,children:g})})}),jM=W.memo(W.forwardRef(function(e,t){let n=Hj()?.RadioGroup??AM;return(0,G.jsx)(n,{...e,ref:t})})),MM=W.createContext(void 0);function NM(){let e=W.useContext(MM);if(e===void 0)throw Error(Hv(35));return e}var PM=W.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,{store:f}=Rj(),{value:p,setValue:m,disabled:h}=kM(),g=IA({guess:!0,label:a}),_=yb(i),v=f.useState(`isActive`,g.index),y=f.useState(`floatingNodeId`),b=f.useState(`itemProps`),x=f.useState(`disabled`),S=s||h||x,C=p===l,{getItemProps:w,itemRef:T}=Qj({closeOnClick:c,disabled:S,highlighted:v,id:_,store:f,nativeButton:o,nodeId:y,itemMetadata:Zj}),E=W.useMemo(()=>({disabled:S,highlighted:v,checked:C}),[S,v,C]);function D(e){let t=Wy(Zy,e.nativeEvent,void 0,{preventUnmountOnClose:oy});m(l,t)}let O=fy(`div`,e,{state:E,stateAttributesMapping:tM,props:[b,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,g.ref]});return(0,G.jsx)(MM.Provider,{value:E,children:O})}),FM=W.forwardRef(function(e,t){let n=Kj(e,t);return n.visible?(0,G.jsx)(PM,{...e,ref:n.ref}):null}),IM=W.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=NM(),c=W.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=NC(s.checked);return RC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),fy(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:tM,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),LM=W.createContext(null);function RM(e){let t=W.useContext(LM);if(t===null&&!e)throw Error(Hv(5));return t}function zM(e){return e==null?Ky:e.type.startsWith(`key`)?ib:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?ab:Ky}var BM={...Tw,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=Tw.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>Fb&&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`&&!Tw.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`)}},VM=class extends gw{constructor(e,t,n=!1){let r=new ew,i=WM(r,t,n,e);super(i,UM(r),BM),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 HM(){let e=new ew,t=new IE(Object.freeze(WM(e)),Object.freeze(UM(e)),BM);return Object.assign(t,{setOpen:oy})}function UM(e){return{positionerRef:W.createRef(),popupRef:W.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:W.createRef(),beforeTriggerFocusGuardRef:W.createRef(),beforeContentFocusGuardRef:W.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function WM(e,t,n=!1,r){return{...yw(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:cy,inputProps:cy,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new oC,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:cy,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var GM=W.createContext(null);function KM(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function qM(e,t){return e===`list-navigation`||KM(e,t)}var JM=aw(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=Pj(!0),C=Rj(!0),w=RM(!0),T=C?.store,E=C?.virtualFocus??!1,D=W.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=yb(),k=yb(),[A,j]=W.useState(void 0),M=(A??k)||void 0,N=lC(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=xv(()=>F?P?.state.instantType:void 0).current,L=xv(()=>{let e=new VM({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=dC(R),B=L.useState(`open`),V=L.useState(`activeTriggerElement`),H=L.useState(`positionerElement`),ee=L.useState(`hoverEnabled`),te=L.useState(`disabled`),ne=L.useState(`lastOpenChangeReason`),re=L.useState(`parent`),ie=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),U=L.useState(`payload`),oe=L.useState(`floatingParentNodeId`),se=W.useRef(null),ce=W.useRef(re.type!==`context-menu`),le=Cb(),ue=W.useRef(!0),de=Cb(),fe=oe!=null,{openMethod:pe,triggerProps:me}=qE(B);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:re.type===void 0?c:void 0,openMethod:pe,rootId:O}),XC(L);let{forceUnmount:he,transitionStatus:ge}=ZC(B,L,()=>{L.set(`allowMouseEnter`,!1)},F),_e=LC(L.context.popupRef);W.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!B){e();return}if(ge!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return _e(e,t.signal),()=>{t.abort()}},[I,B,ge,_e,L]),J(()=>{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,V,L]),W.useEffect(()=>{B||(se.current=null),re.type===`context-menu`&&(B?le.start(500,()=>{ce.current=!0}):(le.clear(),ce.current=!1))},[le,B,re.type]),J(()=>{!B&&!ee&&L.set(`hoverEnabled`,!0)},[B,ee,L]);let ve=q((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||B===e&&t.trigger===V&&ne===n)return;let i=qC(t);if(!e&&t.trigger==null&&(t.trigger=V??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`&&!ue.current)return;e&&n===`trigger-focus`?(ue.current=!1,de.start(300,()=>{ue.current=!0})):(ue.current=!0,de.clear());let o=!e&&(n===`escape-key`||n==null);se.current=t.event;let s=KC(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&qM(n,a),s.instantType=re.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:KM(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),ye=MC({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ve}),be=ye.context.events;J(()=>{let e=({open:e,eventDetails:t})=>ve(e,t);return be.on(`setOpen`,e),()=>{be?.off(`setOpen`,e)}},[be,ve]),J(()=>L.subscribeToParentMenu(),[L]);let xe=W.useCallback(()=>{L.setOpen(!1,Wy(fb))},[L]);W.useImperativeHandle(d,()=>({unmount:he,close:xe}),[he,xe]);let Se;re.type===`context-menu`&&(Se=re.context),W.useImperativeHandle(Se?.positionerRef,()=>H,[H]),W.useImperativeHandle(Se?.actionsRef,()=>({setOpen:ve}),[ve]);let Ce=AC(ye,{enabled:!te,bubbles:{escapeKey:f&&re.type===`menu`},outsidePress(){return re.type!==`context-menu`||se.current?.type===`contextmenu`||ce.current},externalTree:fe?R:void 0}),we=Wk(),Te=Ww(ye,{enabled:!te,listRef:L.context.itemDomElements,activeIndex:ie,virtual:v,nested:re.type===`menubar`||!v&&re.type!==void 0,parentOrientation:re.type===`menubar`?re.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:we===`rtl`,disabledIndices:sy,onNavigate(e,t){L.setActiveIndex(e,zM(t),t?.nativeEvent)},openOnArrowKeyDown:re.type!==`context-menu`&&!(v&&_),externalTree:!v&&fe?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),Ee=W.useCallback(e=>{L.context.typingRef.current=e},[L]),De=Gw(ye,{enabled:!te&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:(e,t)=>{B&&e!==ie&&L.setActiveIndex(e,ib,t.nativeEvent)},onTyping:Ee}),Oe=q(a),ke=W.useRef(-1),Ae=q(()=>{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(ke.current===n&&L.context.reportedItem===t)return;ke.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=Ky,L.context.highlightEvent=void 0,a&&Oe(t,Gy(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});J(()=>{Ae()},[ie,Ae]);let je=W.useMemo(()=>{if(!v)return Te.reference;if(!Te.trigger)return cy;let{onFocus:e,...t}=Te.trigger;return t},[v,Te.reference,Te.trigger]);L.useSyncedValue(`inputProps`,v?Te.reference??cy:cy);let Me=W.useMemo(()=>{let e=Ov(De.reference,je,Ce.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=B,e},[L,De.reference,je,Ce.reference,me,B]),Ne=W.useMemo(()=>{let e=Ov(Te.trigger,Ce.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Te.trigger,Ce.trigger,me]);xv(()=>(L.update({inactiveTriggerProps:Ne}),null)),QC(L,{floatingRootContext:ye,activeTriggerProps:Me,inactiveTriggerProps:Ne,popupProps:W.useMemo(()=>Ov(BC,{onMouseMove(){L.set(`allowMouseEnter`,!0),re.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)}},De.floating,Te.floating,Ce.floating),[re.type,L,De.floating,Te.floating,Ce.floating]),itemProps:Te.item??cy});let Pe=W.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:Ae}),[L,D,u,l,b,k,v,E,Ae]),Fe=typeof t==`function`?t({payload:U}):t,Ie=(0,G.jsxs)(Lj.Provider,{value:Pe,children:[p&&(0,G.jsx)(UC,{handle:p,store:L}),Fe]});return(re.type===void 0||re.type===`context-menu`)&&(Ie=(0,G.jsx)(pC,{externalTree:R,children:Ie})),Ie});function YM(e){let t=W.useContext(GM);if(t===null)return(0,G.jsx)(JM,{...e});let n=t.Root;return(0,G.jsx)(GM.Provider,{value:null,children:(0,G.jsx)(n,{...t.options,...e})})}var XM={};function ZM(e){Rj();let t=W.useContext(GM);if(t!==null){let n=t.SubmenuRoot;return(0,G.jsx)(GM.Provider,{value:null,children:(0,G.jsx)(n,{...t.options,...e})})}return(0,G.jsx)(mM.Provider,{value:XM,children:(0,G.jsx)(JM,{...e,isSubmenu:!0})})}function QM(e){if(ev(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!fv(e))return QM(hv(e))}function $M(e,t){function n(n,r,i){let a=n.currentTarget;$S.flushSync(()=>{e.setOpen(!1,Wy(tb,n.nativeEvent,a))}),kS(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&&AS(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function eN(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=W.useRef(!1);return W.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Kv(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:cy,[t,n,r])}var tN=ow(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=Rj(!0),h=Ew(d)??m?.store;if(!h)throw Error(Hv(85));let g=yb(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=W.useRef(null),S=rN(),C=Wv(!0),w=uC(),T=W.useMemo(()=>w??new oC,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=YC(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:dC(T),floatingParentNodeId:lC(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Jv({disabled:A,native:o});W.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=W.useRef(null),P=Cb(),F=q(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Y(N.current,t)||Y(h.select(`positionerElement`),t)||t===N.current||t!=null&&QM(t)===h.select(`rootId`)||Ck(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:sb})});W.useEffect(()=>{let e=Kv(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=Lw(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:$w({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=nN(y,h.select(`lastOpenChangeReason`)),z=wC(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=kw(v,{enabled:!A&&I}),V=eN({open:y,enabled:O,mouseDownAction:`open`}),H=W.useMemo(()=>Ov(B.reference,z.reference),[B.reference,z.reference]),ee=h.useState(`triggerProps`,D),te=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:ne,handleFocusTargetFocus:re}=$M(h,x),ie={disabled:A,open:y},ae=[N,t,M,E,x],U=[H,L??cy,ee,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Kv(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},te,O?{role:`menuitem`}:{},V,p,j],oe=fy(`button`,e,{enabled:!O,stateAttributesMapping:By,state:ie,ref:ae,props:U});return O?(0,G.jsx)(QA,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:U,stateAttributesMapping:By}):y?(0,G.jsxs)(W.Fragment,{children:[(0,G.jsx)(Ox,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:ne},`${g}-pre-focus-guard`),(0,G.jsx)(W.Fragment,{children:oe},g),(0,G.jsx)(Ox,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,G.jsx)(W.Fragment,{children:oe},g)});function nN(e,t){let n=Cb(),[r,i]=W.useState(!1);return J(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function rN(){let e=RM(!0);return W.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function iN(e){let t=pv(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ev(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(jx(n)!==a||jx(r)!==o)&&(n=a,r=o),{width:n,height:r}}var aN=`--popup-width`,oN=`--popup-height`;function sN(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:c}=e,l=LC(t,!0),u=wx(),d=W.useRef(null),f=q(a),p=q(o),m=W.useMemo(()=>cN(s,c),[s,c]);J(()=>{if(!i){d.current=null;return}if(!t||!n)return;let e=uN(t,m);dN(t,`auto`);let r=lN(t,`position`,`static`),a=lN(t,`transform`,`none`),o=lN(t,`scale`,`1`),s=uN(n,{[Yk]:`max-content`,[Xk]:`max-content`});function c(){r(),a(),s(),o()}if(f?.(),d.current===null){fN(n,`max-content`);let r=iN(t);return d.current=r,fN(n,r),c(),p?.(null,r),e}fN(n,`max-content`);let h=d.current,g=iN(t);d.current=g,dN(t,h),c(),p?.(h,g),fN(n,g);let _=new AbortController;return u.request(()=>{dN(t,g),l(()=>{t.style.setProperty(aN,`auto`),t.style.setProperty(oN,`auto`)},_.signal)}),()=>{_.abort(),u.cancel(),e()}},[r,t,n,l,u,i,f,p,m])}function cN(e,t){let n=e===`top`,r=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!n&&!r?cy:{position:`absolute`,[n?`bottom`:`top`]:`0`,[r?`right`:`left`]:`0`}}function lN(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function uN(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(lN(e,r,i));return n.length?()=>{n.forEach(e=>e())}:oy}function dN(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(aN,n),e.style.setProperty(oN,r)}function fN(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(eA,n),e.style.setProperty(tA,r)}var pN={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=X_(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:Jk};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Kv(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Lx(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Jk.sideX,g=f===`top`?`bottom`:Jk.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},mN=`data-activation-direction`,hN={activationDirection:e=>e?{[mN]:e}:null};function gN(e){let{store:t,side:n,children:r}=e,i=Wk(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),s=t.useState(`open`),c=t.useState(`payload`),l=t.useState(`mounted`),u=t.useState(`popupElement`),d=t.useState(`positionerElement`),f=GO(s?a:null),p=bN(o,c),m=W.useRef(null),[h,g]=W.useState(null),[_,v]=W.useState(null),y=W.useRef(null),b=W.useRef(null),x=LC(y,!0),S=wx(),C=W.useRef(null),[w,T]=W.useState(null),[E,D]=W.useState(!1);J(()=>(t.set(`adaptiveOrigin`,pN),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let O=q(()=>{y.current?.style.setProperty(`animation`,`none`),y.current?.style.setProperty(`transition`,`none`),b.current?.style.setProperty(`display`,`none`)}),k=q(e=>{y.current?.style.removeProperty(`animation`),y.current?.style.removeProperty(`transition`),b.current?.style.removeProperty(`display`),e&&T(e)}),A=q(()=>{C.current?.abort();let e=new AbortController;C.current=e,x(()=>{g(null),T(null),m.current=null},e.signal)}),j=W.useRef(null);J(()=>{s&&l||(j.current=null)},[s,l]),J(()=>{if(s&&a&&f&&a!==f&&j.current!==a&&m.current){g(m.current),D(!0);let e=yN(f,a);v(e),j.current=a}},[s,a,f]),J(()=>{h!=null&&(C.current?.abort(),D(!0),S.request(()=>{$S.flushSync(()=>{D(!1)}),A()}))},[p,h,A,S]),J(()=>{let e=y.current;if(!e)return;let t=Kv(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));m.current=t});let M=h!=null,N;N=M?(0,G.jsxs)(W.Fragment,{children:[(0,G.jsx)(`div`,{"data-previous":!0,inert:xE(!0),ref:b,style:{...w?{[aN]:`${w.width}px`,[oN]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,G.jsx)(`div`,{"data-current":!0,ref:y,"data-starting-style":E?``:void 0,children:r},p)]}):(0,G.jsx)(`div`,{"data-current":!0,ref:y,children:r},p),J(()=>{let e=b.current;e&&h&&e.replaceChildren(...Array.from(h.childNodes))},[h]),sN({popupElement:u,positionerElement:d,mounted:l,content:c,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:i});let P={activationDirection:_N(_),transitioning:M};return{children:N,state:P}}function _N(e){if(e)return`${vN(e.horizontal,5,`right`,`left`)} ${vN(e.vertical,5,`down`,`up`)}`}function vN(e,t,n,r){return e>t?n:e<-t?r:``}function yN(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function bN(e,t){let[n,r]=W.useState(0),i=W.useRef(e),a=W.useRef(t),o=W.useRef(!1);return J(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var xN=W.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{store:s}=Rj(),{side:c}=Ij(),l=s.useState(`instantType`),{children:u,state:d}=gN({store:s,side:c,children:a});return fy(`div`,e,{state:{activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l},ref:t,props:[o,{children:u}],stateAttributesMapping:hN})}),SN=W.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return fy(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),CN={"aria-expanded":void 0},wN=W.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=Rj(!0);if(p?.parent.type!==`menu`)throw Error(Hv(37));let m=Ij(),h=hM(),{store:g,parentVirtualFocus:_}=p,v=p.parent.store,y=IA({guess:!0,label:a}),b=yb(o),x=g.useState(`open`),S=W.useRef(!1),C=g.useState(`positionerElement`),w=g.useState(`floatingRootContext`),T=g.useState(`floatingTreeRoot`),E=g.useState(`triggerPopupId`,b),D=GC(b,g),O=q(e=>{D(e);let t=g.select(`activeTriggerElement`);e!==null&&g.select(`open`)&&(t===e||g.select(`activeTriggerId`)==null)&&g.update({activeTriggerId:b??null,activeTriggerElement:e,closeDelay:u})}),k=W.useRef(null),A=W.useCallback(e=>{k.current=e,g.set(`activeTriggerElement`,e)},[g]);J(()=>(O(k.current),()=>O(null)),[O,b,g]),J(()=>{if(!x||!C)return;function e(e){Kb(e)===g.context.beforeContentFocusGuardRef.current&&(S.current=e.relatedTarget===k.current)}return C.addEventListener(`focusout`,e,!0),()=>{S.current=!1,C.removeEventListener(`focusout`,e,!0)}},[x,C,g]),g.useSyncedValue(`closeDelay`,u);let j=g.useState(`disabled`),M=v.useState(`disabled`),N=d||j||M,P=v.useState(`itemProps`),F=v.useState(`isActive`,y.index),I=W.useMemo(()=>({type:`submenu-trigger`,setActive(e){v.select(`highlightItemOnHover`)&&v.setActiveIndex(y.index,ab,e)}}),[v,y.index]),{getItemProps:L,itemRef:R}=Qj({closeOnClick:!1,disabled:N,highlighted:F,id:b,store:g,typingRef:v.context.typingRef,nativeButton:s,itemMetadata:I,nodeId:m?.context.nodeId}),z=Lw(w,{enabled:g.useState(`hoverEnabled`)&&c&&!N,handleClose:$w({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>v.select(`allowMouseEnter`):void 0,triggerElementRef:k,externalTree:T,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),B=wC(w,{enabled:!N,event:`mousedown`,toggle:!0,ignoreMouse:c,stickIfOpen:c}).reference??cy,V=g.useState(`triggerProps`,!0);delete V.id;let H={disabled:N,highlighted:F,open:x},ee=g.useState(`openMethod`),te=g.useState(`lastOpenChangeReason`)===`list-navigation`||ee===`keyboard`,ne=x&&te&&Ib;return fy(`div`,e,{state:H,stateAttributesMapping:zy,props:[B,z,V,h?.onTriggerKeyDown?{onKeyDown:h.onTriggerKeyDown}:void 0,P,ne?CN:void 0,{"aria-controls":E,tabIndex:_||!(x||F)?-1:0,onFocus(e){g.select(`open`)&&S.current&&(S.current=!1,g.setOpen(!1,Wy(tb,e.nativeEvent)))},onBlur(){F&&v.setActiveIndex(null,Ky)}},f,L],ref:[t,y.ref,R,O,A]})}),TN=W.forwardRef(function(e,t){let n=Kj(e,t,`submenu-trigger`);if(!n.visible)return null;let r=n.props?Ov(n.props,e):e;return(0,G.jsx)(wN,{...r,ref:n.ref})}),EN=class extends jC{constructor(){super(HM(),`Menu`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function DN(){return new EN}function ON(e){return Array.isArray(e)?e.map(e=>ON(e)).join(`,`):e==null?``:String(e)}var kN=new Map;function AN(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${ON(t)}|${JSON.stringify(r)}`,a=kN.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=fk(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=fk(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=fk(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return kN.set(i,s),s}function jN(){let e=xv(()=>new Map).current,[t,n]=W.useState(0),r=W.useRef(!1),i=q(()=>{r.current||(r.current=!0,n(e=>e+1))}),a=q((t,n)=>(e.set(t,n),i(),()=>{e.delete(t),i()})),o=W.useMemo(()=>new Map(e),[t]);return J(()=>{r.current=!1},[t]),{items:o,registerItem:a,liveItems:e}}function MN(){throw Error(Hv(103))}var NN=W.createContext(null);function PN(e=!1){let t=W.useContext(NN);return t===null&&!e&&MN(),t}var FN=W.createContext(null);function IN(e=!1){let t=W.useContext(FN);return t===null&&!e&&MN(),t}function LN(e){let t=W.useContext(NN);if(e===null)return null;for(;t!==null&&t.listRef!==e;)t=t.parent;return t}var RN=W.createContext(``);function zN(){return W.useContext(RN)}var BN={isEmpty:e=>e.visibleItemIds===null?e.registeredItemCount===0:e.visibleItemIds.size===0,isItemVisible:(e,t)=>e.visibleItemIds===null||e.visibleItemIds.has(t)},VN=class extends gw{constructor(){super({visibleItemIds:null,registeredItemCount:0},cy,BN)}},HN={registerItem:()=>oy,store:new VN};function UN(e){let{children:t,open:n,disabled:r=!1,openedByKeyboard:i=!1,locale:a,value:o,query:s,onValueChange:c,filter:l,autoHighlight:u=!1,triggerId:d,listRef:f,getActiveIndex:p,setActiveIndex:m,focusOwnerRef:h}=e,g=W.useContext(NN),[_,v]=W.useState(void 0),[y,b]=W.useState(i),[x,S]=W.useState(i),[C,w]=W.useState(i);i!==C&&(w(i),b(i),S(i));let{items:T,registerItem:E,liveItems:D}=jN(),O=yb(),k=xv(()=>new VN).current,A=q((e,t)=>{let n=E(e,t);return k.set(`registeredItemCount`,D.size),()=>{n(),k.set(`registeredItemCount`,D.size)}}),j=W.useRef(null),M=W.useRef(null),N=W.useMemo(()=>AN({locale:a}).contains,[a]),P=h??j,F=(s??o).trim(),I=F===``||l===null?null:l??N,L=n&&(u===`always`||u&&F!==``),R=O?`${O}-list`:void 0,z=(_??R)||void 0,B=d||void 0,V=q((e,t)=>{c?.(e,t),!t.isCanceled&&!u&&m(null)}),H=q(e=>{let t=f.current,n=p();(n==null||t[n]==null||t[n]!==e[n])&&m(L&&t.length>0?0:null)});J(()=>{if(!n&&s===void 0)return;let e=M.current!==null&&M.current!==F;if(M.current=F,I===null){k.set(`visibleItemIds`,null),L&&D.size>0?(e||p()==null)&&m(0):F===``&&e&&m(null);return}let t=k.state.visibleItemIds;if(t===null&&D.size===0)return;let r=new Set,i=t===null;D.forEach(({getText:e},n)=>{let a=e();a!=null&&I(a,F)&&(r.add(n),i||=!t?.has(n))}),i||t?.size!==r.size?(L&&r.size>0?m(0):(t!==null||e)&&m(null),k.set(`visibleItemIds`,r)):L&&e&&r.size>0&&m(0)},[n,s,F,T,D,I,L,k,m,p]);let ee=W.useMemo(()=>({open:n,disabled:r,inputFocusVisible:y,setInputFocusVisible:b,keyboardModality:x,setKeyboardModality:S,autoHighlight:u,triggerId:B,defaultListId:R,listId:z,setRenderedListId:v,focusOwnerRef:P,setActiveIndex:m,onItemsChange:H,onValueChange:V}),[n,r,y,x,u,B,R,z,P,m,H,V]),te=W.useMemo(()=>({parent:g,store:k,registerItem:A,listRef:f}),[g,k,A,f]);return(0,G.jsx)(NN.Provider,{value:te,children:(0,G.jsx)(FN.Provider,{value:ee,children:(0,G.jsx)(RN.Provider,{value:s??o,children:t})})})}function WN(e){let{open:t,mounted:n,value:r,onValueChange:i}=e,[a,o]=W.useState(null),s=W.useRef(t);return J(()=>{let e=s.current;s.current=t,e&&!t&&r!==``?(o(r),i(``,Wy(ob))):(t||!n)&&a!==null&&o(null)},[t,n,r,a,i]),!t&&a!==null?a:r}var GN=!1;function KN(e){GN=!0;try{e.focus({preventScroll:!0})}finally{GN=!1}}function qN(){return GN}function JN(e){let t=IN(),n=Wk(),{focusOwnerRef:r}=t,i=W.useRef(null),a=W.useRef(`mouse`);function o(e){a.current=e.pointerType||`mouse`}function s(e,n){let a=r.current;if(!t.open||!a)return;let o=Wb(Kv(e.currentTarget));if(o===a||Y(e.currentTarget,o))return;let s=null;e.nativeEvent.composedPath().find(e=>ev(e)?e.getAttribute(`role`)===`dialog`||e.hasAttribute(`data-rootownerid`)?!0:(e.hasAttribute(`aria-haspopup`)&&(s=e),!1):!1)===e.currentTarget&&(!i.current||n&&s)&&(n&&s&&$_(e.relatedTarget)&&Y(s,e.relatedTarget)||KN(a))}return{"aria-activedescendant":void 0,"aria-orientation":void 0,onMouseDown(e){Kb(e.nativeEvent)===e.currentTarget&&e.preventDefault()},onPointerDown:o,onPointerOver:o,onPointerMove:o,onMouseMove(e){a.current===`mouse`&&s(e,!1)},onMouseOver(e){a.current===`mouse`&&i.current&&s(e,!0)},onFocus(e){let n=Kb(e.nativeEvent);n===r.current?i.current=null:ev(n)&&!Y(e.currentTarget,n)&&!qN()&&(i.current=n),t.open&&n===e.currentTarget&&r.current?.focus({preventScroll:!0})},onKeyDown(t){let i=Kb(t.nativeEvent);i===r.current||rx(i)||Uw(t.key,e,n===`rtl`,!1)&&(r.current?.focus({preventScroll:!0}),t.stopPropagation())}}}var YN=W.forwardRef(function(e,t){let{store:n,orientation:r}=Rj(),i=n.useState(`open`),a=n.useState(`parent`),o=n.useState(`openMethod`),s=n.useState(`lastOpenChangeReason`),c=JN(r),l=i&&s===`trigger-hover`,u=a.type!==`menu`||i&&(o===`keyboard`||s===`list-navigation`||s===`trigger-hover`||s===`trigger-press`),d=!1;u&&(d=()=>{let e=(o===`touch`||o===`pen`)&&!n.context.virtualPress;return l||e?!1:n.context.virtualFocusRef?.current??!1});let f=Ov(c,e);return(0,G.jsx)(yM,{...f,role:`dialog`,initialFocus:d,ref:t})}),XN=W.createContext(null);function ZN(){return W.useContext(XN)}var QN=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=IN(),[c,l]=_M(e,s.defaultListId,s.setRenderedListId);return fy(`div`,e,{ref:[t,l],props:[{tabIndex:-1,id:c,onFocus(e){let t=s.focusOwnerRef.current;t&&e.relatedTarget===t&&Kb(e.nativeEvent)===e.currentTarget&&KN(t)},onPointerMove(){s.setKeyboardModality(!1)},onPointerDown(){s.setKeyboardModality(!1)}},o,{children:(0,G.jsx)(XN.Provider,{value:null,children:o.children})}]})});function $N(e,t){let{orientation:n,rtl:r,hasActiveItem:i,activeItemOpensSubmenu:a,hasValue:o}=t,{key:s}=e;if(e.which===229)return`ignore`;if(s===`Tab`)return e.shiftKey?`close`:`ignore`;if(s===`Enter`)return i?`activate`:`navigate`;let c=s.startsWith(`Arrow`),l=s===`Home`||s===`End`;return e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?c||l||s.length===1?`edit`:`navigate`:s.length===1?`edit`:l?i&&!o?`navigate`:`edit`:c?Bw(s,n)?n===`horizontal`&&!i&&o?`edit`:`navigate`:a&&(Hw(s,n,r)||Uw(s,n,r,!1))?`submenu`:n===`horizontal`&&!i?`enter-list`:o?`edit`:`navigate`:`navigate`}function eP(e){let{orientation:t,store:n}=Rj(),r=hM(),i=Wk();return q(a=>{if(!n.select(`open`))return;let o=n.state.highlightedItem;switch($N(a,{orientation:t,rtl:i===`rtl`,hasActiveItem:o!=null,activeItemOpensSubmenu:o?.hasAttribute(`aria-haspopup`)??!1,hasValue:e})){case`edit`:a.stopPropagation(),a.key.length!==1||a.ctrlKey||a.metaKey||a.altKey||n.state.inputProps.onKeyDown?.(a);break;case`navigate`:Bw(a.key,t)&&a.stopPropagation(),n.state.inputProps.onKeyDown?.(a);break;case`enter-list`:{a.stopPropagation();let e=n.context.itemDomElements,t=a.key===`ArrowDown`?rS(e,sy):iS(e,sy);e.current[t]&&(a.preventDefault(),n.setActiveIndex(t,ib,a.nativeEvent));break}case`submenu`:{Rb(a);let e=X_(o).KeyboardEvent;o.dispatchEvent(new e(a.type,a.nativeEvent));break}case`activate`:a.preventDefault(),qv(o,a);break;case`close`:{Rb(a);let e=n.state.parent.type===`menu`&&r?.getReturnElement?.()||n.state.activeTriggerElement,t=Wy(tb,a.nativeEvent);n.setOpen(!1,t),!t.isCanceled&&ev(e)&&e.focus();break}}})}function tP(e,t,n,r){let{orientation:i,rtl:a,loopFocus:o,allowEscape:s}=r,c=e.context.itemDomElements,l=c.current,{index:u}=aS(l,l.indexOf(t),{decrement:!Vw(n.key,i,a),loopFocus:o,allowEscape:s,disabledIndices:sy,minIndex:rS(c,sy),maxIndex:iS(c,sy)}),d=l[u];return d&&(e.setActiveIndex(u,ib,n.nativeEvent),d.scrollIntoView?.({block:`nearest`,inline:`nearest`})),d??void 0}var nP=W.forwardRef(function(e,t){let{store:n,orientation:r,loopFocus:i,allowEscape:a}=Rj(),o=Wk(),{onItemsChange:s,focusOwnerRef:c,triggerId:l}=IN(),{listRef:u}=PN(),{subscribeMapChange:d}=Pk(),f=eP(zN()!==``),p=q(e=>{let t=c.current,s=Kb(e.nativeEvent),l=t!=null&&Wb(Kv(t))===t,u=!Y(e.currentTarget,s);if(t==null||l||u){if(e.which!==229&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&Bw(e.key,r)){e.stopPropagation();let t=u&&l?m(s):void 0;t&&tP(n,t,e,{orientation:r,rtl:o===`rtl`,loopFocus:i,allowEscape:a})}}else e.defaultPrevented||(KN(t),f(e))});function m(e){let t=e.getRootNode();return u.current.find(n=>{let r=n?.getAttribute(`aria-controls`);return r!=null&&ev(n)&&Y(t.getElementById(r),e)})}let h=W.useRef(null),g=q(()=>{let e=[...u.current],t=h.current;(t===null||t.length!==e.length||e.some((e,n)=>e!==t[n]))&&t!==null&&s(t),h.current=e});J(()=>d(g),[d,g]);let _=Ov({role:`menu`,"aria-labelledby":vM(e,null,l??null),"aria-orientation":r===`horizontal`?`horizontal`:void 0,onKeyDown:p},e);return(0,G.jsx)(QN,{..._,ref:t})});function rP(e,t){if(e.visibleItemIds===null||t.size===0)return!1;for(let[n,r]of t)if(r||e.visibleItemIds.has(n))return!1;return!0}function iP(){let{store:e}=PN(),t=ZN(),{items:n,registerItem:r}=jN(),i=dw(e,rP,n),a=xv(()=>Symbol(`filter-dropdown-group`)).current,o=t?.registerItem;return J(()=>o?.(a,!i),[o,a,i]),{hidden:i,context:W.useMemo(()=>({registerItem:r}),[r])}}var aP=W.forwardRef(function(e,t){let{hidden:n,context:r}=iP();return(0,G.jsx)(XN.Provider,{value:r,children:(0,G.jsx)(sM,{...e,hidden:n||e.hidden||void 0,ref:t})})}),oP=W.forwardRef(function(e,t){let{hidden:n,context:r}=iP();return(0,G.jsx)(XN.Provider,{value:r,children:(0,G.jsx)(AM,{...e,hidden:n||e.hidden||void 0,ref:t})})});function sP(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(sP).join(``):W.isValidElement(e)?sP(e.props.children):``}function cP(e){let{label:t,retainGroup:n=!1,children:r,render:i,context:a}=e,o=PN(a!==void 0),s=ZN(),{registerItem:c,store:l}=(a===void 0?o:a)??HN,u=s?.registerItem,d=xv(()=>Symbol(`filter-dropdown-item`)).current,f=W.useRef(null),p=W.useRef(void 0),m=dw(l,BN.isItemVisible,d),[h,g]=W.useState(m),_=yx(r),v=yx(i),y=W.useRef(void 0),b=W.useCallback(()=>{if(t!=null)return t;let e=sP(_.current??gy(v.current)),n=y.current;return y.current=e,f.current===null?p.current!==void 0&&e===n?p.current:e:f.current.textContent??``},[t,_,v]),x=W.useCallback(e=>{let n=e??b();return n&&(p.current=n),c(d,{getText(){return t==null&&f.current&&(p.current=f.current.textContent??``),p.current}})},[d,t,c,b]);return J(()=>{let e=x();return g(!0),e},[x]),J(()=>u?.(d,n),[u,d,n]),J(()=>{let e=b();e!==p.current&&(p.current=e,x(e))},[x,b,r,i,t]),{visible:!h||m,ref:f}}function lP(e){let{store:t,virtualFocus:n}=Rj(),r=t.useState(`open`),i=t.useState(`mounted`),a=t.useState(`parent`),o=LN(a.type===`menu`?a.store.context.itemDomElements:null),{visible:s,ref:c}=cP({...e,context:o,retainGroup:i});J(()=>{!s&&r&&t.setOpen(!1,Wy(Ky))},[s,r,t]);let l=WE((e,n)=>{e.type===`click`&&t.select(`open`)&&(n===`keyboard`||n===`mouse`&&t.select(`lastOpenChangeReason`)===`trigger-press`)&&t.context.virtualFocusRef?.current?.focus({preventScroll:!0})}),u={...n?{"aria-haspopup":`dialog`}:void 0,...l,onPointerDown(e){l.onPointerDown(e),t.context.virtualPress=Vb(e.nativeEvent)},onFocus(e){let n=t.context.virtualFocusRef?.current;n&&t.select(`open`)&&e.relatedTarget===n&&(e.preventBaseUIHandler(),n.focus({preventScroll:!0}))}};return o===null?{visible:!0,ref:null,props:u}:{visible:s||i,ref:c,props:u}}function uP(e,t,n,r){let i=t.type===`menu`?t.store:null,a=i?.context.virtualFocusRef,o=q((t,n)=>{let o=a?.current;!r&&!e.select(`open`)&&i?.select(`open`)&&o&&(Y(e.context.popupRef.current,Wb(Kv(o)))&&o.focus({preventScroll:!0}),(n===`list-navigation`||n===`escape-key`)&&i.state.activeIndex==null&&i.highlightItem(t,Ky))});J(()=>{if(!n){let t=e.state.activeTriggerElement,n=e.select(`lastOpenChangeReason`);queueMicrotask(()=>o(t,n))}},[n,e,o]);function s(){!r&&a&&i?.state.activeIndex!=null&&i.setActiveIndex(null,Ky)}return{parentVirtualFocusRef:a,handleFocus:s}}var dP={Popup:YN,List:nP,Group:aP,RadioGroup:oP,useItem:cP,useSubmenuTrigger:lP,useParentHandoff:uP};function fP(e){let{value:t,defaultValue:n=``,onValueChange:r,...i}=e,{store:a}=Rj(),o=a.useState(`open`),s=a.useState(`mounted`),c=a.useState(`keyboardOpen`),l=a.useState(`activeTriggerId`),u=a.useState(`activeTriggerElement`),d=a.useState(`disabled`),[f,p]=iO({controlled:t,default:n,name:`MenuFilterProvider`,state:`value`}),m=q((e,t)=>{r?.(e,t),t.isCanceled||p(e)}),h=q(()=>a.state.activeIndex),g=q(e=>{a.setActiveIndex(e,Ky)}),_=WN({open:o,mounted:s,value:f,onValueChange:m}),v=pP(f!==``);xv(()=>(a.set(`filterTriggerProps`,v),null)),a.useSyncedValue(`filterTriggerProps`,v),J(()=>{o||a.set(`keyboardOpen`,!1)},[o,a]);let y=u?u.id||null:l;return(0,G.jsx)(Vj.Provider,{value:dP,children:(0,G.jsx)(UN,{...i,open:o,openedByKeyboard:c,disabled:d,value:f,query:_,onValueChange:m,triggerId:y,listRef:a.context.itemDomElements,getActiveIndex:h,setActiveIndex:g,focusOwnerRef:a.context.virtualFocusRef})})}function pP(e){let{store:t}=Rj(),n=RM(!0)!=null,r=eP(e);return W.useMemo(()=>({"aria-haspopup":`dialog`,onPointerDown(e){t.context.virtualPress=Vb(e.nativeEvent)},onKeyDown(e){let i=t.context.virtualFocusRef?.current;t.select(`open`)&&i&&!n&&(e.key===`ArrowUp`||e.key===`ArrowDown`?(i.focus({preventScroll:!0}),r(e),e.preventDefault(),e.preventBaseUIHandler()):e.key===`ArrowLeft`||e.key===`ArrowRight`?e.preventBaseUIHandler():mP(e)&&i.focus({preventScroll:!0}))}}),[t,n,r])}function mP(e){return e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function hP(e){let{children:t,value:n,defaultValue:r,onValueChange:i,filter:a,autoHighlight:o=!1,locale:s,...c}=e,l=W.useRef(null);return{children:t,rootProps:{...c,virtualFocus:!0,virtualFocusRef:l,allowEscape:!o,resetOnPointerLeave:o!==`always`},dropdownProps:{value:n,defaultValue:r,onValueChange:i,filter:a,autoHighlight:o,locale:s}}}function gP(e){let{children:t,rootProps:n,dropdownProps:r}=hP(e);return(0,G.jsx)(JM,{...n,children:e=>(0,G.jsx)(fP,{...r,children:typeof t==`function`?t(e):t})})}function _P(e){let t=Rj(),n=t.store,r=n.useState(`disabled`),{rootProps:i,dropdownProps:a}=hP(e),o=W.useRef(null);function s(e,r){let i=t.virtualFocus?n.context.virtualFocusRef?.current:Wb(Kv(e));ev(i)&&(o.current={reference:i,trigger:e},n.setActiveIndex(null,r?ib:Ky,r))}function c(e,t){n.highlightItem(e,ib,t)}function l(e){let t=o.current;t&&(t.reference.focus({preventScroll:!0}),c(t.trigger,e))}function u(e,r){i.onOpenChange?.(e,r),r.isCanceled||(e?(o.current=null,ev(r.trigger)&&qM(r.reason,r.event)&&s(r.trigger,r.reason===`list-navigation`?r.event:void 0)):r.reason===`escape-key`&&ev(r.trigger)&&(c(r.trigger,r.event),o.current={reference:t.virtualFocus?n.context.virtualFocusRef?.current??r.trigger:r.trigger,trigger:r.trigger}))}return(0,G.jsx)(JM,{...i,isSubmenu:!0,disabled:r||e.disabled,onOpenChange:u,children:(0,G.jsx)(vP,{parentStore:n,parentVirtualFocus:t.virtualFocus,parentAllowEscape:t.virtualFocus&&t.allowEscape,parentOrientation:t.orientation,parentLoopFocus:t.loopFocus,getReturnElement:()=>o.current?.reference??(t.virtualFocus?n.context.virtualFocusRef?.current:null)??null,onSubmenuEnter:s,onSubmenuExit:l,children:(0,G.jsx)(fP,{...a,children:e.children})})})}function vP(e){let{children:t,parentStore:n,parentVirtualFocus:r,parentAllowEscape:i,parentOrientation:a,parentLoopFocus:o,onSubmenuEnter:s,onSubmenuExit:c,getReturnElement:l}=e,{store:u,orientation:d}=Rj(),f=Wk(),p=u.useState(`mounted`),m=W.useRef(!1),h=q(()=>{let[e]=u.context.triggerElements.elements();return l()??(ev(e)?e:null)});J(()=>{let e=m.current;if(m.current=p,p||!e)return;let t=h();if(!t||!n.select(`open`))return;let r=Kv(t),i=Wb(r);(i===r.body||Y(u.select(`popupElement`),i))&&t.focus({preventScroll:!0})},[p,u,n,h]);function g(e,t){let s=tP(n,e,t,{orientation:a,rtl:f===`rtl`,loopFocus:o,allowEscape:i});r||s?.focus({preventScroll:!0})}function _(e){if(!u.select(`open`))return;Rb(e);let t=u.select(`activeTriggerElement`),n=Wy(rb,e.nativeEvent);u.setOpen(!1,n),n.isCanceled||c(e.nativeEvent);let r=l()??u.select(`activeTriggerElement`);!u.select(`open`)&&ev(r)&&Wb(Kv(r))!==r&&r.focus(),!u.select(`open`)&&ev(t)&&Bw(e.key,a)&&g(t,e)}let v=q(e=>{if(Bw(e.key,a)){g(e.currentTarget,e),e.preventBaseUIHandler(),Rb(e);return}let t=u.select(`open`),n=f===`rtl`,r=Uw(e.key,d,n,!1);t&&r?_(e):Hw(e.key,a,n)&&(Rb(e),t?(s(e.currentTarget,e.nativeEvent),u.context.virtualFocusRef?.current?.focus({preventScroll:!0})):u.setOpen(!0,Wy(rb,e.nativeEvent,e.currentTarget)))}),y=q(e=>{e.which!==229&&Uw(e.key,d,f===`rtl`,!1)&&_(e)}),b=W.useMemo(()=>({getReturnElement:h,onTriggerKeyDown:v,onPopupKeyDown:y}),[h,v,y]);return(0,G.jsx)(mM.Provider,{value:b,children:t})}function yP(e){let{children:t,filter:n,value:r,defaultValue:i,onValueChange:a,autoHighlight:o,locale:s}=e,c=W.useMemo(()=>({Root:gP,SubmenuRoot:_P,options:{filter:n,value:r,defaultValue:i,onValueChange:a,autoHighlight:o,locale:s}}),[n,r,i,a,o,s]);return(0,G.jsx)(GM.Provider,{value:c,children:t})}var bP=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,disabled:o,activeItemId:s,navigationProps:c,...l}=e,u=yb(a),d=IN(),{listRef:f}=PN(),p=zN(),[m,h]=W.useState(null),g=W.useRef(!1);function _(e,t){if(!d.open)return;let n=e===``?eb:$y;d.onValueChange(e,Wy(n,t))}return fy(`input`,e,{state:{highlighted:d.inputFocusVisible&&(!d.keyboardModality||s==null)},ref:[t,d.focusOwnerRef],props:[c,{id:u,type:`text`,disabled:d.disabled||o,"aria-activedescendant":s,role:`searchbox`,inputMode:`search`,autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`,"aria-autocomplete":void 0,"aria-controls":d.listId,value:m??p,onCompositionStart(e){Mb||(g.current=!0,h(e.currentTarget.value))},onCompositionEnd(e){g.current&&(g.current=!1,h(null),_(e.currentTarget.value,e.nativeEvent))},onChange(e){g.current?h(e.currentTarget.value):_(e.currentTarget.value,e.nativeEvent)},onKeyDown(){d.setKeyboardModality(!0)},onPointerDown(){d.setKeyboardModality(!1)},onMouseEnter(e){d.setKeyboardModality(!1),d.open&&KN(e.currentTarget)},onFocus(e){if(d.setInputFocusVisible(!0),d.autoHighlight===`always`||qN())return;let t=e.relatedTarget;t!==null&&f.current.includes(t)&&d.setActiveIndex(null)},onBlur(){d.setInputFocusVisible(!1)}},l]})}),xP=W.forwardRef(function(e,t){Uj(`Input`);let{store:n}=Rj(),r=zN(),{onKeyDown:i,...a}=n.useState(`inputProps`),o=n.useState(`highlightedItemId`),s=eP(r!==``),c=Zv(t,W.useCallback(e=>{n.set(`inputFocused`,e!==null&&Wb(Kv(e))===e)},[n])),l=Ov({onKeyDown:s,onFocus(){n.set(`inputFocused`,!0)},onBlur(){n.set(`inputFocused`,!1)}},e);return(0,G.jsx)(bP,{...l,activeItemId:o,navigationProps:a,ref:c})}),SP=W.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s,orientation:c}=Rj(),l=s.useState(`activeTriggerId`),u=s.useState(`activeTriggerElement`),d=s.useStateSetter(`listElement`),f=yb(a),p=W.useRef(f);J(()=>{p.current!==f&&(p.current=f,s.notifyAll())},[f,s]);let m=vM(e,u,l);return fy(`div`,e,{ref:[t,d],props:[{id:f,role:`menu`,tabIndex:-1,"aria-orientation":c===`horizontal`?`horizontal`:void 0,"aria-labelledby":m},o]})}),CP=W.forwardRef(function(e,t){let n=Hj()?.List??SP;return(0,G.jsx)(n,{...e,ref:t})}),wP=W.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=IN(),l=zN(),u=c.disabled||a,d=l!==``,{buttonRef:f,getButtonProps:p}=Jv({disabled:u,native:o});return fy(`button`,e,{enabled:d,state:{disabled:u},ref:[t,f],props:[{tabIndex:-1,"aria-hidden":!0,onMouseDown(e){e.preventDefault()},onClick(e){let t=Wy(Qy,e.nativeEvent);c.onValueChange(``,t),c.focusOwnerRef.current?.focus({preventScroll:!0})}},s,p]})}),TP=W.forwardRef(function(e,t){return Uj(`Clear`),(0,G.jsx)(wP,{...e,ref:t})}),EP=``;function DP(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function OP(e=!0){let t=Cb(),n=W.useRef(null);return W.useEffect(()=>{if(!e||Ab)return;let r=n.current;if(r==null)return;let i=DP(r);if(i==null)return;let a=i.data,o=`${a}${EP}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}var kP=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=PN(),s=dw(o,BN.isEmpty),[c,l]=W.useState(!1);J(()=>{l(!0)},[]);let u=c&&s;return fy(`div`,e,{enabled:u,ref:[t,OP(u)],props:[{role:`status`,"aria-live":`polite`,"aria-atomic":!0},a]})}),AP=W.forwardRef(function(e,t){return Uj(`Empty`),(0,G.jsx)(kP,{...e,ref:t})}),jP=e({Arrow:()=>zj,Backdrop:()=>Bj,CheckboxItem:()=>rM,CheckboxItemIndicator:()=>iM,Clear:()=>TP,Empty:()=>AP,FilterProvider:()=>yP,Group:()=>cM,GroupLabel:()=>lM,Handle:()=>EN,Input:()=>xP,Item:()=>dM,LinkItem:()=>pM,List:()=>CP,Popup:()=>SM,Portal:()=>TM,Positioner:()=>DM,RadioGroup:()=>jM,RadioItem:()=>FM,RadioItemIndicator:()=>IM,Root:()=>YM,Separator:()=>SN,SubmenuRoot:()=>ZM,SubmenuTrigger:()=>TN,Trigger:()=>tN,Viewport:()=>xN,createHandle:()=>DN,useFilter:()=>AN});function MP(e){let[t,n]=W.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=W.useRef(null),i=W.useRef(null),a=W.useRef(null),o=W.useRef(null),s=W.useRef(!0),c=W.useRef(null),l=vb(),u=W.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,G.jsx)(Nj.Provider,{value:u,children:(0,G.jsx)(Lj.Provider,{value:void 0,children:(0,G.jsx)(YM,{...e})})})}var NP=500,PP=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{setAnchor:o,actionsRef:s,internalBackdropRef:c,backdropRef:l,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:f,rootId:p}=Pj(!1),{store:m}=Rj(!1),h=m.useState(`open`),g=m.useState(`disabled`),_=W.useRef(null),v=W.useRef(null),y=Cb(),b=Cb(),x=W.useRef(!1),S=W.useRef(null);function C(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),x.current=!1,s.current?.setOpen(!0,Wy(qy,n)),b.start(NP,()=>{x.current=!0})}function w(e){if(g)return;d.current=!0,Rb(e),C(e.clientX,e.clientY,e.nativeEvent);let t=Kv(_.current);S.current?.abort();let n=new AbortController;S.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!x.current)return;b.clear(),x.current=!1;let t=Kb(e);Y(u.current,t)||p&&t&&QM(t)===p||s.current?.setOpen(!1,Wy(sb,e))},{once:!0,signal:n.signal})}function T(){y.clear(),v.current=null}function E(e){if(g||(d.current=!1,e.touches.length!==1)){T();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};v.current=n,y.start(NP,()=>{C(n.x,n.y,e.nativeEvent)})}function D(e){if(e.touches.length!==1)T();else if(y.isStarted()&&v.current){let t=e.touches[0],n=Math.abs(t.clientX-v.current.x),r=Math.abs(t.clientY-v.current.y);(n>10||r>10)&&T()}}return W.useEffect(()=>()=>{S.current?.abort()},[]),W.useEffect(()=>{function e(e){if(g)return;let t=Kb(e);(Y(_.current,t)||Y(c.current,t)||Y(l.current,t))&&e.preventDefault()}return _x(Kv(_.current),`contextmenu`,e)},[l,g,c]),fy(`div`,e,{state:{open:h},ref:[_,t],props:[{onContextMenu:w,onTouchStart:E,onTouchMove:D,onTouchEnd:T,onTouchCancel:T,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:By})}),FP=DM,IP=e({Arrow:()=>zj,Backdrop:()=>Bj,CheckboxItem:()=>rM,CheckboxItemIndicator:()=>iM,Group:()=>cM,GroupLabel:()=>lM,Item:()=>dM,LinkItem:()=>pM,Popup:()=>SM,Portal:()=>TM,Positioner:()=>FP,RadioGroup:()=>jM,RadioItem:()=>FM,RadioItemIndicator:()=>IM,Root:()=>MP,Separator:()=>SN,SubmenuRoot:()=>ZM,SubmenuTrigger:()=>TN,Trigger:()=>PP}),LP={surface:{k7Eaqz:`x57cstt`,$$css:!0}};function RP({entries:e,parts:t}){return e.map((e,n)=>e.type===`separator`?(0,G.jsx)(t.Separator,{className:`xjm9jq1 xg9jes1 xr6ywxm x14i5uus`},n):e.type===`submenu`?(0,G.jsxs)(t.SubmenuRoot,{children:[(0,G.jsxs)(t.SubmenuTrigger,{className:`x78zum5 x6s0dn4 x1qughib x1v2ro7d x1jgo0hl xdqyycr xqtwvag x122w267 xn7wf0q xt0e3qv x1a2a7pz x87ps6o xjbqb8w x1gjw99y x2e3pq1`,children:[e.label,(0,G.jsx)(`span`,{className:`x1tviuuy x78zum5`,children:(0,G.jsx)(te,{})})]}),(0,G.jsx)(t.Portal,{children:(0,G.jsx)(t.Positioner,{sideOffset:4,...Fo(VA.positioner),children:(0,G.jsx)(t.Popup,{...Fo(VA.surface,LP.surface),children:(0,G.jsx)(RP,{entries:e.entries,parts:t})})})})]},`${n}:${e.label}`):(0,G.jsxs)(t.Item,{onClick:e.onSelect,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1v2ro7d x1jgo0hl xdqyycr xqtwvag x122w267 xn7wf0q xt0e3qv x1a2a7pz x87ps6o xjbqb8w x1gjw99y x2e3pq1`},1:{className:`x78zum5 x6s0dn4 x1qughib x1v2ro7d x1jgo0hl xdqyycr xqtwvag xn7wf0q xt0e3qv x1a2a7pz x87ps6o xjbqb8w x1gjw99y x2e3pq1 xb0vdwp`}}[!!e.danger|0],children:[e.label,e.hint?(0,G.jsx)(`span`,{className:`x1tviuuy`,children:e.hint}):null]},`${n}:${e.label}`))}function zP(e){let t=(0,ko.c)(9),{trigger:n,entries:r}=e,i;t[0]===n?i=t[1]:(i=(0,G.jsx)(tN,{render:n}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=Fo(VA.positioner),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=Fo(VA.surface,LP.surface),t[3]=o):o=t[3];let s;t[4]===r?s=t[5]:(s=(0,G.jsx)(TM,{children:(0,G.jsx)(DM,{align:`start`,sideOffset:4,...a,children:(0,G.jsx)(SM,{...o,children:(0,G.jsx)(RP,{entries:r,parts:jP})})})}),t[4]=r,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,G.jsxs)(YM,{children:[i,s]}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function BP(e){let t=(0,ko.c)(9),{entries:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,G.jsx)(PP,{className:`xjp7ctv`,children:r}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=Fo(VA.positioner),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=Fo(VA.surface,LP.surface),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,G.jsx)(TM,{children:(0,G.jsx)(FP,{...a,children:(0,G.jsx)(SM,{...o,children:(0,G.jsx)(RP,{entries:n,parts:IP})})})}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,G.jsxs)(MP,{children:[i,s]}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}var VP=16;function HP(e){let t=(0,ko.c)(37),{label:n,value:r,min:i,max:a,defaultValue:o,onChange:s}=e,[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),f;t[0]!==a||t[1]!==i?(f=e=>Math.min(a,Math.max(i,Math.round(e))),t[0]=a,t[1]=i,t[2]=f):f=t[2];let p=f,m;t[3]!==c||t[4]!==r?(m=e=>{e.button!==0||c||(e.currentTarget.setPointerCapture(e.pointerId),l({startX:e.clientX,startWidth:r}),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`)},t[3]=c,t[4]=r,t[5]=m):m=t[5];let h=m,g;t[6]!==p||t[7]!==c||t[8]!==s?(g=e=>{c&&s(p(c.startWidth+e.clientX-c.startX),!1)},t[6]=p,t[7]=c,t[8]=s,t[9]=g):g=t[9];let _=g,v;t[10]!==c||t[11]!==s||t[12]!==r?(v=e=>{c&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.style.cursor=``,document.body.style.userSelect=``,l(null),s(r,!0))},t[10]=c,t[11]=s,t[12]=r,t[13]=v):v=t[13];let y=v,b;t[14]!==p||t[15]!==s||t[16]!==r?(b=e=>{let t=e.key===`ArrowLeft`?-16:e.key===`ArrowRight`?VP:0;t!==0&&(e.preventDefault(),s(p(r+t),!0))},t[14]=p,t[15]=s,t[16]=r,t[17]=b):b=t[17];let x=b,S;t[18]!==o||t[19]!==s?(S=()=>s(o,!0),t[18]=o,t[19]=s,t[20]=S):S=t[20];let C,w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>d(e.currentTarget.matches(`:focus-visible`)),w=()=>d(!1),t[21]=C,t[22]=w):(C=t[21],w=t[22]);let T;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(T={0:{className:`xfo62xy x5yr21d xjbqb8w xvs4sct x15406qy x1qfwjxi x6setmy`},2:{className:`xfo62xy x5yr21d x15406qy x1qfwjxi x6setmy x152q98y`},1:{className:`xfo62xy x5yr21d x15406qy x1qfwjxi x6setmy xq83s4c`},3:{className:`xfo62xy x5yr21d x15406qy x1qfwjxi x6setmy xq83s4c`}},t[23]=T):T=t[23];let E=T[!!c<<1|!!u],D;t[24]===E?D=t[25]:(D=(0,G.jsx)(`div`,{...E}),t[24]=E,t[25]=D);let O;return t[26]!==y||t[27]!==n||t[28]!==a||t[29]!==i||t[30]!==x||t[31]!==h||t[32]!==_||t[33]!==D||t[34]!==S||t[35]!==r?(O=(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":n,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:h,onPointerMove:_,onPointerUp:y,onPointerCancel:y,onLostPointerCapture:y,onDoubleClick:S,onKeyDown:x,onFocus:C,onBlur:w,className:`x10l6tqk x13vifvy x1ey2m1c xzkxjte x1wc42o8 x1u8a7rm xicojor x5ve5x3 x1a2a7pz x78zum5 xl56j7k`,children:D}),t[26]=y,t[27]=n,t[28]=a,t[29]=i,t[30]=x,t[31]=h,t[32]=_,t[33]=D,t[34]=S,t[35]=r,t[36]=O):O=t[36],O}var UP=W.createContext(void 0);function WP(e){let t=W.useContext(UP);if(t===void 0&&!e)throw Error(Hv(72));return t}var GP={...Tw,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,appliedTriggerProps:(e,t)=>t?e.activeTriggerProps:void 0,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},KP=class extends gw{constructor(e,t,n){let r=new ew;super(qP(e,r,t,n),JP(r),GP)}setOpen=(e,t)=>{JC(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Wy(qy,e))}};function qP(e,t,n,r=!1){return{...yw(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function JP(e){return{popupRef:W.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var YP=aw(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=HC((e,t)=>new KP({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),XC(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=ZC(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=W.useRef(null);J(()=>{m&&t&&p.setOpen(!1,Wy(lb))},[m,t,p]),J(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),J(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),W.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,Wy(fb))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,G.jsxs)(UP.Provider,{value:p,children:[l&&(0,G.jsx)(UC,{handle:l,store:p}),T&&(0,G.jsx)(XP,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function XP({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=AC(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=DC(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=W.useMemo(()=>Ov(a.reference,i.reference),[a.reference,i.reference]);return QC(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??cy}),null}var ZP=W.createContext(void 0);function QP(){return W.useContext(ZP)}var $P=`data-base-ui-tooltip-trigger`;function eF(e){let t=Kb(e);return $_(t)?t:null}var tF=ow(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=WP(!0),m=Ew(a)??p;if(!m)throw Error(Hv(82));let h=yb(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=W.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=YC(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=QP(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=gx(v,{open:_}),O=Pw(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=yx(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=W.useRef(!1),F=Cb(),I=W.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=Gb(e,`[${$P}]`);return n!==null&&n!==t&&Y(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=Lw(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?$w():null,restMs:L,delay(){return u==null&&D?{close:lx(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=kw(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=eF(e),r=z(n),i=y.current,a=i&&n&&Y(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,Wy(Jy,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&Hb(I.current)){let t=()=>{P.current||j.current||m.select(`open`)||m.setOpen(!0,Wy(Jy,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},ee=m.useState(`appliedTriggerProps`,S||M!==`none`);return fy(`button`,e,{state:{open:_},ref:[t,x,y],props:[B,V,ee,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(eF(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[$b]:A?``:void 0,[$P]:A?void 0:``},f],stateAttributesMapping:zy})}),nF=W.createContext(void 0);function rF(){let e=W.useContext(nF);if(e===void 0)throw Error(Hv(70));return e}var iF=W.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=rC({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,G.jsxs)(W.Fragment,{children:[l,c&&$S.createPortal(n,c)]})}),aF=W.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return WP().useState(`mounted`)||n?(0,G.jsx)(nF.Provider,{value:n,children:(0,G.jsx)(iF,{ref:t,...r})}):null}),oF=W.createContext(void 0);function sF(){let e=W.useContext(oF);if(e===void 0)throw Error(Hv(71));return e}var cF=W.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=ZS,style:g,..._}=e,v=WP(),y=rF(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=oA({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=mA(e,W.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,G.jsx)(oF.Provider,{value:D,children:O})}),lF=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=WP(),{side:s,align:c}=sF(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);RC({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Fw(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return fy(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[BC,f,pA(d),a],stateAttributesMapping:Hy})}),uF=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=W.useMemo(()=>({open:t,close:n}),[t,n]);return(0,G.jsx)(ZP.Provider,{value:t,children:(0,G.jsx)(hx,{delay:i,timeoutMs:r,children:e.children})})};function dF(e){let t=(0,ko.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(uF,{delay:400,closeDelay:0,children:n}),t[0]=n,t[1]=r),r}function fF(e){let t=(0,ko.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,G.jsx)(tF,{render:i}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,G.jsx)(aF,{children:(0,G.jsx)(cF,{sideOffset:6,className:`x6y048q`,children:(0,G.jsxs)(lF,{className:`x78zum5 x6s0dn4 x167g77z x12ulsxz xdqyycr xqtwvag x14fh20 x122w267 xvjf9rd xmkeg23 x1y0btm7 x4s12hp x5kdpwh x1jkqq1h xctpfpq x1hc1fzr x1hw7zpd xiyypsa x3oybdh x1qdyiyv x14up28i x6o7n8i x19jr8i9 x1fdgx8g x1ya1k7h x6setmy`,children:[n,r]})})}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,G.jsxs)(YP,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function pF(e){let t=(0,ko.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`span`,{className:`xxb57xf xss6m8b`,children:n}),t[0]=n,t[1]=r),r}var mF={k1K539:`x1k9oyp`,kmVPX3:`x13bz5fa`,kaIpWk:`xr11lhz`,kWkggS:`xxhzbed`,$$css:!0},hF={kzqmXN:`x1xc55vz`,kZKoxP:`xdk7pt`,kaIpWk:`x16rqkct`,kmuXW:`x2lah0s`,$$css:!0},gF={sidebar:{kVAEAm:`x1n2onr6`,kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`x5yr21d`,kWkggS:`xgwgzc4`,kWqL5O:`xs1s249`,kSWEuD:`x32b0ac`,k26BEO:`xl7466b`,$$css:!0},width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],group:e=>[mF,{"--xm54oyi":e==null?e:`xyynxod`,$$css:!0},{"--x---xm54oyi":e??void 0}],dot:e=>[hF,{kWkggS:e==null?e:`xl8spv7`,$$css:!0},{"--x-backgroundColor":e??void 0}]};function _F(){let e=(0,ko.c)(53),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=He(),e[0]=t):t=e[0];let n=Le(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=M(),e[1]=r):r=e[1];let i=Le(r),a=al(),o=ya(),s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={strict:!1},e[2]=s):s=e[2];let c=_a(s),l=zo(),{layout:u,update:d}=il(),[f,p]=(0,W.useState)(null),m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=new Set,e[3]=m):m=e[3];let[h,g]=(0,W.useState)(m),_;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>p({type:`settings`}),e[4]=_):_=e[4],Zc(`Mod+,`,_);let v;e[5]===n.data?v=e[6]:(v=n.data??[],e[5]=n.data,e[6]=v);let y=v,b;if(e[7]!==h||e[8]!==i.data||e[9]!==i.isError||e[10]!==l||e[11]!==y||e[12]!==u.sidebarOpen||e[13]!==u.sidebarWidth||e[14]!==a||e[15]!==d){let t=i.data??[],n;e[17]===y?n=e[18]:(n=e=>e.folderId===null||!y.some(t=>t.id===e.folderId),e[17]=y,e[18]=n);let r=t.filter(n),o;e[19]===h?o=e[20]:(o=e=>{let t=new Set(h);t.has(e)?t.delete(e):t.add(e),g(t)},e[19]=h,e[20]=o);let s=o,c;e[21]!==y||e[22]!==a?(c=e=>[{label:`Edit...`,onSelect:()=>p({type:`connection`,connection:e})},{type:`submenu`,label:`Move to folder`,entries:[{label:`Ungrouped`,onSelect:()=>a.moveConnection.mutate({data:{id:e.id,folderId:null}})},...y.map(t=>({label:t.name,onSelect:()=>a.moveConnection.mutate({data:{id:e.id,folderId:t.id}})}))]},{type:`separator`},{label:`Delete`,danger:!0,onSelect:()=>p({type:`delete-connection`,connection:e})}],e[21]=y,e[22]=a,e[23]=c):c=e[23];let f=c,m;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>[{label:`New connection here...`,onSelect:()=>p({type:`connection`,folderId:e.id})},{label:`Rename / recolor...`,onSelect:()=>p({type:`folder`,folder:e})},{type:`separator`},{label:`Delete folder`,danger:!0,onSelect:()=>p({type:`delete-folder`,folder:e})}],e[24]=m):m=e[24];let _=m,v;e[25]!==f||e[26]!==l?(v=e=>t=>(0,G.jsx)(BP,{entries:f(t),children:(0,G.jsxs)(`div`,{...{0:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd xjbqb8w x1sxlxsz x15406qy x19jr8i9 x6setmy x-default-marker`},4:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy x1nke8ei x-default-marker`},2:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy xjbqb8w x1jw1774 x-default-marker`},6:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy xjbqb8w x1jw1774 x-default-marker`},1:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy x11lsgwc x-default-marker`},5:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy x11lsgwc x-default-marker`},3:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy x11lsgwc x-default-marker`},7:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy x11lsgwc x-default-marker`}}[(l===t.id)<<2|!!e<<1|!!(e&&l===t.id)],children:[(0,G.jsxs)(Pa,{to:`/c/$connectionId`,params:{connectionId:t.id},className:`x78zum5 x6s0dn4 xbbb4fa x98rzlu xeuugli x5yr21d x1x7g8rv xy13l1i xvjf9rd x122w267 x1hl2dhg xvj2dgp x1a2a7pz xn0s4wz x1g40iwv`,children:[(0,G.jsx)(`span`,{className:`x78zum5 x1tviuuy`,children:(0,G.jsx)(ae,{})}),(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:t.name}),(0,G.jsx)(`span`,{className:`x2lah0s x1j6dyjg x1tviuuy x1hc1fzr xpr5m1m xzo1hb2 x11fdr6z`,children:V_[t.kind].label})]}),(0,G.jsx)(`div`,{className:`x10l6tqk x3lmqil xs7f9wi x1hc1fzr x4fpvau x7stcvd x1j36eff x1apysje`,children:(0,G.jsx)(zP,{trigger:(0,G.jsx)(xy,{variant:`ghost`,icon:!0,small:!0,"aria-label":`Actions for ${t.name}`,children:(0,G.jsx)(xe,{})}),entries:f(t)})})]})},t.id),e[25]=f,e[26]=l,e[27]=v):v=e[27];let x=v,S;e[28]!==h||e[29]!==s?(S=(e,t,n,r,i,a)=>(0,G.jsxs)(`div`,{...{0:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd xjbqb8w x1sxlxsz x15406qy x19jr8i9 x6setmy x-default-marker`},1:{className:`x1n2onr6 x78zum5 x6s0dn4 x1jgo0hl xvjf9rd x15406qy x19jr8i9 x6setmy xjbqb8w x1jw1774 x-default-marker`}}[!!(a!==void 0&&a)|0],children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!h.has(e),className:`x78zum5 x6s0dn4 x17d4w8g x98rzlu xeuugli x5yr21d x1xijbu4 xc342km xvjf9rd xjbqb8w x1ypdohk xdpxx8g x122w267 xvj2dgp xk50ysn x87ps6o x1a2a7pz xn0s4wz x1g40iwv`,onClick:()=>s(e),children:[(0,G.jsx)(`span`,{...{0:{className:`x78zum5 x1tviuuy x7p49u4 x11xpdln x19jr8i9 x6setmy`},1:{className:`x78zum5 x1tviuuy x11xpdln x19jr8i9 x6setmy x1iffjtl`}}[!h.has(e)|0],children:(0,G.jsx)(te,{})}),r?(0,G.jsx)(`span`,{...Fo(gF.dot(r))}):null,(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:t}),(0,G.jsx)(`span`,{className:`x1tviuuy xqtwvag xo1l8bm x1hc1fzr xpr5m1m xzo1hb2 x11fdr6z`,children:(0,G.jsx)(pF,{children:n})})]}),i]}),e[28]=h,e[29]=s,e[30]=S):S=e[30];let C=S;b=u.sidebarOpen?(0,G.jsxs)(`aside`,{...Fo(gF.sidebar,gF.width(u.sidebarWidth)),children:[(0,G.jsxs)(`div`,{className:`x78zum5 xbbb4fa xbhnzry x2lah0s`,children:[(0,G.jsx)(`div`,{className:`x98rzlu`,children:(0,G.jsxs)(xy,{variant:`primary`,fill:!0,onClick:()=>p({type:`connection`}),children:[(0,G.jsx)(de,{}),` New connection`]})}),(0,G.jsx)(fF,{label:`New folder`,children:(0,G.jsx)(xy,{icon:!0,"aria-label":`New folder`,onClick:()=>p({type:`folder`}),children:(0,G.jsx)(le,{})})})]}),(0,G.jsxs)(`div`,{className:`x98rzlu x1odjw0f x1ik00rn xaxbvzv`,children:[i.isError?(0,G.jsx)(`div`,{className:`xmjl1bo xqtwvag xb0vdwp`,children:`Could not load connections.`}):null,t.length===0&&y.length===0?(0,G.jsx)(`div`,{className:`x1a2dy25 xqtwvag x1tviuuy x1evy7pa`,children:`No connections yet. Create one to start browsing a database.`}):null,y.map(e=>{let n=t.filter(t=>t.folderId===e.id);return(0,G.jsxs)(`div`,{...Fo(gF.group(H_[e.color])),children:[(0,G.jsx)(BP,{entries:_(e),children:C(e.id,e.name,n.length,H_[e.color],(0,G.jsx)(`div`,{className:`x10l6tqk x3lmqil xs7f9wi x1hc1fzr x4fpvau x7stcvd x1j36eff x1apysje`,children:(0,G.jsx)(zP,{trigger:(0,G.jsx)(xy,{variant:`ghost`,icon:!0,small:!0,"aria-label":`Actions for folder ${e.name}`,children:(0,G.jsx)(xe,{})}),entries:_(e)})}),!0)}),h.has(e.id)?null:n.map(x(!0))]},e.id)}),r.length>0?(0,G.jsxs)(`div`,{className:`x13bz5fa`,children:[C(`__ungrouped__`,`Ungrouped`,r.length,null,null),h.has(`__ungrouped__`)?null:r.map(x(!1))]}):null]}),(0,G.jsx)(`div`,{className:`x2lah0s xbhnzry x178xt8z x13fuv20 x10gwal6`,children:(0,G.jsxs)(`button`,{type:`button`,className:`x78zum5 x6s0dn4 xbbb4fa xh8yej3 x1jgo0hl x1xijbu4 xc342km xvjf9rd xjbqb8w x1sxlxsz x1tviuuy xvj2dgp x1ypdohk xdpxx8g x101pvzj x1qfwjxi x6setmy x1c071of xk4oym4 x1a2a7pz xn0s4wz x1g40iwv`,onClick:()=>p({type:`settings`}),children:[(0,G.jsx)(Be,{}),(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:`Settings`}),(0,G.jsx)(Mj,{children:`⌘,`})]})}),(0,G.jsx)(HP,{label:`Resize sidebar`,value:u.sidebarWidth,min:180,max:480,defaultValue:Qc.sidebarWidth,onChange:(e,t)=>d({sidebarWidth:e},t)})]}):null,e[7]=h,e[8]=i.data,e[9]=i.isError,e[10]=l,e[11]=y,e[12]=u.sidebarOpen,e[13]=u.sidebarWidth,e[14]=a,e[15]=d,e[16]=b}else b=e[16];let x;e[31]===f?.type?x=e[32]:(x=f?.type===`settings`?(0,G.jsx)(Aj,{onClose:()=>p(null)}):null,e[31]=f?.type,e[32]=x);let S;e[33]===f?S=e[34]:(S=f?.type===`folder`?(0,G.jsx)(fj,{folder:f.folder,onClose:()=>p(null)}):null,e[33]=f,e[34]=S);let C;e[35]!==f||e[36]!==y?(C=f?.type===`connection`?(0,G.jsx)(KA,{connection:f.connection,folderId:f.folderId,folders:y,onClose:()=>p(null)}):null,e[35]=f,e[36]=y,e[37]=C):C=e[37];let w;e[38]!==f||e[39]!==a?(w=f?.type===`delete-folder`?(0,G.jsx)(XE,{title:`Delete folder`,message:`Delete "${f.folder.name}"? Its connections move to Ungrouped.`,confirmLabel:`Delete folder`,busy:a.deleteFolder.isPending,onCancel:()=>p(null),onConfirm:async()=>{await a.deleteFolder.mutateAsync({data:{id:f.folder.id}}),p(null)}}):null,e[38]=f,e[39]=a,e[40]=w):w=e[40];let T;e[41]!==f||e[42]!==a||e[43]!==o||e[44]!==c?(T=f?.type===`delete-connection`?(0,G.jsx)(XE,{title:`Delete connection`,message:`Delete connection "${f.connection.name}"? The database itself is not touched.`,confirmLabel:`Delete connection`,busy:a.deleteConnection.isPending,onCancel:()=>p(null),onConfirm:async()=>{let e=f.connection.id,t=await a.deleteConnection.mutateAsync({data:{id:e}});p(null);let n=c.tabId&&!t.tabs.some(e=>e.id===c.tabId);(c.connectionId===e||n)&&await o({to:`/`})}}):null,e[41]=f,e[42]=a,e[43]=o,e[44]=c,e[45]=T):T=e[45];let E;return e[46]!==w||e[47]!==T||e[48]!==b||e[49]!==x||e[50]!==S||e[51]!==C?(E=(0,G.jsxs)(G.Fragment,{children:[b,x,S,C,w,T]}),e[46]=w,e[47]=T,e[48]=b,e[49]=x,e[50]=S,e[51]=C,e[52]=E):E=e[52],E}function vF(){let e=(0,ko.c)(14),{layout:t,update:n}=il(),r;e[0]!==t.sidebarOpen||e[1]!==n?(r=()=>n({sidebarOpen:!t.sidebarOpen}),e[0]=t.sidebarOpen,e[1]=n,e[2]=r):r=e[2];let i=r;Zc(`Mod+B`,i);let a=t.sidebarOpen?`Hide sidebar`:`Show sidebar`,o;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(Mj,{children:`⌘B`}),e[3]=o):o=e[3];let s;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Ce,{size:16}),e[4]=s):s=e[4];let c;e[5]!==t.sidebarOpen||e[6]!==i?(c=(0,G.jsx)(xy,{variant:`ghost`,icon:!0,"aria-label":`Toggle sidebar`,"aria-pressed":t.sidebarOpen,onClick:i,children:s}),e[5]=t.sidebarOpen,e[6]=i,e[7]=c):c=e[7];let l;e[8]!==a||e[9]!==c?(l=(0,G.jsx)(fF,{label:a,hint:o,children:c}),e[8]=a,e[9]=c,e[10]=l):l=e[10];let u;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,G.jsx)(`span`,{className:`xvj2dgp x1s688f xtiv8zk`,children:`db-player`}),e[11]=u):u=e[11];let d;return e[12]===l?d=e[13]:(d=(0,G.jsxs)(`header`,{className:`x78zum5 x6s0dn4 xbbb4fa x5md06r xu7byfh x2lah0s xgwgzc4 xso031l x1q0q8m5 x1atvb72`,children:[l,u]}),e[12]=l,e[13]=d),d}var yF=(0,W.createContext)(null);function bF(){return(0,W.useContext)(yF)?.defaultOptions??{}}function xF(e){return typeof e==`function`}function SF(e,...t){return xF(e)?e(...t):e}var CF=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}},wF=new Map;function TF(e,t){wF.set(e,t)}function EF(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function DF(e){return typeof e.get==`function`?e.get():e.state}function OF(e){return{key:e.key,store:{state:EF(DF(e.store))},options:EF(e.options)}}var kF=class extends CF{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},AF=(e,t)=>{let n=t.key;n&&(TF(n,t),jF.emit(e,OF({...t,key:n})))},jF=new kF;function MF(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}var NF={enabled:!0,leading:!1,trailing:!0,wait:0},PF=class{fn;store=new sa(MF());key;options;#e;constructor(e,t){this.fn=e,this.key=t.key,this.options={...NF,...t},this.#t(this.options.initialState??{}),this.key&&jF.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()};#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),AF(`Debouncer`,this)};#n=()=>!!SF(this.options.enabled,this);#r=()=>SF(this.options.wait,this);maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())};#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))};flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))};#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)};cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})};reset=()=>{this.#t(MF())}};function FF(e,t,n=()=>({})){let r={...bF().debouncer,...t},[i]=(0,W.useState)(()=>{let t=new PF(e,r);return t.Subscribe=function(e){let n=A(t.store,e.selector,{compare:ua});return typeof e.children==`function`?e.children(n):e.children},t});i.fn=e,i.setOptions(r),(0,W.useEffect)(()=>()=>{r.onUnmount?r.onUnmount(i):i.cancel()},[]);let a=A(i.store,n,{compare:ua});return(0,W.useMemo)(()=>({...i,state:a}),[i,a])}function IF(e,t,n){let[r,i]=(0,W.useState)(e),a=FF(i,t,n);return[r,a.maybeExecute,a]}function LF(e,t,n){let[r,i,a]=IF(e,t,n);return(0,W.useEffect)(()=>{i(e)},[e,i]),[r,a]}var RF={explorer:{kVAEAm:`x1n2onr6`,kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`x5yr21d`,kWkggS:`x185or1n`,kWqL5O:`xs1s249`,kSWEuD:`x32b0ac`,k26BEO:`xl7466b`,$$css:!0},width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function zF(e){let t=(0,ko.c)(23),{connectionId:n,database:r,filter:i,activeTable:a}=e,o=Bo(),s;t[0]!==n||t[1]!==r?(s=ye(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=Le(s);if(c.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`div`,{className:`x1ua62b8 x1x7g8rv xqtwvag x1tviuuy`,children:`Loading…`}),t[3]=e):e=t[3],e}if(c.isError){let e;t[4]===c.error?e=t[5]:(e=q_(c.error),t[4]=c.error,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,G.jsx)(`div`,{className:`xmjl1bo xqtwvag xb0vdwp xfrs9s4 x13faqbe`,children:e}),t[6]=e,t[7]=n),n}let l,u;if(t[8]!==o||t[9]!==a||t[10]!==n||t[11]!==r||t[12]!==i||t[13]!==c.data){u=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i.toLowerCase(),s=c.data.filter(t=>t.name.toLowerCase().includes(e));if(s.length===0){let n=e?`No matches`:`No tables`,r;t[16]===n?r=t[17]:(r=(0,G.jsx)(`div`,{className:`x1ua62b8 x1x7g8rv xqtwvag x1tviuuy`,children:n}),t[16]=n,t[17]=r),u=r;break bb0}let d;t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==r?(d=e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o.openTable(n,r,e.name),...{0:{className:`x78zum5 x6s0dn4 x17d4w8g xh8yej3 x1jgo0hl x1xijbu4 xc342km xvjf9rd xdpxx8g x1hl2dhg xvj2dgp xo1l8bm x1ypdohk xjbqb8w x1sxlxsz x1a2a7pz xn0s4wz x1g40iwv x1x7g8rv x1tviuuy`},1:{className:`x78zum5 x6s0dn4 x17d4w8g xh8yej3 x1jgo0hl x1xijbu4 xc342km xvjf9rd xdpxx8g x1hl2dhg xvj2dgp xo1l8bm x1ypdohk x1a2a7pz xn0s4wz x1g40iwv x1x7g8rv x1nke8ei x122w267`}}[(a?.database===r&&a.table===e.name)|0],children:[(0,G.jsx)(Ke,{}),(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:e.name}),e.isView?(0,G.jsx)(`span`,{className:`x1j6dyjg x1tviuuy`,children:`view`}):null]},e.name),t[18]=o,t[19]=a,t[20]=n,t[21]=r,t[22]=d):d=t[22],l=s.map(d)}t[8]=o,t[9]=a,t[10]=n,t[11]=r,t[12]=i,t[13]=c.data,t[14]=l,t[15]=u}else l=t[14],u=t[15];return u===Symbol.for(`react.early_return_sentinel`)?l:u}function BF(e){let t=(0,ko.c)(85),{connection:n,activeTable:r}=e,i=Bo(),a=F(),{layout:o,update:c}=il(),l;t[0]===n.id?l=t[1]:(l=s(n.id),t[0]=n.id,t[1]=l);let u=Le(l),[d,f]=(0,W.useState)(``),p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={wait:250},t[2]=p):p=t[2];let[m]=LF(d,p),h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[3]=h):h=t[3];let[g,_]=(0,W.useState)(h),v=(0,W.useRef)(null),y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>v.current?.focus(),t[4]=y):y=t[4],Zc(`Mod+K`,y);let b;t[5]!==r?.database||t[6]!==n.database||t[7]!==g?(b=e=>g[e]??(e===r?.database||e===n.database),t[5]=r?.database,t[6]=n.database,t[7]=g,t[8]=b):b=t[8];let x=b,S,C,w,T,E,D,O,k,A;if(t[9]!==i||t[10]!==r||t[11]!==n.id||t[12]!==n.name||t[13]!==u.data||t[14]!==u.error||t[15]!==u.isError||t[16]!==u.isPending||t[17]!==m||t[18]!==d||t[19]!==x||t[20]!==o.explorerWidth||t[21]!==a||t[22]!==g){let e=m.toLowerCase(),s=(u.data??[]).filter(t=>x(t)||t.toLowerCase().includes(e));t[32]===o.explorerWidth?S=t[33]:(S=Fo(RF.explorer,RF.width(o.explorerWidth)),t[32]=o.explorerWidth,t[33]=S),C=`Explorer`;let c;t[34]===n.name?c=t[35]:(c=(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xvj2dgp x1s688f xb3r6kr xlyipyv xuxw1ft`,children:n.name}),t[34]=n.name,t[35]=c);let l;t[36]!==n.id||t[37]!==a?(l=()=>{a.invalidateQueries({queryKey:[`databases`,n.id]}),a.invalidateQueries({queryKey:[`tables`,n.id]}),a.invalidateQueries({queryKey:[`sqlSchema`,n.id]})},t[36]=n.id,t[37]=a,t[38]=l):l=t[38];let p;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,G.jsx)(H,{}),t[39]=p):p=t[39];let h;t[40]===l?h=t[41]:(h=(0,G.jsx)(fF,{label:`Reload databases and tables`,children:(0,G.jsx)(xy,{variant:`ghost`,icon:!0,"aria-label":`Reload`,onClick:l,children:p})}),t[40]=l,t[41]=h),t[42]!==c||t[43]!==h?(w=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xbbb4fa x5md06r x69q509 x5ku0wl x2lah0s`,children:[c,h]}),t[42]=c,t[43]=h,t[44]=w):w=t[44];let y;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>f(e.target.value),t[45]=y):y=t[45],t[46]===d?T=t[47]:(T=(0,G.jsx)(`div`,{className:`xu7byfh x1o95cbt x2lah0s`,children:(0,G.jsx)(UO,{inputRef:v,placeholder:`Filter…`,"aria-label":`Filter databases and tables`,value:d,onChange:y})}),t[46]=d,t[47]=T);let b;t[48]!==i||t[49]!==n.id?(b=()=>void i.openSql(n.id),t[48]=i,t[49]=n.id,t[50]=b):b=t[50];let j,M,N;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(`span`,{className:`x78zum5 x1tviuuy`,children:(0,G.jsx)(re,{})}),M=(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:`SQL editor`}),N=(0,G.jsx)(Mj,{children:`⌥T`}),t[51]=j,t[52]=M,t[53]=N):(j=t[51],M=t[52],N=t[53]),t[54]===b?E=t[55]:(E=(0,G.jsx)(`div`,{className:`xu7byfh xbp0ul4 x2lah0s`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:b,className:`x78zum5 x6s0dn4 x17d4w8g xh8yej3 x1jgo0hl x1xijbu4 xc342km xvjf9rd x122w267 xdpxx8g x1hl2dhg xvj2dgp xo1l8bm x1ypdohk xjbqb8w x1sxlxsz x1a2a7pz xn0s4wz x1g40iwv`,children:[j,M,N]})}),t[54]=b,t[55]=E),D=`x98rzlu x1odjw0f xu7byfh xaxbvzv`,t[56]===u.isPending?O=t[57]:(O=u.isPending?(0,G.jsx)(`div`,{className:`x1ua62b8 x1x7g8rv xqtwvag x1tviuuy`,children:`Connecting…`}):null,t[56]=u.isPending,t[57]=O),t[58]!==u.error||t[59]!==u.isError?(k=u.isError?(0,G.jsx)(`div`,{className:`xmjl1bo xqtwvag xb0vdwp xfrs9s4 x13faqbe`,children:q_(u.error)}):null,t[58]=u.error,t[59]=u.isError,t[60]=k):k=t[60];let P;t[61]!==r||t[62]!==n.id||t[63]!==m||t[64]!==x||t[65]!==g?(P=e=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":x(e),className:`x78zum5 x6s0dn4 x17d4w8g xh8yej3 x1jgo0hl x1xijbu4 xc342km xvjf9rd x122w267 xdpxx8g x1hl2dhg xvj2dgp x1ypdohk xjbqb8w x1sxlxsz x1a2a7pz xn0s4wz x1g40iwv xk50ysn`,onClick:()=>_({...g,[e]:!x(e)}),children:[(0,G.jsx)(`span`,{...{0:{className:`x78zum5 x1tviuuy x7p49u4 x11xpdln x19jr8i9 x6setmy`},1:{className:`x78zum5 x1tviuuy x11xpdln x19jr8i9 x6setmy x1iffjtl`}}[!!x(e)|0],children:(0,G.jsx)(te,{})}),(0,G.jsx)(`span`,{className:`x78zum5 x1tviuuy`,children:(0,G.jsx)(ae,{})}),(0,G.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:e})]}),x(e)?(0,G.jsx)(zF,{connectionId:n.id,database:e,filter:m,activeTable:r}):null]},e),t[61]=r,t[62]=n.id,t[63]=m,t[64]=x,t[65]=g,t[66]=P):P=t[66],A=s.map(P),t[9]=i,t[10]=r,t[11]=n.id,t[12]=n.name,t[13]=u.data,t[14]=u.error,t[15]=u.isError,t[16]=u.isPending,t[17]=m,t[18]=d,t[19]=x,t[20]=o.explorerWidth,t[21]=a,t[22]=g,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A}else S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],k=t[30],A=t[31];let j;t[67]!==D||t[68]!==O||t[69]!==k||t[70]!==A?(j=(0,G.jsxs)(`div`,{className:D,children:[O,k,A]}),t[67]=D,t[68]=O,t[69]=k,t[70]=A,t[71]=j):j=t[71];let M;t[72]===c?M=t[73]:(M=(e,t)=>c({explorerWidth:e},t),t[72]=c,t[73]=M);let N;t[74]!==o.explorerWidth||t[75]!==M?(N=(0,G.jsx)(HP,{label:`Resize explorer`,value:o.explorerWidth,min:180,max:480,defaultValue:248,onChange:M}),t[74]=o.explorerWidth,t[75]=M,t[76]=N):N=t[76];let P;return t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==E||t[82]!==j||t[83]!==N?(P=(0,G.jsxs)(`nav`,{...S,"aria-label":C,children:[w,T,E,j,N]}),t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=E,t[82]=j,t[83]=N,t[84]=P):P=t[84],P}function VF(e){return HF(e)||typeof e==`function`||UF(e)}function HF(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function UF(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function WF(e,t){return e==null?null:VF(e)?W.createElement(e,t):e}function GF(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?WF(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:WF(n.cell,t.getContext())}return`header`in e&&e.header?WF(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?WF(e.footer.column.columnDef.footer,e.footer.getContext()):null}function KF(e){let t=A(e.source,e.selector,{compare:ua});return typeof e.children==`function`?e.children(t):e.children}function qF(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function JF(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return a&&i(o,t)||(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function YF(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{n&&t(r,e)||i(e)})}}function XF(){return JF({createAtom:aa,batch:na})}function ZF(e,t){return typeof e==`function`?e(t):e}function QF(e){if(Array.isArray(e))return e.map(QF);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?$F():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:QF(e[i]),writable:!0})}return n}return e}function $F(){return Object.create(null)}function eI(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tI(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>ZF(n,e))}}function nI(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var rI=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u&&(o=l,a?.(),s=e(...l??[]),r?.(s)),s}};function iI(e){let t=!1;return()=>{t?e():t=!0}}function aI({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return rI({...a,...o})}function oI(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function sI(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=oI(r);t[n]=a?aI({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function cI(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=oI(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=aI({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function lI(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function uI(e){return e.row.getValue(e.column.id)}function dI(e){return e.getValue()??e.table.options.renderFallbackValue}function fI(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var pI={assignCellPrototype:(e,t)=>{cI(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>uI(e)},cell_renderValue:{fn:e=>dI(e)},cell_getContext:{fn:e=>fI(e),memoDeps:e=>[e]}})}};function mI(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function hI(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=mI(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function gI(e){return e.getIsVisible?.()??!0}function _I(e){return e.getVisibleLeafColumns?.()??e.getAllLeafColumns()}function vI(e,t){let n=e,r=t;return n.getOrderColumnsFn?.()(r)??n._orderGroupedColumns?.(r)??t}function yI(e,t,n,r){return e._orderByColumnPinning?.(t,n,r)??t}function bI(e,t){return e.getPinnedVisibleLeafColumns?.(t)??(t&&t!==`center`?[]:_I(e))}function xI(e,t){return e._expandRows?.(t)??t}function SI(e){e.autoResetExpanded?.()}function CI(e){e.autoResetPageIndex?.()}function wI(e){e.autoResetSorting?.()}function TI(e){e.autoResetCellSelection?.()}function EI(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function DI(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return vI(e.table,t)}return[e]}function OI(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function kI(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=hI(e,o,r,n),c=o;s.columns=c.columns?kI(e,c.columns,s,r+1):[],i[a]=s}return i}function AI(e){return kI(e,e.options.columns)}function jI(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function MI(e){let t=$F(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function NI(e){return vI(e,e.getAllColumns().flatMap(e=>e.getLeafColumns()))}function PI(e){let t=$F(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function FI(e,t){return e.getAllFlatColumnsById()[t]}var II={assignColumnPrototype:(e,t)=>{cI(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>EI(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>DI(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{sI(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>OI(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>AI(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>jI(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>MI(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>NI(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>PI(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>FI(e,t)}})}};function LI(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function RI(e,t,n){let r=LI(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function zI(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];gI(i)&&i.columns.length&&(n=Math.max(n,zI(i.columns,t+1)))}return n}function BI(e,t){return e?`${e}_${t}`:String(t)}function VI(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function HI(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function UI(e,t,n,r,i,a){let o={depth:t,id:BI(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=RI(n,u,{id:VI(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(HI(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&UI(s,t-1,n,r,i,a)}function WI(e){for(let t=0;t<e.length;t++){let n=e[t];if(!gI(n.column))continue;let r=0;if(n.subHeaders.length){WI(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];gI(t.column)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function GI(e,t,n,r){let i=zI(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=RI(n,t[e],{depth:i,index:e}));return UI(s,i-1,n,r,a,o),a.reverse(),WI(a[0]?.headers??[]),a}function KI(e,t){for(let n=0;n<e.subHeaders.length;n++)KI(e.subHeaders[n],t);t.push(e)}function qI(e){let t=[];return KI(e,t),t}function JI(e){return{column:e.column,header:e,table:e.column.table}}function YI(e){return GI(e.getAllColumns(),yI(e,_I(e),e=>e.id),e)}function XI(e){return[...e.getHeaderGroups()].reverse()}function ZI(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function QI(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var $I={assignHeaderPrototype:(e,t)=>{cI(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>qI(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>JI(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{sI(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>YI(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>XI(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>ZI(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>QI(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function eL(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var tL=(e,t,n,r,i,a,o)=>{let s=eL(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=$F(),c._valuesCache=$F(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c};function nL(){return e=>aI({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>iL(e,e.options.data),onAfterUpdate:iI(()=>{SI(e),CI(e),wI(e),TI(e)})})}function rL(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=tL(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=rL(e,t,c.originalSubRows,r+1,c)))}return a}function iL(e,t){let n={rows:[],flatRows:[],rowsById:$F()};return n.rows=rL(e,n,t),n}function aL(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??nL()(e)),e._rowModels.coreRowModel()}function oL(e){return e.getCoreRowModel()}function sL(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function cL(e){return e.getFilteredRowModel()}function lL(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function uL(e){return e.getGroupedRowModel()}function dL(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function fL(e){return e.getSortedRowModel()}function pL(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function mL(e){return e.getExpandedRowModel()}function hL(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function gL(e){return e.getPaginatedRowModel()}var _L={constructTableAPIs:e=>{sI(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>aL(e)},table_getPreFilteredRowModel:{fn:()=>oL(e)},table_getFilteredRowModel:{fn:()=>sL(e)},table_getPreGroupedRowModel:{fn:()=>cL(e)},table_getGroupedRowModel:{fn:()=>lL(e)},table_getPreSortedRowModel:{fn:()=>uL(e)},table_getSortedRowModel:{fn:()=>dL(e)},table_getPreExpandedRowModel:{fn:()=>fL(e)},table_getExpandedRowModel:{fn:()=>pL(e)},table_getPrePaginatedRowModel:{fn:()=>mL(e)},table_getPaginatedRowModel:{fn:()=>hL(e)},table_getRowModel:{fn:()=>gL(e)}})}};function vL(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function yL(e,t,n){let r=vL(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function bL(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function xL(e){let t=e.getPrePaginatedRowModel(),n=e.options.paginateExpandedRows===!1?xI(e,t).rows:t.rows;for(let e=0;e<n.length;e++)n[e]._displayIndexCache=e;return n}function SL(e,t){if(eI(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function CL(e,t){if(eI(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function wL(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function TL(e){return nI(e.subRows,e=>e.subRows)}function EL(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function DL(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function OL(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function kL(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=yL(a,e,e.table),n.set(a,o)),r[i]=o}return r}function AL(e){let t=$F(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function jL(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function ML(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var NL={assignRowPrototype:(e,t)=>{cI(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>bL(e)},row_getAllCellsByColumnId:{fn:e=>AL(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>kL(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>TL(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>DL(e)},row_getParentRows:{fn:e=>OL(e)},row_getUniqueValues:{fn:(e,t)=>CL(e,t)},row_getValue:{fn:(e,t)=>SL(e,t)},row_renderValue:{fn:(e,t)=>wL(e,t)}})},constructTableAPIs:e=>{sI(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>xL(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>jL(t,e,n,r)},table_getRow:{fn:(t,n)=>ML(e,t,n)},table_getMaxSubRowDepth:{fn:()=>EL(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function PL(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function FL(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{PL(e,t,n),e._reactivity.commit?.()})}function IL(e){let t=QF(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function LL(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function RL(e,t,n){let r=LL(e,ZF(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&FL(e,r.state??null)}var zL={coreCellsFeature:pI,coreColumnsFeature:II,coreHeadersFeature:$I,coreRowModelsFeature:_L,coreRowsFeature:NL,coreTablesFeature:{constructTableAPIs:e=>{sI(`coreTablesFeature`,e,{table_reset:{fn:()=>IL(e)},table_setOptions:{fn:t=>RL(e,t)}})}}};function BL(){return{accessor:(e,t)=>typeof e==`function`?{...t,accessorFn:e}:{...t,accessorKey:e},columns:e=>e,display:e=>e,group:e=>e}}function VL(e){return e}function HL(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),QF(t)}function UL(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...zL,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=HL(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&eI(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}PL(v),v.store=qF(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:ua,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}function WL(){return $F()}function GL(){return{size:150,minSize:20,maxSize:2**53-1}}function KL(e){let t=GL(),n=e.table.atoms.columnSizing?.get(),r=n&&eI(n,e.id)?n[e.id]:void 0;return Math.min(Math.max(e.columnDef.minSize??t.minSize,r??e.columnDef.size??t.size),e.columnDef.maxSize??t.maxSize)}function qL(e){let t=$F(),n=$F(),r=Array(e.length),i=0;for(let n=0;n<e.length;n++){let a=e[n],o=lI(a,`getSize`,KL);r[n]=o,t[a.id]=i,i+=o}let a=0;for(let t=e.length-1;t>=0;t--)n[e[t].id]=a,a+=r[t];return{starts:t,afters:n}}function JL(e){return{all:qL(bI(e)),center:qL(bI(e,`center`)),start:qL(bI(e,`start`)),end:qL(bI(e,`end`))}}function YL(e){return e===`start`?`start`:e===`end`?`end`:e===`center`?`center`:`all`}function XL(e,t){return lI(e.table,`getColumnOffsets`,JL)[YL(t)].starts[e.id]??0}function ZL(e,t){return lI(e.table,`getColumnOffsets`,JL)[YL(t)].afters[e.id]??0}function QL(e){nR(e.table,t=>{let n=$F(),r=Object.keys(t);for(let i=0;i<r.length;i++){let a=r[i];a!==e.id&&(n[a]=t[a])}return n})}function $L(e){if(!e.subHeaders.length)return KL(e.column);let t=0;for(let n=0;n<e.subHeaders.length;n++)t+=$L(e.subHeaders[n]);return t}function eR(e){return $L(e)}function tR(e){if(e.index>0){let t=e.headerGroup?.headers[e.index-1];if(t)return lI(t,`getStart`,tR)+lI(t,`getSize`,eR)}return 0}function nR(e,t){e.options.onColumnSizingChange?.(t)}function rR(e,t){nR(e,t?$F():Object.assign($F(),QF(e.initialState.columnSizing??{})))}function iR(e){let t=0;for(let n=0;n<e.length;n++)t+=lI(e[n],`getSize`,KL);return t}function aR(e){return e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+eR(t),0)??0}function oR(e){return iR(bI(e,`start`))}function sR(e){return iR(bI(e,`center`))}function cR(e){return iR(bI(e,`end`))}function lR(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}function uR(e){return(e.columnDef.enableResizing??!0)&&(e.table.options.enableColumnResizing??!0)}function dR(e){return e.table.atoms.columnResizing?.get()?.isResizingColumn===e.id}function fR(e,t){let n=e.table.getColumn(e.column.id),r=uR(n);return i=>{if(!r||_R(i)&&i.touches.length>1)return;let a=eR(e),o=e.getLeafHeaders().map(e=>[e.column.id,KL(e.column)]),s=_R(i)?Math.round(i.touches[0].clientX):i.clientX,c=$F(),l=(e,t)=>{if(typeof t!=`number`)return;let r=n.table,i=r.options.columnResizeMode===`onChange`||e===`end`;r._reactivity.batch(()=>{pR(r,e=>{let n=r.options.columnResizeDirection===`rtl`?-1:1,a=(t-(e.startOffset??0))*n,o=e.startSize??0,s=Math.max(o>0?a/o:0,-.999999);if(i){let t=e.columnSizingStart;for(let e=0;e<t.length;e++){let n=t[e],r=n[1];c[n[0]]=Math.round(Math.max(r>0?r+r*s:a/t.length,0)*100)/100}}return{...e,deltaOffset:a,deltaPercentage:s}}),i&&nR(r,e=>Object.assign($F(),e,c))})},u=null,d=!1,f,p=()=>{d?(d=!1,l(`move`,f),u=requestAnimationFrame(p)):u=null},m=e=>{f=e,typeof requestAnimationFrame==`function`?u===null?(l(`move`,e),u=requestAnimationFrame(p)):d=!0:l(`move`,e)},h=e=>{u!==null&&(cancelAnimationFrame(u),u=null,d=!1),n.table._reactivity.batch(()=>{l(`end`,e??f),pR(n.table,e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))})},g=t||(typeof document<`u`?document:null),_={moveHandler:e=>m(e.clientX),upHandler:e=>{g?.removeEventListener(`mousemove`,_.moveHandler),g?.removeEventListener(`mouseup`,_.upHandler),h(e.clientX)}},v={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{y(),e.cancelable&&(e.preventDefault(),e.stopPropagation()),h(e.touches[0]?.clientX)},cancelHandler:()=>{y(),h()}},y=()=>{g?.removeEventListener(`touchmove`,v.moveHandler),g?.removeEventListener(`touchend`,v.upHandler),g?.removeEventListener(`touchcancel`,v.cancelHandler)},b=gR()?{passive:!1}:!1;_R(i)?(g?.addEventListener(`touchmove`,v.moveHandler,b),g?.addEventListener(`touchend`,v.upHandler,b),g?.addEventListener(`touchcancel`,v.cancelHandler,b)):(g?.addEventListener(`mousemove`,_.moveHandler,b),g?.addEventListener(`mouseup`,_.upHandler,b)),pR(n.table,e=>({...e,startOffset:s,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:o,isResizingColumn:n.id}))}}function pR(e,t){e.options.onColumnResizingChange?.(t)}function mR(e,t){pR(e,t?lR():QF(e.initialState.columnResizing??lR()))}var hR=null;function gR(){if(typeof hR==`boolean`)return hR;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return hR=e,hR}function _R(e){return e.type===`touchstart`}var vR={getInitialState:e=>({columnResizing:lR(),...e}),getDefaultTableOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnResizingChange:tI(`columnResizing`,e)}),assignColumnPrototype:(e,t)=>{cI(`columnResizingFeature`,e,t,{column_getCanResize:{fn:e=>uR(e)},column_getIsResizing:{fn:e=>dR(e)}})},assignHeaderPrototype:(e,t)=>{cI(`columnResizingFeature`,e,t,{header_getResizeHandler:{fn:(e,t)=>fR(e,t)}})},constructTableAPIs:e=>{sI(`columnResizingFeature`,e,{table_setColumnResizing:{fn:t=>pR(e,t)},table_resetHeaderSizeInfo:{fn:t=>mR(e,t)}})}},yR={getInitialState:e=>({columnSizing:WL(),...e}),getDefaultColumnDef:()=>GL(),getDefaultTableOptions:e=>({onColumnSizingChange:tI(`columnSizing`,e)}),assignColumnPrototype:(e,t)=>{cI(`columnSizingFeature`,e,t,{column_getSize:{fn:e=>KL(e),memoDeps:e=>[t.options.columns,t.atoms.columnSizing?.get()?.[e.id]]},column_getStart:{fn:(e,t)=>XL(e,t)},column_getAfter:{fn:(e,t)=>ZL(e,t)},column_resetSize:{fn:e=>QL(e)}})},assignHeaderPrototype:(e,t)=>{cI(`columnSizingFeature`,e,t,{header_getSize:{fn:e=>eR(e),memoDeps:e=>[t.options.columns,e.column.columns.length>0?t.atoms.columnSizing?.get():t.atoms.columnSizing?.get()?.[e.column.id]]},header_getStart:{fn:e=>tR(e),memoDeps:()=>[t.options.columns,t.atoms.columnSizing?.get(),t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode]}})},constructTableAPIs:e=>{sI(`columnSizingFeature`,e,{table_getColumnOffsets:{fn:()=>JL(e),memoDeps:()=>[e.options.columns,e.atoms.columnSizing?.get(),e.atoms.columnOrder?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.atoms.grouping?.get(),e.options.groupedColumnMode]},table_setColumnSizing:{fn:t=>nR(e,t)},table_resetColumnSizing:{fn:t=>rR(e,t)},table_getTotalSize:{fn:()=>aR(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getStartTotalSize:{fn:()=>oR(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getCenterTotalSize:{fn:()=>sR(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getEndTotalSize:{fn:()=>cR(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]}})}},bR=typeof window>`u`?W.useEffect:W.useLayoutEffect;function xR(e,t){let[{table:n,rootSource:r}]=(0,W.useState)(()=>{let t=UL({...e,features:{coreReactivityFeature:XF(),...e.features}});return t.Subscribe=(e=>KF({...e,source:e.source??t.store})),t.FlexRender=GF,{table:t,rootSource:YF(t.store,ua)}}),i=n;RL(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=A(r,t,{compare:ua});return bR(()=>{r.markCommitted(o),FL(i,a??null,ua)}),(0,W.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}function SR(e){return typeof e==`object`?e.key:e}function CR(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function wR(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function TR(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var ER=(e,t)=>Math.abs(e-t)<1.01,DR=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function OR({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var kR=e=>e===`smooth`||e===`smoothFinishing`;function AR({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!kR(n.phase)&&!ER(t,n.lastTargetOffset)&&!ER(t,r())&&e!==`clampedEcho`}var jR=40;function MR(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<jR;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<jR;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function NR(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<jR;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var PR,FR=()=>{if(PR!==void 0)return PR;if(typeof navigator>`u`)return PR=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return PR=!0;let e=navigator.maxTouchPoints;return PR=navigator.platform===`MacIntel`&&e!==void 0&&e>0},IR,LR=()=>IR===void 0?IR=FR()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):IR,RR=()=>!FR()||LR(),zR={capture:!0,passive:!0},BR=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,zR),e.addEventListener(`touchend`,n,zR),e.addEventListener(`touchcancel`,n,zR),()=>{e.removeEventListener(`touchstart`,t,zR),e.removeEventListener(`touchend`,n,zR),e.removeEventListener(`touchcancel`,n,zR),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},VR=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},HR=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},UR=e=>e,WR=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},GR=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(VR(n)),!r.ResizeObserver)return()=>{};let a=HR(r),o=new r.ResizeObserver(()=>{let t=()=>{i(VR(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},KR={passive:!0},qR=typeof window>`u`||`onscrollend`in window,JR=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&qR,o=0,s=a?null:DR(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,KR),a&&r.addEventListener(`scrollend`,u,KR),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},YR=(e,t)=>JR(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),XR=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},ZR=(e,{adjustments:t=0,behavior:n},r)=>{var i;let{scrollElement:a,options:o}=r,s=e+t,c=o.horizontal&&o.isRtl&&a!==null&&`ownerDocument`in a;(i=a?.scrollTo)==null||i.call(a,{[o.horizontal?`left`:`top`]:c?-s:s,behavior:n})},QR=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,$R=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function ez(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var tz=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new BR({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&NR(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=!1,r=!1,i=new Set,a=()=>{if(e)return e;let r=this.targetWindow;if(!r||!r.ResizeObserver)return null;let i=t=HR(r);return e=new r.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(o)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)i.schedule(t);else{n=!0;try{t()}finally{n=!1}}})},o=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var n;(n=a())==null||n.disconnect(),t?.cancel(),i.clear(),r=!1,e=null,t=null},observe:o=>{let s=a();s&&(n?(i.add(o),r||(r=!0,t?.schedule(()=>{r=!1,i.forEach(t=>{t.isConnected&&e?.observe(t,{box:`border-box`})}),i.clear()}))):s.observe(o,{box:`border-box`}))},unobserve:e=>{var t;i.delete(e),(t=a())==null||t.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:UR,rangeExtractor:WR,onChange:()=>{},measureElement:XR,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>SR(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||ez(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=wR(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:AR({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||MR(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?$R(this.scrollState)&&!ER(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>OR({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=QR(t,e.index!=null&&ER(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(FR()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=wR(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=wR(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=CR(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=wR(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes,this._getLayoutTotalSize()+this.options.scrollMargin],(e,t,n,r,i)=>{if(e.length===0||t===0)return this.range=null,null;let a=Math.max(i-t,0);return this.range=iz(e,t,Math.min(n,a),r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=wR(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!$R(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!$R(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!$R(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=wR(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return TR(t[nz(0,t.length-1,r?e=>n[e*2]:e=>TR(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a),c=()=>this.options.horizontal?r.clientHeight:r.clientWidth,l=c();if(i.setProperty(a,`hidden`,`important`),c()!==l){i.setProperty(a,o,s);return}let u={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=u,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===u&&(this._momentumStop=null,u.restore()&&u.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.getMeasurements()[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(FR()&&this._iosGesture.dragging())&&e!==null&&!ER(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&ER(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=$R(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&RR()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:QR(n,e.index!=null&&ER(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},nz=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function rz(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function iz(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=rz(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=nz(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var az=typeof document<`u`?W.useLayoutEffect:W.useEffect;function oz({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=W.useReducer(e=>e+1,0)[1],a=W.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=W.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,$S.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=W.useState(()=>{let e=new tz(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),az(()=>d._didMount(),[]),az(()=>(s(d),d._willUpdate())),az(()=>{l(d)}),d}function sz(e){return oz({observeElementRect:GR,observeElementOffset:YR,scrollToFn:ZR,...e})}var cz=/^(?:nullable|lowcardinality)\((.*)\)$/i,lz=/^(?:u?int(?:8|16|32|64|128|256)?|tinyint|smallint|mediumint|bigint|integer|decimal(?:32|64|128|256)?|dec|numeric|fixed|float(?:32|64)?|double(?: precision)?|real|bit|year|long|longlong|newdecimal|tiny|short|int24)(?:\([^)]*\))?(?:\s+(?:unsigned|signed|zerofill))*$/i;function uz(e){let t=e.trim();for(let e=cz.exec(t);e;e=cz.exec(t))t=(e[1]??``).trim();return lz.test(t)}var dz=28,fz=36,pz=72,mz=360,hz=50,gz=7.2,_z={kVAEAm:`x1n2onr6`,$$css:!0},vz={k1xSpc:`xrvj5dj`,kVAEAm:`x7wzq59`,k87sOh:`x13vifvy`,kY2c9j:`xhtitgo`,kZKoxP:`xc9qbxq`,kWkggS:`xgwgzc4`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`x1orbg20`,$$css:!0},yz={k1xSpc:`xrvj5dj`,kZKoxP:`x1fgtraw`,kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kbCHJM:`xu96u03`,k3aq6I:`xsqj5wx`,kWkggS:`xjbqb8w x1sxlxsz`,$$css:!0},bz={inner:(e,t)=>[_z,{kzqmXN:e==null?e:`x5lhr3w`,kZKoxP:t==null?t:`x16ye13r`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(t)}],headRow:(e,t)=>[vz,{kumcoG:e==null?e:`xqketvx`,kzqmXN:t==null?t:`x5lhr3w`,$$css:!0},{"--x-gridTemplateColumns":e??void 0,"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(t)}],row:(e,t,n)=>[yz,{kumcoG:e==null?e:`xqketvx`,kzqmXN:t==null?t:`x5lhr3w`,$$css:!0},{"--x-gridTemplateColumns":e??void 0,"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-transform":`translateY(${n}px)`==null?void 0:`translateY(${n}px)`}],rowSelected:{kWkggS:`x1vbvkw5`,$$css:!0}},xz=VL({columnSizingFeature:yR,columnResizingFeature:vR}),Sz=BL(),Cz=e=>uz(e.type);function wz(e,t){let n=t.slice(0,hz);return e.map((e,t)=>{let r=e.name.length*7.4+20+(e.isKey?18:0)+18,i=e.type.length*7.2+20,a=n.reduce((e,n)=>Math.max(e,Math.min(K_(n[t]).length,60)),0)*gz+20;return Math.round(Math.min(mz,Math.max(pz,r,i,a)))})}function Tz(e){let t=(0,ko.c)(5),n;t[0]===e.columns?n=t[1]:(n=e.columns.map(Ez).join(`\0`),t[0]=e.columns,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,G.jsx)(Dz,{...e},n),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function Ez(e){return e.name}function Dz({columns:e,rows:t,loading:n,sort:r,onSortChange:i,onCommit:a,selected:o,onSelectedChange:s}){let c=(0,W.useRef)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(null);p===null&&t.length>0&&m(wz(e,t));let h=p??wz(e,[]),g=xR({features:xz,columns:Sz.columns(e.map((e,t)=>Sz.accessor(e=>e[t],{id:String(t),header:e.name,size:h[t],minSize:48,maxSize:1200}))),data:t,columnResizeMode:`onChange`}),_=g.getRowModel().rows,v=g.getHeaderGroups()[0]?.headers??[],y=sz({count:_.length,getScrollElement:()=>c.current,estimateSize:()=>dz,overscan:12});Zc(`Escape`,()=>u(null),{enabled:l!==null});let b=o!==void 0&&s!==void 0,x=v.map(e=>e.getSize()),S=`${b?`${fz}px `:``}${x.map(e=>`${e}px`).join(` `)}`,C=(b?fz:0)+x.reduce((e,t)=>e+t,0),w=async()=>{if(!l||!a)return;let t=e[l.col];if(!t)return;let{row:n,original:r}=l;u(null),d!==r&&await a(n,t,d===``&&t.nullable?null:d)},T=t.length>0&&o?.size===t.length;return(0,G.jsxs)(`div`,{ref:c,className:`x98rzlu x2lwn1j xysyzu8 x1n2onr6 x185or1n`,children:[(0,G.jsxs)(`div`,{...Fo(bz.headRow(S,C)),role:`row`,children:[b?(0,G.jsx)(`div`,{className:`x78zum5 x6s0dn4 xl56j7k`,children:(0,G.jsx)(IO,{ariaLabel:`Select all rows`,checked:T,onCheckedChange:e=>s(e?new Set(t.map((e,t)=>t)):new Set)})}):null,v.map((t,n)=>{let a=e[n];if(!a)return null;let o=r?.column===a.name?r.direction:null;return(0,G.jsxs)(`div`,{role:`columnheader`,tabIndex:i?0:void 0,"aria-sort":o===`asc`?`ascending`:o===`desc`?`descending`:`none`,...{0:{className:`x1n2onr6 x78zum5 xdt5ytf xl56j7k x1awh872 xeuugli x1ypdohk x87ps6o x1a2a7pz xjbqb8w x1sxlxsz x1jrw5c4 x15406qy x1qfwjxi x6setmy`},1:{className:`x1n2onr6 x78zum5 xdt5ytf xl56j7k x1awh872 xeuugli x1ypdohk x87ps6o x1a2a7pz xjbqb8w x1sxlxsz x1jrw5c4 x15406qy x1qfwjxi x6setmy xuk3077`}}[!!Cz(a)|0],onClick:()=>i?.(a.name),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i?.(a.name))},children:[(0,G.jsxs)(`span`,{className:`x78zum5 x6s0dn4 x1jnr06f x193iq5w xqtwvag x1s688f`,children:[a.isKey?(0,G.jsx)(`span`,{className:`x78zum5 x2lah0s x1tviuuy`,role:`img`,"aria-label":`Key column`,children:(0,G.jsx)(ke,{})}):null,(0,G.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:a.name}),o?(0,G.jsx)(`span`,{className:`x78zum5 x2lah0s x1tviuuy`,children:o===`asc`?(0,G.jsx)(Me,{}):(0,G.jsx)(Te,{})}):null]}),(0,G.jsx)(`span`,{className:`x193iq5w x1j6dyjg x1tviuuy xb3r6kr xlyipyv xuxw1ft`,children:a.type}),(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize ${a.name}`,className:`x10l6tqk x13vifvy xzkxjte x1ey2m1c x1wc42o8 xzkaem6 xicojor x5ve5x3 x78zum5 xl56j7k`,onMouseDown:t.getResizeHandler(),onTouchStart:t.getResizeHandler(),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),t.column.resetSize()},children:(0,G.jsx)(`div`,{...{0:{className:`x1i1rx1s x5yr21d x14i5uus x5o664w`},1:{className:`x5yr21d x152q98y xfo62xy`}}[!!t.column.getIsResizing()|0]})})]},t.id)})]}),t.length===0?n?(0,G.jsx)(Ao,{}):(0,G.jsx)(`div`,{className:`xggk2y7 x1tviuuy xqtwvag`,children:`No rows.`}):null,(0,G.jsx)(`div`,{...Fo(bz.inner(C,y.getTotalSize())),children:y.getVirtualItems().map(t=>{let n=_[t.index];if(!n)return null;let r=o?.has(t.index)??!1;return(0,G.jsxs)(`div`,{role:`row`,"data-row":t.index,...Fo(bz.row(S,C,t.start),r&&bz.rowSelected),children:[b?(0,G.jsx)(`div`,{className:`x78zum5 x6s0dn4 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 xl56j7k xnjsko4`,children:(0,G.jsx)(IO,{ariaLabel:`Select row ${t.index+1}`,checked:r,onCheckedChange:e=>{let n=new Set(o);e?n.add(t.index):n.delete(t.index),s(n)}})}):null,n.getAllCells().map((n,r)=>{let i=n.getValue(),o=e[r],s=l?.row===t.index&&l.col===r;return(0,G.jsx)(`div`,{role:`gridcell`,...{0:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72`},8:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl`},4:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x18z6s4b`},12:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x18z6s4b`},2:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x1tviuuy x1k4tb9n`},10:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x1tviuuy x1k4tb9n`},6:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x18z6s4b x1tviuuy x1k4tb9n`},14:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xb3r6kr xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x18z6s4b x1tviuuy x1k4tb9n`},1:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x1717udv x1rea2x4`},9:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x1717udv x1rea2x4`},5:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x18z6s4b x1717udv x1rea2x4`},13:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x18z6s4b x1717udv x1rea2x4`},3:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x1tviuuy x1k4tb9n x1717udv x1rea2x4`},11:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x1tviuuy x1k4tb9n x1717udv x1rea2x4`},7:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x18z6s4b x1tviuuy x1k4tb9n x1717udv x1rea2x4`},15:{className:`x78zum5 x6s0dn4 x1awh872 xeuugli xxb57xf xqtwvag xss6m8b xlyipyv xuxw1ft xso031l x1q0q8m5 x1atvb72 x13a6bvl x18z6s4b x1tviuuy x1k4tb9n x1717udv x1rea2x4`}}[!!(o&&Cz(o))<<3|!!a<<2|(i===null)<<1|!!s],title:K_(i),onDoubleClick:()=>{if(!a)return;let e=i==null?``:K_(i);f(e),u({row:t.index,col:r,original:e})},children:s?(0,G.jsx)(UO,{autoFocus:!0,"aria-label":`Edit ${e[r]?.name??`cell`}`,value:d,onChange:e=>f(e.target.value),onFocus:e=>e.currentTarget.select(),onBlur:()=>u(null),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w())}}):K_(i)},n.id)})]},n.id)})})]})}var Oz=[],kz=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?kz:Oz).push(n+=e[t])})();function Az(e){if(e<768)return!1;for(let t=0,n=Oz.length;;){let r=t+n>>1;if(e<Oz[r])n=r;else if(e>=kz[r])t=r+1;else return!0;if(t==n)return!1}}function jz(e){return e>=127462&&e<=127487}var Mz=8205;function Nz(e,t,n=!0,r=!0){return(n?Pz:Fz)(e,t,r)}function Pz(e,t,n){if(t==e.length)return t;t&&Lz(e.charCodeAt(t))&&Rz(e.charCodeAt(t-1))&&t--;let r=Iz(e,t);for(t+=zz(r);t<e.length;){let i=Iz(e,t);if(r==Mz||i==Mz||n&&Az(i))t+=zz(i),r=i;else if(jz(i)){let n=0,r=t-2;for(;r>=0&&jz(Iz(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Fz(e,t,n){for(;t>1;){let r=Pz(e,t-2,n);if(r<t)return r;t--}return 0}function Iz(e,t){let n=e.charCodeAt(t);if(!Rz(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Lz(r)?(n-55296<<10)+(r-56320)+65536:n}function Lz(e){return e>=56320&&e<57344}function Rz(e){return e>=55296&&e<56320}function zz(e){return e<65536?1:2}var Bz=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Xz(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Hz.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Xz(this,e,t);let n=[];return this.decompose(e,t,n,0),Hz.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Kz(this),i=new Kz(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new Kz(this,e)}iterRange(e,t=this.length){return new qz(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Jz(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new Vz(t):Hz.from(Vz.split(t,[]))}},Vz=class e extends Bz{constructor(e,t=Uz(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Yz(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Gz(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Wz(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Xz(this,t,n);let i=Wz(this.text,Wz(r.text,Gz(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Hz.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
67
|
+
`){[e,t]=Xz(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},Hz=class e extends Bz{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=Xz(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
68
|
+
`){[e,t]=Xz(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new Vz(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof Vz&&c&&(n=u[u.length-1])instanceof Vz&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Vz(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};Bz.empty=new Vz([``],0);function Uz(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Wz(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function Gz(e,t,n){return Wz(e,[``],t,n)}var Kz=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof Vz?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof Vz?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
69
|
+
`,this;e--}else if(r instanceof Vz){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof Vz?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},qz=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Kz(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},Jz=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(Bz.prototype[Symbol.iterator]=function(){return this.iter()},Kz.prototype[Symbol.iterator]=qz.prototype[Symbol.iterator]=Jz.prototype[Symbol.iterator]=function(){return this});var Yz=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Xz(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Zz(e,t,n=!0,r=!0){return Nz(e,t,n,r)}function Qz(e){return e>=56320&&e<57344}function $z(e){return e>=55296&&e<56320}function eB(e,t){let n=e.charCodeAt(t);if(!$z(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Qz(r)?(n-55296<<10)+(r-56320)+65536:n}function tB(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function nB(e){return e<65536?1:2}var rB=/\r\n?|\n/,iB=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(iB||={}),aB=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){lB(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:dB(this,e)}mapDesc(e,t=!1){return e.empty?this:uB(this,e,t)}mapPos(e,t=-1,n=iB.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=iB.Simple&&c>=e&&(n==iB.TrackDel&&r<e&&c>e||n==iB.TrackBefore&&r<e||n==iB.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},oB=class e extends aB{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return lB(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return uB(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(Bz.empty);r.push(a?t.slice(i,i+a):Bz.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:dB(this,e,!0)}map(e,t=!1){return e.empty?this:uB(this,e,t,!0)}iterChanges(e,t=!1){lB(this,e,t)}get desc(){return aB.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new fB(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);sB(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;sB(n,e,t),t>0&&cB(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);sB(n,e,-1),sB(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:aB.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&sB(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?Bz.of(l.split(r||rB)):l:Bz.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&sB(i,e-o,-1),sB(i,s-e,d),cB(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(Bz.empty);r[e]=Bz.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function sB(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function cB(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Bz.empty);e.push(n)}}function lB(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=Bz.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function uB(e,t,n,r=!1){let i=[],a=r?[]:null,o=new fB(e),s=new fB(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);sB(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(sB(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(sB(i,0,o.ins),a&&cB(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;sB(i,t,e<o.i?o.ins:0),a&&e<o.i&&cB(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?oB.createSet(i,a):aB.create(i);else throw Error(`Mismatched change set lengths`)}function dB(e,t,n=!1){let r=[],i=n?[]:null,a=new fB(e),o=new fB(t);for(let e=!1;;)if(a.done&&o.done)return i?oB.createSet(r,i):aB.create(r);else if(a.ins==0)sB(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)sB(r,0,o.ins,e),i&&cB(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;sB(r,t,n,e),i&&n&&cB(i,r,o.text)}else o.ins==-1?(sB(r,a.off?0:a.len,t,e),i&&cB(i,r,a.textBit(t))):(sB(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&cB(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var fB=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Bz.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Bz.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},pB=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return X.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return X.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return X.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},X=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>pB.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return pB.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?pB.create(t,e,a|32,n):pB.create(e,t,a,n)}static undirectionalRange(e,t){return pB.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function mB(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var hB=0,gB=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=hB++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:_B),!!t.static,t.enables)}of(e){return new vB([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new vB(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new vB(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function _B(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var vB=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=hB++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||bB(e,c)){let r=t(e);if(a?!yB(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=NB(o,c);if(this.dependencies.every(t=>t instanceof gB?o.facet(t)===e.facet(t):t instanceof CB?o.field(t,!1)==e.field(t,!1):!0)||(a?yB(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function yB(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function bB(e,t){let n=!1;for(let r of t)MB(e,r)&1&&(n=!0);return n}function xB(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=NB(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)MB(e,t);return e.values[o]=s(e),1},update(e,n){if(!bB(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=bB(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&_B(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var SB=gB.define({static:!0}),CB=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(hB++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(SB).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(SB),i=n.facet(SB),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,SB.of({field:this,create:e})]}get extension(){return this}},wB={lowest:4,low:3,default:2,high:1,highest:0};function TB(e){return t=>new DB(t,e)}var EB={highest:TB(wB.highest),high:TB(wB.high),default:TB(wB.default),low:TB(wB.low),lowest:TB(wB.lowest)},DB=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},OB=class e{of(e){return new kB(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},kB=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},AB=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of jB(t,n,o))e instanceof CB?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,_B(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>xB(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function jB(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof kB&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof kB){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof DB)a(e.inner,e.prec);else if(e instanceof CB)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof vB)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,wB.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,wB.default),r.reduce((e,t)=>e.concat(t))}function MB(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function NB(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var PB=gB.define(),FB=gB.define({combine:e=>e.some(e=>e),static:!0}),IB=gB.define({combine:e=>e.length?e[0]:void 0,static:!0}),LB=gB.define(),RB=gB.define(),zB=gB.define(),BB=gB.define({combine:e=>e.length?e[0]:!1}),VB=class{constructor(e,t){this.type=e,this.value=t}static define(){return new HB}},HB=class{of(e){return new VB(this,e)}},UB=class{constructor(e){this.map=e}of(e){return new WB(this,e)}},WB=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new UB(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};WB.reconfigure=WB.define(),WB.appendConfig=WB.define();var GB=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&mB(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};GB.time=VB.define(),GB.userEvent=VB.define(),GB.addToHistory=VB.define(),GB.remote=VB.define();function KB(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function qB(e,t,n){let r,i,a;return n?(r=t.changes,i=oB.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:WB.mapEffects(e.effects,r).concat(WB.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function JB(e,t,n){let r=t.selection,i=$B(t.annotations);return t.userEvent&&(i=i.concat(GB.userEvent.of(t.userEvent))),{changes:t.changes instanceof oB?t.changes:oB.of(t.changes||[],n,e.facet(IB)),selection:r&&(r instanceof X?r:X.single(r.anchor,r.head)),effects:$B(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function YB(e,t,n){let r=JB(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=qB(r,JB(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=GB.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return ZB(n?XB(i):i)}function XB(e){let t=e.startState,n=!0;for(let r of t.facet(LB)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:KB(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=oB.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=GB.create(t,r,e.selection&&e.selection.map(i),WB.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(RB);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof GB?i:Array.isArray(i)&&i.length==1&&i[0]instanceof GB?i[0]:YB(t,$B(i),!1)}return e}function ZB(e){let t=e.startState,n=t.facet(zB),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=qB(r,JB(t,a,e.changes.newLength),!0))}return r==e?e:GB.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var QB=[];function $B(e){return e==null?QB:Array.isArray(e)?e:[e]}var eV=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(eV||={}),tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,nV;try{nV=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function rV(e){if(nV)return nV.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function iV(e){return t=>{if(!/\S/.test(t))return eV.Space;if(rV(t))return eV.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return eV.Word;return eV.Other}}var aV=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)MB(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`)}else return MB(this,n),NB(this,n)}update(...e){return YB(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(OB.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(WB.reconfigure)?(n=null,r=e.value):e.is(WB.appendConfig)&&(n=null,r=$B(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=AB.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(FB)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:X.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=$B(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=WB.mapEffects(a,c).concat(WB.mapEffects($B(o.effects),l))}return{changes:r,selection:X.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof oB?t:oB.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return Bz.of(t.split(this.facet(e.lineSeparator)||rB))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(MB(this,t),NB(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof CB&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:X.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=AB.resolve(t.extensions||[],new Map),r=t.doc instanceof Bz?t.doc:Bz.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||rB)),i=t.selection?t.selection instanceof X?t.selection:X.single(t.selection.anchor,t.selection.head):X.single(0);return mB(i,r.length),n.staticFacet(FB)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
|
|
70
|
+
`}get readOnly(){return this.facet(BB)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(PB))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return iV(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=Zz(t,a,!1);if(i(t.slice(e,a))!=eV.Word)break;a=e}for(;o<r;){let e=Zz(t,o);if(i(t.slice(o,e))!=eV.Word)break;o=e}return a==o?null:X.range(a+n,o+n)}};aV.allowMultipleSelections=FB,aV.tabSize=gB.define({combine:e=>e.length?e[0]:4}),aV.lineSeparator=IB,aV.readOnly=BB,aV.phrases=gB.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),aV.languageData=PB,aV.changeFilter=LB,aV.transactionFilter=RB,aV.transactionExtender=zB,OB.reconfigure=WB.define();function oV(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var sV=class{eq(e){return this==e}range(e,t=e){return lV.create(e,t,this)}};sV.prototype.startSide=sV.prototype.endSide=0,sV.prototype.point=!1,sV.prototype.mapMode=iB.TrackDel;function cV(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var lV=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function uV(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var dV=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return pV(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},fV=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(uV)),this.isEmpty)return n.length?e.of(n):this;let s=new _V(this,null,-1).goto(0),c=0,l=[],u=new hV;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value,!1)||l.push(lV.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1,a,o=(e,t,n)=>{a||=new hV,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[pV(r)+pV(n).length,pV(pV(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return vV.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return vV.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=gV(a,o,n),c=new bV(a,s,i),l=new bV(o,s,i);n.iterGaps((e,t,n)=>xV(c,e,l,t,n,r)),n.empty&&n.length==0&&xV(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=gV(i,a),s=new bV(i,o,0).goto(n),c=new bV(a,o,0).goto(n);for(;;){if(s.to!=c.to||!SV(s.active,c.active)||s.point&&(!c.point||!cV(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new bV(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new hV;for(let r of e instanceof lV?[e]:t?mV(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=pV(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};fV.empty=new fV([],[],null,-1);function pV(e){return e[e.length-1]}function mV(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(uV(t,r)>0)return e.slice().sort(uV);t=r}return e}fV.empty.nextLayer=fV.empty;var hV=class e{finishChunk(e){this.chunks.push(new dV(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(fV.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=fV.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function gV(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var _V=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},vV=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new _V(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)yV(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)yV(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),yV(this.heap,0)}}};function yV(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var bV=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vV.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){CV(this.active,e),CV(this.activeTo,e),CV(this.activeRank,e),this.minActive=TV(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;wV(this.active,t,n),wV(this.activeTo,t,r),wV(this.activeRank,t,i),e&&wV(e,t,this.cursor.from),this.minActive=TV(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&CV(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function xV(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&cV(e.point,n.point)&&SV(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!SV(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function SV(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!cV(e[n],t[n]))return!1;return!0}function CV(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function wV(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function TV(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function EV(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=Zz(e,i));return r}function DV(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=Zz(e,r)}return r===!0?-1:e.length}for(var OV=`ͼ`,kV=typeof Symbol>`u`?`__ͼ`:Symbol.for(OV),AV=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),jV=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},MV=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`
|
|
71
|
+
`)}static newName(){let e=jV[kV]||1;return jV[kV]=e+1,OV+e.toString(36)}static mount(e,t,n){let r=e[AV],i=n&&n.nonce;r?i&&r.setNonce(i):r=new PV(e,i),r.mount(Array.isArray(t)?t:[t],e)}},NV=new Map,PV=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=NV.get(n);if(t)return e[AV]=t;this.sheet=new r.CSSStyleSheet,NV.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[AV]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
72
|
+
`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},FV={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},IV={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},LV=typeof navigator<`u`&&/Mac/.test(navigator.platform),RV=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),zV=0;zV<10;zV++)FV[48+zV]=FV[96+zV]=String(zV);for(var zV=1;zV<=24;zV++)FV[zV+111]=`F`+zV;for(var zV=65;zV<=90;zV++)FV[zV]=String.fromCharCode(zV+32),IV[zV]=String.fromCharCode(zV);for(var BV in FV)IV.hasOwnProperty(BV)||(IV[BV]=FV[BV]);function VV(e){var t=!(LV&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||RV&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?IV:FV)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function HV(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)UV(e,arguments[t]);return e}function UV(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)UV(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var WV=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},GV=typeof document<`u`?document:{documentElement:{style:{}}},KV=/Edge\/(\d+)/.exec(WV.userAgent),qV=/MSIE \d/.test(WV.userAgent),JV=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(WV.userAgent),YV=!!(qV||JV||KV),XV=!YV&&/gecko\/(\d+)/i.test(WV.userAgent),ZV=!YV&&/Chrome\/(\d+)/.exec(WV.userAgent),QV=`webkitFontSmoothing`in GV.documentElement.style,$V=!YV&&/Apple Computer/.test(WV.vendor),eH=$V&&(/Mobile\/\w+/.test(WV.userAgent)||WV.maxTouchPoints>2),Z={mac:eH||/Mac/.test(WV.platform),windows:/Win/.test(WV.platform),linux:/Linux|X11/.test(WV.platform),ie:YV,ie_version:qV?GV.documentMode||6:JV?+JV[1]:KV?+KV[1]:0,gecko:XV,gecko_version:XV?+(/Firefox\/(\d+)/.exec(WV.userAgent)||[0,0])[1]:0,chrome:!!ZV,chrome_version:ZV?+ZV[1]:0,ios:eH,android:/Android\b/.test(WV.userAgent),webkit:QV,webkit_version:QV?+(/\bAppleWebKit\/(\d+)/.exec(WV.userAgent)||[0,0])[1]:0,safari:$V,safari_version:$V?+(/\bVersion\/(\d+(\.\d+)?)/.exec(WV.userAgent)||[0,0])[1]:0,tabSize:GV.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function tH(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var nH=Object.create(null);function rH(e,t,n){if(e==t)return!0;e||=nH,t||=nH;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function iH(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function aH(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function oH(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var sH=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},cH=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(cH||={}),lH=class extends sV{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new uH(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new fH(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=pH(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new fH(e,n,r,t,e.widget||null,!0)}static line(e){return new dH(e)}static set(e,t=!1){return fV.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};lH.none=fV.empty;var uH=class e extends lH{constructor(e){let{start:t,end:n}=pH(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?tH(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||nH}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&rH(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};uH.prototype.point=!1;var dH=class e extends lH{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&rH(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};dH.prototype.mapMode=iB.TrackBefore,dH.prototype.point=!0;var fH=class e extends lH{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?iB.TrackBefore:iB.TrackAfter:iB.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?cH.WidgetBefore:cH.WidgetAfter:cH.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&mH(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};fH.prototype.point=!0;function pH(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function mH(e,t){return e==t||!!(e&&t&&e.compare(t))}function hH(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var gH=class e extends sV{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&rH(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||nH,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return fV.of(e,t)}};gH.prototype.startSide=gH.prototype.endSide=-1;var _H=e=>e.nodeType==1,vH=e=>e.nodeType==3;function yH(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function bH(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function xH(e,t){if(!t.anchorNode)return!1;try{return bH(e,t.anchorNode)}catch{return!1}}function SH(e){return vH(e)?zH(e,0,e.nodeValue.length).getClientRects():_H(e)?e.getClientRects():[]}function CH(e,t,n,r){return n?EH(e,t,n,r,-1)||EH(e,t,n,r,1):!1}function wH(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function TH(e){return _H(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function EH(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:DH(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!_H(n))return!1;t=wH(e)+(i<0?0:1),e=n}else if(_H(e)){if(e=e.childNodes[t+(i<0?-1:0)],_H(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?DH(e):0}else return!1}}function DH(e){return vH(e)?e.nodeValue.length:e.childNodes.length}function OH(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function kH(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function AH(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function jH(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(_H(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=kH(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=AH(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function MH(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(_H(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var NH=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?DH(t):0),n,Math.min(e.focusOffset,n?DH(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function PH(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)_H(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function FH(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var IH=null;Z.safari&&Z.safari_version>=26&&(IH=!1);function LH(e){if(e.setActive)return e.setActive();if(IH)return e.focus(IH);let t=PH(e);e.focus(IH==null?{get preventScroll(){return IH={preventScroll:!0},!0}}:void 0),IH||(IH=!1,FH(t))}var RH;function zH(e,t,n=t){let r=RH||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function BH(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function VH(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function HH(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,DH(n));;)if(r){if(!_H(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=DH(n))}else if(n==e)return!0;else r=wH(n),n=n.parentNode}function UH(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function WH(e,t){for(let n=e,r=t;;)if(vH(n)&&r>0)return{node:n,offset:r};else if(_H(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=DH(n)}else if(n.parentNode&&!TH(n))r=wH(n),n=n.parentNode;else return null}function GH(e,t){for(let n=e,r=t;;)if(vH(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(_H(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!TH(n))r=wH(n)+1,n=n.parentNode;else return null}var KH=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,wH(t),n)}static after(t,n){return new e(t.parentNode,wH(t)+1,n)}},qH=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(qH||={}),JH=qH.LTR,YH=qH.RTL;function XH(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var ZH=XH(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),QH=XH(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),$H=Object.create(null),eU=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);$H[t]=n,$H[n]=-t}function tU(e){return e<=247?ZH[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?QH[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var nU=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,rU=class{get dir(){return this.level%2?YH:JH}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function iU(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!iU(r.inner,i.inner))return!1}return!0}var aU=[];function oU(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=tU(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),aU[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=aU[e];if(i==128)e<s-1&&t==aU[e+1]&&t&24?i=aU[e]=t:aU[e]=256;else if(i==64){let i=e+1;for(;i<s&&aU[i]==64;)i++;let a=e&&t==8||i<n&&aU[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)aU[t]=a;e=i-1}else i==8&&r==1&&(aU[e]=1);t=i,i&7&&(r=i)}}}function sU(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=$H[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(eU[e+1]==-r){let n=eU[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(aU[t]=aU[eU[e]]=r),s=e;break}}else if(eU.length==189)break;else eU[s++]=t,eU[s++]=n,eU[s++]=c}else if((o=aU[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=eU[t+2];if(n&2)break;if(e)eU[t+2]|=2;else{if(n&4)break;eU[t+2]|=4}}}}}function cU(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=aU[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(aU[o]==256)o++;else break;let l=a==1,u=l==((o<t?aU[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),aU[--t]=u;c=o}else a=o,c++}}}function lU(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=aU[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(aU[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new rU(c,m.from,f)),uU(e,m.direction==JH==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?aU[p]!=s:aU[p]==s))break;else p++;d?lU(e,c,p,r+1,i,d,o):c<p&&o.push(new rU(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=aU[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(aU[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new rU(m.to,c,f)),uU(e,m.direction==JH==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?aU[p-1]!=s:aU[p-1]==s))break;else p--;d?lU(e,p,c,r+1,i,d,o):p<c&&o.push(new rU(p,c,f)),c=p}}function uU(e,t,n,r,i,a,o){let s=t%2?2:1;oU(e,i,a,r,s),sU(e,i,a,r,s),cU(i,a,r,s),lU(e,i,a,t,n,r,o)}function dU(e,t,n){if(!e)return[new rU(0,0,+(t==YH))];if(t==JH&&!n.length&&!nU.test(e))return fU(e.length);if(n.length)for(;e.length>aU.length;)aU[aU.length]=256;let r=[],i=t==JH?0:1;return uU(e,i,i,n,0,e.length,r),r}function fU(e){return[new rU(0,e,0)]}var pU=``;function mU(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=rU.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=Zz(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),pU=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?X.cursor(e.to,1):X.cursor(e.from,-1);if(u.level+ +!i<s.level)return X.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return X.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function hU(e,t,n){for(let r=t;r<n;r++){let t=tU(e.charCodeAt(r));if(t==1)return JH;if(t==2||t==4)return YH}}var gU=gB.define(),_U=gB.define(),vU=gB.define(),yU=gB.define(),bU=gB.define(),xU=gB.define(),SU=gB.define(),CU=gB.define(),wU=gB.define(),TU=gB.define({combine:e=>e.some(e=>e)}),EU=gB.define({combine:e=>e.some(e=>e)}),DU=gB.define(),OU=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(X.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},kU=WB.define({map:(e,t)=>e.map(t)}),AU=WB.define();function jU(e,t,n){let r=e.facet(yU);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var MU=gB.define({combine:e=>!e.length||e[0]}),NU=0,PU=gB.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),FU=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(PU.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(PU.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(NU++,t,r,i,e=>{let t=[];return o&&t.push(zU.of(t=>{let n=t.plugin(e);return n?o(n):lH.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},IU=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){jU(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(jU(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){jU(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},LU=gB.define(),RU=gB.define(),zU=gB.define(),BU=gB.define(),VU=gB.define(),HU=gB.define(),UU=gB.define();function WU(e,t){let n=e.state.facet(UU);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return fV.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),GU(t.text,i)}function GU(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=hU(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=qH.LTR}GU(e,n.inner)}return t}var KU=gB.define();function qU(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(KU)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var JU=gB.define(),YU=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},XU=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=oB.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new YU(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},ZU=[],QU=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return ZU}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&iH(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=wH(this.dom),r=this.length?e>0:t>0;return new KH(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof tW)return e;return null}static get(e){return e.cmTile}},$U=class extends QU{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=eW(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=eW(r);this.length=a}};function eW(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var tW=class extends $U{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=QU.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof nW)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},nW=class e extends $U{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},rW=class e extends $U{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return n&&r||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&aW(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):iW(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new KH(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new KH(e.dom,0);e==n.tile&&(a=!0)}}return new KH(this.dom,0)}};function iW(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=SH(t);return n[n.length-1]||null}function aW(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var oW=class e extends $U{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},sW=class e extends QU{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?Z.chrome||Z.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=zH(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return Z.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:OH(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},cW=class e extends QU{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return OH(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return OH(n,!r)}}get overrideDOMText(){if(!this.length)return Bz.empty;let{root:e}=this;if(!e)return Bz.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},lW=class extends QU{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Bz.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:OH(r,t>0==n)}},uW=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},dW=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},fW=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new sW(a.dom,a.text+e);t.parent=i}else i.append(r||sW.of(e,this.cache.find(sW)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?SW(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof oW&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(SW(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&QU.get(n.dom)&&(e=SW(n.dom));let t=oW.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=QU.get(e.text);i&&this.cache.reused.set(i,2);let a=new sW(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=yW;let n=rW.start(e,t||this.cache.find(rW)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof oW&&a.mark.eq(i))n=a,t--;else{let e=oW.of(i,this.cache.find(oW,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!_W(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(Z.ios&&_W(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(wW,0,32)||new cW(wW.toDOM(),0,wW,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new dW(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof nW&&n.wrapper.eq(t.wrapper))e=n;else{let n=nW.of(t.wrapper,this.cache.find(nW,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(lW,void 0,1);return n&&(n.flags=t),n||new lW(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},pW=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},mW=[cW,rW,sW,oW,lW,nW,tW];for(let e=0;e<mW.length;e++)mW[e].bucket=e;var hW=class{constructor(e){this.view=e,this.buckets=mW.map(()=>[]),this.index=mW.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new cW(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},gW=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new hW(e),this.text=new pW(e.state.doc),this.builder=new fW(this.cache,new tW(e,e.contentDOM),fV.iter(n)),this.cache.reused.set(t,2),this.old=new uW(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=xW(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?cW.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof lW)this.cache.add(e);else if(e instanceof oW)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof oW&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof oW&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=fV.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof fH){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?CW.block:CW.inline),c=vW(a),l=this.cache.findWidget(i,t-e,c)||cW.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=bW(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=QU.get(r);if(r==this.view.contentDOM)break;e instanceof oW?t.push(e):e?.isLine()?n=e:e instanceof nW||(r.nodeName==`DIV`&&!n?n=new rW(r,yW):n||t.push(oW.of(new uH({tagName:r.nodeName.toLowerCase(),attributes:oH(r)}),r)))}return n?{line:n,marks:t}:null}};function _W(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function vW(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var yW={class:`cm-line`};function bW(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&tH(n,e),r&&(e.class+=` `+r)),e}function xW(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof oW&&t.push(r.mark)}return t}function SW(e){let t=QU.get(e);return t&&t.setDOM(e.cloneNode()),e}var CW=class extends sH{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};CW.inline=new CW(`span`),CW.block=new CW(`div`);var wW=new class extends sH{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},TW=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=lH.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new tW(e,e.contentDOM),this.updateInner([new YU(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!IW(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?kW(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new YU(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Z.ie||Z.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=MW(i,this.decorations,e.changes);o.length&&(t=YU.extendWithRanges(t,o));let s=PW(a,this.blockWrappers,e.changes);return s.length&&(t=YU.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new gW(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&QU.get(t.text)&&r.cache.reused.set(QU.get(t.text),2),this.tile=r.run(e,t),EW(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=Z.chrome||Z.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof LW&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(AU)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(MU)||n.tabIndex>-1)&&xH(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),Z.gecko&&s.empty&&!this.hasComposition&&DW(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new KH(e,0),o=!0}let u=this.view.observer.selectionRange;!o&&u.focusNode&&(CH(c.node,c.offset,u.anchorNode,u.anchorOffset)&&CH(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore(()=>{Z.android&&Z.chrome&&n.contains(u.focusNode)&&FW(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=yH(this.view.root);if(e){if(s.empty){if(Z.gecko){let e=AW(c.node,c.offset);if(e&&e!=3){let t=(e==1?WH:GH)(c.node,c.offset);t&&(c=new KH(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new KH(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new KH(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&CH(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=yH(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=DH(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!QU.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof LW?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=Zz(e.text,t);if(n==t)return null;let r=zH(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==qH.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof nW)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?SH(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?qH.RTL:qH.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=SH(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=SH(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(lH.replace({widget:new LW(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return lH.set(e)}updateDeco(){let e=1,t=this.view.state.facet(zU).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(VU).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(fV.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(BU).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(DU))try{if(t(this.view,e.range,e))return!0}catch(e){jU(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=qU(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(jH(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==qH.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=PH(e.dom);e.dom.scrollIntoView({block:`nearest`}),FH(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){EW(this.tile)}};function EW(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)EW(n,t)}}function DW(e){return _H(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function OW(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=WH(n.focusNode,n.focusOffset),i=GH(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=QU.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=QU.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function kW(e,t,n){let r=OW(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new YU(c.mapPos(a),c.mapPos(o),a,o),text:i}}function AW(e,t){return _H(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var jW=class{constructor(){this.changes=[]}compareRange(e,t){hH(e,t,this.changes)}comparePoint(e,t){hH(e,t,this.changes)}boundChange(e){hH(e,e,this.changes)}};function MW(e,t,n){let r=new jW;return fV.compare(e,t,n,r),r.changes}var NW=class{constructor(){this.changes=[]}compareRange(e,t){hH(e,t,this.changes)}comparePoint(){}boundChange(e){hH(e,e,this.changes)}};function PW(e,t,n){let r=new NW;return fV.compare(e,t,n,r),r.changes}function FW(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(_H(n)&&n.contentEditable==`false`)return!0;return!1}function IW(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var LW=class extends sH{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function RW(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return X.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=Zz(i.text,a,!1):s=Zz(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=Zz(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=Zz(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return X.undirectionalRange(o+i.from,s+i.from)}function zW(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+DV(o,a,e.state.tabSize)}function BW(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==cH.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function VW(e,t,n,r){let i=BW(e,t.head,t.assoc||-1),a=!r||i.type!=cH.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==qH.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return X.cursor(o.pos,o.assoc)}return X.cursor(n?i.to:i.from,n?1:-1)}function HW(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=mU(i,a,o,s,n),l=pU;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
73
|
+
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?X.cursor(i.from,-1):X.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function UW(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==eV.Space&&(i=t),i==t}}function WW(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return X.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=YW(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return X.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return X.cursor(i.pos,i.assoc,void 0,o)}}function GW(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function KW(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=GW(e,i.from,0);t!=i.from&&(a=X.cursor(t,-1))}else{let t=GW(e,i.from,-1),n=GW(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?X.undirectionalRange(i.from,i.to):X.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?X.create(n,t.mainIndex):t}function qW(e,t,n){let r=GW(e.state.facet(HU).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:X.cursor(r,r<n.from?1:-1)}var JW=class{constructor(e,t){this.pos=e,this.assoc=t}};function YW(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new JW(0,1);if(c>e.viewState.docHeight)return new JW(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==cH.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==cH.Text){let t=zW(e,i,l,o,s);return new JW(t,t==l.from?1:-1)}}if(l.type!=cH.Text)return c<(l.top+l.bottom)/2?new JW(l.from,1):new JW(l.to,-1);let u=e.docView.lineAt(l.from,2);return u&&u.length==l.length||(u=e.docView.lineAt(l.from,-2)),new XW(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var XW=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[rU.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[rU.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==qH.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==qH.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=Zz(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return zH(e.dom,i,a).getClientRects()});return r.after?new JW(n[r.i+1],-1):new JW(n[r.i],1)}scanTile(e,t){if(!e.length)return new JW(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(_H(n.dom)?n.dom:zH(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new JW(n[r.i+1],-1):new JW(a,1)}},ZW=``,QW=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(aV.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ZW}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=QU.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=QU.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:TH(r))||TH(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!eG(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=QU.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else vH(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():_H(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(vH(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+($W(e,n.node,n.offset)?t:0))}};function $W(e,t,n){for(;;){if(!t||n<DH(t))return!1;if(t==e)return!0;n=wH(t)+1,t=t.parentNode}}function eG(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=QU.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var tG=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},nG=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=rG(e.docView.tile,t,n,0))){let t=i||a?[]:cG(e),n=new QW(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=lG(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!bH(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!bH(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((Z.ios||Z.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;a!=0&&a!=1&&t!=0||o!=0&&o!=-1&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(X.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=X.create([X.cursor(n,r)])}else this.newSel=X.single(r,n)}}};function rG(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return rG(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function iG(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||Z.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,ZW),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:Bz.of(t.text.slice(a.from-e,u).split(ZW))}:(d=sG(l,t.text,s-e,c))&&(Z.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==``&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:Bz.of(t.text.slice(d.from,d.toB).split(ZW))})}else r&&(!e.hasFocus&&i.facet(MU)||uG(r,a))&&(r=null);if(!n&&!r)return!1;if((Z.mac||Z.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=X.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Bz.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:Z.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
74
|
+
`&&e.lineWrapping&&(r&&=X.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:Bz.of([` `])}),n)return aG(e,n,r,o);if(r&&!uG(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=KW(i.facet(HU).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function aG(e,t,n,r=-1){if(Z.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Z.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&BH(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&BH(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&BH(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=oG(e,t,n);return e.state.facet(xU).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function oG(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=GW(i.facet(HU).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:X.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&OW(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?X.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function sG(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function cG(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new tG(n,r)),(i!=n||a!=r)&&t.push(new tG(i,a))),t}function lG(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?X.create([X.cursor(r+t,-1)]):X.single(n+t,r+t)}function uG(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var dG=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Z.safari&&e.contentDOM.addEventListener(`input`,()=>null),Z.gecko&&JG(e.contentDOM.ownerDocument)}handleEvent(e){TG(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=mG(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&_G.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Z.android&&Z.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Z.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(hG.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||gG.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Z.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&fG(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,BH(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Z.safari&&!Z.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function fG(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function pG(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){jU(n.state,e)}}}function mG(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(pG(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(pG(t.value,r))}}for(let e in EG)n(e).handlers.push(EG[e]);for(let e in DG)n(e).observers.push(DG[e]);return t}var hG=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],gG=`dthko`,_G=[16,17,18,20,91,92,224,225],vG=6;function yG(e){return Math.max(0,e)*.7+8}function bG(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var xG=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=MH(e.contentDOM),this.atoms=e.state.facet(HU).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(aV.allowMultipleSelections)&&SG(e,t),this.dragging=wG(e,t)&&LG(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&bG(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=qU(this.view);e.clientX-s.left<=r+vG?t=-yG(r-e.clientX):e.clientX+s.right>=a-vG&&(t=yG(e.clientX-a)),e.clientY-s.top<=i+vG?n=-yG(i-e.clientY):e.clientY+s.bottom>=o-vG&&(n=yG(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=KW(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function SG(e,t){let n=e.state.facet(gU);return n.length?n[0](t):Z.mac?t.metaKey:t.ctrlKey}function CG(e,t){let n=e.state.facet(_U);return n.length?n[0](t):Z.mac?!t.altKey:!t.ctrlKey}function wG(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=yH(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function TG(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=QU.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var EG=Object.create(null),DG=Object.create(null),OG=Z.ie&&Z.ie_version<15||Z.ios&&Z.webkit_version<604;function kG(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),jG(e,n.value)},50)}function AG(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function jG(e,t){t=AG(e.state,CU,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(UG!=null&&n.selection.ranges.every(e=>e.empty)&&UG==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:X.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:X.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}DG.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Z.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},DG.wheel=DG.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},EG.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),DG.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},DG.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},DG.touchend=(e,t)=>{e.inputState.touchActive=!1},EG.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(vU))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=RG(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new xG(e,t,n,r)),r&&e.observer.ignore(()=>{LH(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function MG(e,t,n,r){if(r==1)return X.cursor(t,n);if(r==2)return RW(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,X.undirectionalRange(a,o)}}var NG=Z.ie&&Z.ie_version<=11,PG=null,FG=0,IG=0;function LG(e){if(!NG)return e.detail;let t=PG,n=IG;return PG=e,IG=Date.now(),FG=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(FG+1)%3:1}function RG(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=LG(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=MG(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=MG(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?X.range(i,a,l.assoc):X.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=zG(i,s.pos))?c:o?i.addRange(l):X.create([l])}}}function zG(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return X.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}EG.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=X.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,AG(e.state,wU,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},EG.dragend=e=>(e.inputState.draggedContent=null,!1);function BG(e,t,n,r){if(n=AG(e.state,CU,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&CG(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}EG.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&BG(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return BG(e,t,n,!0),!0}return!1},EG.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=OG?null:t.clipboardData;return n?(jG(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(kG(e),!1)};function VG(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function HG(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:AG(e,wU,t.join(e.lineBreak)),ranges:n,linewise:r}}var UG=null;EG.copy=EG.cut=(e,t)=>{if(!xH(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=HG(e.state);if(!n&&!i)return!1;UG=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=OG?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(VG(e,n),!1)};var WG=VB.define();function GG(e,t){let n=[];for(let r of e.facet(SU)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:WG.of(!0)}):null}function KG(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=GG(e.state,t);n?e.dispatch(n):e.update([])}},10)}DG.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),KG(e)},DG.blur=e=>{e.observer.clearSelectionRange(),KG(e)},DG.compositionstart=DG.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},DG.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Z.chrome&&Z.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},DG.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},EG.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return aG(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(Z.chrome&&Z.android&&(n=hG.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Z.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),Z.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>DG.compositionend(e,t),20),!1};var qG=new Set;function JG(e){qG.has(e)||(qG.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var YG=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],XG=!1;function ZG(){XG=!1}var QG=class{constructor(e){this.lineWrapping=e,this.doc=Bz.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return YG.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=YG.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},$G=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},eK=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?cH.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof fH?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},tK=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(tK||={}),nK=.001,rK=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>nK&&(XG=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,tK.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,tK.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,tK.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=fK.build(n.setDoc(a),e,l,u);i=iK(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new sK(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new lK(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function iK(e,t){return e==t?e:(e.constructor!=t.constructor&&(XG=!0),t)}rK.prototype.size=1;var aK=lH.replace({}),oK=class extends rK{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new eK(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new eK(r,0,n,this.spaceAbove,aK):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,tK.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},sK=class e extends oK{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new eK(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof cK&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof cK?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):rK.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:``}${this.widgetHeight?`:`+this.widgetHeight:``})`}},cK=class e extends rK{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new eK(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new eK(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==tK.ByHeight)return this.blockAt(e,n,r,i);if(t==tK.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new eK(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new eK(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new eK(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return rK.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=nK&&(s=-2);let c=new sK(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=rK.of(r);return(s<0||Math.abs(c.height-this.height)>=nK||Math.abs(s-this.heightMetrics(t,n).perLine)>=nK)&&(XG=!0),iK(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},lK=class extends rK{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==tK.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==tK.ByPosNoHeight?tK.ByPosNoHeight:tK.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,tK.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&uK(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),uK(i,e)}return rK.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?rK.of(this.break?[e,null,t]:[e,t]):(this.left=iK(this.left,e),this.right=iK(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function uK(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof cK&&(r=e[t+1])instanceof cK&&e.splice(t-1,3,new cK(n.length+1+r.length))}var dK=5,fK=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof sK?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new sK(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new oK(a,r,n)):(a||i||r>=dK)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new sK(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new cK(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof sK)return e;let t=new sK(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof sK)&&!this.isCovered?this.nodes.push(new sK(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof sK&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return fV.spans(n,r,i,a,0),a.finish(r)}};function pK(e,t,n){let r=new mK;return fV.compare(e,t,n,r,0),r.changes}var mK=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&hH(e,t,this.changes,5)}};function hK(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(_H(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function gK(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function _K(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var vK=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return lH.replace({widget:new yK(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},yK=class extends sH{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},bK=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=EK,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=qH.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(RU).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new QG(n),this.stateDeco=DK(t),this.heightMap=rK.empty().applyChanges(this.stateDeco,Bz.empty,this.heightOracle.setDoc(t.doc),[new YU(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=lH.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new xK(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?EK:OK.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(kK(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=DK(this.state);let r=e.changedRanges,i=YU.extendWithRanges(r,pK(n,this.stateDeco,e?e.changes:oB.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ZG(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||XG)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(EU)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?qH.RTL:qH.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=AH(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=MH(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=UH(this.scrollParent||e.win);let m=(this.printing?_K:hK)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!gK(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),ZG();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?rK.empty().applyChanges(this.stateDeco,Bz.empty,this.heightOracle,[new YU(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new $G(n.from,i))}XG&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new xK(r.lineAt(a-n*1e3,tK.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,tK.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,tK.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new xK(r.lineAt(o-500,tK.ByHeight,i,0,0).from,r.lineAt(o+n+500,tK.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new xK(this.heightMap.lineAt(n,tK.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,tK.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,tK.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,tK.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new vK(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=qH.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=TK(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(X.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new vK(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=cH.Text)return;let i=SK(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=wK(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=CK(i,n),l=CK(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=wK(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=CK(i,f),l=CK(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=wK(r,n)-wK(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){vK.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=lH.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];fV.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||kK(this.heightMap.lineAt(e,tK.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||kK(this.heightMap.lineAt(this.scaler.fromDOM(e),tK.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return kK(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},xK=class{constructor(e,t){this.from=e,this.to=t}};function SK(e,t,n){let r=[],i=e,a=0;return fV.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function CK({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function wK(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function TK(e,t){for(let n of e)if(t(n))return n}var EK={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function DK(e){let t=e.facet(zU).filter(e=>typeof e!=`function`),n=e.facet(VU).filter(e=>typeof e!=`function`);return n.length&&t.push(fV.join(n)),t}var OK=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,tK.ByPos,t,0,0).top,o=n.lineAt(r,tK.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return EK;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function kK(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new eK(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>kK(e,t)):e._content)}var AK=gB.define({combine:e=>e.join(` `)}),jK=gB.define({combine:e=>e.indexOf(!0)>-1}),MK=MV.newName(),NK=MV.newName(),PK=MV.newName(),FK={"&light":`.`+NK,"&dark":`.`+PK};function IK(e,t,n){return new MV(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var LK=IK(`.`+MK,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{userSelect:`none`,position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},".cm-panels-top":{top:`0`},".cm-panels-bottom":{bottom:`0`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},FK),RK={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zK=Z.ie&&Z.ie_version<=11,BK=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new NH,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(Z.ie&&Z.ie_version<=11||Z.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Z.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Z.chrome&&Z.chrome_version<126)&&(this.editContext=new WK(e),e.state.facet(MU)&&(e.contentDOM.editContext=this.editContext.editContext)),zK&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type!=`change`&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(MU)?n.root.activeElement!=this.dom:!xH(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(Z.ie&&Z.ie_version<=11||Z.android&&Z.chrome)&&!n.state.selection.main.empty&&r.focusNode&&CH(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=yH(e.root);if(!t)return!1;let n=Z.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&UK(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=xH(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&HH(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(_H(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,RK),zK&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),zK&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&BH(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&e!=`Enter`||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&xH(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new nG(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=iG(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=VK(t,e.previousSibling||e.target.previousSibling,-1),r=VK(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return e.type==`characterData`?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(MU)!=e.state.facet(MU)&&(e.view.contentDOM.editContext=e.state.facet(MU)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function VK(e,t,n){for(;t;){let r=QU.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function HK(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return CH(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function UK(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return HK(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?HK(e,n):null}var WK=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=sG(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=X.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));uG(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Bz.of(n.text.slice(l.from,l.toB).split(`
|
|
75
|
+
`))};if((Z.mac||Z.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Bz.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);aG(e,u,X.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(lH.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:AU.of(lH.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=yH(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},GK=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||VH(e.parent)||document,this.viewState=new bK(this,e.state||aV.create(e)),e.scrollTo&&e.scrollTo.is(kU)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(PU).map(e=>new IU(e));for(let e of this.plugins)e.update(this);this.observer=new BK(this),this.inputState=new dG(this),this.inputState.ensureHandlers(this.plugins),this.docView=new TW(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof GB?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(WG))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=GG(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(aV.phrases)!=this.state.facet(aV.phrases))return this.setState(a);i=XU.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new OU(t.empty?t:X.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(kU)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=JK.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(JU)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(AK)!=i.state.facet(AK)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(bU))try{e(i)}catch(e){jU(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!iG(this,u)&&l.force&&BH(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw Error(`Calls to EditorView.setState are not allowed while an update is in progress`);if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new bK(this,e),this.plugins=e.facet(PU).map(e=>new IU(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new TW(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(PU),n=e.state.facet(PU);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new IU(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){jU(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(UH(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return jU(this.state,e),qK}}),u=XU.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=qK)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){jU(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(Z.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(bU))e(t)}get themeClasses(){return MK+` `+(this.state.facet(jK)?PK:NK)+` `+this.state.facet(AK)}updateAttrs(){let e=YK(this,LU,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(MU)?`true`:`false`,class:`cm-content`,style:`${Z.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),YK(this,RU,t);let n=this.observer.ignore(()=>{let n=aH(this.contentDOM,this.contentAttrs,t),r=aH(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(JU);let t=this.state.facet(e.cspNonce);MV.mount(this.root,this.styleModules.concat(LK).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return qW(this,e,HW(this,e,t,n))}moveByGroup(e,t){return qW(this,e,HW(this,e,t,t=>UW(this,e.head,t)))}visualLineSide(e,t){return t?X.cursor(e.to,1):X.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return VW(this,e,t,n)}moveVertically(e,t,n){return qW(this,e,WW(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=YW(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),YW(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[rU.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==qH.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(TU)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>KK)return fU(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||iU(r.isolates,n=WU(this,e))))return r.order;n||=WU(this,e);let r=dU(e.text,t,n);return this.bidiCache.push(new JK(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||Z.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{LH(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return kU.of(new OU(typeof e==`number`?X.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return kU.of(new OU(X.cursor(n.from),`start`,`start`,n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e==`boolean`?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return FU.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return FU.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=MV.newName(),r=[AK.of(n),JU.of(IK(`.${n}`,e))];return t&&t.dark&&r.push(jK.of(!0)),r}static baseTheme(e){return EB.lowest(JU.of(IK(`.`+MK,e,FK)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&QU.get(t)||QU.get(e))?.root?.view||null}};GK.styleModule=JU,GK.inputHandler=xU,GK.clipboardInputFilter=CU,GK.clipboardOutputFilter=wU,GK.scrollHandler=DU,GK.focusChangeEffect=SU,GK.perLineTextDirection=TU,GK.exceptionSink=yU,GK.updateListener=bU,GK.editable=MU,GK.mouseSelectionStyle=vU,GK.dragMovesSelection=_U,GK.clickAddsSelectionRange=gU,GK.decorations=zU,GK.blockWrappers=BU,GK.outerDecorations=VU,GK.atomicRanges=HU,GK.bidiIsolatedRanges=UU,GK.cursorScrollMargin=gB.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),GK.scrollMargins=KU,GK.darkTheme=jK,GK.cspNonce=gB.define({combine:e=>e.length?e[0]:``}),GK.contentAttributes=RU,GK.editorAttributes=LU,GK.lineWrapping=GK.contentAttributes.of({class:`cm-lineWrapping`}),GK.announce=WB.define();var KK=4096,qK={},JK=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:qH.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function YK(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&tH(a,n)}return n}var XK=Z.mac?`mac`:Z.windows?`win`:Z.linux?`linux`:`key`;function ZK(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function QK(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var $K=EB.default(GK.domEventHandlers({keydown(e,t){return cq(nq(t.state),e,t,`editor`)}})),eq=gB.define({enables:$K}),tq=new WeakMap;function nq(e){let t=e.facet(eq),n=tq.get(t);return n||tq.set(t,n=oq(t.reduce((e,t)=>e.concat(t),[]))),n}function rq(e,t,n){return cq(nq(e.state),t,e,n)}var iq=null,aq=4e3;function oq(e,t=XK){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>ZK(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=iq={view:t,prefix:n,scope:e};return setTimeout(()=>{iq==r&&(iq=null)},aq),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,sq))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var sq=null;function cq(e,t,n,r){sq=t;let i=VV(t),a=nB(eB(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;iq&&iq.view==n&&iq.scope==r&&(o=iq.prefix+` `,_G.indexOf(t.keyCode)<0&&(c=!0,iq=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+QK(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Z.windows&&t.ctrlKey&&t.altKey)&&!(Z.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=FV[t.keyCode])&&p!=i?(d(f[o+QK(p,t,!0)])||t.shiftKey&&(m=IV[t.keyCode])!=i&&m!=p&&d(f[o+QK(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+QK(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),sq=null,s}var lq=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,this.width!=null&&(e.style.width=this.width+`px`),e.style.height=this.height+`px`}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=uq(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return fq(t,n,r)}};function uq(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==qH.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function dq(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function fq(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==qH.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=uq(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=BW(e,r,1),m=BW(e,i,-1),h=p.type==cH.Text?p:null,g=m.type==cH.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=dq(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=dq(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==cH.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new lq(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==qH.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function pq(e,t){return e.constructor==t.constructor&&e.eq(t)}var mq=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement(`div`)),this.dom.classList.add(`cm-layer`),t.above&&this.dom.classList.add(`cm-layer-above`),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute(`aria-hidden`,`true`),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(hq)!=e.state.facet(hq)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(hq);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!pq(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,Z.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},hq=gB.define();function gq(e){return[FU.define(t=>new mq(t,e)),hq.of(e)]}var _q=!Z.ios,vq=gB.define({combine(e){return oV(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function yq(e={}){return[vq.of(e),xq,Cq,Tq,EU.of(!0)]}function bq(e){return e.startState.facet(vq)!=e.state.facet(vq)}var xq=gq({above:!0,markers(e){let{state:t}=e,n=t.facet(vq),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&Z.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:X.cursor(i.head,i.assoc);for(let i of lq.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=bq(e);return n&&Sq(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Sq(t.state,e)},class:`cm-cursorLayer`});function Sq(e,t){t.style.animationDuration=e.facet(vq).cursorBlinkRate+`ms`}var Cq=gq({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(_q||i!=n))for(let n of lq.forRange(e,`cm-selectionBackground`,i))t.push(n);if(Z.ios&&!n.empty&&e.state.facet(vq).iosSelectionHandles){for(let r of lq.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,X.cursor(n.from,1)))t.push(r);for(let r of lq.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,X.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||bq(e)},class:`cm-selectionLayer`}),wq=Z.gecko&&Z.gecko_version==153?`#ffffff01`:`transparent`,Tq=EB.highest(GK.theme({".cm-line":{..._q?{"& ::selection, &::selection":{backgroundColor:`${wq} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,..._q?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}}));/x/.unicode;var Eq=class extends sH{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?SH(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=OH(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function Dq(e){let t=FU.fromClass(class{constructor(t){this.view=t,this.placeholder=e?lH.set([lH.widget({widget:new Eq(e),side:1}).range(0)]):lH.none}get decorations(){return this.view.state.doc.length?lH.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,GK.contentAttributes.of({"aria-placeholder":e})]:t}var Oq=`-10000px`,kq=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function Aq(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function jq(e){let{left:t,right:n}=Aq(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Mq=gB.define({combine:e=>({position:Z.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||jq})}),Nq=new WeakMap,Pq=FU.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Mq);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new kq(e,Rq,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Mq);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=Oq,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Z.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=Aq(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=qU(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Mq).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=Oq;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Nq.get(c)??d.bottom-d.top,g=c.offset||Lq,_=this.view.textDirection==qH.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(b<h&&c.resize!==!1){if(b<this.view.defaultLineHeight){l.style.top=Oq;continue}Nq.set(c,h),l.style.height=(h=b)/i+`px`}else l.style.height&&(l.style.height=``);let x=y?u.top-h-p-g.y:u.bottom+p+g.y,S=v+m;if(c.overlap!==!0)for(let e of a)e.left<S&&e.right>v&&e.top<x+h&&e.bottom>x&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,Fq(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,Fq(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=Oq}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Fq(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var Iq=GK.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:`border-box`},"&light .cm-tooltip":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},"&light .cm-tooltip-section:not(:first-child)":{borderTop:`1px solid #bbb`},"&dark .cm-tooltip":{backgroundColor:`#333338`,color:`white`},".cm-tooltip-arrow":{height:`7px`,width:`14px`,position:`absolute`,zIndex:-1,overflow:`hidden`,"&:before, &:after":{content:`''`,position:`absolute`,width:0,height:0,borderLeft:`7px solid transparent`,borderRight:`7px solid transparent`},".cm-tooltip-above &":{bottom:`-7px`,"&:before":{borderTop:`7px solid #bbb`},"&:after":{borderTop:`7px solid #f5f5f5`,bottom:`1px`}},".cm-tooltip-below &":{top:`-7px`,"&:before":{borderBottom:`7px solid #bbb`},"&:after":{borderBottom:`7px solid #f5f5f5`,top:`1px`}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:`#333338`,borderBottomColor:`#333338`},"&:after":{borderTopColor:`transparent`,borderBottomColor:`transparent`}}}),Lq={x:0,y:0},Rq=gB.define({enables:[Pq,Iq]});function zq(e,t){let n=e.plugin(Pq);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var Bq=gB.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Vq(e,t){let n=e.plugin(Hq),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var Hq=FU.fromClass(class{constructor(e){this.input=e.state.facet(Gq),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Bq);this.top=new Uq(e,!0,t.topContainer),this.bottom=new Uq(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(Bq);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Uq(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Uq(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Gq);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>GK.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),Uq=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Wq(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Wq(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function Wq(e){let t=e.nextSibling;return e.remove(),t}var Gq=gB.define({enables:Hq});function Kq(e,t){let n,r=new Promise(e=>n=e),i=e=>Zq(e,t,n);e.state.field(Jq,!1)?e.dispatch({effects:Yq.of(i)}):e.dispatch({effects:WB.appendConfig.of(Jq.init(()=>[i]))});let a=Xq.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Jq).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function qq(e,t){let n=e.state.field(Jq,!1)||[];for(let r of n){let n=Vq(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var Jq=CB.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(Yq)?e=[n.value].concat(e):n.is(Xq)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Gq.computeN([e],t=>t.field(e))}),Yq=WB.define(),Xq=WB.define();function Zq(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=HV(`form`),t.input){let e=HV(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(HV(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(HV(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),s(null)):e.keyCode==13&&(e.preventDefault(),s(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),s(t)})}let a=HV(`div`,r,HV(`button`,{onclick:()=>s(null),"aria-label":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);let o=typeof t.focus==`string`?r.querySelector(t.focus):t.focus?r.querySelector(`input`)||r.querySelector(`button`):null;function s(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{o&&(`select`in o?o.select():`focus`in o&&o.focus())},destroy:()=>n(null)}}var Qq=class extends sV{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Qq.prototype.elementClass=``,Qq.prototype.toDOM=void 0,Qq.prototype.mapMode=iB.TrackBefore,Qq.prototype.startSide=Qq.prototype.endSide=-1,Qq.prototype.point=!0;var $q=1024,eJ=0,tJ=class{constructor(e,t){this.from=e,this.to=t}},nJ=class{constructor(e={}){this.id=eJ++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=aJ.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};nJ.closedBy=new nJ({deserialize:e=>e.split(` `)}),nJ.openedBy=new nJ({deserialize:e=>e.split(` `)}),nJ.group=new nJ({deserialize:e=>e.split(` `)}),nJ.isolate=new nJ({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),nJ.contextHash=new nJ({perNode:!0}),nJ.lookAhead=new nJ({perNode:!0}),nJ.mounted=new nJ({perNode:!0});var rJ=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[nJ.mounted.id]}},iJ=Object.create(null),aJ=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):iJ,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(nJ.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(nJ.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};aJ.none=new aJ(``,Object.create(null),0,8);var oJ=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new aJ(e.name,r,e.id,e.flags):e)}return new e(n)}},sJ=new WeakMap,cJ=new WeakMap,lJ;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(lJ||={});var uJ=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=rJ.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new wJ(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new wJ(sJ.get(this)||this.topNode);return r.moveTo(e,t),sJ.set(this,r._tree),r}get topNode(){return new gJ(this,0,0,null)}resolve(e,t=0){let n=mJ(sJ.get(this)||this.topNode,e,t,!1);return sJ.set(this,n),n}resolveInner(e,t=0){let n=mJ(cJ.get(this)||this.topNode,e,t,!0);return cJ.set(this,n),n}resolveStack(e,t=0){return CJ(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&lJ.IncludeAnonymous)>0;for(let e=this.cursor(a|lJ.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:kJ(aJ.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(aJ.none,t,n,r)))}static build(e){return EJ(e)}};uJ.empty=new uJ(aJ.none,[],[],0);var dJ=class e{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new e(this.buffer,this.index)}},fJ=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return aJ.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(pJ(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function pJ(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function mJ(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof gJ&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:lJ.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof gJ&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var hJ=class{cursor(e=0){return new wJ(this,e)}getChild(e,t=null,n=null){let r=_J(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return _J(this,e,t,n)}resolve(e,t=0){return mJ(this,e,t,!1)}resolveInner(e,t=0){return mJ(this,e,t,!0)}matchContext(e){return vJ(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},gJ=class e extends hJ{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&lJ.EnterBracketed&&l instanceof uJ&&(d=rJ.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||pJ(i,r,u,u+l.length)){if(l instanceof fJ){if(a&lJ.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new bJ(new yJ(o,l,t,u),null,e)}else if(a&lJ.IncludeAnonymous||!l.type.isAnonymous||TJ(l)){let s;if(!(a&lJ.IgnoreMounts)&&(s=rJ.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&lJ.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&lJ.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&lJ.IgnoreOverlays)&&(i=rJ.get(this._tree))&&i.overlay){let a=t-this.from,o=r&lJ.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function _J(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function vJ(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var yJ=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},bJ=class e extends hJ{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&lJ.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new uJ(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function xJ(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof gJ&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new SJ(i,n)}var SJ=class{constructor(e,t){this.heads=e,this.node=t}get next(){return xJ(this.heads)}};function CJ(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof gJ?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=rJ.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new gJ(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(mJ(o,t,n,!1))}}return i?xJ(i):r}var wJ=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~lJ.EnterBracketed,e instanceof gJ)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof gJ?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&lJ.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&lJ.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&lJ.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&lJ.IncludeAnonymous||e instanceof fJ||!e.type.isAnonymous||TJ(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new bJ(this.buffer,t,this.stack[e]);return this.bufferNode=new bJ(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return vJ(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return vJ(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function TJ(e){return e.children.some(e=>e instanceof fJ||!e.type.isAnonymous||TJ(e))}function EJ(e){let{buffer:t,nodeSet:n,maxBufferLength:r=$q,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new dJ(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,T=l,E=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let D=s[x],O,k,A=S-e;if(C-S<=r&&(k=h(o.pos-t,y))){let t=new Uint16Array(k.size-k.skip),r=o.pos-k.size,i=t.length;for(;o.pos>r;)i=g(k.start,t,i);O=new fJ(t,C-k.start,n),A=k.start-e}else{let e=o.pos-w;o.next();let t=[],s=[],c=x>=a?x:-1,h=0,g=C,_=T;for(;o.pos>e;)c>=0&&o.id==c&&o.size>=0?(o.end<=g-r&&(p(t,s,S,h,o.end,g,c,_,E),h=t.length,g=o.end,_=l),o.next()):b>2500?d(S,e,t,s):(c>=0&&o.size==-1&&i[o.id].type==n.types[c]&&(h<t.length&&p(t,s,S,h,o.end,g,c,_,E),h=t.length+1,g=o.start,_=l),u(S,e,t,s,c,b+1));if(c>=0&&h>0&&h<t.length&&p(t,s,S,h,S,g,c,_,E),t.reverse(),s.reverse(),c>-1&&h>0){let e=f(D,E);O=kJ(D,t,s,0,t.length,0,C-S,e,e)}else O=m(D,t,s,C-S,T-C,E)}_.push(O),v.push(A)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new fJ(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof uJ){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(nJ.lookAhead))&&(a=r[o]+s.length+c-i)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[nJ.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[nJ.lookAhead,i];o=o?[e].concat(o):[e]}return new uJ(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new uJ(s[e.topID],_.reverse(),v.reverse(),y)}var DJ=new WeakMap;function OJ(e,t){if(!e.isAnonymous||t instanceof fJ||t.type!=e)return 1;let n=DJ.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof uJ)){n=1;break}n+=OJ(e,r)}DJ.set(t,n)}return n}function kJ(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=OJ(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=OJ(e,t[s]);for(s++;s<i;s++){let n=OJ(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(kJ(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var AJ=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},jJ=class{startParse(e,t,n){return typeof e==`string`&&(e=new MJ(e)),n=n?n.length?n.map(e=>new tJ(e.from,e.to)):[new tJ(0,0)]:[new tJ(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},MJ=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new nJ({perNode:!0});var NJ=0,PJ=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=NJ++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new IJ(e);return e=>e.modified.indexOf(t)>-1?e:IJ.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},FJ=0,IJ=class e{constructor(e){this.name=e,this.instances=[],this.id=FJ++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&LJ(n,e.modified));if(r)return r;let i=[],a=new PJ(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=RJ(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function LJ(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function RJ(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function zJ(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new VJ(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return BJ.add(t)}var BJ=new nJ({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new VJ(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),VJ=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};VJ.empty=new VJ([],2,null);function HJ(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function UJ(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function WJ(e,t,n,r=0,i=e.length){let a=new GJ(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var GJ=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=KJ(e)||VJ.empty,u=UJ(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(nJ.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function KJ(e){let t=e.type.prop(BJ);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Q=PJ.define,qJ=Q(),JJ=Q(),YJ=Q(JJ),XJ=Q(JJ),ZJ=Q(),QJ=Q(ZJ),$J=Q(ZJ),eY=Q(),tY=Q(eY),nY=Q(),rY=Q(),iY=Q(),aY=Q(iY),oY=Q(),$={comment:qJ,lineComment:Q(qJ),blockComment:Q(qJ),docComment:Q(qJ),name:JJ,variableName:Q(JJ),typeName:YJ,tagName:Q(YJ),propertyName:XJ,attributeName:Q(XJ),className:Q(JJ),labelName:Q(JJ),namespace:Q(JJ),macroName:Q(JJ),literal:ZJ,string:QJ,docString:Q(QJ),character:Q(QJ),attributeValue:Q(QJ),number:$J,integer:Q($J),float:Q($J),bool:Q(ZJ),regexp:Q(ZJ),escape:Q(ZJ),color:Q(ZJ),url:Q(ZJ),keyword:nY,self:Q(nY),null:Q(nY),atom:Q(nY),unit:Q(nY),modifier:Q(nY),operatorKeyword:Q(nY),controlKeyword:Q(nY),definitionKeyword:Q(nY),moduleKeyword:Q(nY),operator:rY,derefOperator:Q(rY),arithmeticOperator:Q(rY),logicOperator:Q(rY),bitwiseOperator:Q(rY),compareOperator:Q(rY),updateOperator:Q(rY),definitionOperator:Q(rY),typeOperator:Q(rY),controlOperator:Q(rY),punctuation:iY,separator:Q(iY),bracket:aY,angleBracket:Q(aY),squareBracket:Q(aY),paren:Q(aY),brace:Q(aY),content:eY,heading:tY,heading1:Q(tY),heading2:Q(tY),heading3:Q(tY),heading4:Q(tY),heading5:Q(tY),heading6:Q(tY),contentSeparator:Q(eY),list:Q(eY),quote:Q(eY),emphasis:Q(eY),strong:Q(eY),link:Q(eY),monospace:Q(eY),strikethrough:Q(eY),inserted:Q(),deleted:Q(),changed:Q(),invalid:Q(),meta:oY,documentMeta:Q(oY),annotation:Q(oY),processingInstruction:Q(oY),definition:PJ.defineModifier(`definition`),constant:PJ.defineModifier(`constant`),function:PJ.defineModifier(`function`),standard:PJ.defineModifier(`standard`),local:PJ.defineModifier(`local`),special:PJ.defineModifier(`special`)};for(let e in $){let t=$[e];t instanceof PJ&&(t.name=e)}HJ([{tag:$.link,class:`tok-link`},{tag:$.heading,class:`tok-heading`},{tag:$.emphasis,class:`tok-emphasis`},{tag:$.strong,class:`tok-strong`},{tag:$.keyword,class:`tok-keyword`},{tag:$.atom,class:`tok-atom`},{tag:$.bool,class:`tok-bool`},{tag:$.url,class:`tok-url`},{tag:$.labelName,class:`tok-labelName`},{tag:$.inserted,class:`tok-inserted`},{tag:$.deleted,class:`tok-deleted`},{tag:$.literal,class:`tok-literal`},{tag:$.string,class:`tok-string`},{tag:$.number,class:`tok-number`},{tag:[$.regexp,$.escape,$.special($.string)],class:`tok-string2`},{tag:$.variableName,class:`tok-variableName`},{tag:$.local($.variableName),class:`tok-variableName tok-local`},{tag:$.definition($.variableName),class:`tok-variableName tok-definition`},{tag:$.special($.variableName),class:`tok-variableName2`},{tag:$.definition($.propertyName),class:`tok-propertyName tok-definition`},{tag:$.typeName,class:`tok-typeName`},{tag:$.namespace,class:`tok-namespace`},{tag:$.className,class:`tok-className`},{tag:$.macroName,class:`tok-macroName`},{tag:$.propertyName,class:`tok-propertyName`},{tag:$.operator,class:`tok-operator`},{tag:$.comment,class:`tok-comment`},{tag:$.meta,class:`tok-meta`},{tag:$.invalid,class:`tok-invalid`},{tag:$.punctuation,class:`tok-punctuation`}]);var sY=new nJ;function cY(e){return gB.define({combine:e?t=>t.concat(e):void 0})}var lY=new nJ,uY=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,aV.prototype.hasOwnProperty(`tree`)||Object.defineProperty(aV.prototype,"tree",{get(){return pY(this)}}),this.parser=t,this.extension=[SY.of(this),aV.languageData.of((e,t,n)=>{let r=dY(e,t,n),i=r.type.prop(sY);if(!i)return[];let a=e.facet(i),o=r.type.prop(lY);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return dY(e,t,n).type.prop(sY)==this.data}findRegions(e){let t=e.facet(SY);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(sY)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(nJ.mounted);if(i){if(i.tree.prop(sY)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof uJ&&r(i,e.positions[n]+t)}};return r(pY(e),0),n}get allowsNesting(){return!0}};uY.setState=WB.define();function dY(e,t,n){let r=e.facet(SY),i=pY(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,lJ.ExcludeBuffers|lJ.EnterBracketed))e.type.isTop&&(i=e);return i}var fY=class e extends uY{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=cY(t.languageData);return new e(n,t.parser.configure({props:[sY.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pY(e){let t=e.field(uY.state,!1);return t?t.tree:uJ.empty}var mY=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},hY=null,gY=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],uJ.empty,0,r,[],null)}startParse(){return this.parser.startParse(new mY(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=uJ.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(AJ.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(AJ.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hY;hY=this;try{return e()}finally{hY=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=_Y(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=AJ.applyChanges(r,e),i=uJ.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=_Y(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends jJ{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=hY;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new uJ(aJ.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return hY}};function _Y(e,t,n){return AJ.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var vY=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=gY.create(t.facet(SY).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};uY.state=CB.define({create:vY.init,update(e,t){for(let e of t.effects)if(e.is(uY.setState))return e.value;return t.startState.facet(SY)==t.state.facet(SY)?e.apply(t):vY.init(t.state)}});var yY=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(yY=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var bY=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,xY=FU.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(uY.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(uY.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=yY(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(uY.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!bY?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>bY&&bY()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:uY.setState.of(new vY(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>jU(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),SY=gB.define({combine(e){return e.length?e[0]:null},enables:e=>[uY.state,xY,GK.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),CY=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},wY=gB.define(),TY=gB.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function EY(e){let t=e.facet(TY);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function DY(e,t){let n=``,r=e.tabSize,i=e.facet(TY)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function OY(e,t){e instanceof aV&&(e=new kY(e));for(let n of e.state.facet(wY)){let r=n(e,t);if(r!==void 0)return r}let n=pY(e.state);return n.length>=t?jY(e,n,t):null}var kY=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=EY(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return EV(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},AY=new nJ;function jY(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return MY(r,e,n)}function MY(e,t,n){for(let r=e;r;r=r.next){let e=PY(r.node);if(e)return e(IY.create(t,n,r))}return 0}function NY(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function PY(e){let t=e.type.prop(AY);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(nJ.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>zY(e,!0,1,void 0,n&&!NY(e)?t.from:void 0)}return e.parent==null?FY:null}function FY(){return 0}var IY=class e extends kY{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(LY(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return MY(this.context.next,this.base,this.pos)}};function LY(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function RY(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function zY(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?RY(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function BY({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var VY=200;function HY(){return aV.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent(`input.type`)&&!e.isUserEvent(`input.complete`))return e;let t=e.startState.languageDataAt(`indentOnInput`,e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+VY)return e;let a=n.sliceString(i.from,r);if(!t.some(e=>e.test(a)))return e;let{state:o}=e,s=-1,c=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==s)continue;s=t.from;let n=OY(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=DY(o,n);r!=i&&c.push({from:t.from,to:t.from+r.length,insert:i})}return c.length?[e,{changes:c,sequential:!0}]:e})}var UY=new nJ,WY=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=MV.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof uY?e=>e.prop(sY)==a.data:a?e=>e==a:void 0,this.style=HJ(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new MV(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},GY=gB.define(),KY=gB.define({combine(e){return e.length?[e[0]]:null}});function qY(e){let t=e.facet(GY);return t.length?t:e.facet(KY)}function JY(e,t){let n=[XY],r;return e instanceof WY&&(e.module&&n.push(GK.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(KY.of(e)):r?n.push(GY.computeN([GK.darkTheme],t=>t.facet(GK.darkTheme)==(r==`dark`)?[e]:[])):n.push(GY.of(e)),n}var YY=class{constructor(e){this.markCache=Object.create(null),this.tree=pY(e.state),this.decorations=this.buildDeco(e,qY(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=pY(e.state),n=qY(e.state),r=n!=qY(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return lH.none;let n=new hV;for(let{from:r,to:i}of e.visibleRanges)WJ(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=lH.mark({class:r})))},r,i);return n.finish()}},XY=EB.high(FU.fromClass(YY,{decorations:e=>e.decorations}));$.meta,$.link,$.heading,$.emphasis,$.strong,$.strikethrough,$.keyword,$.atom,$.bool,$.url,$.contentSeparator,$.labelName,$.literal,$.inserted,$.string,$.deleted,$.regexp,$.escape,$.string,$.variableName,$.variableName,$.typeName,$.namespace,$.className,$.variableName,$.macroName,$.propertyName,$.comment,$.invalid;var ZY=GK.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),QY=1e4,$Y=`()[]{}`,eX=gB.define({combine(e){return oV(e,{afterCursor:!0,brackets:$Y,maxScanDistance:QY,renderMatch:rX})}}),tX=lH.mark({class:`cm-matchingBracket`}),nX=lH.mark({class:`cm-nonmatchingBracket`});function rX(e){let t=[],n=e.matched?tX:nX;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function iX(e){let t=[],n=e.facet(eX);for(let r of e.selection.ranges){if(!r.empty)continue;let i=uX(e,r.head,-1,n)||r.head>0&&uX(e,r.head-1,1,n)||n.afterCursor&&(uX(e,r.head,1,n)||r.head<e.doc.length&&uX(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return lH.set(t,!0)}var aX=[FU.fromClass(class{constructor(e){this.paused=!1,this.decorations=iX(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=iX(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),ZY];function oX(e={}){return[eX.of(e),aX]}var sX=new nJ;function cX(e,t,n){let r=e.prop(t<0?nJ.openedBy:nJ.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function lX(e){let t=e.type.prop(sX);return t?t(e.node):e}function uX(e,t,n,r={}){let i=r.maxScanDistance||QY,a=r.brackets||$Y,o=pY(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=cX(r.type,n,a);if(i&&r.from<r.to){let o=lX(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return dX(e,t,n,r,o,i,a)}}return fX(e,t,n,o,s.type,i,a)}function dX(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=lX(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(cX(u.type,n,o))l++;else if(cX(u.type,-n,o)){if(l==0){let e=lX(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function fX(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var pX=Object.create(null),mX=[aJ.none],hX=[],gX=Object.create(null),_X=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])_X[e]=yX(pX,t);function vX(e,t){hX.indexOf(e)>-1||(hX.push(e),console.warn(t))}function yX(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||$[n];r?typeof r==`function`?t.length?t=t.map(r):vX(n,`Modifier ${n} used at start of tag`):t.length?vX(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:vX(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=gX[i];if(a)return a.id;let o=gX[i]=aJ.define({id:mX.length,name:r,props:[zJ({[r]:n})]});return mX.push(o),o.id}qH.RTL,qH.LTR;var bX=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=pY(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(DX(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function xX(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function SX(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=xX(t)+xX(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function CX(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:SX(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function wX(e,t){return n=>{for(let t=pY(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var TX=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function EX(e){return e.selection.main.from}function DX(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var OX=VB.define();function kX(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:X.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var AX=new WeakMap;function jX(e){if(!Array.isArray(e))return e;let t=AX.get(e);return t||AX.set(e,t=CX(e)),t}var MX=WB.define(),NX=WB.define(),PX=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=eB(e,t),r=nB(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(eB(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=eB(e,0),i=nB(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=eB(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=nB(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=eB(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=tB(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=nB(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?nB(eB(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},FX=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},IX=gB.define({combine(e){return oV(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RX,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>LX(e(n),t(n)),optionClass:(e,t)=>n=>LX(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function LX(e,t){return e?t?e+` `+t:e:t}function RX(e,t,n,r,i,a){let o=e.textDirection==qH.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var zX=WB.define();function BX(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function VX(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var HX=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(IX);this.optionContent=BX(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=VX(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:zX.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(IX).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:NX.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=VX(r.length,i,e.state.facet(IX).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=VX(t.options.length,t.selected,this.view.state.facet(IX).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>jU(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&WX(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(IX).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function UX(e,t){return n=>new HX(n,e,t)}function WX(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function GX(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function KX(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(IX);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new TX(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new FX(n):new PX(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new TX(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):GX(e.completion)>GX(c)&&(s[s.length-1]=e),c=e.completion}return s}var qX=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,QX(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=KX(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(IX).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,QX(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:sZ,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},JX=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e($X,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(IX),i=(r.override||n.languageDataAt(`autocomplete`,EX(n)).map(jX)).map(e=>(this.active.find(t=>t.source==e)||new tZ(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(iZ));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!YX(i,this.active)||o?a=qX.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new tZ(e.source,0):e));for(let e of t.effects)e.is(zX)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XX:ZX}};function YX(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var XX={"aria-autocomplete":`list`},ZX={};function QX(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var $X=[];function eZ(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(OX);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var tZ=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=eZ(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(MX))i=new e(i.source,1,n.value);else if(n.is(NX))i=new e(i.source,0);else if(n.is(iZ))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(EX(e.state))}},nZ=class e extends tZ{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=EX(t.state);if(o>a||!r||n&2&&(EX(t.startState)==this.from||o<this.limit))return new tZ(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return rZ(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new bX(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??EX(t.state)):new tZ(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new tZ(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function rZ(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):DX(e,!0).test(i)}var iZ=WB.define({map(e,t){return e.map(e=>e.map(t))}}),aZ=CB.define({create(){return JX.start()},update(e,t){return e.update(t)},provide:e=>[Rq.from(e,e=>e.tooltip),GK.contentAttributes.from(e,e=>e.attrs)]});function oZ(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(aZ).active.find(e=>e.source==t.source);return r instanceof nZ&&(typeof n==`string`?e.dispatch({...kX(e.state,n,r.from,r.to),annotations:OX.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var sZ=UX(aZ,oZ);function cZ(e,t=`option`){return n=>{let r=n.state.field(aZ,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(IX).interactionDelay)return!1;let i=1,a;t==`page`&&(a=zq(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:zX.of(s)}),!0}}var lZ=e=>{let t=e.state.field(aZ,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(IX).interactionDelay?!1:oZ(e,t.open.options[t.open.selected])},uZ=e=>e.state.field(aZ,!1)?(e.dispatch({effects:MX.of(!0)}),!0):!1,dZ=e=>{let t=e.state.field(aZ,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:NX.of(null)}),!0)},fZ=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},pZ=50,mZ=1e3,hZ=FU.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(aZ).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(aZ),n=e.state.facet(IX);if(!e.selectionSet&&!e.docChanged&&e.startState.field(aZ)==t)return;let r=e.transactions.some(e=>{let t=eZ(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>pZ&&Date.now()-n.time>mZ){for(let e of n.context.abortListeners)try{e()}catch(e){jU(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(MX)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(aZ);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(IX).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new bX(t,EX(t),e.explicit,this.view),r=new fZ(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:NX.of(null)}),jU(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(IX).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(IX),n=this.view.state.field(aZ);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=EX(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new nZ(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new tZ(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:iZ.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(aZ,!1);if(t&&t.tooltip&&this.view.state.facet(IX).closeOnBlur){let n=t.open&&zq(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:NX.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:MX.of(!1)}),20),this.composing=0}}}),gZ=typeof navigator==`object`&&/Win/.test(navigator.platform),_Z=EB.highest(GK.domEventHandlers({keydown(e,t){let n=t.state.field(aZ,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!e.key||e.key.length>1||e.ctrlKey&&!(gZ&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&oZ(t,r),!1}})),vZ=GK.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),yZ={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},bZ=WB.define({map(e,t){return t.mapPos(e,-1,iB.TrackAfter)??void 0}}),xZ=new class extends sV{};xZ.startSide=1,xZ.endSide=-1;var SZ=CB.define({create(){return fV.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(bZ)&&(e=e.update({add:[xZ.range(n.value,n.value+1)]}));return e}});function CZ(){return[OZ,SZ]}var wZ=`()[]{}<>«»»«[]{}`;function TZ(e){for(let t=0;t<16;t+=2)if(wZ.charCodeAt(t)==e)return wZ.charAt(t+1);return tB(e<128?e:e+1)}function EZ(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||yZ}var DZ=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),OZ=GK.inputHandler.of((e,t,n,r)=>{if((DZ?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&nB(eB(r,0))==1||t!=i.from||n!=i.to)return!1;let a=AZ(e.state,r);return a?(e.dispatch(a),!0):!1}),kZ=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=EZ(e,e.selection.main.head).brackets||yZ.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=NZ(e.doc,t.head);for(let i of n)if(i==r&&MZ(e.doc,t.head)==TZ(eB(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:X.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function AZ(e,t){let n=EZ(e,e.selection.main.head),r=n.brackets||yZ.brackets;for(let i of r){let a=TZ(eB(i,0));if(t==i)return a==i?IZ(e,i,r.indexOf(i+i+i)>-1,n):PZ(e,i,a,n.before||yZ.before);if(t==a&&jZ(e,e.selection.main.from))return FZ(e,i,a)}return null}function jZ(e,t){let n=!1;return e.field(SZ).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function MZ(e,t){let n=e.sliceString(t,t+2);return n.slice(0,nB(eB(n,0)))}function NZ(e,t){let n=e.sliceString(t-2,t);return nB(eB(n,0))==n.length?n:n.slice(1)}function PZ(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:bZ.of(a.to+t.length),range:X.range(a.anchor+t.length,a.head+t.length)};let o=MZ(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:bZ.of(a.head+t.length),range:X.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function FZ(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&MZ(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:X.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function IZ(e,t,n,r){let i=r.stringPrefixes||yZ.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:bZ.of(r.to+t.length),range:X.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=MZ(e.doc,o),c;if(s==t){if(LZ(e,o))return{changes:{insert:t+t,from:o},effects:bZ.of(o+t.length),range:X.cursor(o+t.length)};if(jZ(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:X.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=zZ(e,o-2*t.length,i))>-1&&LZ(e,c))return{changes:{insert:t+t+t+t,from:o},effects:bZ.of(o+t.length),range:X.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=eV.Word&&zZ(e,o,i)>-1&&!RZ(e,o,t,i))return{changes:{insert:t+t,from:o},effects:bZ.of(o+t.length),range:X.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function LZ(e,t){let n=pY(e).resolveInner(t+1);return n.parent&&n.from==t}function RZ(e,t,n,r){let i=pY(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function zZ(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=eV.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=eV.Word)return n}return-1}function BZ(e={}){return[_Z,aZ,IX.of(e),hZ,HZ,vZ]}var VZ=[{key:`Ctrl-Space`,run:uZ},{mac:"Alt-`",run:uZ},{mac:`Alt-i`,run:uZ},{key:`Escape`,run:dZ},{key:`ArrowDown`,run:cZ(!0)},{key:`ArrowUp`,run:cZ(!1)},{key:`PageDown`,run:cZ(!0,`page`)},{key:`PageUp`,run:cZ(!1,`page`)},{key:`Enter`,run:lZ}],HZ=EB.highest(eq.computeN([IX],e=>e.facet(IX).defaultKeymap?[VZ]:[])),UZ=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=JZ(e.state,n.from);return r.line?GZ(e):r.block?qZ(e):!1};function WZ(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var GZ=WZ($Z,0),KZ=WZ(QZ,0),qZ=WZ((e,t)=>QZ(e,t,ZZ(t)),0);function JZ(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var YZ=50;function XZ(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-YZ,r),o=e.sliceDoc(i,i+YZ),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+YZ),d=e.sliceDoc(i-YZ,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function ZZ(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function QZ(e,t,n=t.selection.ranges){let r=n.map(e=>JZ(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>XZ(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function $Z(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=JZ(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var eQ=VB.define(),tQ=VB.define(),nQ=gB.define(),rQ=gB.define({combine(e){return oV(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),iQ=CB.define({create(){return CQ.empty},update(e,t){let n=t.state.facet(rQ),r=t.annotation(eQ);if(r){let i=dQ.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?fQ(o,o.length,n.minDepth,i):vQ(o,t.startState.selection),new CQ(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(tQ);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(GB.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=dQ.fromTransaction(t),o=t.annotation(GB.time),s=t.annotation(GB.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new CQ(e.done.map(dQ.fromJSON),e.undone.map(dQ.fromJSON))}});function aQ(e={}){return[iQ,rQ.of(e),GK.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?sQ:e.inputType==`historyRedo`?cQ:null;return n?(e.preventDefault(),n(t)):!1}})]}function oQ(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(iQ,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var sQ=oQ(0,!1),cQ=oQ(1,!1),lQ=oQ(0,!0),uQ=oQ(1,!0),dQ=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&oB.fromJSON(t.changes),[],t.mapped&&aB.fromJSON(t.mapped),t.startSelection&&X.fromJSON(t.startSelection),t.selectionsAfter.map(X.fromJSON))}static fromTransaction(t,n){let r=gQ;for(let e of t.startState.facet(nQ)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,gQ)}static selection(t){return new e(void 0,gQ,void 0,void 0,t)}};function fQ(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function pQ(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function mQ(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function hQ(e,t){return e.length?t.length?e.concat(t):e:t}var gQ=[],_Q=200;function vQ(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-_Q));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),fQ(e,e.length-1,1e9,n.setSelAfter(r)))}return[dQ.selection([t])]}function yQ(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function bQ(e,t){if(!e.length)return e;let n=e.length,r=gQ;for(;n;){let i=xQ(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[dQ.selection(r)]:gQ}function xQ(e,t,n){let r=hQ(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):gQ,n);if(!e.changes)return dQ.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new dQ(i,WB.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var SQ=/^(input\.type|delete)($|\.)/,CQ=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||SQ.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,pQ(s.changes,t.changes))||r==`input.type.compose`)?fQ(o,o.length-1,i.minDepth,new dQ(t.changes.compose(s.changes),hQ(WB.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,gQ)):fQ(o,o.length,i.minDepth,t),new e(o,gQ,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:gQ;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&mQ(a[a.length-1],t)?this:new e(vQ(this.done,t),this.undone,n,r)}addMapping(t){return new e(bQ(this.done,t),bQ(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:eQ.of({side:e,rest:yQ(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?gQ:r.slice(0,r.length-1);return i.mapped&&(n=bQ(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:eQ.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};CQ.empty=new CQ(gQ,gQ);var wQ=[{key:`Mod-z`,run:sQ,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:cQ,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:cQ,preventDefault:!0},{key:`Mod-u`,run:lQ,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:uQ,preventDefault:!0}];function TQ(e,t){return X.create(e.ranges.map(t),e.mainIndex)}function EQ(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function DQ({state:e,dispatch:t},n){let r=TQ(e.selection,n);return!r.eq(e.selection,!0)&&(t(EQ(e,r)),!0)}function OQ(e,t){return X.cursor(t?e.to:e.from)}function kQ(e,t){return DQ(e,n=>n.empty?e.moveByChar(n,t):OQ(n,t))}function AQ(e){return e.textDirectionAt(e.state.selection.main.head)==qH.LTR}var jQ=e=>kQ(e,!AQ(e)),MQ=e=>kQ(e,AQ(e));function NQ(e,t){return DQ(e,n=>n.empty?e.moveByGroup(n,t):OQ(n,t))}var PQ=e=>NQ(e,!AQ(e)),FQ=e=>NQ(e,AQ(e));typeof Intl<`u`&&Intl.Segmenter;function IQ(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function LQ(e,t,n){let r=pY(e).resolveInner(t.head),i=n?nJ.closedBy:nJ.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;IQ(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?uX(e,r.from,1):uX(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,X.cursor(s,n?-1:1)}var RQ=e=>DQ(e,t=>LQ(e.state,t,!AQ(e))),zQ=e=>DQ(e,t=>LQ(e.state,t,AQ(e)));function BQ(e,t){return DQ(e,n=>{if(!n.empty)return OQ(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var VQ=e=>BQ(e,!1),HQ=e=>BQ(e,!0);function UQ(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(GK.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function WQ(e,t){let n=UQ(e),{state:r}=e,i=TQ(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):OQ(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=GK.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(EQ(r,i),{effects:a}),!0}var GQ=e=>WQ(e,!1),KQ=e=>WQ(e,!0);function qQ(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=X.cursor(r.from+n))}return i}var JQ=e=>DQ(e,t=>qQ(e,t,!0)),YQ=e=>DQ(e,t=>qQ(e,t,!1)),XQ=e=>DQ(e,t=>qQ(e,t,!AQ(e))),ZQ=e=>DQ(e,t=>qQ(e,t,AQ(e))),QQ=e=>DQ(e,t=>e.moveToLineBoundary(t,!1,!1)),$Q=e=>DQ(e,t=>e.moveToLineBoundary(t,!0,!1));function e$(e,t,n){let r=!1,i=TQ(e.selection,t=>{let i=uX(e,t.head,-1)||uX(e,t.head,1)||t.head>0&&uX(e,t.head-1,1)||t.head<e.doc.length&&uX(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?X.range(t.anchor,a):X.cursor(a)});return r?(t(EQ(e,i)),!0):!1}var t$=({state:e,dispatch:t})=>e$(e,t,!1);function n$(e,t,n){let r=TQ(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=X.range(e.head,e.anchor));let r=n(e);return X.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(EQ(e.state,r)),!0)}function r$(e,t){return n$(e,t,n=>e.moveByChar(n,t))}var i$=e=>r$(e,!AQ(e)),a$=e=>r$(e,AQ(e));function o$(e,t){return n$(e,t,n=>e.moveByGroup(n,t))}var s$=e=>o$(e,!AQ(e)),c$=e=>o$(e,AQ(e)),l$=e=>{let t=!AQ(e);return n$(e,t,n=>LQ(e.state,n,t))},u$=e=>{let t=AQ(e);return n$(e,t,n=>LQ(e.state,n,t))};function d$(e,t){return n$(e,t,n=>e.moveVertically(n,t))}var f$=e=>d$(e,!1),p$=e=>d$(e,!0);function m$(e,t){return n$(e,t,n=>e.moveVertically(n,t,UQ(e).height))}var h$=e=>m$(e,!1),g$=e=>m$(e,!0),_$=e=>n$(e,!0,t=>qQ(e,t,!0)),v$=e=>n$(e,!1,t=>qQ(e,t,!1)),y$=e=>{let t=!AQ(e);return n$(e,t,n=>qQ(e,n,t))},b$=e=>{let t=AQ(e);return n$(e,t,n=>qQ(e,n,t))},x$=e=>n$(e,!1,t=>X.cursor(e.lineBlockAt(t.head).from)),S$=e=>n$(e,!0,t=>X.cursor(e.lineBlockAt(t.head).to)),C$=({state:e,dispatch:t})=>(t(EQ(e,{anchor:0})),!0),w$=({state:e,dispatch:t})=>(t(EQ(e,{anchor:e.doc.length})),!0),T$=({state:e,dispatch:t})=>(t(EQ(e,{anchor:e.selection.main.anchor,head:0})),!0),E$=({state:e,dispatch:t})=>(t(EQ(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),D$=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),O$=({state:e,dispatch:t})=>{let n=q$(e).map(({from:t,to:n})=>X.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:X.create(n),userEvent:`select`})),!0},k$=({state:e,dispatch:t})=>{let n=TQ(e.selection,t=>{let n=pY(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return X.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(EQ(e,n)),!0)};function A$(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(EQ(n,X.create(i,i.length-1))),!0)}var j$=e=>A$(e,!1),M$=e=>A$(e,!0),N$=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=X.create([n.main]):n.main.empty||(r=X.create([X.cursor(n.main.head)])),r?(t(EQ(e,r)),!0):!1};function P$(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=F$(e,o,!1)):o>i&&(n=`delete.forward`,o=F$(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=F$(e,i,!1),a=F$(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:X.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?GK.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function F$(e,t,n){if(e instanceof GK)for(let r of e.state.facet(GK.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var I$=(e,t,n)=>P$(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=EV(s,a.tabSize)%EY(a)||EY(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Zz(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=Zz(o.text,c-o.from,!1,!1)+o.from);return c}),L$=e=>I$(e,!1,!0),R$=e=>I$(e,!0,!1),z$=(e,t)=>P$(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=Zz(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),B$=e=>z$(e,!1),V$=e=>z$(e,!0),H$=e=>P$(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),U$=e=>P$(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),W$=e=>P$(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),G$=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Bz.of([``,``])},range:X.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},K$=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Zz(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Zz(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:X.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function q$(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function J$(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of q$(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(X.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(X.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:X.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Y$=({state:e,dispatch:t})=>J$(e,t,!1),X$=({state:e,dispatch:t})=>J$(e,t,!0);function Z$(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of q$(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Q$=({state:e,dispatch:t})=>Z$(e,t,!1),$$=({state:e,dispatch:t})=>Z$(e,t,!0),e1=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(q$(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=TQ(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function t1(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=pY(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(nJ.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var n1=i1(!1),r1=i1(!0);function i1(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&t1(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new kY(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=OY(s,r);for(c??=EV(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,DY(t,c)];return o&&l.push(DY(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Bz.of(l)},range:X.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function a1(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:X.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var o1=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new kY(e,{overrideIndentation:e=>n[e]??-1}),i=a1(e,(t,i,a)=>{let o=OY(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=DY(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},s1=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(a1(e,(t,n)=>{n.push({from:t.from,insert:e.facet(TY)})}),{userEvent:`input.indent`})),!0),c1=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(a1(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=EV(r,e.tabSize),a=0,o=DY(e,Math.max(0,i-EY(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),l1=e=>(e.setTabFocusMode(),!0),u1=[{key:`Ctrl-b`,run:jQ,shift:i$,preventDefault:!0},{key:`Ctrl-f`,run:MQ,shift:a$},{key:`Ctrl-p`,run:VQ,shift:f$},{key:`Ctrl-n`,run:HQ,shift:p$},{key:`Ctrl-a`,run:QQ,shift:x$},{key:`Ctrl-e`,run:$Q,shift:S$},{key:`Ctrl-d`,run:R$},{key:`Ctrl-h`,run:L$},{key:`Ctrl-k`,run:H$},{key:`Ctrl-Alt-h`,run:B$},{key:`Ctrl-o`,run:G$},{key:`Ctrl-t`,run:K$},{key:`Ctrl-v`,run:KQ}],d1=[{key:`ArrowLeft`,run:jQ,shift:i$,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:PQ,shift:s$,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:XQ,shift:y$,preventDefault:!0},{key:`ArrowRight`,run:MQ,shift:a$,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:FQ,shift:c$,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ZQ,shift:b$,preventDefault:!0},{key:`ArrowUp`,run:VQ,shift:f$,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:C$,shift:T$},{mac:`Ctrl-ArrowUp`,run:GQ,shift:h$},{key:`ArrowDown`,run:HQ,shift:p$,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:w$,shift:E$},{mac:`Ctrl-ArrowDown`,run:KQ,shift:g$},{key:`PageUp`,run:GQ,shift:h$},{key:`PageDown`,run:KQ,shift:g$},{key:`Home`,run:YQ,shift:v$,preventDefault:!0},{key:`Mod-Home`,run:C$,shift:T$},{key:`End`,run:JQ,shift:_$,preventDefault:!0},{key:`Mod-End`,run:w$,shift:E$},{key:`Enter`,run:n1,shift:n1},{key:`Mod-a`,run:D$},{key:`Backspace`,run:L$,shift:L$,preventDefault:!0},{key:`Delete`,run:R$,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:B$,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:V$,preventDefault:!0},{mac:`Mod-Backspace`,run:U$,preventDefault:!0},{mac:`Mod-Delete`,run:W$,preventDefault:!0}].concat(u1.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),f1=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:RQ,shift:l$},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:zQ,shift:u$},{key:`Alt-ArrowUp`,run:Y$},{key:`Shift-Alt-ArrowUp`,run:Q$},{key:`Alt-ArrowDown`,run:X$},{key:`Shift-Alt-ArrowDown`,run:$$},{key:`Mod-Alt-ArrowUp`,run:j$},{key:`Mod-Alt-ArrowDown`,run:M$},{key:`Escape`,run:N$},{key:`Mod-Enter`,run:r1},{key:`Alt-l`,mac:`Ctrl-l`,run:O$},{key:`Mod-i`,run:k$,preventDefault:!0},{key:`Mod-[`,run:c1},{key:`Mod-]`,run:s1},{key:`Mod-Alt-\\`,run:o1},{key:`Shift-Mod-k`,run:e1},{key:`Shift-Mod-\\`,run:t$},{key:`Mod-/`,run:UZ},{key:`Alt-A`,mac:`Ctrl-A`,run:KZ},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:l1}].concat(d1),p1=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,m1=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(p1(e)):p1,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return eB(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=tB(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=nB(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(m1.prototype[Symbol.iterator]=function(){return this});var h1={from:-1,to:-1,match:/.*/.exec(``),precise:!0},g1=`gm`+(/x/.unicode==null?``:`u`),_1=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=h1,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new b1(e,t,n,r,i);this.re=new RegExp(t,g1+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=S1(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=S1(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},v1=new WeakMap,y1=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=v1.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return v1.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),v1.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},b1=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=h1,this.matchPos=S1(e,r),this.re=new RegExp(t,g1+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=y1.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=S1(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=y1.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(_1.prototype[Symbol.iterator]=b1.prototype[Symbol.iterator]=function(){return this});function x1(e){try{return new RegExp(e,g1),!0}catch{return!1}}function S1(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var C1=e=>{let t=qq(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=Kq(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=X.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,GK.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},w1={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},T1=gB.define({combine(e){return oV(e,w1,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function E1(e){let t=[M1,j1];return e&&t.push(T1.of(e)),t}var D1=lH.mark({class:`cm-selectionMatch`}),O1=lH.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function k1(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=eV.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=eV.Word)}function A1(e,t,n,r){return e(t.sliceDoc(n,n+1))==eV.Word&&e(t.sliceDoc(r-1,r))==eV.Word}var j1=FU.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(T1),{state:n}=e,r=n.selection;if(r.ranges.length>1)return lH.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return lH.none;let e=n.wordAt(i.head);if(!e)return lH.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return lH.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(k1(o,n,i.from,i.to)&&A1(o,n,i.from,i.to)))return lH.none}else if(a=n.sliceDoc(i.from,i.to),!a)return lH.none}let s=[];for(let r of e.visibleRanges){let e=new m1(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||k1(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(O1.range(r,a)):(r>=i.to||a<=i.from)&&s.push(D1.range(r,a)),s.length>t.maxMatches))return lH.none}}return lH.set(s)}},{decorations:e=>e.decorations}),M1=GK.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),N1=({state:e,dispatch:t})=>{let{selection:n}=e,r=X.create(n.ranges.map(t=>e.wordAt(t.head)||X.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function P1(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new m1(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new m1(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var F1=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return N1({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=P1(e,r);return i?(t(e.update({selection:e.selection.addRange(X.range(i.from,i.to),!1),effects:GK.scrollIntoView(i.to)})),!0):!1},I1=gB.define({combine(e){return oV(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new g0(e),scrollToMatch:e=>GK.scrollIntoView(e)})}}),L1=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||x1(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
76
|
+
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new J1(this):new H1(this)}getCursor(e,t=0,n){let r=e.doc?e:aV.create({doc:e});return n??=r.doc.length,this.regexp?W1(this,r,t,n):B1(this,r,t,n)}},R1=class{constructor(e){this.spec=e}};function z1(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function B1(e,t,n,r){let i;return e.wholeWord&&(i=V1(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=z1(e.test,t,i)),new m1(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function V1(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(G1(i,n-a))!=eV.Word||t(K1(i,n-a))!=eV.Word)&&(t(K1(i,r-a))!=eV.Word||t(G1(i,r-a))!=eV.Word))}var H1=class extends R1{constructor(e){super(e)}nextMatch(e,t,n){let r=B1(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=B1(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=B1(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=B1(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=B1(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function U1(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function W1(e,t,n,r){let i;return e.wholeWord&&(i=q1(t.charCategorizer(t.selection.main.head))),e.test&&(i=U1(e.test,t,i)),new _1(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function G1(e,t){return e.slice(Zz(e,t,!1),t)}function K1(e,t){return e.slice(t,Zz(e,t))}function q1(e){return(t,n,r)=>!r[0].length||(e(G1(r.input,r.index))!=eV.Word||e(K1(r.input,r.index))!=eV.Word)&&(e(K1(r.input,r.index+r[0].length))!=eV.Word||e(G1(r.input,r.index+r[0].length))!=eV.Word)}var J1=class extends R1{nextMatch(e,t,n){let r=W1(this.spec,e,n,e.doc.length).next();return r.done&&(r=W1(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=W1(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=W1(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=W1(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},Y1=WB.define(),X1=WB.define(),Z1=CB.define({create(e){return new Q1(u0(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Y1)?e=new Q1(n.value.create(),e.panel):n.is(X1)&&(e=new Q1(e.query,n.value?l0:null));return e},provide:e=>Gq.from(e,e=>e.panel)}),Q1=class{constructor(e,t){this.query=e,this.panel=t}},$1=lH.mark({class:`cm-searchMatch`}),e0=lH.mark({class:`cm-searchMatch cm-searchMatch-selected`}),t0=FU.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Z1))}update(e){let t=e.state.field(Z1);(t!=e.startState.field(Z1)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return lH.none;let{view:n}=this,r=new hV;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?e0:$1)})}return r.finish()}},{decorations:e=>e.decorations});function n0(e){return t=>{let n=t.state.field(Z1,!1);return n&&n.query.spec.valid?e(t,n):p0(t)}}var r0=n0((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=X.single(r.from,r.to),a=e.state.facet(I1);return e.dispatch({selection:i,effects:[b0(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),f0(e),!0}),i0=n0((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=X.single(i.from,i.to),o=e.state.facet(I1);return e.dispatch({selection:a,effects:[b0(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),f0(e),!0}),a0=n0((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:X.create(n.map(e=>X.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),o0=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new m1(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(X.range(t.value.from,t.value.to))}return t(e.update({selection:X.create(a,o),userEvent:`select.search.matches`})),!0},s0=n0((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(GK.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=X.single(o.from,o.to).map(d),u.push(b0(e,o)),u.push(n.facet(I1).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),c0=n0((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:GK.announce.of(r),userEvent:`input.replace.all`}),!0});function l0(e){return e.state.facet(I1).createPanel(e)}function u0(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(I1);return new L1({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function d0(e){let t=Vq(e,l0);return t&&t.dom.querySelector(`[main-field]`)}function f0(e){let t=d0(e);t&&t==e.root.activeElement&&t.select()}var p0=e=>{let t=e.state.field(Z1,!1);if(t&&t.panel){let n=d0(e);if(n&&n!=e.root.activeElement){let r=u0(e.state,t.query.spec);r.valid&&e.dispatch({effects:Y1.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[X1.of(!0),t?Y1.of(u0(e.state,t.query.spec)):WB.appendConfig.of(S0)]});return!0},m0=e=>{let t=e.state.field(Z1,!1);if(!t||!t.panel)return!1;let n=Vq(e,l0);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:X1.of(!1)}),!0},h0=[{key:`Mod-f`,run:p0,scope:`editor search-panel`},{key:`F3`,run:r0,shift:i0,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:r0,shift:i0,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:m0,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:o0},{key:`Mod-Alt-g`,run:C1},{key:`Mod-d`,run:F1,preventDefault:!0}],g0=class{constructor(e){this.view=e;let t=this.query=e.state.field(Z1).query.spec;this.commit=this.commit.bind(this),this.searchField=HV(`input`,{value:t.search,placeholder:_0(e,`Find`),"aria-label":_0(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=HV(`input`,{value:t.replace,placeholder:_0(e,`Replace`),"aria-label":_0(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=HV(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=HV(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=HV(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return HV(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=HV(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>r0(e),[_0(e,`next`)]),n(`prev`,()=>i0(e),[_0(e,`previous`)]),n(`select`,()=>a0(e),[_0(e,`all`)]),HV(`label`,null,[this.caseField,_0(e,`match case`)]),HV(`label`,null,[this.reField,_0(e,`regexp`)]),HV(`label`,null,[this.wordField,_0(e,`by word`)]),...e.state.readOnly?[]:[HV(`br`),this.replaceField,n(`replace`,()=>s0(e),[_0(e,`replace`)]),n(`replaceAll`,()=>c0(e),[_0(e,`replace all`)])],HV(`button`,{name:`close`,onclick:()=>m0(e),"aria-label":_0(e,`close`),type:`button`},[`×`])])}commit(){let e=new L1({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Y1.of(e)}))}keydown(e){rq(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?i0:r0)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),s0(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Y1)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I1).top}};function _0(e,t){return e.state.phrase(t)}var v0=30,y0=/[\s\.,:;?!]/;function b0(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-v0),o=Math.min(i,n+v0),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<v0;e++)if(!y0.test(s[e+1])&&y0.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-v0;e--)if(!y0.test(s[e-1])&&y0.test(s[e])){s=s.slice(0,e);break}}return GK.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var x0=GK.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),S0=[Z1,EB.low(t0),x0],C0=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new w0(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new T0(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new w0(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},w0=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},T0=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},E0=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function D0(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var O0=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},k0=new O0,A0=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=k0,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=k0,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},j0=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;P0(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};j0.prototype.contextual=j0.prototype.fallback=j0.prototype.extend=!1;var M0=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?D0(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(P0(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};M0.prototype.contextual=j0.prototype.fallback=j0.prototype.extend=!1;var N0=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function P0(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||I0(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function F0(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function I0(e,t,n,r){let i=F0(n,r,t);return i<0||F0(n,r,e)<i}var L0=typeof process<`u`&&/\bparse\b/.test({}.LOG),R0=null;function z0(e,t,n){let r=e.cursor(lJ.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var B0=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?z0(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?z0(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;if(e<this.safeFrom)return null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(i instanceof uJ){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(nJ.lookAhead))||t+r<this.fragment.to)&&(n&&(this.lastRepeat=i,this.lastRepeatPos=a),a==e))return i}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},V0=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new O0)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if((!n||c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new O0,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new O0,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=K0(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(K0(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(K0(o,s+1),t,n,r))}return r}},H0=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new A0(t,r),this.tokens=new V0(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[C0.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new B0(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&q0(r);if(e)return L0&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw L0&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return L0&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}tryReuse(e,t,n,r){if(!n)return null;let i=e.curContext&&e.curContext.tracker.strict,a=i?e.curContext.hash:0;for(;n;){let o=this.parser.nodeSet.types[n.type.id]==n.type?this.parser.getGoto(e.state,n.type.id):-1;if(o>-1&&n.length&&(!i||(n.prop(nJ.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof uJ&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=L0?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos<r&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,r,this.fragments.nodeAt(r),!1);if(t)return L0&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(t.type.id)})`),!0}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),L0&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;o<s.length;){let c=s[o++],l=s[o++],u=s[o++],d=o==s.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(c,l,p?p.start:f.pos,u),L0&&console.log(a+this.stackID(f)+` (via ${c&65536?`reduce of ${i.getName(c&65535)}`:`shift`} for ${i.getName(l)} @ ${r}${f==e?``:`, split`})`),d)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return U0(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=L0?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),L0&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(L0&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)L0&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))L0&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),L0&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),U0(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),uJ.build({buffer:E0.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(R0||=new WeakMap).get(e);return t||R0.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function U0(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var W0=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},G0=class e extends jJ{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=nJ[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new oJ(t.map((t,i)=>aJ.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=$q;let a=D0(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(J0),this.states=D0(e.states,Uint32Array),this.data=D0(e.stateData),this.goto=D0(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new j0(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new H0(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=K0(n,i+2)];else if(n[i+1]==2)return K0(n,i+2);else break}if(a==t||a==0)return K0(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K0(this.data,n+2);else break}r=t(K0(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K0(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=J0(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new W0(e,n,r)}static deserialize(t){return new e(t)}};function K0(e,t){return e[t]|e[t+1]<<16}function q0(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function J0(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var Y0=36,X0=1,Z0=2,Q0=3,$0=4,e2=5,t2=6,n2=7,r2=8,i2=9,a2=10,o2=11,s2=12,c2=13,l2=14,u2=15,d2=16,f2=17,p2=18,m2=19,h2=20,g2=21,_2=22,v2=23,y2=24;function b2(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function x2(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function S2(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function C2(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function w2(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function T2(e,t){for(;e.next==95||b2(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function E2(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),S2(e,t,!1)}else T2(e)}function D2(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function O2(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function k2(e){for(;!(e.next<0||e.next==10);)e.advance()}function A2(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var j2=` \r
|
|
77
|
+
`;function M2(e,t,n){let r=Object.create(null);r.true=r.false=e2,r.null=r.unknown=t2;for(let t of e.split(` `))t&&(r[t]=h2);for(let e of t.split(` `))e&&(r[e]=g2);for(let e of(n||``).split(` `))e&&(r[e]=y2);return r}var N2=`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `,P2=`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,F2={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!1,words:M2(P2,N2)};function I2(e,t,n,r){let i={};for(let t in F2)i[t]=(e.hasOwnProperty(t)?e:F2)[t];return t&&(i.words=M2(t,n||``,r)),i}function L2(e){return new N0(t=>{let{next:n}=t;if(t.advance(),A2(n,j2)){for(;A2(t.next,j2);)t.advance();t.acceptToken(Y0)}else if(n==36&&e.doubleDollarQuotedStrings){let e=T2(t,``);t.next==36&&(t.advance(),C2(t,e),t.acceptToken(Q0))}else if(n==39||n==34&&e.doubleQuotedStrings)S2(t,n,e.backslashEscapes),t.acceptToken(Q0);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)k2(t),t.acceptToken(X0);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))k2(t),t.acceptToken(X0);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(Z0)}else if((n==101||n==69)&&t.next==39)t.advance(),S2(t,39,!0),t.acceptToken(Q0);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),S2(t,39,e.backslashEscapes),t.acceptToken(Q0);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),S2(t,39,e.backslashEscapes),t.acceptToken(Q0);break}if(!b2(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!A2(t.peek(1),j2)){let e=t.peek(1);t.advance(2),w2(t,e),t.acceptToken(Q0)}else if(A2(n,e.identifierQuotes))S2(t,n==91?93:n,!1),t.acceptToken(m2);else if(n==40)t.acceptToken(n2);else if(n==41)t.acceptToken(r2);else if(n==123)t.acceptToken(i2);else if(n==125)t.acceptToken(a2);else if(n==91)t.acceptToken(o2);else if(n==93)t.acceptToken(s2);else if(n==59)t.acceptToken(c2);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),D2(t),t.acceptToken(_2);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(S2(t,n,e.backslashEscapes),t.acceptToken(v2)):(D2(t,n),t.acceptToken(_2))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();x2(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken($0)}else if(n==46&&t.next>=48&&t.next<=57)O2(t,!0),t.acceptToken($0);else if(n==46)t.acceptToken(l2);else if(n>=48&&n<=57)O2(t,!1),t.acceptToken($0);else if(A2(n,e.operatorChars)){for(;A2(t.next,e.operatorChars);)t.advance();t.acceptToken(u2)}else if(A2(n,e.specialVar))t.next==n&&t.advance(),E2(t),t.acceptToken(f2);else if(n==58||n==44)t.acceptToken(d2);else if(b2(n)){let r=T2(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?p2:e.words[r.toLowerCase()]??p2)}})}var R2=L2(F2),z2=G0.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:`⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement`,maxTerm:38,nodeProps:[[`isolate`,-4,1,2,3,19,``]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:`RORO`,tokenizers:[0,R2],topRules:{Script:[0,25]},tokenPrec:0});function B2(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function V2(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function H2(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function U2(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)H2(r)&&n.push(V2(e,r));return n}return[V2(e,t)]}function W2(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=B2(t);if(!H2(r))return n;n.unshift(V2(e,r)),t=B2(r)}}function G2(e,t){let n=pY(e).resolveInner(t,-1),r=q2(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:W2(e.doc,B2(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:W2(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var K2=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function q2(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&H2(t.nextSibling))o=V2(e,t.nextSibling);else if(n&&K2.has(n))break;else a&&H2(t)&&(o=V2(e,t));o&&(r||=Object.create(null),r[o]=U2(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function J2(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Y2=/^\w*$/,X2=/^[`'"\[]?\w*[`'"\]]?$/;function Z2(e){return e.self&&typeof e.self.label==`string`}var Q2=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push($2(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t==`string`?$2(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Z2(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\?\./g,e=>e==`.`?`\0`:e).split(`\0`),a=this;Z2(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\./g,`.`));a.addNamespace(n)}}};function $2(e,t,n,r){return RegExp(`^[a-z_][a-z_\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+e4(n)}}function e4(e){return e===`[`?`]`:e}function t4(e,t,n,r,i,a){let o=new Q2(a?.spec.identifierQuotes?.[0]||`"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=G2(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=e4(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:J2(t,r,u),validFor:X2}}return{from:n,options:u,validFor:Y2}}}function n4(e){return e==g2?`type`:e==h2?`keyword`:`variable`}function r4(e,t,n){return wX([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],CX(Object.keys(e).map(r=>n(t?r.toUpperCase():r,n4(e[r])))))}var i4=z2.configure({props:[AY.add({Statement:BY()}),UY.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),zJ({Keyword:$.keyword,Type:$.typeName,Builtin:$.standard($.name),Bits:$.number,Bytes:$.string,Bool:$.bool,Null:$.null,Number:$.number,String:$.string,Identifier:$.name,QuotedIdentifier:$.special($.string),SpecialVar:$.special($.name),LineComment:$.lineComment,BlockComment:$.blockComment,Operator:$.operator,"Semi Punctuation":$.punctuation,"( )":$.paren,"{ }":$.brace,"[ ]":$.squareBracket})]}),a4=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=I2(t,t.keywords,t.types,t.builtin),r=fY.define({name:`sql`,parser:i4.configure({tokenizers:[{from:R2,to:L2(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}});return new e(n,r,t)}};function o4(e,t){return{label:e,type:t,boost:-1}}function s4(e,t=!1,n){return r4(e.dialect.words,t,n||o4)}function c4(e){return e.schema?t4(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||d4):()=>null}function l4(e){return e.schema?(e.dialect||d4).language.data.of({autocomplete:c4(e)}):[]}function u4(e={}){let t=e.dialect||d4;return new CY(t.language,[l4(e),t.language.data.of({autocomplete:s4(t,e.upperCaseKeywords,e.keywordCompletion)})])}var d4=a4.define({}),f4=`accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`,p4=N2+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed`,m4=a4.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:"`",keywords:P2+`group_concat `+f4,types:p4,builtin:`charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee`}),h4=e=>e.split(/\s+/).filter(Boolean),g4=h4(`
|
|
78
|
+
add after alias all alter and anti any array as asc ascending asof assume attach between by
|
|
79
|
+
case cast check cluster codec collate column columns comment cross cube database databases
|
|
80
|
+
default delete desc descending describe detach dictionary distinct distributed drop else
|
|
81
|
+
end engine except exchange exists explain extract fetch fill final first for format from
|
|
82
|
+
full global grant group having ilike in index inner insert interval into is join key kill
|
|
83
|
+
last left like limit live materialized modify move mutation natural not null nulls offset on
|
|
84
|
+
optimize option or order outer outfile over partition populate prewhere primary projection
|
|
85
|
+
qualify query refresh rename replace right rollup sample select semi set settings show
|
|
86
|
+
step system table tables temporary then to top totals truncate ttl union unique update use
|
|
87
|
+
using values view volume watch when where window with
|
|
88
|
+
`),_4=h4(`
|
|
89
|
+
AggregateFunction Array Bool Date Date32 DateTime DateTime64 Decimal Decimal32 Decimal64
|
|
90
|
+
Decimal128 Decimal256 Dynamic Enum Enum8 Enum16 FixedString Float32 Float64 IPv4 IPv6 Int8
|
|
91
|
+
Int16 Int32 Int64 Int128 Int256 JSON LowCardinality Map Nested Nullable Point Polygon Ring
|
|
92
|
+
SimpleAggregateFunction String Tuple UInt8 UInt16 UInt32 UInt64 UInt128 UInt256 UUID Variant
|
|
93
|
+
`),v4=h4(`
|
|
94
|
+
abs acos any anyHeavy anyLast argMax argMin array arrayAll arrayAvg arrayConcat arrayCount
|
|
95
|
+
arrayCumSum arrayDistinct arrayElement arrayEnumerate arrayExists arrayFill arrayFilter
|
|
96
|
+
arrayFirst arrayFlatten arrayIntersect arrayJoin arrayMap arrayMax arrayMin arrayPopBack
|
|
97
|
+
arrayPopFront arrayProduct arrayPushBack arrayPushFront arrayReduce arrayResize arrayReverse
|
|
98
|
+
arraySlice arraySort arraySplit arraySum arrayUniq arrayZip asin atan avg avgIf avgWeighted
|
|
99
|
+
base64Decode base64Encode bitAnd bitCount bitOr bitShiftLeft bitShiftRight bitXor bar
|
|
100
|
+
ceil coalesce concat concatWithSeparator corr cos count countDistinct countIf countSubstrings
|
|
101
|
+
covarPop covarSamp cutQueryString cutURLParameter dateDiff dateName dateTrunc date_trunc
|
|
102
|
+
decodeURLComponent dictGet dictGetOrDefault dictHas domain domainWithoutWWW dumpColumnStructure
|
|
103
|
+
empty emptyArrayString encodeURLComponent endsWith exp extract extractAll extractGroups
|
|
104
|
+
extractURLParameter extractURLParameters firstSignificantSubdomain floor formatDateTime
|
|
105
|
+
formatReadableQuantity formatReadableSize formatReadableTimeDelta fromUnixTimestamp
|
|
106
|
+
fromUnixTimestamp64Milli generateUUIDv4 greatest groupArray groupArrayInsertAt groupArrayMovingAvg
|
|
107
|
+
groupArraySample groupBitAnd groupBitOr groupBitXor groupUniqArray has hasAll hasAny hasToken
|
|
108
|
+
hex hostName if ifNull indexOf intDiv intDivOrZero isFinite isInfinite isNaN isNotNull isNull
|
|
109
|
+
isValidUTF8 JSONExtract JSONExtractArrayRaw JSONExtractBool JSONExtractFloat JSONExtractInt
|
|
110
|
+
JSONExtractKeys JSONExtractKeysAndValues JSONExtractRaw JSONExtractString JSONExtractUInt
|
|
111
|
+
JSONHas JSONLength JSONType JSON_VALUE JSON_QUERY kurtPop kurtSamp lagInFrame
|
|
112
|
+
last_value leadInFrame least left leftPad length lengthUTF8 log log10 log2 lower lowerUTF8
|
|
113
|
+
map mapKeys mapValues match materialize max maxIf median min minIf modulo multiIf
|
|
114
|
+
multiMatchAny murmurHash3_64 neighbor not notEmpty notLike now now64 nullIf numbers
|
|
115
|
+
parseDateTime parseDateTimeBestEffort parseDateTimeBestEffortOrNull parseURL path
|
|
116
|
+
position positionCaseInsensitive pow protocol quantile quantileDeterministic quantileExact
|
|
117
|
+
quantileExactWeighted quantileTDigest quantileTiming quantiles quantilesExact
|
|
118
|
+
quantilesTDigest quantilesTiming rand rand64 range rank regexpExtract regexpReplaceAll
|
|
119
|
+
regexpReplaceOne replace replaceAll replaceOne replaceRegexpAll replaceRegexpOne reverse right
|
|
120
|
+
rightPad round roundBankers row_number rowNumberInBlock runningDifference sin skewPop skewSamp
|
|
121
|
+
splitByChar splitByRegexp splitByString sqrt startsWith stddevPop stddevSamp substring
|
|
122
|
+
substringUTF8 sum sumIf sumMap sumWithOverflow tan today toDate toDate32 toDateOrNull
|
|
123
|
+
toDateOrZero toDateTime toDateTime64 toDayOfMonth toDayOfWeek toDayOfYear toDecimal32
|
|
124
|
+
toDecimal64 toDecimal128 toFloat32 toFloat64 toFloat64OrNull toHour toInt8 toInt16 toInt32
|
|
125
|
+
toInt64 toInt32OrNull toInt64OrNull toIntervalDay toIntervalHour toIntervalMinute
|
|
126
|
+
toIntervalMonth toIntervalSecond toIntervalWeek toIntervalYear toISOWeek toISOYear toJSONString
|
|
127
|
+
toLastDayOfMonth toLowCardinality toMinute toMonday toMonth toNullable toQuarter toRelativeDayNum
|
|
128
|
+
toRelativeHourNum toRelativeMonthNum toSecond toStartOfDay toStartOfFifteenMinutes
|
|
129
|
+
toStartOfFiveMinutes toStartOfHour toStartOfInterval toStartOfMinute toStartOfMonth
|
|
130
|
+
toStartOfQuarter toStartOfTenMinutes toStartOfWeek toStartOfYear toString toTime toTimeZone
|
|
131
|
+
toTypeName toUInt8 toUInt16 toUInt32 toUInt64 toUInt32OrNull toUInt64OrNull toUnixTimestamp
|
|
132
|
+
toUnixTimestamp64Milli toUUID toWeek toYYYYMM toYYYYMMDD toYYYYMMDDhhmmss toYear
|
|
133
|
+
topK topKWeighted trim trimBoth trimLeft trimRight tuple tupleElement uniq uniqCombined
|
|
134
|
+
uniqCombined64 uniqExact uniqHLL12 uniqTheta upper upperUTF8 uptime
|
|
135
|
+
varPop varSamp version yesterday
|
|
136
|
+
`),y4=new Map([..._4,...v4].map(e=>[e.toLowerCase(),e])),b4={mysql:m4,clickhouse:a4.define({keywords:g4.join(` `),types:_4.join(` `).toLowerCase(),builtin:v4.join(` `).toLowerCase(),backslashEscapes:!0,hashComments:!0,identifierQuotes:'`"',charSetCasts:!1,operatorChars:`*+-%<>!=&|^/`})},x4={mysql:(e,t)=>({label:e,type:t===`variable`?`function`:t}),clickhouse:(e,t)=>({label:y4.get(e.toLowerCase())??e,type:t===`variable`?`function`:t})},S4=/^[A-Za-z_][A-Za-z0-9_]*$/;function C4(e,t,n){return{label:e,type:t,detail:n,...S4.test(e)?{}:{apply:`\`${e.replaceAll("`","``")}\``}}}var w4=e=>e.replaceAll(`.`,`\\.`);function T4(e){let t=Object.create(null);for(let[n,r]of Object.entries(e?.schema??{})){let e=Object.create(null);for(let[t,n]of Object.entries(r))e[w4(t)]={self:C4(t,`class`,`table`),children:n.map(e=>C4(e.name,`property`,e.type))};t[w4(n)]={self:C4(n,`namespace`,`database`),children:e}}return t}function E4(e,t){return u4({dialect:b4[e],schema:T4(t),defaultSchema:t?.defaultDatabase??void 0,upperCaseKeywords:!0,keywordCompletion:x4[e]})}var D4=(e,t)=>({"&:after":{content:`"${e}"`},color:t,opacity:1}),O4=[GK.theme({"&":{height:`100%`,color:Co.text,backgroundColor:Co.surface,fontSize:Do.xs,borderRadius:Eo.md,border:`1px solid ${Co.borderStrong}`},"&.cm-focused":{outline:`none`,borderColor:Co.primary},".cm-scroller":{fontFamily:Oo.mono,lineHeight:`1.6`,overflow:`auto`},".cm-content":{padding:`10px`,caretColor:Co.text},".cm-line":{padding:`0`},".cm-cursor, .cm-dropCursor":{borderLeftColor:Co.text},".cm-placeholder":{color:Co.faint},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Co.selection},".cm-selectionMatch":{backgroundColor:Co.hover},"&.cm-focused .cm-matchingBracket":{backgroundColor:Co.active,outline:`1px solid ${Co.borderStrong}`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:Co.dangerBg},".cm-panels":{backgroundColor:Co.raised,color:Co.text},".cm-searchMatch":{backgroundColor:Co.active},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Co.selection},".cm-tooltip":{fontFamily:Oo.mono,fontSize:Do.xs,color:Co.text,backgroundColor:Co.raised,border:`1px solid ${Co.borderStrong}`,borderRadius:Eo.lg,boxShadow:`0 8px 24px ${Co.shadow}`,overflow:`hidden`},".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:Oo.mono,maxHeight:`240px`,minWidth:`220px`,padding:`4px`},"& > ul > li":{display:`flex`,alignItems:`center`,padding:`2px 8px 2px 4px`,borderRadius:Eo.sm,lineHeight:`1.6`},"& > ul > li[aria-selected]":{backgroundColor:Co.active,color:Co.text},"& .cm-completionLabel":{color:Co.text},"& .cm-completionMatchedText":{textDecoration:`none`,fontWeight:`700`,color:Co.primary},"& .cm-completionDetail":{marginLeft:`auto`,paddingLeft:`20px`,fontStyle:`normal`,color:Co.faint},"& .cm-completionIcon":{width:`1.6em`,paddingRight:`0`,fontSize:`100%`,fontWeight:`600`,textAlign:`center`,color:Co.faint,opacity:1},"& .cm-completionIcon-namespace":D4(`D`,Co.synKeyword),"& .cm-completionIcon-class":D4(`T`,Co.synFunction),"& .cm-completionIcon-property":D4(`c`,Co.synString),"& .cm-completionIcon-function":D4(`ƒ`,Co.synNumber),"& .cm-completionIcon-keyword":D4(`k`,Co.faint),"& .cm-completionIcon-type":D4(`t`,Co.synType),"& .cm-completionIcon-constant":D4(`a`,Co.muted)}},{dark:!0}),JY(WY.define([{tag:$.keyword,color:Co.synKeyword},{tag:$.typeName,color:Co.synType},{tag:$.standard($.name),color:Co.synFunction},{tag:$.special($.string),color:Co.text},{tag:$.string,color:Co.synString},{tag:[$.number,$.bool,$.null],color:Co.synNumber},{tag:[$.lineComment,$.blockComment],color:Co.synComment,fontStyle:`italic`},{tag:[$.operator,$.punctuation,$.paren,$.squareBracket],color:Co.muted},{tag:$.name,color:Co.text}]))],k4=new OB;function A4(e){return{empty:e.doc.length===0,hasSelection:!e.selection.main.empty}}function j4(e){let t=(0,ko.c)(16),{ref:n,kind:r,schema:i,initialDoc:a,onStatus:o,onDocChange:s,onRun:c}=e,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(a),p;t[0]!==s||t[1]!==c||t[2]!==o?(p={onStatus:o,onDocChange:s,onRun:c},t[0]=s,t[1]=c,t[2]=o,t[3]=p):p=t[3];let m=(0,W.useRef)(p),h;t[4]!==s||t[5]!==c||t[6]!==o?(h=()=>{m.current={onStatus:o,onDocChange:s,onRun:c}},t[4]=s,t[5]=c,t[6]=o,t[7]=h):h=t[7],(0,W.useEffect)(h);let g,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=l.current;if(!e)return;let t=d.current,n=new GK({parent:e,state:t?.state??aV.create({doc:f.current,extensions:[EB.highest(eq.of([{key:`Mod-Enter`,run:()=>(m.current.onRun(),!0)}])),k4.of([]),BZ({icons:!0,maxRenderedOptions:80}),aQ(),yq(),HY(),oX(),CZ(),E1(),eq.of([...kZ,...f1,...h0,...wQ]),GK.lineWrapping,GK.contentAttributes.of({"aria-label":`SQL`,spellcheck:`false`,autocapitalize:`off`,autocorrect:`off`}),Dq(`SELECT * FROM …`),O4,GK.updateListener.of(e=>{e.docChanged&&m.current.onDocChange(e.state.doc.toString()),(e.docChanged||e.selectionSet)&&m.current.onStatus(A4(e.state))})]})});return u.current=n,t&&(n.scrollDOM.scrollTop=t.scrollTop,t.focused&&n.focus()),()=>{d.current={state:n.state,scrollTop:n.scrollDOM.scrollTop,focused:n.hasFocus},n.destroy(),u.current=null}},_=[],t[8]=g,t[9]=_):(g=t[8],_=t[9]),(0,W.useEffect)(g,_);let v,y;t[10]!==r||t[11]!==i?(v=()=>{u.current?.dispatch({effects:k4.reconfigure(E4(r,i))})},y=[r,i],t[10]=r,t[11]=i,t[12]=v,t[13]=y):(v=t[12],y=t[13]),(0,W.useEffect)(v,y);let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>({runnableText:()=>{let e=u.current?.state;if(!e)return``;let{from:t,to:n,empty:r}=e.selection.main;return r?e.doc.toString():e.sliceDoc(t,n)}}),t[14]=b):b=t[14],(0,W.useImperativeHandle)(n,b);let x;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(`div`,{ref:l,className:`x5yr21d`}),t[15]=x):x=t[15],x}function M4(e){let t=(0,ko.c)(16),{result:n}=e,r;t[0]===n.elapsedMs?r=t[1]:(r=(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(pF,{children:n.elapsedMs}),` ms`]}),t[0]=n.elapsedMs,t[1]=r);let i=r;if(n.columns.length>0){let e;t[2]===n.rowCount?e=t[3]:(e=(0,G.jsx)(pF,{children:n.rowCount}),t[2]=n.rowCount,t[3]=e);let r=n.rowCount===1?``:`s`,a;t[4]===n.truncated?a=t[5]:(a=n.truncated?(0,G.jsxs)(G.Fragment,{children:[` `,`(truncated at `,(0,G.jsx)(pF,{children:`1000`}),`)`]}):null,t[4]=n.truncated,t[5]=a);let o;return t[6]!==i||t[7]!==e||t[8]!==r||t[9]!==a?(o=(0,G.jsxs)(G.Fragment,{children:[e,` row`,r,a,i]}),t[6]=i,t[7]=e,t[8]=r,t[9]=a,t[10]=o):o=t[10],o}let a;t[11]===n.affectedRows?a=t[12]:(a=n.affectedRows===void 0?null:(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(pF,{children:n.affectedRows}),` rows affected`]}),t[11]=n.affectedRows,t[12]=a);let o;return t[13]!==i||t[14]!==a?(o=(0,G.jsxs)(G.Fragment,{children:[`OK`,a,i]}),t[13]=i,t[14]=a,t[15]=o):o=t[15],o}var N4=500,P4=``;function F4(e){let t=(0,ko.c)(3),{tab:n}=e,r=Le(M()).data?.find(e=>e.id===n.target.connectionId),i;return t[0]!==r||t[1]!==n?(i=r?(0,G.jsx)(I4,{tab:n,connection:r}):null,t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function I4(e){let t=(0,ko.c)(81),{tab:n,connection:r}=e,i=r.id,{database:a}=n.target,o=F(),c=Bo(),l;t[0]===i?l=t[1]:(l=E(i),t[0]=i,t[1]=l);let u=Le(l),d;t[2]===i?d=t[3]:(d=s(i),t[2]=i,t[3]=d);let f=Le(d),p;t[4]!==a||t[5]!==u.data?(p=u.data&&{...u.data,defaultDatabase:a??u.data.defaultDatabase},t[4]=a,t[5]=u.data,t[6]=p):p=t[6];let m=p,h=a??r.database??P4,_;t[7]!==h||t[8]!==f.data?(_=[...new Set([...h===P4?[]:[h],...f.data??[]])].map(R4),h===P4&&_.unshift({value:P4,label:`No database`}),t[7]=h,t[8]=f.data,t[9]=_):_=t[9];let v;t[10]!==c||t[11]!==n.id?(v=e=>void c.saveDraft(n.id,e),t[10]=c,t[11]=n.id,t[12]=v):v=t[12];let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y={wait:N4,onUnmount:L4},t[13]=y):y=t[13];let b=FF(v,y),x,S;t[14]===b?(x=t[15],S=t[16]):(x=()=>{let e=()=>b.flush();return document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,e)}},S=[b],t[14]=b,t[15]=x,t[16]=S),(0,W.useEffect)(x,S);let C=n.sql.length===0,w;t[17]===C?w=t[18]:(w={empty:C,hasSelection:!1},t[17]=C,t[18]=w);let[T,D]=(0,W.useState)(w),[O,k]=(0,W.useState)(null),A=(0,W.useRef)(null),j;t[19]!==i||t[20]!==o?(j=async e=>{k(e),e.ok&&e.result.columns.length===0&&(await o.invalidateQueries({queryKey:[`tables`,i]}),await o.invalidateQueries({queryKey:[`rows`,i]}),await o.invalidateQueries({queryKey:[`schema`,i]}),await o.invalidateQueries({queryKey:[`sqlSchema`,i]}))},t[19]=i,t[20]=o,t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>k({ok:!1,error:q_(e)}),t[22]=M):M=t[22];let N;t[23]===j?N=t[24]:(N={mutationFn:g,onSuccess:j,onError:M},t[23]=j,t[24]=N);let P=Ti(N),I;t[25]!==i||t[26]!==a||t[27]!==P?(I=()=>{let e=A.current?.runnableText().trim()??``;e&&!P.isPending&&P.mutate({data:{connectionId:i,database:a,sql:e}})},t[25]=i,t[26]=a,t[27]=P,t[28]=I):I=t[28];let L=I,R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(R={ignoreDefaultPrevented:!0},t[29]=R):R=t[29],Zc(`Mod+Enter`,L,R);let z=O?.ok?O.result:null,B;t[30]!==c||t[31]!==n.id?(B=e=>void c.setDatabase(n.id,e||null),t[30]=c,t[31]=n.id,t[32]=B):B=t[32];let V;t[33]!==h||t[34]!==_||t[35]!==B?(V=(0,G.jsx)(`div`,{className:`x16grhtn`,children:(0,G.jsx)(UA,{ariaLabel:`Database`,value:h,options:_,onValueChange:B})}),t[33]=h,t[34]=_,t[35]=B,t[36]=V):V=t[36];let ee;t[37]===u?ee=t[38]:(ee=()=>void u.refetch(),t[37]=u,t[38]=ee);let te;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,G.jsx)(H,{}),t[39]=te):te=t[39];let ne;t[40]!==u.isFetching||t[41]!==ee?(ne=(0,G.jsx)(fF,{label:`Refresh schema for autocomplete`,children:(0,G.jsx)(xy,{variant:`ghost`,icon:!0,"aria-label":`Refresh schema`,disabled:u.isFetching,onClick:ee,children:te})}),t[40]=u.isFetching,t[41]=ee,t[42]=ne):ne=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,G.jsx)(Mj,{children:`⌘↵`}),t[43]=re):re=t[43];let ie=P.isPending||T.empty,ae;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,G.jsx)(pe,{}),t[44]=ae):ae=t[44];let U=P.isPending?`Running…`:T.hasSelection?`Run selection`:`Run`,oe;t[45]!==L||t[46]!==ie||t[47]!==U?(oe=(0,G.jsxs)(xy,{variant:`primary`,onClick:L,disabled:ie,children:[ae,` `,U]}),t[45]=L,t[46]=ie,t[47]=U,t[48]=oe):oe=t[48];let se;t[49]!==ne||t[50]!==oe?(se=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xbbb4fa`,children:[ne,re,oe]}),t[49]=ne,t[50]=oe,t[51]=se):se=t[51];let ce;t[52]!==V||t[53]!==se?(ce=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x5md06r xgt6uh4 x2lah0s`,children:[V,se]}),t[52]=V,t[53]=se,t[54]=ce):ce=t[54];let le;t[55]!==m||t[56]!==r.kind||t[57]!==L||t[58]!==b.maybeExecute||t[59]!==n.sql?(le=(0,G.jsx)(`div`,{className:`xjr6psv xaxbvzv x2lah0s xrskzf1`,children:(0,G.jsx)(j4,{ref:A,kind:r.kind,schema:m,initialDoc:n.sql,onDocChange:b.maybeExecute,onStatus:D,onRun:L})}),t[55]=m,t[56]=r.kind,t[57]=L,t[58]=b.maybeExecute,t[59]=n.sql,t[60]=le):le=t[60];let ue;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,G.jsx)(`span`,{className:`xk50ysn x122w267`,children:`Results`}),t[61]=ue):ue=t[61];let de;t[62]===z?de=t[63]:(de=z?(0,G.jsx)(M4,{result:z}):null,t[62]=z,t[63]=de);let fe;t[64]===de?fe=t[65]:(fe=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x10w6t97 xgt6uh4 x2lah0s xqtwvag x1tviuuy xgwgzc4 x178xt8z x13fuv20 x10gwal6 xso031l x1q0q8m5 x1atvb72`,children:[ue,(0,G.jsx)(`span`,{children:de})]}),t[64]=de,t[65]=fe);let me;t[66]===O?me=t[67]:(me=O&&!O.ok?(0,G.jsx)(`div`,{role:`alert`,className:`xwdmyjr xmjl1bo x1b02387 xqtwvag xb0vdwp x1imhpfg xmkeg23 x1y0btm7 xb1jnos xvjf9rd x126k92a x13faqbe`,children:O.error}):null,t[66]=O,t[67]=me);let he;t[68]===z?he=t[69]:(he=z&&z.columns.length>0?(0,G.jsx)(Tz,{columns:z.columns,rows:z.rows}):null,t[68]=z,t[69]=he);let ge;t[70]===O?ge=t[71]:(ge=O?null:(0,G.jsx)(`div`,{className:`x1a2dy25 xqtwvag x1tviuuy`,children:`Run a query to see results.`}),t[70]=O,t[71]=ge);let _e;t[72]!==me||t[73]!==he||t[74]!==ge?(_e=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:[me,he,ge]}),t[72]=me,t[73]=he,t[74]=ge,t[75]=_e):_e=t[75];let ve;return t[76]!==ce||t[77]!==le||t[78]!==fe||t[79]!==_e?(ve=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:[ce,le,fe,_e]}),t[76]=ce,t[77]=le,t[78]=fe,t[79]=_e,t[80]=ve):ve=t[80],ve}function L4(e){return e.flush()}function R4(e){return{value:e,label:e}}function z4(e){let t=(0,ko.c)(33),{columns:n,onInsert:r,onClose:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={},t[0]=a):a=t[0];let[o,s]=(0,W.useState)(a),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),f;t[1]!==i||t[2]!==r||t[3]!==u||t[4]!==o?(f=async()=>{if(u)return;let e=Object.fromEntries(Object.entries(o).filter(B4));d(!0),l(null);try{await r(e),i()}catch(e){l(q_(e)),d(!1)}},t[1]=i,t[2]=r,t[3]=u,t[4]=o,t[5]=f):f=t[5];let p=f,m;t[6]===i?m=t[7]:(m=e=>!e&&i(),t[6]=i,t[7]=m);let h;t[8]===p?h=t[9]:(h=e=>{e.preventDefault(),p()},t[8]=p,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,G.jsx)(`p`,{className:`x1j6dyjg x1tviuuy x1ghz6dp`,children:`Leave a field empty to use its default (or NULL).`}),t[10]=g):g=t[10];let _;if(t[11]!==n||t[12]!==o){let e;t[14]===o?e=t[15]:(e=e=>(0,G.jsx)(LO,{label:`${e.name} ${e.type}${e.default?` default: ${e.default}`:``}`,children:(0,G.jsx)(UO,{mono:!0,"aria-label":e.name,value:o[e.name]??``,onChange:t=>s({...o,[e.name]:t.target.value})})},e.name),t[14]=o,t[15]=e),_=n.map(e),t[11]=n,t[12]=o,t[13]=_}else _=t[13];let v;t[16]===c?v=t[17]:(v=c?(0,G.jsx)(`div`,{role:`alert`,className:`xfifm61 xb0vdwp x13faqbe`,children:c}):null,t[16]=c,t[17]=v);let y;t[18]===i?y=t[19]:(y=(0,G.jsx)(xy,{type:`button`,onClick:i,children:`Cancel`}),t[18]=i,t[19]=y);let b;t[20]===u?b=t[21]:(b=(0,G.jsx)(xy,{type:`submit`,variant:`primary`,disabled:u,children:`Insert row`}),t[20]=u,t[21]=b);let x;t[22]!==y||t[23]!==b?(x=(0,G.jsxs)(YE,{children:[y,b]}),t[22]=y,t[23]=b,t[24]=x):x=t[24];let S;t[25]!==x||t[26]!==h||t[27]!==_||t[28]!==v?(S=(0,G.jsxs)(`form`,{className:`x78zum5 xdt5ytf x883omv`,onSubmit:h,children:[g,_,v,x]}),t[25]=x,t[26]=h,t[27]=_,t[28]=v,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m?(C=(0,G.jsx)(JE,{open:!0,onOpenChange:m,title:`Add row`,children:S}),t[30]=S,t[31]=m,t[32]=C):C=t[32],C}function B4(e){let[,t]=e;return t!==``}var V4=W.createContext(void 0);function H4(){let e=W.useContext(V4);if(e===void 0)throw Error(Hv(64));return e}var U4=`data-activation-direction`,W4={tabActivationDirection:e=>({[U4]:e})},G4=W.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=W.useRef([]),[f,p]=W.useState(()=>new Map),[m,h]=iO({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=W.useState(()=>new Map),y=W.useRef(void 0),b=W.useCallback(e=>K4(_,e),[_]),[x,S]=W.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=q4(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;J(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=q((e,t)=>{t.activationDirection=q4(m,e,a,_),i?.(e,t),t.isCanceled||h(()=>e)}),A=q((e,t)=>{i?.(e,Wy(t,void 0,void 0,{activationDirection:`none`}))}),j=q((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=W.useCallback(e=>f.get(e),[f]),N=W.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=W.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=W.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=W.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=W.useRef(!u),R=W.useRef(r),z=W.useRef(u),B=W.useRef(!1);J(()=>{if(g)return;function e(e,t){h(()=>e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){B.current&&m!==null&&!y.current?.isConnected&&e(null,ub);return}B.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(z.current=!1),z.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=ub;r?i=db:t&&(i=lb),e(n,i)}else r&&F!=null&&(A(m,db),L.current=!1)},[I,g,A,F,h,_,m]);let V=fy(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:W4});return(0,G.jsx)(V4.Provider,{value:P,children:(0,G.jsx)(Fk,{elementsRef:d,children:V})})});function K4(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function q4(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=K4(r,e),c=K4(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var J4=W.createContext(void 0);function Y4(){let e=W.useContext(J4);if(e===void 0)throw Error(Hv(65));return e}var X4=W.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=H4(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Y4(),{highlightedIndex:v,onHighlightedIndexChange:y}=Wv(),b=yb(o),{compositeProps:x,compositeRef:S,index:C}=ZA({metadata:W.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=W.useRef(!1),E=W.useRef(null),D=q(e=>{E.current?.(),E.current=e?g(e):null});J(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=Wb(Kv(e));if(t&&Y(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=Jv({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=W.useRef(!1),M=W.useRef(!1);function N(e){f(a,Wy(Ky,e.nativeEvent,void 0,{activationDirection:`none`}))}function P(e){w||r||N(e)}function F(e){w||r||h&&(!j.current||M.current)&&N(e)}function I(e){if(w||r)return;j.current=!0,M.current=e.button===0;let t=Kv(e.currentTarget);function n(){j.current=!1,M.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return fy(`button`,e,{state:{disabled:r,active:w,orientation:p,tabActivationDirection:m},ref:[t,k,S,D],props:[x,{role:`tab`,"aria-controls":A,"aria-selected":w,id:b,onClick:P,onFocus:F,onPointerDown:I,[XA]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:W4})}),Z4=`data-index`,Q4={...W4,...Oy},$4=W.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=H4(),p=yb(),{ref:m,index:h}=IA(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=NC(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=W.useRef(null),w=fy(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:xE(!g),[Z4]:h},s],stateAttributesMapping:Q4});return RC({open:g,ref:C,onComplete(){g||y(!1)}}),J(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null}),e3=W.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=H4(),[d,f]=W.useState(0),[p,m]=W.useState(null),h=W.useRef(new Set),g=W.useRef(new Set),_=W.useRef(null);J(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=q(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=q(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=W.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,G.jsx)(J4.Provider,{value:S,children:(0,G.jsx)(oj,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:W4,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:sy})})});function t3(e){let t=(0,ko.c)(13),{value:n,onValueChange:r,items:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(e),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i.map(r3),t[2]=i,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,G.jsx)(e3,{className:`x78zum5 x195vfkc xdqyycr xso031l x1q0q8m5 x1atvb72 x2lah0s`,children:o}),t[4]=o,t[5]=s);let c;t[6]===i?c=t[7]:(c=i.map(n3),t[6]=i,t[7]=c);let l;return t[8]!==a||t[9]!==s||t[10]!==c||t[11]!==n?(l=(0,G.jsxs)(G4,{value:n,onValueChange:a,className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:[s,c]}),t[8]=a,t[9]=s,t[10]=c,t[11]=n,t[12]=l):l=t[12],l}function n3(e){return(0,G.jsx)($4,{value:e.value,className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:e.content},e.value)}function r3(e){return(0,G.jsx)(X4,{value:e.value,className:`x10w6t97 x1awh872 xqtwvag xk50ysn xjbqb8w xc342km xlxy82 x1q0q8m5 x16stqrj x1m6keyf x1tviuuy x1jo8w1h xxbnkst xrf8owv x1qfwjxi x6setmy x1ypdohk x1a2a7pz xn0s4wz x2ssjo2`,children:e.label},e.value)}var i3=200,a3=new Set;function o3(e){let t=(0,ko.c)(172),{connectionId:n,database:r,table:i}=e,a=F(),o;t[0]!==n||t[1]!==r||t[2]!==i?(o=l(n,r,i),t[0]=n,t[1]=r,t[2]=i,t[3]=o):o=t[3];let{data:s}=Ci(o),[c,u]=(0,W.useState)(`data`),[f,p]=(0,W.useState)(0),[m,h]=(0,W.useState)(),[g,v]=(0,W.useState)(``),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={wait:400},t[4]=b):b=t[4];let[S]=LF(g,b),C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C={source:void 0,rows:a3},t[5]=C):C=t[5];let[w,T]=(0,W.useState)(C),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(null),[A,j]=(0,W.useState)(null),M=(0,W.useRef)(null),N;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>M.current?.focus(),t[6]=N):N=t[6],Zc(`Mod+Shift+F`,N);let P,I;t[7]!==n||t[8]!==r||t[9]!==f||t[10]!==m||t[11]!==i||t[12]!==S?(P={connectionId:n,database:r,table:i},I=d({...P,limit:i3,offset:f*i3,orderBy:m,where:S.trim()||void 0}),t[7]=n,t[8]=r,t[9]=f,t[10]=m,t[11]=i,t[12]=S,t[13]=P,t[14]=I):(P=t[13],I=t[14]);let L=I,R;t[15]===L?R=t[16]:(R={...L,placeholderData:me},t[15]=L,t[16]=R);let z=Le(R),B;t[17]!==n||t[18]!==r||t[19]!==a||t[20]!==i?(B=()=>a.invalidateQueries({queryKey:[`rows`,n,r,i]}),t[17]=n,t[18]=r,t[19]=a,t[20]=i,t[21]=B):B=t[21];let V=B,ee;t[22]===V?ee=t[23]:(ee={mutationFn:y,onSuccess:V},t[22]=V,t[23]=ee);let ne=Ti(ee),re;t[24]===V?re=t[25]:(re={mutationFn:x,onSuccess:V},t[24]=V,t[25]=re);let ie=Ti(re),ae;t[26]===V?ae=t[27]:(ae={mutationFn:_,onSuccess:V},t[26]=V,t[27]=ae);let U=Ti(ae),oe;t[28]!==z.data?.result.columns||t[29]!==s.columns?(oe=z.data?.result.columns??s.columns.map(l3),t[28]=z.data?.result.columns,t[29]=s.columns,t[30]=oe):oe=t[30];let se;if(t[31]!==s.columns||t[32]!==oe){let e;t[34]===s.columns?e=t[35]:(e=e=>{let t=s.columns.find(t=>t.name===e.name);return{name:e.name,type:t?.type??e.type,nullable:t?.nullable,isKey:t?.isPrimaryKey}},t[34]=s.columns,t[35]=e),se=oe.map(e),t[31]=s.columns,t[32]=oe,t[33]=se}else se=t[33];let ce=se,le=z.data?.result.rows,ue;t[36]===le?ue=t[37]:(ue=le??[],t[36]=le,t[37]=ue);let fe=ue,pe=w.source===le?w.rows:a3,ge;t[38]===le?ge=t[39]:(ge=e=>T({source:le,rows:e}),t[38]=le,t[39]=ge);let _e=ge,ve=z.data?.total??0,ye=s.editBlockedReason===null,be;t[40]!==ce||t[41]!==s.keyColumns?(be=e=>Object.fromEntries(s.keyColumns.map(t=>[t,e[ce.findIndex(e=>e.name===t)]??null])),t[40]=ce,t[41]=s.keyColumns,t[42]=be):be=t[42];let xe=be,Se;t[43]!==fe||t[44]!==xe||t[45]!==P||t[46]!==ne?(Se=async(e,t,n)=>{let r=fe[e];if(r){j(null);try{await ne.mutateAsync({data:{...P,key:xe(r),changes:{[t.name]:n}}})}catch(e){j(q_(e))}}},t[43]=fe,t[44]=xe,t[45]=P,t[46]=ne,t[47]=Se):Se=t[47];let Ce=Se,we;t[48]===_e?we=t[49]:(we=e=>{p(0),_e(a3),h(t=>t?.column===e?t.direction===`asc`?{column:e,direction:`desc`}:void 0:{column:e,direction:`asc`})},t[48]=_e,t[49]=we);let Te=we,Ee=ve===0?0:f*i3+1,De=f*i3+fe.length,Oe;t[50]===_e?Oe=t[51]:(Oe=e=>{v(e.target.value),p(0),_e(a3)},t[50]=_e,t[51]=Oe);let ke;t[52]!==Oe||t[53]!==g?(ke=(0,G.jsx)(`div`,{className:`x1elwuyh x5w4yej x17fpy1y`,children:(0,G.jsx)(UO,{inputRef:M,mono:!0,"aria-label":`Row filter`,placeholder:`WHERE …`,value:g,onChange:Oe})}),t[52]=Oe,t[53]=g,t[54]=ke):ke=t[54];let Ae;t[55]===V?Ae=t[56]:(Ae=()=>void V(),t[55]=V,t[56]=Ae);let je;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,G.jsx)(H,{}),t[57]=je):je=t[57];let Me;t[58]===Ae?Me=t[59]:(Me=(0,G.jsx)(xy,{icon:!0,variant:`ghost`,"aria-label":`Refresh rows`,onClick:Ae,children:je}),t[58]=Ae,t[59]=Me);let Ne;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,G.jsx)(`div`,{className:`x98rzlu`}),t[60]=Ne):Ne=t[60];let Pe;t[61]!==fe||t[62]!==xe||t[63]!==pe?(Pe=pe.size>0?(0,G.jsxs)(xy,{variant:`danger`,onClick:()=>k([...pe].map(e=>xe(fe[e]??[]))),children:[(0,G.jsx)(We,{}),(0,G.jsxs)(`span`,{children:[`Delete `,(0,G.jsx)(pF,{children:pe.size}),` `,pe.size===1?`row`:`rows`]})]}):null,t[61]=fe,t[62]=xe,t[63]=pe,t[64]=Pe):Pe=t[64];let Fe=!ye,Ie,Re;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=()=>D(!0),Re=(0,G.jsx)(de,{}),t[65]=Ie,t[66]=Re):(Ie=t[65],Re=t[66]);let ze;t[67]===Fe?ze=t[68]:(ze=(0,G.jsxs)(xy,{disabled:Fe,onClick:Ie,children:[Re,` Add row`]}),t[67]=Fe,t[68]=ze);let Be;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Be={0:{className:`xqtwvag x1tviuuy xuxw1ft x19991ni x19jr8i9 x6setmy`},1:{className:`xqtwvag x1tviuuy xuxw1ft x19991ni x19jr8i9 x6setmy xbyyjgo`}},t[69]=Be):Be=t[69];let Ve=Be[!!z.isFetching|0],He;t[70]!==Ee||t[71]!==De?(He=(0,G.jsxs)(pF,{children:[Ee,`–`,De]}),t[70]=Ee,t[71]=De,t[72]=He):He=t[72];let Ue;t[73]===ve?Ue=t[74]:(Ue=(0,G.jsx)(pF,{children:ve}),t[73]=ve,t[74]=Ue);let Ge=z.data?.result.elapsedMs??0,Ke;t[75]===Ge?Ke=t[76]:(Ke=(0,G.jsx)(pF,{children:Ge}),t[75]=Ge,t[76]=Ke);let qe;t[77]!==Ve||t[78]!==He||t[79]!==Ue||t[80]!==Ke?(qe=(0,G.jsxs)(`span`,{...Ve,children:[He,` `,`of `,Ue,` · `,Ke,` ms`]}),t[77]=Ve,t[78]=He,t[79]=Ue,t[80]=Ke,t[81]=qe):qe=t[81];let Je=f===0,Ye;t[82]!==f||t[83]!==_e?(Ye=()=>{p(f-1),_e(a3)},t[82]=f,t[83]=_e,t[84]=Ye):Ye=t[84];let Xe;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,G.jsx)(he,{}),t[85]=Xe):Xe=t[85];let Ze;t[86]!==Je||t[87]!==Ye?(Ze=(0,G.jsx)(xy,{icon:!0,"aria-label":`Previous page`,disabled:Je,onClick:Ye,children:Xe}),t[86]=Je,t[87]=Ye,t[88]=Ze):Ze=t[88];let Qe=De>=ve,$e;t[89]!==f||t[90]!==_e?($e=()=>{p(f+1),_e(a3)},t[89]=f,t[90]=_e,t[91]=$e):$e=t[91];let et;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,G.jsx)(te,{}),t[92]=et):et=t[92];let tt;t[93]!==Qe||t[94]!==$e?(tt=(0,G.jsx)(xy,{icon:!0,"aria-label":`Next page`,disabled:Qe,onClick:$e,children:et}),t[93]=Qe,t[94]=$e,t[95]=tt):tt=t[95];let nt;t[96]!==Ze||t[97]!==tt?(nt=(0,G.jsxs)(`div`,{className:`x78zum5 x1jnr06f`,children:[Ze,tt]}),t[96]=Ze,t[97]=tt,t[98]=nt):nt=t[98];let rt;t[99]!==qe||t[100]!==nt?(rt=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xbbb4fa x2lah0s`,children:[qe,nt]}),t[99]=qe,t[100]=nt,t[101]=rt):rt=t[101];let it;t[102]!==ke||t[103]!==Me||t[104]!==Pe||t[105]!==ze||t[106]!==rt?(it=(0,G.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xbbb4fa xjr6psv xwwqodo x2lah0s xso031l x1q0q8m5 x1atvb72`,children:[ke,Me,Ne,Pe,ze,rt]}),t[102]=ke,t[103]=Me,t[104]=Pe,t[105]=ze,t[106]=rt,t[107]=it):it=t[107];let at;t[108]===s.editBlockedReason?at=t[109]:(at=s.editBlockedReason?(0,G.jsxs)(`div`,{className:`x1t0vds8 xjr6psv xqtwvag x1tviuuy xgwgzc4 xso031l x1q0q8m5 x1atvb72 x2lah0s`,children:[`Read-only: `,s.editBlockedReason]}):null,t[108]=s.editBlockedReason,t[109]=at);let ot;t[110]===A?ot=t[111]:(ot=A?(0,G.jsx)(`div`,{role:`alert`,className:`xwwqodo xjr6psv xqtwvag xb0vdwp x1imhpfg xso031l x1q0q8m5 x1mo5f3e x126k92a x13faqbe x2lah0s`,children:A}):null,t[110]=A,t[111]=ot);let st;t[112]!==z.error||t[113]!==z.isError?(st=z.isError?(0,G.jsx)(`div`,{role:`alert`,className:`xwwqodo xjr6psv xqtwvag xb0vdwp x1imhpfg xso031l x1q0q8m5 x1mo5f3e x126k92a x13faqbe x2lah0s`,children:q_(z.error)}):null,t[112]=z.error,t[113]=z.isError,t[114]=st):st=t[114];let ct;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(ct={0:{className:`x98rzlu x2lwn1j x78zum5 xdt5ytf x19991ni x19jr8i9`},1:{className:`x98rzlu x2lwn1j x78zum5 xdt5ytf x19991ni x19jr8i9 xbyyjgo x47corl x5h36tt`}},t[115]=ct):ct=t[115];let lt=ct[!!z.isFetching|0],ut=ye?Ce:void 0,dt=ye?pe:void 0,ft=ye?_e:void 0,pt;t[116]!==ce||t[117]!==fe||t[118]!==z.isPending||t[119]!==m||t[120]!==ut||t[121]!==dt||t[122]!==ft||t[123]!==Te?(pt=(0,G.jsx)(Tz,{columns:ce,rows:fe,loading:z.isPending,sort:m,onSortChange:Te,onCommit:ut,selected:dt,onSelectedChange:ft}),t[116]=ce,t[117]=fe,t[118]=z.isPending,t[119]=m,t[120]=ut,t[121]=dt,t[122]=ft,t[123]=Te,t[124]=pt):pt=t[124];let mt;t[125]!==lt||t[126]!==pt?(mt=(0,G.jsx)(`div`,{...lt,children:pt}),t[125]=lt,t[126]=pt,t[127]=mt):mt=t[127];let ht;t[128]!==it||t[129]!==at||t[130]!==ot||t[131]!==st||t[132]!==mt?(ht=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:[it,at,ot,st,mt]}),t[128]=it,t[129]=at,t[130]=ot,t[131]=st,t[132]=mt,t[133]=ht):ht=t[133];let gt=ht,_t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,G.jsx)(`thead`,{children:(0,G.jsx)(`tr`,{children:[`Column`,`Type`,`Nullable`,`Key`,`Default`].map(c3)})}),t[134]=_t):_t=t[134];let vt;t[135]===s.columns?vt=t[136]:(vt=s.columns.map(s3),t[135]=s.columns,t[136]=vt);let yt;t[137]===vt?yt=t[138]:(yt=(0,G.jsx)(`div`,{className:`xysyzu8 xmjl1bo`,children:(0,G.jsxs)(`table`,{className:`x1mwwwfo xqtwvag`,children:[_t,(0,G.jsx)(`tbody`,{children:vt})]})}),t[137]=vt,t[138]=yt);let bt=yt,xt;t[139]===r?xt=t[140]:(xt=(0,G.jsxs)(`span`,{className:`x1tviuuy`,children:[r,` /`]}),t[139]=r,t[140]=xt);let St;t[141]===i?St=t[142]:(St=(0,G.jsx)(`span`,{className:`x1s688f`,children:i}),t[141]=i,t[142]=St);let Ct;t[143]!==xt||t[144]!==St?(Ct=(0,G.jsxs)(`div`,{className:`x78zum5 x17d4w8g x5md06r xgt6uh4 x2lah0s xkh2ocl x6s0dn4 xvj2dgp`,children:[xt,St]}),t[143]=xt,t[144]=St,t[145]=Ct):Ct=t[145];let wt;t[146]===gt?wt=t[147]:(wt={value:`data`,label:`Data`,content:gt},t[146]=gt,t[147]=wt);let Tt;t[148]===bt?Tt=t[149]:(Tt={value:`structure`,label:`Structure`,content:bt},t[148]=bt,t[149]=Tt);let Et;t[150]!==wt||t[151]!==Tt?(Et=[wt,Tt],t[150]=wt,t[151]=Tt,t[152]=Et):Et=t[152];let Dt;t[153]!==Et||t[154]!==c?(Dt=(0,G.jsx)(t3,{value:c,onValueChange:u,items:Et}),t[153]=Et,t[154]=c,t[155]=Dt):Dt=t[155];let Ot;t[156]!==E||t[157]!==ie||t[158]!==P||t[159]!==s.columns?(Ot=E?(0,G.jsx)(z4,{columns:s.columns,onClose:()=>D(!1),onInsert:async e=>{await ie.mutateAsync({data:{...P,values:e}})}}):null,t[156]=E,t[157]=ie,t[158]=P,t[159]=s.columns,t[160]=Ot):Ot=t[160];let kt;t[161]!==r||t[162]!==P||t[163]!==O||t[164]!==U||t[165]!==i?(kt=O?(0,G.jsx)(XE,{title:`Delete rows`,message:(0,G.jsxs)(G.Fragment,{children:[`Delete `,(0,G.jsx)(pF,{children:O.length}),` selected row`,O.length===1?``:`s`,` from `,r,`.`,i,`? This cannot be undone.`]}),confirmLabel:`Delete rows`,busy:U.isPending,onCancel:()=>k(null),onConfirm:async()=>{j(null);try{await U.mutateAsync({data:{...P,keys:O}})}catch(e){j(q_(e))}k(null)}}):null,t[161]=r,t[162]=P,t[163]=O,t[164]=U,t[165]=i,t[166]=kt):kt=t[166];let At;return t[167]!==Ct||t[168]!==Dt||t[169]!==Ot||t[170]!==kt?(At=(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu x2lwn1j`,children:[Ct,Dt,Ot,kt]}),t[167]=Ct,t[168]=Dt,t[169]=Ot,t[170]=kt,t[171]=At):At=t[171],At}function s3(e){return(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`td`,{className:`x1t0vds8 xjr6psv xso031l x1q0q8m5 x1atvb72`,children:e.name}),(0,G.jsx)(`td`,{className:`x1t0vds8 xjr6psv xso031l x1q0q8m5 x1atvb72`,children:e.type}),(0,G.jsx)(`td`,{className:`x1t0vds8 xjr6psv xso031l x1q0q8m5 x1atvb72`,children:e.nullable?`yes`:`no`}),(0,G.jsx)(`td`,{className:`x1t0vds8 xjr6psv xso031l x1q0q8m5 x1atvb72 x1tviuuy`,children:e.isPrimaryKey?(0,G.jsx)(`span`,{role:`img`,"aria-label":`Primary key`,children:(0,G.jsx)(ke,{})}):null}),(0,G.jsx)(`td`,{className:`x1t0vds8 xjr6psv xso031l x1q0q8m5 x1atvb72`,children:e.default??``})]},e.name)}function c3(e){return(0,G.jsx)(`th`,{className:`xdpxx8g x1t0vds8 xjr6psv x1tviuuy xk50ysn xso031l x1q0q8m5 x1orbg20`,children:e},e)}function l3(e){return{name:e.name,type:e.type}}var u3={table:{icon:Ke,title:e=>e.target.table,detail:(e,{connection:t})=>`${t?.name??`Deleted connection`} / ${e.target.database}.${e.target.table}`,duplicable:!1,render:e=>(0,G.jsx)(o3,{connectionId:e.target.connectionId,database:e.target.database,table:e.target.table})},sql:{icon:re,title:e=>`SQL ${e.target.serial}`,detail:(e,{connection:t})=>`${t?.name??`Deleted connection`} / ${e.target.database??t?.database??`default database`}`,duplicable:!0,render:e=>(0,G.jsx)(F4,{tab:e})}},d3=e=>u3[e.target.kind],f3=4,p3=2,m3={tab:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,kZKoxP:`x10w6t97`,kUk6DE:`x1sz3e5v`,k7Eaqz:`x1rp7rr8`,kE3dHu:`x1lqa7cf`,kpe85a:`x1ug7bdz`,kGuDYH:`xvj2dgp`,kMwMTN:`x1tviuuy`,kIxVMA:`xp8sth8`,ksF3WI:`x8qswk9`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x9r1u3d`,kt9PQ7:`x1qhh985`,kWkggS:`xjbqb8w x1sxlxsz`,k1ekBW:`x15406qy`,kIyJzY:`x19jr8i9`,kAMwcw:`x6setmy`,kkrTdU:`xt0e3qv`,kfSwDN:`x87ps6o`,kFalU9:`x1bblx7b`,kI3sdo:`x1a2a7pz xn0s4wz`,kInvED:`x1g40iwv`,$$css:!0},tabActive:{kMwMTN:`x122w267`,kWkggS:`x185or1n`,kVAM5u:`xpa2s8g`,k1ekBW:`x13b0p5u`,$$css:!0},hue:e=>[{"--xm54oyi":e==null?e:`xyynxod`,$$css:!0},{"--x---xm54oyi":e??void 0}],tabTint:{kWkggS:`xxhzbed x1jw1774`,$$css:!0},tabTintActive:{kWkggS:`x1ke9jqs`,$$css:!0},tabDragging:{kY2c9j:`xhtitgo`,kWkggS:`x14fh20`,kGVxlE:`xx50l81`,kkrTdU:`xi9pz9s`,k1ekBW:`x13b0p5u`,$$css:!0}},h3={"x-default-marker":`x-default-marker`,$$css:!0};function g3(){let e=(0,ko.c)(26),{tabs:t}=Lo(),n=Ro(),r=zo(),i=Bo(),a=Le(M()).data??[],o=Le(He()).data??[],[s,c]=(0,W.useState)(null),l=(0,W.useRef)(null),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new Map,e[0]=u):u=e[0];let d=(0,W.useRef)(u),f=(0,W.useRef)(null),p;e[1]===n?p=e[2]:(p=()=>{n&&d.current.get(n.id)?.scrollIntoView({block:`nearest`,inline:`nearest`})},e[1]=n,e[2]=p);let m=n?.id,h;e[3]!==m||e[4]!==t.length?(h=[m,t.length],e[3]=m,e[4]=t.length,e[5]=h):h=e[5],(0,W.useEffect)(p,h);let g=(e,t)=>{let n=e.slots[e.index];n&&e.slots.forEach((r,i)=>{let a=d.current.get(r.id);if(!a)return;let o=0;i===e.index?o=t:i<e.index&&i>=e.target?o=n.width+p3:i>e.index&&i<=e.target&&(o=-(n.width+p3)),a.style.transform=o===0?``:`translateX(${o}px)`})},_=(e,r,a)=>{e.button===0&&(n?.id!==r.id&&i.activate(r.id),e.currentTarget.setPointerCapture(e.pointerId),f.current={id:r.id,index:a,pointerId:e.pointerId,startX:e.clientX,startScroll:l.current?.scrollLeft??0,slots:t.map(e=>{let t=d.current.get(e.id);return{id:e.id,left:t?.offsetLeft??0,width:t?.offsetWidth??0}}),moved:!1,target:a})},v=e=>{let t=f.current,n=t?.slots[t.index],r=t?.slots[0],i=t?.slots.at(-1);if(!t||!n||!r||!i||e.pointerId!==t.pointerId)return;let a=e.clientX-t.startX+((l.current?.scrollLeft??0)-t.startScroll);if(!t.moved){if(Math.abs(a)<f3)return;t.moved=!0,c(t.id)}let o=Math.min(Math.max(a,r.left-n.left),i.left+i.width-(n.left+n.width)),s=n.left+n.width/2+o;t.target=t.slots.filter(e=>e.id!==t.id&&e.left+e.width/2<s).length,g(t,o)},y=e=>{let n=f.current;if(!n||e.pointerId!==n.pointerId||(f.current=null,c(null),!n.moved))return;for(let e of d.current.values())e.style.transform=``;if(n.target===n.index)return;let r=t.map(S3);r.splice(n.index,1),r.splice(n.target,0,n.id),i.reorder(r)},b;e[6]!==i||e[7]!==t?(b=(e,n)=>{let r=t.filter(t=>t.id!==e.id).map(x3),a=t.slice(n+1).map(b3),o=e.target.kind===`sql`?{...e,target:e.target}:null;return[{label:`Close`,hint:`⌥W`,onSelect:()=>void i.close([e.id])},...r.length>0?[{label:`Close others`,onSelect:()=>void i.close(r,e.id)}]:[],...a.length>0?[{label:`Close to the right`,onSelect:()=>void i.close(a,e.id)}]:[],{label:`Close all`,onSelect:()=>void i.close(t.map(y3))},...o&&d3(e).duplicable?[{type:`separator`},{label:`Duplicate`,onSelect:()=>void i.duplicate(o)}]:[]]},e[6]=i,e[7]=t,e[8]=b):b=e[8];let x=b,S;e[9]!==i||e[10]!==r?(S=()=>{r&&i.openSql(r)},e[9]=i,e[10]=r,e[11]=S):S=e[11];let C=S,w=e=>{e.deltaX===0&&l.current&&(l.current.scrollLeft=l.current.scrollLeft+e.deltaY)},T=t.map((e,t)=>{let r=a.find(t=>t.id===e.target.connectionId),c=o.find(e=>e.id===r?.folderId),l=d3(e),u=l.icon,f=l.title(e,{connection:r}),p=e.id===n?.id;return(0,G.jsx)(BP,{entries:x(e,t),children:(0,G.jsx)(fF,{label:`${f} · ${l.detail(e,{connection:r})}`,hint:t<9?(0,G.jsx)(Mj,{children:`⌥${t+1}`}):void 0,children:(0,G.jsxs)(`div`,{role:`tab`,"aria-selected":p,tabIndex:p?0:-1,ref:t=>(t&&d.current.set(e.id,t),()=>{d.current.delete(e.id)}),...Fo(m3.tab,c&&m3.hue(H_[c.color]),c&&m3.tabTint,p&&m3.tabActive,c&&p&&m3.tabTintActive,s===e.id&&m3.tabDragging,h3),onPointerDown:n=>_(n,e,t),onPointerMove:v,onPointerUp:y,onPointerCancel:y,onMouseDown:v3,onAuxClick:t=>{t.button===1&&i.close([e.id])},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i.activate(e.id))},children:[(0,G.jsx)(`span`,{className:`x78zum5 x1tviuuy x2lah0s`,children:(0,G.jsx)(u,{})}),(0,G.jsx)(`span`,{className:`xeuugli x1f0l55g x2lah0s xb3r6kr xlyipyv xuxw1ft xk50ysn`,children:f}),(0,G.jsx)(`span`,{className:`xeuugli x1bcm92b xb3r6kr xlyipyv xuxw1ft xqtwvag x1tviuuy`,children:r?.name??`?`}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Close ${f}`,tabIndex:-1,...{0:{className:`x78zum5 x6s0dn4 xl56j7k x1xp8n7a xmix8c7 x8x9d4c x1717udv x2lah0s xc342km xn7wf0q x1tviuuy x1ypdohk xjbqb8w x1sp8090 x1hc1fzr x4fpvau x7stcvd x1j36eff x1nxt06a x1a2a7pz xn0s4wz`},1:{className:`x78zum5 x6s0dn4 xl56j7k x1xp8n7a xmix8c7 x8x9d4c x1717udv x2lah0s xc342km xn7wf0q x1tviuuy x1ypdohk xjbqb8w x1sp8090 x1a2a7pz xn0s4wz x1hc1fzr`}}[!!p|0],onPointerDown:_3,onClick:t=>{t.stopPropagation(),i.close([e.id])},children:(0,G.jsx)(De,{})})]})})},e.id)}),E;e[12]===T?E=e[13]:(E=(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Open tabs`,className:`x1n2onr6 x78zum5 x195vfkc xuk3077 x5yr21d`,children:T}),e[12]=T,e[13]=E);let D;e[14]!==l||e[15]!==E||e[16]!==w?(D=(0,G.jsx)(`div`,{ref:l,className:`xkz0k9k xeuugli xw2csxc x10wlt62 x1rohswg`,onWheel:w,children:E}),e[14]=l,e[15]=E,e[16]=w,e[17]=D):D=e[17];let O;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,G.jsx)(Mj,{children:`⌥T`}),e[18]=O):O=e[18];let k=!r,A;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,G.jsx)(de,{}),e[19]=A):A=e[19];let j;e[20]!==C||e[21]!==k?(j=(0,G.jsx)(`div`,{className:`x78zum5 x6s0dn4 xu7byfh x2lah0s`,children:(0,G.jsx)(fF,{label:`New SQL tab`,hint:O,children:(0,G.jsx)(xy,{variant:`ghost`,icon:!0,small:!0,"aria-label":`New SQL tab`,disabled:k,onClick:C,children:A})})}),e[20]=C,e[21]=k,e[22]=j):j=e[22];let N;return e[23]!==D||e[24]!==j?(N=(0,G.jsxs)(`div`,{className:`x78zum5 x1qjc9v5 xc9qbxq x2lah0s x1peleaf xgwgzc4 xpgesz`,children:[D,j]}),e[23]=D,e[24]=j,e[25]=N):N=e[25],N}function _3(e){return e.stopPropagation()}function v3(e){e.button===1&&e.preventDefault()}function y3(e){return e.id}function b3(e){return e.id}function x3(e){return e.id}function S3(e){return e.id}function C3(e){let t=(0,ko.c)(10),{tab:n}=e,r;t[0]===n.id?r=t[1]:(r=()=>n.id,t[0]=n.id,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(Ao,{}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=d3(n).render(n),t[3]=n,t[4]=a);let o;t[5]===a?o=t[6]:(o=(0,G.jsx)(W.Suspense,{fallback:i,children:a}),t[5]=a,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,G.jsx)(`div`,{role:`tabpanel`,className:`x78zum5 xdt5ytf x98rzlu x2lwn1j xeuugli`,children:(0,G.jsx)(ji,{getResetKey:r,errorComponent:w3,children:o})}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function w3(e){let{error:t}=e;return(0,G.jsx)(Ie,{title:`Could not open tab`,hint:q_(t),danger:!0})}function T3(){let e=(0,ko.c)(5),{tabs:t}=Lo(),n=Ro(),r;if(e[0]!==n?.id||e[1]!==t){let i;e[3]===n?.id?i=e[4]:(i=e=>(0,G.jsx)(W.Activity,{mode:e.id===n?.id?`visible`:`hidden`,children:(0,G.jsx)(C3,{tab:e})},e.id),e[3]=n?.id,e[4]=i),r=t.map(i),e[0]=n?.id,e[1]=t,e[2]=r}else r=e[2];return r}var E3=[1,2,3,4,5,6,7,8,9];function D3(){let e=(0,ko.c)(44),t=Lo(),n=Ro(),r=zo(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=M(),e[0]=i):i=e[0];let a=Le(i),o=Bo(),s;e[1]!==a.data||e[2]!==r?(s=a.data?.find(e=>e.id===r),e[1]=a.data,e[2]=r,e[3]=s):s=e[3];let c=s,l;e[4]!==o||e[5]!==n||e[6]!==t.activeTabId?(l=()=>{n&&t.activeTabId!==n.id&&o.markActive(n.id)},e[4]=o,e[5]=n,e[6]=t.activeTabId,e[7]=l):l=e[7],(0,W.useEffect)(l);let{tabs:u}=t,d;e[8]!==o||e[9]!==n?.id||e[10]!==u?(d=e=>{let t=Math.max(u.findIndex(e=>e.id===n?.id),0),r=u.at((t+e)%u.length);r&&o.activate(r.id)},e[8]=o,e[9]=n?.id,e[10]=u,e[11]=d):d=e[11];let f=d,p;e[12]!==o||e[13]!==c?(p={hotkey:`Alt+[KeyT]`,callback:()=>{c&&o.openSql(c.id)}},e[12]=o,e[13]=c,e[14]=p):p=e[14];let m;e[15]!==o||e[16]!==n?(m={hotkey:`Alt+[KeyW]`,callback:()=>{n&&o.close([n.id])}},e[15]=o,e[16]=n,e[17]=m):m=e[17];let h;e[18]===f?h=e[19]:(h={hotkey:`Alt+[BracketRight]`,callback:()=>f(1)},e[18]=f,e[19]=h);let g;e[20]===f?g=e[21]:(g={hotkey:`Alt+[BracketLeft]`,callback:()=>f(-1)},e[20]=f,e[21]=g);let _;if(e[22]!==o||e[23]!==p||e[24]!==m||e[25]!==h||e[26]!==g||e[27]!==u){let t;e[29]!==o||e[30]!==u?(t=e=>({hotkey:`Alt+[Digit${e}]`,callback:()=>{let t=u[e-1];t&&o.activate(t.id)}}),e[29]=o,e[30]=u,e[31]=t):t=e[31],_=[p,m,h,g,...E3.map(t)],e[22]=o,e[23]=p,e[24]=m,e[25]=h,e[26]=g,e[27]=u,e[28]=_}else _=e[28];let v;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(v={ignoreInputs:!1},e[32]=v):v=e[32],Xc(_,v);let y;e[33]!==n||e[34]!==c?(y=c?(0,G.jsx)(BF,{connection:c,activeTable:n?.target.kind===`table`?n.target:null},c.id):null,e[33]=n,e[34]=c,e[35]=y):y=e[35];let b;e[36]===u.length?b=e[37]:(b=u.length>0?(0,G.jsx)(g3,{}):null,e[36]=u.length,e[37]=b);let x;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsxs)(`div`,{className:`x98rzlu x2lwn1j x78zum5 xdt5ytf`,children:[(0,G.jsx)(T3,{}),(0,G.jsx)(eo,{})]}),e[38]=x):x=e[38];let S;e[39]===b?S=e[40]:(S=(0,G.jsxs)(`div`,{className:`x98rzlu xeuugli x78zum5 xdt5ytf x5yr21d`,children:[b,x]}),e[39]=b,e[40]=S);let C;return e[41]!==y||e[42]!==S?(C=(0,G.jsxs)(`main`,{className:`x98rzlu xeuugli x78zum5 x5yr21d`,children:[y,S]}),e[41]=y,e[42]=S,e[43]=C):C=e[43],C}function O3(){let e=(0,ko.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:k3},e[0]=t):t=e[0];let n=uo(t),r=wi()>0;if(!n&&!r)return null;let i;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading`,className:`xixxii4 x13vifvy xu96u03 x3m8u43 x36qwtl xb3r6kr x47corl xfo81ep xqcmdr3 x12l1aco xmmqq2k xskzprw`,children:(0,G.jsx)(`div`,{className:`xxljpkc x5yr21d xq83s4c xr9n2wq xr7ufhj x4hg4is xa4qsjk`})}),e[1]=i):i=e[1],i}function k3(e){return e.status===`pending`}var A3=`/assets/styles-D3kk8PAA.css`,j3=`modulepreload`,M3=function(e){return`/`+e},N3={},P3=function(e){return e.pathname.endsWith(`.css`)},F3=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},I3=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=M3(t,n);let r=s(t),i=P3(r);return F3(N3,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:j3,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}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)})},L3=Ba()({head:()=>({meta:[{charSet:`utf-8`},{name:`viewport`,content:`width=device-width, initial-scale=1`},{title:`db-player`}],links:[{rel:`stylesheet`,href:A3}]}),loader:async({context:e})=>{let[t,n]=await Promise.all([_j(),el(),e.queryClient.ensureQueryData(He()),e.queryClient.ensureQueryData(M()),e.queryClient.ensureQueryData(i())]);return{theme:t,layout:n}},component:R3});function R3(){let{theme:e,layout:t}=L3.useLoaderData();return(0,W.useEffect)(()=>{},[]),(0,G.jsxs)(`html`,{lang:`en`,"data-theme":e===`system`?void 0:e,...Fo(e===`light`&&wo,e===`dark`&&To),children:[(0,G.jsx)(`head`,{children:(0,G.jsx)(_o,{})}),(0,G.jsxs)(`body`,{className:`x134rb1s x185or1n x122w267`,children:[(0,G.jsx)(rl,{initial:t,children:(0,G.jsxs)(dF,{children:[(0,G.jsx)(O3,{}),(0,G.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1dr59a3 xb3r6kr`,children:[(0,G.jsx)(vF,{}),(0,G.jsxs)(`div`,{className:`x98rzlu x2lwn1j x78zum5`,children:[(0,G.jsx)(_F,{}),(0,G.jsx)(D3,{})]})]})]})}),(0,G.jsx)(yo,{})]})]})}var z3=Ua(`/`)({beforeLoad:async({context:e})=>{let{activeTabId:t}=await e.queryClient.ensureQueryData(i());if(t)throw C({to:`/t/$tabId`,params:{tabId:t}})},component:Wa(()=>I3(()=>import(`./routes-_dAU0q9L.js`),__vite__mapDeps([0,1,2])),`component`)}),B3=Ua(`/c/$connectionId`)({loader:({context:e,params:t})=>e.queryClient.prefetchQuery(s(t.connectionId)),component:Wa(()=>I3(()=>import(`./c._connectionId-BAPOAiu0.js`),__vite__mapDeps([3,2,1])),`component`)}),V3=Ua(`/t/$tabId`)({pendingMs:1/0,beforeLoad:async({context:e,params:t})=>{if(!(await e.queryClient.ensureQueryData(i())).tabs.some(e=>e.id===t.tabId))throw C({to:`/`})},loader:async({context:e,params:t})=>{let n=e.queryClient.getQueryData(i().queryKey)?.tabs.find(e=>e.id===t.tabId);if(!n)return;let{target:r}=n;await Promise.all([e.queryClient.prefetchQuery(s(r.connectionId)),r.kind===`table`?e.queryClient.prefetchQuery(l(r.connectionId,r.database,r.table)):void 0])},component:Wa(()=>I3(()=>import(`./t._tabId-DJ7LAi8J.js`),[]),`component`)}),H3=Ua(`/c/$connectionId/sql`)({beforeLoad:async({context:e,params:t,preload:n})=>{if(n)return;let r=(await e.queryClient.ensureQueryData(i())).tabs.find(e=>e.target.kind===`sql`&&e.target.connectionId===t.connectionId);if(r)throw C({to:`/t/$tabId`,params:{tabId:r.id},replace:!0});let a=await Je({data:{target:{kind:`sql`,connectionId:t.connectionId,database:null}}});throw e.queryClient.setQueryData(i().queryKey,a.workspace),C({to:`/t/$tabId`,params:{tabId:a.tabId},replace:!0})}}),U3=Ua(`/c/$connectionId/$database/$table`)({beforeLoad:async({context:e,params:t,preload:n})=>{if(n)return;let{workspace:r,tabId:a}=await Je({data:{target:{kind:`table`,...t}}});throw e.queryClient.setQueryData(i().queryKey,r),C({to:`/t/$tabId`,params:{tabId:a},replace:!0})}}),W3=z3.update({id:`/`,path:`/`,getParentRoute:()=>L3}),G3=B3.update({id:`/c/$connectionId`,path:`/c/$connectionId`,getParentRoute:()=>L3}),K3=V3.update({id:`/t/$tabId`,path:`/t/$tabId`,getParentRoute:()=>L3}),q3={CConnectionIdSqlRoute:H3.update({id:`/sql`,path:`/sql`,getParentRoute:()=>G3}),CConnectionIdDatabaseTableRoute:U3.update({id:`/$database/$table`,path:`/$database/$table`,getParentRoute:()=>G3})},J3={IndexRoute:W3,CConnectionIdRoute:G3._addFileChildren(q3),TTabIdRoute:K3},Y3=L3._addFileChildren(J3);function X3(){let e=new Si({defaultOptions:{queries:{staleTime:15e3,refetchOnWindowFocus:!1}}}),t=oo({routeTree:Y3,context:{queryClient:e},scrollRestoration:!0,defaultPreload:`intent`,defaultPendingMs:200,defaultPendingMinMs:300,defaultPendingComponent:Ao});return So({router:t,queryClient:e}),t}async function Z3(){let e=await X3(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(pi),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:``,serializationAdapters:t}),e.stores.ids.get().length||await Zr(e),e}var Q3=Z3;function $3(){return Q3().finally(()=>window.$_TSR?.h())}var e6;function t6(){return e6||=$3(),(0,G.jsx)(ki,{promise:e6,children:e=>(0,G.jsx)(lo,{router:e})})}var n6=et();(0,W.startTransition)(()=>{(0,n6.hydrateRoot)(document,(0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(t6,{})}))});export{KA as n,xy as r,B3 as t};
|