yamlite 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/sqlite.d.mts +1 -1
- package/dist/browser/sqlite.mjs +7 -3
- package/dist/ui/assets/{ErdView-DoSS_2hC.js → ErdView-Cv4lBB9J.js} +1 -1
- package/dist/ui/assets/{MarkdownField-DGK9weUB.js → MarkdownField-UKgTcG0X.js} +1 -1
- package/dist/ui/assets/{PageView-BNleODcZ.js → PageView-SFpedZG6.js} +1 -1
- package/dist/ui/assets/index-BnlDexUD.js +125 -0
- package/dist/ui/assets/index-BwkTtzmh.css +2 -0
- package/dist/ui/assets/{load-DvgVYICA.js → load-S46Mj3YT.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/ui-embed/{PageView-Cpq5JtTW.js → PageView-BzCYlXPg.js} +1 -1
- package/dist/ui-embed/embed.js +2958 -2988
- package/dist/ui-embed/{pageFrame-Dm62WvvT.js → pageFrame-CFoU6UjD.js} +850 -817
- package/dist/ui-embed/style.css +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/index-rdl0LZp6.css +0 -2
- package/dist/ui/assets/index-yVyR96tO.js +0 -125
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./MarkdownField-DGK9weUB.js","./rolldown-runtime-XKyaHtl9.js","./theme-CMaLONsO.js","./PageView-BNleODcZ.js","./ErdView-DoSS_2hC.js","./ErdView-DLioOiRN.css","./load-DvgVYICA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{C as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./theme-CMaLONsO.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var k=`yamlite-locale`;r(`custom-storage`,{getLocale:()=>{try{return localStorage.getItem(k)??void 0}catch{return}},setLocale:e=>{try{localStorage.setItem(k,e)}catch{}}});var A=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}}}})),j=n(((e,t)=>{t.exports=A()})),M=n((e=>{var t=j(),n=a(),r=D();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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(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 c(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 l(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 u(e){if(s(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=s(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 o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return u(a),e;if(o===r)return u(a),t;o=o.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=o;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=o;break}if(l===r){c=!0,r=a,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=a;break}if(l===r){c=!0,r=o,n=a;break}l=l.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 f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(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)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(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 h(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 g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(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)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(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`),O=Symbol.for(`react.transitional.element`),k=Symbol.for(`react.portal`),A=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),N=Symbol.for(`react.profiler`),P=Symbol.for(`react.consumer`),ee=Symbol.for(`react.context`),F=Symbol.for(`react.forward_ref`),I=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case A:return`Fragment`;case N:return`Profiler`;case M:return`StrictMode`;case I:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case k:return`Portal`;case ee:return e.displayName||`Context`;case P:return(e._context.displayName||`Context`)+`.Consumer`;case F:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,L=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],_e=-1;function ve(e){return{current:e}}function ye(e){0>_e||(e.current=ge[_e],ge[_e]=null,_e--)}function be(e,t){_e++,ge[_e]=e.current,e.current=t}var xe=ve(null),Se=ve(null),Ce=ve(null),we=ve(null);function Te(e,t){switch(be(Ce,t),be(Se,e),be(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Cp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Cp(t),e=wp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ye(xe),be(xe,e)}function Ee(){ye(xe),ye(Se),ye(Ce)}function De(e){var t=e.memoizedState;t!==null&&(bh._currentValue=t.memoizedState,be(we,e)),t=xe.current;var n=wp(t,e.type);t!==n&&(be(Se,e),be(xe,n))}function Oe(e){Se.current===e&&(ye(xe),ye(Se)),we.current===e&&(ye(we),bh._currentValue=he)}var ke,Ae;function je(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+ke+e+Ae}var Me=!1;function Ne(e,t){if(!e||Me)return``;Me=!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{Me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?je(n):``}function Pe(e,t){switch(e.tag){case 26:case 27:case 5:return je(e.type);case 16:return je(`Lazy`);case 13:return e.child!==t&&t!==null?je(`Suspense Fallback`):je(`Suspense`);case 19:return je(`SuspenseList`);case 0:case 15:return Ne(e.type,!1);case 11:return Ne(e.type.render,!1);case 1:return Ne(e.type,!0);case 31:return je(`Activity`);case 30:return je(`ViewTransition`);default:return``}}function Fe(e){try{var t=``,n=null;do t+=Pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var Ie=Object.prototype.hasOwnProperty,Le=t.unstable_scheduleCallback,Re=t.unstable_cancelCallback,ze=t.unstable_shouldYield,Be=t.unstable_requestPaint,Ve=t.unstable_now,He=t.unstable_getCurrentPriorityLevel,Ue=t.unstable_ImmediatePriority,We=t.unstable_UserBlockingPriority,Ge=t.unstable_NormalPriority,Ke=t.unstable_LowPriority,qe=t.unstable_IdlePriority,Je=t.log,Ye=t.unstable_setDisableYieldValue,Xe=null,Ze=null;function Qe(e){if(typeof Je==`function`&&Ye(e),Ze&&typeof Ze.setStrictMode==`function`)try{Ze.setStrictMode(Xe,e)}catch{}}var $e=Math.clz32?Math.clz32:nt,et=Math.log,tt=Math.LN2;function nt(e){return e>>>=0,e===0?32:31-(et(e)/tt|0)|0}var rt=256,it=262144,at=4194304;function ot(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 st(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=ot(n))):i=ot(o):i=ot(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ot(n))):i=ot(o)):i=ot(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 ct(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function lt(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-$e(n),i=1<<r;t|=e[r],n&=~i}return t}function ut(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 dt(){var e=at;return at<<=1,!(at&62914560)&&(at=4194304),e}function ft(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function pt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mt(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-$e(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&&ht(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ht(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-$e(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function gt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-$e(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function _t(e,t){var n=t&-t;return n=n&42?1:vt(n),(n&(e.suspendedLanes|t))===0?n:0}function vt(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 yt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function bt(){var e=me.p;return e===0?(e=window.event,e===void 0?32:Ih(e.type)):e}function xt(e,t){var n=me.p;try{return me.p=e,t()}finally{me.p=n}}var St=Math.random().toString(36).slice(2),Ct=`__reactFiber$`+St,wt=`__reactProps$`+St,Tt=`__reactContainer$`+St,Et=`__reactEvents$`+St,Dt=`__reactListeners$`+St,Ot=`__reactHandles$`+St,kt=`__reactResources$`+St,At=`__reactMarker$`+St,jt=`__reactLoad$`+St;function Mt(e){delete e[Ct],delete e[wt],delete e[Dt],delete e[Ot]}function Nt(e){var t;if(t=e[Ct])return t;for(var n=e.parentNode;n;){if(t=n[Tt]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Tm(e);e!==null;){if(n=e[Ct])return n;e=Tm(e)}return t}e=n,n=e.parentNode}return null}function Pt(e){if(e=e[Ct]||e[Tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function It(e){var t=e[kt];return t||=e[kt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Lt(e){e[At]=!0}function Rt(e){e[jt]=void 0}var zt=new Set,Bt={};function Vt(e,t){Ht(e,t),Ht(e+`Capture`,t)}function Ht(e,t){for(Bt[e]=t,e=0;e<t.length;e++)zt.add(t[e])}var Ut=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]*$`),Wt={},Gt={};function Kt(e){return Ie.call(Gt,e)?!0:Ie.call(Wt,e)?!1:Ut.test(e)?Gt[e]=!0:(Wt[e]=!0,!1)}var qt=!1;function Jt(){var e=qt;return qt=!1,e}function Yt(e,t,n){if(Kt(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 Xt(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 Zt(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 Qt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function $t(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function en(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 tn(e){if(!e._valueTracker){var t=$t(e)?`checked`:`value`;e._valueTracker=en(e,t,``+e[t])}}function nn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=$t(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var rn=/[\n"\\]/g;function an(e){return e.replace(rn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function on(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=``+Qt(t)):e.value!==``+Qt(t)&&(e.value=``+Qt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):cn(e,Qt(n)):o===`number`&&e.value==t?cn(e,Qt(e.value)):cn(e,Qt(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=``+Qt(s):e.removeAttribute(`name`)}function sn(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)){tn(e);return}n=n==null?``:``+Qt(n),t=t==null?n:``+Qt(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),tn(e)}function cn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function ln(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=``+Qt(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 un(e,t,n){t!=null&&(t=``+Qt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Qt(n)}function dn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(pe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Qt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),tn(e)}function fn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pn=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 mn(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||pn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function hn(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]=``,qt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(mn(e,a,r),qt=!0)}else for(var o in t)t.hasOwnProperty(o)&&mn(e,o,t[o])}function gn(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 _n=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`]]),vn=/^[\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 yn(e){return vn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function bn(){}var xn=null;function Sn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cn=null,wn=null;function Tn(e){var t=Pt(e);if(t&&(e=t.stateNode)){var n=e[wt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(on(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="`+an(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[wt]||null;if(!a)throw Error(i(90));on(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&&nn(r)}break a;case`textarea`:un(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&ln(e,!!n.multiple,t,!1)}}}var En=!1;function Dn(e,t,n){if(En)return e(t,n);En=!0;try{return e(t)}finally{if(En=!1,(Cn!==null||wn!==null)&&(Yd(),Cn&&(t=Cn,e=wn,wn=Cn=null,Tn(t),e)))for(t=0;t<e.length;t++)Tn(e[t])}}function On(e,t){var n=e.stateNode;if(n===null)return null;var r=n[wt]||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 kn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,An=!1;if(kn)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){An=!0}}),window.addEventListener(`test`,jn,jn),window.removeEventListener(`test`,jn,jn)}catch{An=!1}var Mn=null,Nn=null,Pn=null;function Fn(){if(Pn)return Pn;var e,t=Nn,n=t.length,r,i=`value`in Mn?Mn.value:Mn.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 Pn=i.slice(e,1<r?1-r:void 0)}function In(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 Ln(){return!0}function Rn(){return!1}function zn(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)?Ln:Rn,this.isPropagationStopped=Rn,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=Ln)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Ln)},persist:function(){},isPersistent:Ln}),t}var Bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vn=zn(Bn),Hn=T({},Bn,{view:0,detail:0}),Un=zn(Hn),Wn,Gn,Kn,qn=T({},Hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ir,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Kn&&(Kn&&e.type===`mousemove`?(Wn=e.screenX-Kn.screenX,Gn=e.screenY-Kn.screenY):Gn=Wn=0,Kn=e),Wn)},movementY:function(e){return`movementY`in e?e.movementY:Gn}}),Jn=zn(qn),Yn=zn(T({},qn,{dataTransfer:0})),Xn=zn(T({},Hn,{relatedTarget:0})),Zn=zn(T({},Bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Qn=zn(T({},Bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),$n=zn(T({},Bn,{data:0})),er={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},tr={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`},nr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function rr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nr[e])?!!t[e]:!1}function ir(){return rr}var ar=zn(T({},Hn,{key:function(e){if(e.key){var t=er[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=In(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?tr[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ir,charCode:function(e){return e.type===`keypress`?In(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?In(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),or=zn(T({},qn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),sr=zn(T({},Bn,{submitter:0})),cr=zn(T({},Hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ir})),lr=zn(T({},Bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ur=zn(T({},qn,{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})),dr=zn(T({},Bn,{newState:0,oldState:0,source:0})),fr=[9,13,27,32],pr=kn&&`CompositionEvent`in window,mr=null;kn&&`documentMode`in document&&(mr=document.documentMode);var hr=kn&&`TextEvent`in window&&!mr,gr=kn&&(!pr||mr&&8<mr&&11>=mr),_r=` `,vr=!1;function yr(e,t){switch(e){case`keyup`:return fr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function br(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var xr=!1;function Sr(e,t){switch(e){case`compositionend`:return br(t);case`keypress`:return t.which===32?(vr=!0,_r):null;case`textInput`:return e=t.data,e===_r&&vr?null:e;default:return null}}function Cr(e,t){if(xr)return e===`compositionend`||!pr&&yr(e,t)?(e=Fn(),Pn=Nn=Mn=null,xr=!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 gr&&t.locale!==`ko`?null:t.data;default:return null}}var wr={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 Tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!wr[e.type]:t===`textarea`}function Er(e,t,n,r){Cn?wn?wn.push(r):wn=[r]:Cn=r,t=op(t,`onChange`),0<t.length&&(n=new Vn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Dr=null,Or=null;function kr(e){Qf(e,0)}function Ar(e){if(nn(Ft(e)))return e}function jr(e,t){if(e===`change`)return t}var Mr=!1;if(kn){var Nr;if(kn){var Pr=`oninput`in document;if(!Pr){var Fr=document.createElement(`div`);Fr.setAttribute(`oninput`,`return;`),Pr=typeof Fr.oninput==`function`}Nr=Pr}else Nr=!1;Mr=Nr&&(!document.documentMode||9<document.documentMode)}function Ir(){Dr&&(Dr.detachEvent(`onpropertychange`,Lr),Or=Dr=null)}function Lr(e){if(e.propertyName===`value`&&Ar(Or)){var t=[];Er(t,Or,e,Sn(e)),Dn(kr,t)}}function Rr(e,t,n){e===`focusin`?(Ir(),Dr=t,Or=n,Dr.attachEvent(`onpropertychange`,Lr)):e===`focusout`&&Ir()}function zr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Ar(Or)}function Br(e,t){if(e===`click`)return Ar(t)}function Vr(e,t){if(e===`input`||e===`change`)return Ar(t)}function Hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ur=typeof Object.is==`function`?Object.is:Hr;function Wr(e,t){if(Ur(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(!Ie.call(t,i)||!Ur(e[i],t[i]))return!1}return!0}function Gr(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 Kr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qr(e,t){var n=Kr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Kr(n)}}function Jr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Gr(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=Gr(e.document)}return t}function Xr(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 Zr=kn&&`documentMode`in document&&11>=document.documentMode,Qr=null,$r=null,ei=null,ti=!1;function ni(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ti||Qr==null||Qr!==Gr(r)||(r=Qr,`selectionStart`in r&&Xr(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}),ei&&Wr(ei,r)||(ei=r,r=op($r,`onSelect`),0<r.length&&(t=new Vn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Qr)))}function ri(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ii={animationend:ri(`Animation`,`AnimationEnd`),animationiteration:ri(`Animation`,`AnimationIteration`),animationstart:ri(`Animation`,`AnimationStart`),transitionrun:ri(`Transition`,`TransitionRun`),transitionstart:ri(`Transition`,`TransitionStart`),transitioncancel:ri(`Transition`,`TransitionCancel`),transitionend:ri(`Transition`,`TransitionEnd`)},ai={},oi={};kn&&(oi=document.createElement(`div`).style,`AnimationEvent`in window||(delete ii.animationend.animation,delete ii.animationiteration.animation,delete ii.animationstart.animation),`TransitionEvent`in window||delete ii.transitionend.transition);function si(e){if(ai[e])return ai[e];if(!ii[e])return e;var t=ii[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in oi)return ai[e]=t[n];return e}var ci=si(`animationend`),li=si(`animationiteration`),ui=si(`animationstart`),di=si(`transitionrun`),fi=si(`transitionstart`),pi=si(`transitioncancel`),mi=si(`transitionend`),hi=new Map,gi=`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(` `);gi.push(`scrollEnd`);function _i(e,t){hi.set(e,t),Vt(t,[e])}var vi=0;function yi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Md.identifierPrefix;var n=vi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function bi(e){if(e==null||typeof e==`string`)return e;var t=null,n=B;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 xi(e,t){return e=bi(e),t=bi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Si=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)},Ci=[],wi=0,Ti=0;function Ei(){for(var e=wi,t=Ti=wi=0;t<e;){var n=Ci[t];Ci[t++]=null;var r=Ci[t];Ci[t++]=null;var i=Ci[t];Ci[t++]=null;var a=Ci[t];if(Ci[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&&Ai(n,i,a)}}function Di(e,t,n,r){Ci[wi++]=e,Ci[wi++]=t,Ci[wi++]=n,Ci[wi++]=r,Ti|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Oi(e,t,n,r){return Di(e,t,n,r),ji(e)}function ki(e,t){return Di(e,null,null,t),ji(e)}function Ai(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-$e(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ji(e){if(50<zd)throw zd=0,Bd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Mi={};function Ni(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 Pi(e,t,n,r){return new Ni(e,t,n,r)}function Fi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ii(e,t){var n=e.alternate;return n===null?(n=Pi(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 Li(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 Ri(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Fi(r)&&(s=1);else if(typeof r==`string`)s=oh(e,n,xe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=Pi(31,n,t,a),e.elementType=ie,e.lanes=o,e;case A:return zi(n.children,a,o,t);case M:s=8,a|=24;break;case N:return e=Pi(12,n,t,a|2),e.elementType=N,e.lanes=o,e;case I:return e=Pi(13,n,t,a),e.elementType=I,e.lanes=o,e;case te:return e=Pi(19,n,t,a),e.elementType=te,e.lanes=o,e;case ae:case se:return e=a|32,e=Pi(30,n,t,e),e.elementType=se,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case ee:s=10;break a;case P:s=9;break a;case F:s=11;break a;case ne:s=14;break a;case re:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Pi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function zi(e,t,n,r){return e=Pi(7,e,r,t),e.lanes=n,e}function Bi(e,t,n){return e=Pi(6,e,null,t),e.lanes=n,e}function Vi(e){var t=Pi(18,null,null,0);return t.stateNode=e,t}function Hi(e,t,n){return t=Pi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ui=new WeakMap;function Wi(e,t){if(typeof e==`object`&&e){var n=Ui.get(e);return n===void 0?(t={value:e,source:t,stack:Fe(t)},Ui.set(e,t),t):n}return{value:e,source:t,stack:Fe(t)}}var Gi=[],Ki=0,qi=null,Ji=0,Yi=[],Xi=0,Zi=null,Qi=1,$i=``;function ea(e,t){Gi[Ki++]=Ji,Gi[Ki++]=qi,qi=e,Ji=t}function ta(e,t,n){Yi[Xi++]=Qi,Yi[Xi++]=$i,Yi[Xi++]=Zi,Zi=e;var r=Qi;e=$i;var i=32-$e(r)-1;r&=~(1<<i),n+=1;var a=32-$e(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Qi=1<<32-$e(t)+i|n<<i|r,$i=a+e}else Qi=1<<a|n<<i|r,$i=e}function na(e){e.return!==null&&(ea(e,1),ta(e,1,0))}function ra(e){for(;e===qi;)qi=Gi[--Ki],Gi[Ki]=null,Ji=Gi[--Ki],Gi[Ki]=null;for(;e===Zi;)Zi=Yi[--Xi],Yi[Xi]=null,$i=Yi[--Xi],Yi[Xi]=null,Qi=Yi[--Xi],Yi[Xi]=null}function ia(e,t){Yi[Xi++]=Qi,Yi[Xi++]=$i,Yi[Xi++]=Zi,Qi=t.id,$i=t.overflow,Zi=e}var aa=null,oa=null,sa=!1,ca=null,la=!1,ua=Error(i(519));function da(e){throw _a(Wi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ua}function fa(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ct]=e,t[wt]=r,n){case`dialog`:$f(`cancel`,t),$f(`close`,t);break;case`iframe`:case`object`:case`embed`:$f(`load`,t);break;case`video`:case`audio`:for(n=0;n<Xf.length;n++)$f(Xf[n],t);break;case`source`:$f(`error`,t);break;case`img`:case`image`:case`link`:$f(`error`,t),$f(`load`,t);break;case`details`:$f(`toggle`,t);break;case`input`:$f(`invalid`,t),sn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$f(`invalid`,t);break;case`textarea`:$f(`invalid`,t),dn(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||fp(t.textContent,n)?(r.popover!=null&&($f(`beforetoggle`,t),$f(`toggle`,t)),r.onScroll!=null&&$f(`scroll`,t),r.onScrollEnd!=null&&$f(`scrollend`,t),r.onClick!=null&&(t.onclick=bn),t=!0):t=!1,t||da(e,!0)}function pa(e){for(aa=e.return;aa;)switch(aa.tag){case 5:case 31:case 13:la=!1;return;case 27:case 3:la=!0;return;default:aa=aa.return}}function ma(e){if(e!==aa)return!1;if(!sa)return pa(e),sa=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ep(e.type,e.memoizedProps)),n=!n),n&&oa&&da(e),pa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));oa=wm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));oa=wm(e)}else t===27?(t=oa,Fp(e.type)?(e=Cm,Cm=null,oa=e):oa=t):oa=aa?Sm(e.stateNode.nextSibling):null;return!0}function ha(){oa=aa=null,sa=!1}function ga(){var e=ca;return e!==null&&(wd===null?wd=e:wd.push.apply(wd,e),ca=null),e}function _a(e){ca===null?ca=[e]:ca.push(e)}var va=ve(null),ya=null,ba=null;function xa(e,t,n){be(va,t._currentValue),t._currentValue=n}function Sa(e){e._currentValue=va.current,ye(va)}function Ca(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 wa(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),Ca(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),Ca(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),Ca(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 Ta(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;Ur(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===we.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[bh]:e.push(bh))}a=a.return}return e!==null&&wa(t,e,n,r),t.flags|=262144,e!==null}function Ea(e){for(e=e.firstContext;e!==null;){if(!Ur(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Da(e){ya=e,ba=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Oa(e){return Aa(ya,e)}function ka(e,t){return ya===null&&Da(e),Aa(e,t)}function Aa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ba===null){if(e===null)throw Error(i(308));ba=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ba=ba.next=t;return n}var ja=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()})}},Ma=t.unstable_scheduleCallback,Na=t.unstable_NormalPriority,Pa={$$typeof:ee,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fa(){return{controller:new ja,data:new Map,refCount:0}}function Ia(e){e.refCount--,e.refCount===0&&Ma(Na,function(){e.controller.abort()})}function La(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 Ra=null;function za(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ba=null,Va=0,Ha=0,Ua=null;function Wa(e,t){if(Ba===null){var n=Ba=[];Va=0,Ha=Gf(),Ua={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Va++,t.then(Ga,Ga),t}function Ga(){if(--Va===0&&(Ra=null,Ba!==null)){Ua!==null&&(Ua.status=`fulfilled`);var e=Ba;Ba=null,Ha=0,Ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ka(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 qa=L.S;L.S=function(e,t){if(Dd=Ve(),typeof t==`object`&&t&&typeof t.then==`function`&&Wa(e,t),Ra!==null)for(var n=jf;n!==null;)La(n,Ra),n=n.next;if(n=e.types,n!==null){for(var r=jf;r!==null;)La(r,n),r=r.next;if(Ha!==0){r=Ra,r===null&&(r=Ra=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}qa!==null&&qa(e,t)};var Ja=ve(null);function Ya(){var e=Ja.current;return e===null?cd.pooledCache:e}function Xa(e,t){t===null?be(Ja,Ja.current):be(Ja,t.pool)}function Za(){var e=Ya();return e===null?null:{parent:Pa._currentValue,pool:e}}var Qa=Error(i(460)),$a=Error(i(474)),eo=Error(i(542)),to={then:function(){}};function no(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ro(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(bn,bn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,so(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(bn,bn);else{if(e=cd,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,so(e),e}throw ao=t,Qa}}function io(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ao=e,Qa):e}}var ao=null;function oo(){if(ao===null)throw Error(i(459));var e=ao;return ao=null,e}function so(e){if(e===Qa||e===eo)throw Error(i(483))}var co=null,lo=0;function uo(e){var t=lo;return lo+=1,co===null&&(co=[]),ro(co,e,t)}function fo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function po(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 mo(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=Ii(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=Bi(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===A?(e=d(e,t,n.props.children,r,n.key),fo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===re&&io(i)===t.type)?(t=a(t,n.props),fo(t,n),t.return=e,t):(t=Ri(n.type,n.key,n.props,null,e.mode,r),fo(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=Hi(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=zi(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=Bi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case O:return n=Ri(t.type,t.key,t.props,null,e.mode,n),fo(n,t),n.return=e,n;case k:return t=Hi(t,e.mode,n),t.return=e,t;case re:return t=io(t),f(e,t,n)}if(pe(t)||ue(t))return t=zi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,uo(t),n);if(t.$$typeof===ee)return f(e,ka(e,t),n);po(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 O:return n.key===i?l(e,t,n,r):null;case k:return n.key===i?u(e,t,n,r):null;case re:return n=io(n),p(e,t,n,r)}if(pe(n)||ue(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,uo(n),r);if(n.$$typeof===ee)return p(e,t,ka(e,n),r);po(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 O:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case k:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case re:return r=io(r),m(e,t,n,r,i)}if(pe(r)||ue(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,uo(r),i);if(r.$$typeof===ee)return m(e,t,n,ka(t,r),i);po(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),sa&&ea(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 sa&&ea(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)}),sa&&ea(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),sa&&ea(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return sa&&ea(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)}),sa&&ea(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===A&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case O:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===A){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),fo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===re&&io(l)===r.type){n(e,r.sibling),c=a(r,o.props),fo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===A?(c=zi(o.props.children,e.mode,c,o.key),fo(c,o),c.return=e,e=c):(c=Ri(o.type,o.key,o.props,null,e.mode,c),fo(c,o),c.return=e,e=c)}return s(e);case k: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=Hi(o,e.mode,c),c.return=e,e=c}return s(e);case re:return o=io(o),_(e,r,o,c)}if(pe(o))return h(e,r,o,c);if(ue(o)){if(l=ue(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,uo(o),c);if(o.$$typeof===ee)return _(e,r,ka(e,o),c);po(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=Bi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{lo=0;var i=_(e,t,n,r);return co=null,i}catch(t){if(t===Qa||t===eo)throw t;var a=Pi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ho=mo(!0),go=mo(!1),_o=!1;function vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yo(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 bo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,sd&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ji(e),Ai(e,null,n),t}return Di(e,r,t,n),ji(e)}function So(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,gt(e,n)}}function Co(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 wo=!1;function To(){if(wo){var e=Ua;if(e!==null)throw e}}function Eo(e,t,n,r){wo=!1;var i=e.updateQueue;_o=!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?(ud&f)===f:(r&f)===f){f!==0&&f===Ha&&(wo=!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:_o=!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),vd|=o,e.lanes=o,e.memoizedState=d}}function Do(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Oo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Do(n[e],t)}var ko=ve(null),Ao=ve(0);function jo(e,t){e=gd,be(Ao,e),be(ko,t),gd=e|t.baseLanes}function Mo(){be(Ao,gd),be(ko,ko.current)}function No(){gd=Ao.current,ye(ko),ye(Ao)}var Po=ve(null),Fo=null;function Io(e){var t=e.alternate;be(Vo,Vo.current&1),be(Po,e),Fo===null&&(t===null||ko.current!==null||t.memoizedState!==null)&&(Fo=e)}function Lo(e){be(Vo,Vo.current),be(Po,e),Fo===null&&(Fo=e)}function Ro(e){e.tag===22?(be(Vo,Vo.current),be(Po,e),Fo===null&&(Fo=e)):zo()}function zo(){be(Vo,Vo.current),be(Po,Po.current)}function Bo(e){ye(Po),Fo===e&&(Fo=null),ye(Vo)}var Vo=ve(0);function Ho(e,t){be(Po,Po.current),be(Vo,t)}function Uo(e){ye(Vo),ye(Po),Fo===e&&(Fo=null)}function Wo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ym(n)||bm(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 Go=0,R=null,Ko=null,qo=null,Jo=!1,Yo=!1,Xo=!1,Zo=0,Qo=0,$o=null,es=0;function ts(){throw Error(i(321))}function ns(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ur(e[n],t[n]))return!1;return!0}function rs(e,t,n,r,i,a){return Go=a,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?bc:xc,Xo=!1,a=n(r,i),Xo=!1,Yo&&(a=as(t,n,r,i)),is(e),a}function is(e){L.H=yc;var t=Ko!==null&&Ko.next!==null;if(Go=0,qo=Ko=R=null,Jo=!1,Qo=0,$o=null,t)throw Error(i(300));e===null||Rc||(e=e.dependencies,e!==null&&Ea(e)&&(Rc=!0))}function as(e,t,n,r){R=e;var a=0;do{if(Yo&&($o=null),Qo=0,Yo=!1,25<=a)throw Error(i(301));if(a+=1,qo=Ko=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}L.H=Sc,o=t(n,r)}while(Yo);return o}function os(){var e=L.H,t=e.useState()[0];return t=typeof t.then==`function`?ps(t):t,e=e.useState()[0],(Ko===null?null:Ko.memoizedState)!==e&&(R.flags|=1024),t}function ss(){var e=Zo!==0;return Zo=0,e}function cs(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ls(e){if(Jo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Jo=!1}Go=0,qo=Ko=R=null,Yo=!1,Qo=Zo=0,$o=null}function us(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qo===null?R.memoizedState=qo=e:qo=qo.next=e,qo}function ds(){if(Ko===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=Ko.next;var t=qo===null?R.memoizedState:qo.next;if(t!==null)qo=t,Ko=e;else{if(e===null)throw R.alternate===null?Error(i(467)):Error(i(310));Ko=e,e={memoizedState:Ko.memoizedState,baseState:Ko.baseState,baseQueue:Ko.baseQueue,queue:Ko.queue,next:null},qo===null?R.memoizedState=qo=e:qo=qo.next=e}return qo}function fs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ps(e){var t=Qo;return Qo+=1,$o===null&&($o=[]),e=ro($o,e,t),t=R,(qo===null?t.memoizedState:qo.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?bc:xc),e}function ms(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ps(e);if(e.$$typeof===ce)return;if(e.$$typeof===ee)return Oa(e)}throw Error(i(438,String(e)))}function hs(e){var t=null,n=R.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=R.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=fs(),R.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]=oe;return t.index++,n}function gs(e,t){return typeof t==`function`?t(e):t}function _s(e){return vs(ds(),Ko,e)}function vs(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?(Go&f)===f:(ud&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===Ha&&(d=!0);else if((Go&p)===p){u=u.next,p===Ha&&(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,R.lanes|=p,vd|=p;f=u.action,Xo&&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,R.lanes|=f,vd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ur(o,e.memoizedState)&&(Rc=!0,d&&(n=Ua,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 ys(e){var t=ds(),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);Ur(o,t.memoizedState)||(Rc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function bs(e,t,n){var r=R,a=ds(),o=sa;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ur((Ko||a).memoizedState,n);if(s&&(a.memoizedState=n,Rc=!0),a=a.queue,Gs(Cs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||qo!==null&&!!(qo.memoizedState.tag&1),Bs(e?9:8,{destroy:void 0},Ss.bind(null,r,a,n,t),null),e){if(r.flags|=2048,cd===null)throw Error(i(349));o||Go&127||xs(r,t,n)}return n}function xs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t=fs(),R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ss(e,t,n,r){t.value=n,t.getSnapshot=r,ws(t)&&Ts(e)}function Cs(e,t,n){return n(function(){ws(t)&&Ts(e)})}function ws(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ur(e,n)}catch{return!0}}function Ts(e){var t=ki(e,2);t!==null&&Wd(t,e,2)}function Es(e){var t=us();if(typeof e==`function`){var n=e;if(e=n(),Xo){Qe(!0);try{n()}finally{Qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:e},t}function Ds(e,t,n,r){return e.baseState=n,vs(e,Ko,typeof r==`function`?r:gs)}function Os(e,t,n,r,a){if(gc(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)}};L.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ks(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ks(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=L.T,o={};o.types=a===null?null:a.types,L.T=o;try{var s=n(i,r),c=L.S;c!==null&&c(o,s),As(e,t,s)}catch(n){Ms(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),L.T=a}}else try{a=n(i,r),As(e,t,a)}catch(n){Ms(e,t,n)}}function As(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){js(e,t,n)},function(n){return Ms(e,t,n)}):js(e,t,n)}function js(e,t,n){t.status=`fulfilled`,t.value=n,Ns(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ks(e,n)))}function Ms(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ns(t),t=t.next;while(t!==r)}e.action=null}function Ns(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ps(e,t){return t}function Fs(e,t){if(sa){var n=cd.formState;if(n!==null){a:{var r=R;if(sa){if(oa){b:{for(var i=oa,a=la;i.nodeType!==8;)if(!a||(i=Sm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){oa=Sm(i.nextSibling),r=i.data===`F!`;break a}}da(r)}r=!1}r&&(t=n[0])}}return n=us(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ps,lastRenderedState:t},n.queue=r,n=pc.bind(null,R,r),r.dispatch=n,r=Es(!1),a=hc.bind(null,R,!1,r.queue),r=us(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Os.bind(null,R,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Is(e){return Ls(ds(),Ko,e)}function Ls(e,t,n){if(t=vs(e,t,Ps)[0],e=_s(gs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ps(t)}catch(e){throw e===Qa?eo:e}else r=t;t=ds();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(R.flags|=2048,Bs(9,{destroy:void 0},Rs.bind(null,i,n),null)),[r,a,e]}function Rs(e,t){e.action=t}function zs(e){var t=ds(),n=Ko;if(n!==null)return Ls(t,n,e);ds(),t=t.memoizedState,n=ds();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Bs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=R.updateQueue,t===null&&(t=fs(),R.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 Vs(){return ds().memoizedState}function Hs(e,t,n,r){var i=us();R.flags|=e,i.memoizedState=Bs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Us(e,t,n,r){var i=ds();r=r===void 0?null:r;var a=i.memoizedState.inst;Ko!==null&&r!==null&&ns(r,Ko.memoizedState.deps)?i.memoizedState=Bs(t,a,n,r):(R.flags|=e,i.memoizedState=Bs(1|t,a,n,r))}function Ws(e,t){Hs(8390656,8,e,t)}function Gs(e,t){Us(2048,8,e,t)}function Ks(e){R.flags|=4;var t=R.updateQueue;if(t===null)t=fs(),R.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function qs(e){var t=ds().memoizedState;return Ks({ref:t,nextImpl:e}),function(){if(sd&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Js(e,t){return Us(4,2,e,t)}function Ys(e,t){return Us(4,4,e,t)}function Xs(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 Zs(e,t,n){n=n==null?null:n.concat([e]),Us(4,4,Xs.bind(null,t,e),n)}function Qs(){}function $s(e,t){var n=ds();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ns(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ec(e,t){var n=ds();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ns(t,r[1]))return r[0];if(r=e(),Xo){Qe(!0);try{e()}finally{Qe(!1)}}return n.memoizedState=[r,t],r}function tc(e,t,n){return n===void 0||Go&1073741824&&!(ud&261930)?e.memoizedState=t:(e.memoizedState=n,e=Hd(),R.lanes|=e,vd|=e,n)}function nc(e,t,n,r){return Ur(n,t)?n:ko.current===null?!(Go&106)||Go&1073741824&&!(ud&261930)?(Rc=!0,e.memoizedState=n):(e=Hd(),R.lanes|=e,vd|=e,t):(e=tc(e,n,r),Ur(e,t)||(Rc=!0),e)}function rc(e,t,n,r,i){var a=me.p;me.p=a!==0&&8>a?a:8;var o=L.T,s={};s.types=o===null?null:o.types,L.T=s,hc(e,!1,t,n);try{var c=i(),l=L.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?mc(e,t,Ka(c,r),Vd(e)):mc(e,t,r,Vd(e))}catch(n){mc(e,t,{then:function(){},status:`rejected`,reason:n},Vd())}finally{me.p=a,o!==null&&s.types!==null&&(o.types=s.types),L.T=o}}function ic(){}function ac(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=oc(e).queue;rc(e,a,t,he,n===null?ic:function(){return sc(e),n(r)})}function oc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:he},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function sc(e){var t=oc(e);t.next===null&&(t=e.alternate.memoizedState),mc(e,t.next.queue,{},Vd())}function cc(){return Oa(bh)}function lc(){return ds().memoizedState}function uc(){return ds().memoizedState}function dc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Vd();e=bo(n);var r=xo(t,e,n);r!==null&&(Wd(r,t,n),So(r,t,n)),t={cache:Fa()},e.payload=t;return}t=t.return}}function fc(e,t,n){var r=Vd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},gc(e)?_c(t,n):(n=Oi(e,t,n,r),n!==null&&(Wd(n,e,r),vc(n,t,r)))}function pc(e,t,n){mc(e,t,n,Vd())}function mc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(gc(e))_c(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,Ur(s,o))return Di(e,t,i,0),cd===null&&Ei(),!1}catch{}if(n=Oi(e,t,i,r),n!==null)return Wd(n,e,r),vc(n,t,r),!0}return!1}function hc(e,t,n,r){if(r={lane:2,revertLane:Gf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gc(e)){if(t)throw Error(i(479))}else t=Oi(e,n,r,2),t!==null&&Wd(t,e,2)}function gc(e){var t=e.alternate;return e===R||t!==null&&t===R}function _c(e,t){Yo=Jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gt(e,n)}}var yc={readContext:Oa,use:ms,useCallback:ts,useContext:ts,useEffect:ts,useImperativeHandle:ts,useLayoutEffect:ts,useInsertionEffect:ts,useMemo:ts,useReducer:ts,useRef:ts,useState:ts,useDebugValue:ts,useDeferredValue:ts,useTransition:ts,useSyncExternalStore:ts,useId:ts,useHostTransitionStatus:ts,useFormState:ts,useActionState:ts,useOptimistic:ts,useMemoCache:ts,useCacheRefresh:ts,useEffectEvent:ts},bc={readContext:Oa,use:ms,useCallback:function(e,t){return us().memoizedState=[e,t===void 0?null:t],e},useContext:Oa,useEffect:Ws,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Hs(4194308,4,Xs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hs(4194308,4,e,t)},useInsertionEffect:function(e,t){Hs(4,2,e,t)},useMemo:function(e,t){var n=us();t=t===void 0?null:t;var r=e();if(Xo){Qe(!0);try{e()}finally{Qe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=us();if(n!==void 0){var i=n(t);if(Xo){Qe(!0);try{n(t)}finally{Qe(!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=fc.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=us();return e={current:e},t.memoizedState=e},useState:function(e){e=Es(e);var t=e.queue,n=pc.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Qs,useDeferredValue:function(e,t){return tc(us(),e,t)},useTransition:function(){var e=Es(!1);return e=rc.bind(null,R,e.queue,!0,!1),us().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,a=us();if(sa){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),cd===null)throw Error(i(349));ud&127||xs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ws(Cs.bind(null,r,o,e),[e]),r.flags|=2048,Bs(9,{destroy:void 0},Ss.bind(null,r,o,n,t),null),n},useId:function(){var e=us(),t=cd.identifierPrefix;if(sa){var n=$i,r=Qi;n=(r&~(1<<32-$e(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Zo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=es++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:cc,useFormState:Fs,useActionState:Fs,useOptimistic:function(e){var t=us();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=hc.bind(null,R,!0,n),n.dispatch=t,[e,t]},useMemoCache:hs,useCacheRefresh:function(){return us().memoizedState=dc.bind(null,R)},useEffectEvent:function(e){var t=us(),n={impl:e};return t.memoizedState=n,function(){if(sd&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},xc={readContext:Oa,use:ms,useCallback:$s,useContext:Oa,useEffect:Gs,useImperativeHandle:Zs,useInsertionEffect:Js,useLayoutEffect:Ys,useMemo:ec,useReducer:_s,useRef:Vs,useState:function(){return _s(gs)},useDebugValue:Qs,useDeferredValue:function(e,t){return nc(ds(),Ko.memoizedState,e,t)},useTransition:function(){var e=_s(gs)[0],t=ds().memoizedState;return[typeof e==`boolean`?e:ps(e),t]},useSyncExternalStore:bs,useId:lc,useHostTransitionStatus:cc,useFormState:Is,useActionState:Is,useOptimistic:function(e,t){return Ds(ds(),Ko,e,t)},useMemoCache:hs,useCacheRefresh:uc,useEffectEvent:qs},Sc={readContext:Oa,use:ms,useCallback:$s,useContext:Oa,useEffect:Gs,useImperativeHandle:Zs,useInsertionEffect:Js,useLayoutEffect:Ys,useMemo:ec,useReducer:ys,useRef:Vs,useState:function(){return ys(gs)},useDebugValue:Qs,useDeferredValue:function(e,t){var n=ds();return Ko===null?tc(n,e,t):nc(n,Ko.memoizedState,e,t)},useTransition:function(){var e=ys(gs)[0],t=ds().memoizedState;return[typeof e==`boolean`?e:ps(e),t]},useSyncExternalStore:bs,useId:lc,useHostTransitionStatus:cc,useFormState:zs,useActionState:zs,useOptimistic:function(e,t){var n=ds();return Ko===null?(n.baseState=e,[e,n.queue.dispatch]):Ds(n,Ko,e,t)},useMemoCache:hs,useCacheRefresh:uc,useEffectEvent:qs};function Cc(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 wc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Vd(),i=bo(r);i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,r),t!==null&&(Wd(t,e,r),So(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Vd(),i=bo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,r),t!==null&&(Wd(t,e,r),So(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vd(),r=bo(n);r.tag=2,t!=null&&(r.callback=t),t=xo(e,r,n),t!==null&&(Wd(t,e,n),So(t,e,n))}};function Tc(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?!Wr(n,r)||!Wr(i,a):!0}function Ec(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&&wc.enqueueReplaceState(t,t.state,null)}function Dc(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 Oc(e){Si(e)}function kc(e){console.error(e)}function Ac(e){Si(e)}function jc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Mc(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 Nc(e,t,n){return n=bo(n),n.tag=3,n.payload={element:null},n.callback=function(){jc(e,t)},n}function Pc(e){return e=bo(e),e.tag=3,e}function Fc(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(){Mc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Mc(t,n,r),typeof i!=`function`&&(Ad===null?Ad=new Set([this]):Ad.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ic(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ta(t,n,a,!0),n=Po.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Fo===null?nf():n.alternate===null&&_d===0&&(_d=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===to?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Tf(e,r,a)),!1;case 22:return n.flags|=65536,r===to?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)),Tf(e,r,a)),!1}throw Error(i(435,n.tag))}return Tf(e,r,a),nf(),!1}if(sa)return t=Po.current,t===null?(r!==ua&&(t=Error(i(423),{cause:r}),_a(Wi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Wi(r,n),a=Nc(e.stateNode,r,a),Co(e,a),_d!==4&&(_d=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ua&&(e=Error(i(422),{cause:r}),_a(Wi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Wi(o,n),Cd===null?Cd=[o]:Cd.push(o),_d!==4&&(_d=2),t===null)return!0;r=Wi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Nc(n.stateNode,r,e),Co(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`&&(Ad===null||!Ad.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Pc(a),Fc(a,e,n,r),Co(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Lc=Error(i(461)),Rc=!1;function zc(e,t,n,r){t.child=e===null?go(t,null,n,r):ho(t,e.child,n,r)}function Bc(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 Da(t),r=rs(e,t,n,o,a,i),s=ss(),e!==null&&!Rc?(cs(e,t,i),ml(e,t,i)):(sa&&s&&na(t),t.flags|=1,zc(e,t,r,i),t.child)}function Vc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Fi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Hc(e,t,a,r,i)):(e=Ri(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!hl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Wr:n,n(o,r)&&e.ref===t.ref)return ml(e,t,i)}return t.flags|=1,e=Ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Wr(a,r)&&e.ref===t.ref){if(Rc=!1,t.pendingProps=r=a,hl(e,i))e.flags&131072&&(Rc=!0);else return t.lanes=e.lanes,ml(e,t,i)}}return Xc(e,t,n,r,i)}function Uc(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 Gc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Xa(t,a===null?null:a.cachePool),a===null?Mo():jo(t,a),Ro(t);else return r=t.lanes=536870912,Gc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Xa(t,null),Mo(),zo()):(Xa(t,a.cachePool),jo(t,a),zo(),t.memoizedState=null);return zc(e,t,i,n),t.child}function Wc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Gc(e,t,n,r,i){var a=Ya();return a=a===null?null:{parent:Pa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Xa(t,null),Mo(),Ro(t),e!==null&&Ta(e,t,r,!0),t.childLanes=i,null}function Kc(e,t){return t=al({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function qc(e,t,n){return ho(t,e.child,null,n),e=Kc(t,t.pendingProps),e.flags|=2,Bo(t),t.memoizedState=null,e}function Jc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(sa){if(r.mode===`hidden`)return e=Kc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Wc(null,e);if(Lo(t),(e=oa)?(e=vm(e,la),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zi===null?null:{id:Qi,overflow:$i},retryLane:536870912,hydrationErrors:null},n=Vi(e),n.return=t,t.child=n,aa=t,oa=null)):e=null,e===null)throw da(t);return t.lanes=536870912,null}return Kc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Lo(t),a){if(t.flags&256)t.flags&=-257,t=qc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Rc||Ta(e,t,n,!1),a=(n&e.childLanes)!==0,Rc||a){if(ko.current===null){if(r=cd,r!==null&&(s=_t(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ki(e,s),Wd(r,e,s),Lc;nf()}t=qc(e,t,n)}else e=o.treeContext,oa=Sm(s.nextSibling),aa=t,sa=!0,ca=null,la=!1,e!==null&&ia(t,e),t=Kc(t,r),t.flags|=134221824;return t}return e=Ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Yc(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 Xc(e,t,n,r,i){return Da(t),n=rs(e,t,n,r,void 0,i),r=ss(),e!==null&&!Rc?(cs(e,t,i),ml(e,t,i)):(sa&&r&&na(t),t.flags|=1,zc(e,t,n,i),t.child)}function Zc(e,t,n,r,i,a){return Da(t),t.updateQueue=null,n=as(t,r,n,i),is(e),r=ss(),e!==null&&!Rc?(cs(e,t,a),ml(e,t,a)):(sa&&r&&na(t),t.flags|=1,zc(e,t,n,a),t.child)}function Qc(e,t,n,r,i){if(Da(t),t.stateNode===null){var a=Mi,o=n.contextType;typeof o==`object`&&o&&(a=Oa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=wc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},vo(t),o=n.contextType,a.context=typeof o==`object`&&o?Oa(o):Mi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Cc(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&&wc.enqueueReplaceState(a,a.state,null),Eo(t,r,a,i),To(),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=Dc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Mi,typeof u==`object`&&u&&(o=Oa(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)&&Ec(t,a,r,o),_o=!1;var f=t.memoizedState;a.state=f,Eo(t,r,a,i),To(),l=t.memoizedState,s||f!==l||_o?(typeof d==`function`&&(Cc(t,n,d,r),l=t.memoizedState),(c=_o||Tc(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,yo(e,t),o=t.memoizedProps,u=Dc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Mi,typeof l==`object`&&l&&(c=Oa(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)&&Ec(t,a,r,c),_o=!1,f=t.memoizedState,a.state=f,Eo(t,r,a,i),To();var p=t.memoizedState;o!==d||f!==p||_o||e!==null&&e.dependencies!==null&&Ea(e.dependencies)?(typeof s==`function`&&(Cc(t,n,s,r),p=t.memoizedState),(u=_o||Tc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ea(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,Yc(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=ho(t,e.child,null,i),t.child=ho(t,null,n,i)):zc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=ml(e,t,i),e}function $c(e,t,n,r){return ha(),t.flags|=256,zc(e,t,n,r),t.child}var el={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tl(e){return{baseLanes:e,cachePool:Za()}}function nl(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=xd),e}function rl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Vo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(sa){if(i?Io(t):zo(),(e=oa)?(e=vm(e,la),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zi===null?null:{id:Qi,overflow:$i},retryLane:536870912,hydrationErrors:null},n=Vi(e),n.return=t,t.child=n,aa=t,oa=null)):e=null,e===null)throw da(t);return t.lanes=bm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(zo(),i=t.mode,a=al({mode:`hidden`,children:a},i),r=zi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=tl(n),r.childLanes=nl(e,o,n),t.memoizedState=el,Wc(null,r)):(Io(t),il(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return sl(e,t,a,o,r,c,s,n)}return i?(zo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ii(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=zi(i,a,n,null),i.flags|=2):i=Ii(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Wc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=tl(n):(a=i.cachePool,a===null?a=Za():(s=Pa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=nl(e,o,n),t.memoizedState=el,Wc(e.child,r)):(Io(t),n=e.child,e=n.sibling,n=Ii(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 il(e,t){return t=al({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function al(e,t){return e=Pi(22,e,null,t),e.lanes=0,e}function ol(e,t,n){return ho(t,e.child,null,n),e=il(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sl(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Io(t),t.flags&=-257,ol(e,t,c)):t.memoizedState===null?(zo(),o=a.fallback,s=t.mode,a=al({mode:`visible`,children:a.children},s),o=zi(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,ho(t,e.child,null,c),a=t.child,a.memoizedState=tl(c),a.childLanes=nl(e,r,c),t.memoizedState=el,Wc(null,a)):(zo(),t.child=e.child,t.flags|=128,null);if(Io(t),bm(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,_a({value:a,source:null,stack:null})),ol(e,t,c)}if(Rc||Ta(e,t,c,!1),r=(c&e.childLanes)!==0,Rc||r){if(ko.current!==null)return ol(e,t,c);if(r=cd,r!==null&&(a=_t(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,ki(e,a),Wd(r,e,a),Lc;return ym(o)||nf(),ol(e,t,c)}return ym(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,oa=Sm(o.nextSibling),aa=t,sa=!0,ca=null,la=!1,e!==null&&ia(t,e),t=il(t,a.children),t.flags|=134221824,t)}function cl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ca(e.return,t,n)}function ll(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Wo(n)===null&&(t=e),e=e.sibling}return t}function ul(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 dl(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 fl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Vo.current;if(t.flags&128)return Ho(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Ho(t,o),i===`backwards`&&e!==null?(dl(e),zc(e,t,r,n),dl(e)):zc(e,t,r,n),r=sa?Ji:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cl(e,n,t);else if(e.tag===19)cl(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=ll(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,dl(t)),ul(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&&Wo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ul(t,!0,n,null,a,r);break;case`together`:ul(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ll(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ul(t,!1,i,n,a,r)}return t.child}function pl(e,t,n){var r=t.pendingProps;return xa(t,t.type,r.value),zc(e,t,r.children,n),t.child}function ml(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),vd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ta(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=Ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function hl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ea(e)))}function gl(e,t,n){switch(t.tag){case 3:Te(t,t.stateNode.containerInfo),xa(t,Pa,e.memoizedState.cache),ha();break;case 27:case 5:De(t);break;case 4:Te(t,t.stateNode.containerInfo);break;case 10:xa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Io(t),t.flags|=128,null;r=Ta(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?rl(e,t,n):(Io(t),e=ml(e,t,n),e===null?null:e.sibling)}Io(t);break;case 19:if(t.flags&128)return fl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return fl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ho(t,Vo.current),r)break;return null;case 22:return t.lanes=0,Uc(e,t,n,t.pendingProps);case 24:xa(t,Pa,e.memoizedState.cache)}return ml(e,t,n)}function _l(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Rc=!0;else{if(!hl(e,n)&&!(t.flags&128))return Rc=!1,gl(e,t,n);Rc=!!(e.flags&131072)}}else Rc=!1,sa&&t.flags&1048576&&ta(t,Ji,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=io(t.elementType),t.type=e,typeof e==`function`)Fi(e)?(r=Dc(e,r),t.tag=1,t=Qc(null,t,e,r,n)):(t.tag=0,t=Xc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===F){t.tag=11,t=Bc(null,t,e,r,n);break a}if(a===ne){t.tag=14,t=Vc(null,t,e,r,n);break a}if(a===ee){t.tag=10,t.type=e,t=pl(null,t,n);break a}}throw t=fe(e)||e,Error(i(306,t,``))}}return t;case 0:return Xc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Dc(r,t.pendingProps),Qc(e,t,r,a,n);case 3:a:{if(Te(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,yo(e,t),Eo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,xa(t,Pa,r),r!==o.cache&&wa(t,[Pa],n,!0),To(),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=$c(e,t,r,n);break a}if(r!==a){a=Wi(Error(i(424)),t),_a(a),t=$c(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(oa=Sm(e.firstChild),aa=t,sa=!0,ca=null,la=!0,n=go(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ha(),r===a){t=ml(e,t,n);break a}zc(e,t,r,n)}t=t.child}return t;case 26:return Yc(e,t),e===null?(n=Km(t.type,null,t.pendingProps,null))?t.memoizedState=n:sa||(t.stateNode=Tp(t.type,t.pendingProps,Ce.current,t)):t.memoizedState=Km(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return De(t),e===null&&sa&&(r=t.stateNode=Om(t.type,t.pendingProps,Ce.current),aa=t,la=!0,a=oa,Fp(t.type)?(Cm=a,oa=Sm(r.firstChild)):oa=a),zc(e,t,t.pendingProps.children,n),Yc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&sa&&((a=r=oa)&&(r=gm(r,t.type,t.pendingProps,la),r===null?a=!1:(t.stateNode=r,aa=t,oa=Sm(r.firstChild),la=!1,a=!0)),a||da(t)),De(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ep(a,o)?r=null:s!==null&&Ep(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=rs(e,t,os,null,null,n),bh._currentValue=a),Yc(e,t),zc(e,t,r,n),t.child;case 6:return e===null&&sa&&((e=n=oa)&&(n=_m(n,t.pendingProps,la),n===null?e=!1:(t.stateNode=n,aa=t,oa=null,e=!0)),e||da(t)),null;case 13:return rl(e,t,n);case 4:return Te(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ho(t,null,r,n):zc(e,t,r,n),t.child;case 11:return Bc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Yc(e,t),zc(e,t,r,n),t.child;case 8:return zc(e,t,t.pendingProps.children,n),t.child;case 12:return zc(e,t,t.pendingProps.children,n),t.child;case 10:return pl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Da(t),a=Oa(a),r=r(a),t.flags|=1,zc(e,t,r,n),t.child;case 14:return Vc(e,t,t.type,t.pendingProps,n);case 15:return Hc(e,t,t.type,t.pendingProps,n);case 19:return fl(e,t,n);case 31:return Jc(e,t,n);case 22:return Uc(e,t,n,t.pendingProps);case 24:return Da(t),r=Oa(Pa),e===null?(a=Ya(),a===null&&(a=cd,o=Fa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},vo(t),xa(t,Pa,a)):((e.lanes&n)!==0&&(yo(e,t),Eo(t,null,null,n),To()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,xa(t,Pa,r),r!==a.cache&&wa(t,[Pa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),xa(t,Pa,r))),zc(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:sa&&na(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Yc(e,t),zc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function vl(e){e.flags|=4}function yl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?sh(t,r):sh(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($d())e.flags|=8192;else throw ao=to,$a}}else e.flags&=-16777217}function bl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!ch(t)){if($d())e.flags|=8192;else throw ao=to,$a}}function xl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:dt(),e.lanes|=t,Sd|=t)}function Sl(e,t){if(!sa)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 Cl(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 wl(e,t,n){var r=t.pendingProps;switch(ra(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cl(t),null;case 1:return Cl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Sa(Pa),Ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ma(t)?vl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ga())),Cl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(vl(t),o===null?(Cl(t),yl(t,a,null,r,n)):(Cl(t),bl(t,o))):o?o===e.memoizedState?(Cl(t),t.flags&=-16777217):(vl(t),Cl(t),bl(t,o)):(e=e.memoizedProps,e!==r&&vl(t),Cl(t),yl(t,a,e,r,n)),null;case 27:if(Oe(t),n=Ce.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Cl(t),t.subtreeFlags&=-33554433,null}e=xe.current,ma(t)?fa(t,e):(e=Om(a,r,n),t.stateNode=e,vl(t))}return Cl(t),t.subtreeFlags&=-33554433,null;case 5:if(Oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Cl(t),t.subtreeFlags&=-33554433,null}if(o=xe.current,ma(t))fa(t,o);else{var s=Sp(Ce.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[Ct]=t,o[wt]=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(hp(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&&vl(t)}}return Cl(t),t.subtreeFlags&=-33554433,yl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&vl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Ce.current,ma(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=aa,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||fp(e.nodeValue,n)),e||da(t,!0)}else e=Sp(e).createTextNode(r),e[Ct]=t,t.stateNode=e}return Cl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ma(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[Ct]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Cl(t),e=!1}else n=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Bo(t),t):(Bo(t),null);if(t.flags&128)throw Error(i(558))}return Cl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ma(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[Ct]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Cl(t),a=!1}else a=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Bo(t),t):(Bo(t),null)}return Bo(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),xl(t,t.updateQueue),Cl(t),null);case 4:return Ee(),e===null&&np(t.stateNode.containerInfo),t.flags|=67108864,Cl(t),null;case 10:return Sa(t.type),Cl(t),null;case 19:if(Uo(t),r=t.memoizedState,r===null)return Cl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Sl(r,!1);else{if(_d!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Wo(e),o!==null){for(t.flags|=128,Sl(r,!1),e=o.updateQueue,t.updateQueue=e,xl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Li(n,e),n=n.sibling;return Ho(t,Vo.current&1|2),sa&&ea(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>Od&&(t.flags|=128,a=!0,Sl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Wo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,xl(t,e),Sl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!sa)return Cl(t),null}else 2*Ve()-r.renderingStartTime>Od&&n!==536870912&&(t.flags|=128,a=!0,Sl(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=Ve(),e.sibling=null,o=Vo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||sa?Ho(t,o):(n=o,be(Po,t),be(Vo,n),Fo===null&&(Fo=t)),sa&&ea(t,r.treeForkCount),e}return Cl(t),null;case 22:case 23:return Bo(t),No(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Cl(t),t.subtreeFlags&6&&(t.flags|=8192)):Cl(t),n=t.updateQueue,n!==null&&xl(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&&ye(Ja),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sa(Pa),Cl(t),null;case 25:return null;case 30:return t.flags|=33554432,Cl(t),null}throw Error(i(156,t.tag))}function Tl(e,t){switch(ra(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sa(Pa),Ee(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Oe(t),null;case 31:if(t.memoizedState!==null){if(Bo(t),t.alternate===null)throw Error(i(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Bo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Uo(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 Ee(),null;case 10:return Sa(t.type),null;case 22:case 23:return Bo(t),No(),e!==null&&ye(Ja),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sa(Pa),null;case 25:return null;default:return null}}function El(e,t){switch(ra(t),t.tag){case 3:Sa(Pa),Ee();break;case 26:case 27:case 5:Oe(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&Bo(t);break;case 13:Bo(t);break;case 19:Uo(t);break;case 10:Sa(t.type);break;case 22:case 23:Bo(t),No(),e!==null&&ye(Ja);break;case 24:Sa(Pa)}}function Dl(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){wf(t,t.return,e)}}function Ol(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){wf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){wf(t,t.return,e)}}function kl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Oo(t,n)}catch(t){wf(e,e.return,t)}}}function Al(e,t,n){n.props=Dc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){wf(e,t,n)}}function jl(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=yi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=qp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Jp(e);p(e.child,!1,dm,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){wf(e,t,n)}}function Ml(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){wf(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){wf(e,t,n)}else n.current=null}}function Nl(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++)pm(e.stateNode,t[n])}function Pl(e){for(var t=e.return;t!==null&&(Ll(t)&&pm(e.stateNode,t.stateNode),!Il(t));)t=t.return}function Fl(e){for(var t=e.return;t!==null&&(Ll(t)&&mm(e.stateNode,t.stateNode),!Il(t));)t=t.return}function Il(e){return e.tag===5||e.tag===3||e.tag===27}function Ll(e){return e&&e.tag===7&&e.stateNode!==null}function Rl(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){wf(e,e.return,t)}}function zl(e,t,n){try{var r=e.stateNode;_p(r,e.type,n,t),r[wt]=t}catch(t){wf(e,e.return,t)}}function Bl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Fp(e.type)||e.tag===4}function Vl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Bl(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&&Fp(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 Hl(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=bn)),Nl(e,r),qt=!0;else if(i!==4&&(i===27&&(Nl(e,r),r=null,Fp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Hl(e,t,n,r),e=e.sibling;e!==null;)Hl(e,t,n,r),e=e.sibling}function Ul(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Nl(e,r),qt=!0;else if(i!==4&&(i===27&&(Nl(e,r),r=null,Fp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ul(e,t,n,r),e=e.sibling;e!==null;)Ul(e,t,n,r),e=e.sibling}function Wl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);hp(t,r,n),t[Ct]=e,t[wt]=n}catch(t){wf(e,e.return,t)}}var Gl=!1,Kl=null;function ql(e){(e.tag===30||e.subtreeFlags&33554432)&&(Gl=!0)}var Jl=null;function Yl(){var e=Jl;return Jl=null,e}var Xl=0;function Zl(e,t,n,r,i){return Xl=0,Ql(e.child,t,n,r,i)}function Ql(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Vp(o);r.push(s),s.view&&(a=!0)}else a||Vp(o).view&&(a=!0);Gl=!0,Rp(o,Xl===0?t:t+`_`+Xl,n),Xl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Ql(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function $l(e,t){for(;e!==null;)e.tag===5?zp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||$l(e.child,t)),e=e.sibling}function eu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(eu(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=xi(t.default,t.share),t!==`none`&&(Zl(e,n,t,null,!1)||$l(e.child,!1))}e=e.sibling}}function tu(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=yi(r,n),a=xi(r.default,n.paired?r.share:r.enter);a===`none`?eu(e):Zl(e,i,a,null,!1)?(eu(e),n.paired||t||Ud(e,r.onEnter)):$l(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)tu(e,t),e=e.sibling;else eu(e)}function nu(e){if(Kl!==null&&Kl.size!==0){var t=Kl;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=xi(n.default,n.share);if(a!==`none`&&(Zl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ud(e,n.onShare)):$l(e.child,!1)),t.delete(r),t.size===0)break}}}nu(e)}e=e.sibling}}}function ru(e){if(e.tag===30){var t=e.memoizedProps,n=yi(t,e.stateNode),r=Kl===null?void 0:Kl.get(n),i=xi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Zl(e,n,i,null,!1)?r===void 0?Ud(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Kl.delete(n),Ud(e,t.onShare)):$l(e.child,!1)),Kl!==null&&nu(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else Kl!==null&&nu(e)}function iu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=yi(t,e.stateNode);t=xi(t.default,t.update),e.flags&=-5,t!==`none`&&Zl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&iu(e);e=e.sibling}}function au(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,$l(e.child,!1))}au(e)}e=e.sibling}}function ou(e){if(e.tag===30)e.stateNode.paired=null,$l(e.child,!1),au(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ou(e),e=e.sibling;else au(e)}function su(e){for(e=e.child;e!==null;)e.tag===30?$l(e.child,!1):e.subtreeFlags&33554432&&su(e),e=e.sibling}function cu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Xl<a.length){var l=a[Xl],u=Vp(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&&Rp(c,Xl===0?n:n+`_`+Xl,i),s&&e.flags&4||(Jl===null&&(Jl=[]),Jl.push(c,Xl===0?r:r+`_`+Xl,t.memoizedProps)),Xl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:cu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function lu(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=yi(n,r),a=xi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Hp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Xl=0,i=cu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ud(e,n.onUpdate))}else e.subtreeFlags&33554432&&lu(e,t);e=e.sibling}}var uu=!1,du=!1,fu=!1,pu=!1,mu=typeof WeakSet==`function`?WeakSet:Set,hu=null,gu=!1,_u=!1,vu=!1,yu=!1;function bu(e,t,n){if(e=e.containerInfo,bp=kh,e=Yr(e),Xr(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(xp={focusedElem:e,selectionRange:r},kh=!1,n=(n&335544064)===n,hu=t,t=n?9270:1024;hu!==null;){if(e=hu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&ru(r[a]);if(e.alternate===null&&e.flags&2)n&&ql(e),xu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&ru(r),xu(n);continue}if(r!==null&&r.memoizedState!==null){n&&ql(e),xu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,hu=r):(n&&iu(e),xu(n))}}Kl=null}function xu(e){for(;hu!==null;){var t=hu,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=Dc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){wf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)hm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:hm(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=yi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=xi(a.default,a.update),a!==`none`&&Zl(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,hu=r;break}hu=t.return}}function Su(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Hu(e,n),r&4&&Dl(5,n);break;case 1:if(Hu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){wf(n,n.return,e)}else{var i=Dc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){wf(n,n.return,e)}}}r&64&&kl(n),r&512&&jl(n,n.return);break;case 3:if(Hu(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{Oo(e,t)}catch(e){wf(n,n.return,e)}}break;case 27:t===null&&r&4&&Wl(n);case 26:case 5:Hu(e,n),t===null&&r&4&&Rl(n),r&512&&jl(n,n.return);break;case 12:Hu(e,n);break;case 31:Hu(e,n),r&4&&ju(e,n);break;case 13:Hu(e,n),r&4&&Mu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Of.bind(null,n),xm(e,n))));break;case 22:if(r=n.memoizedState!==null||uu,!r){var a=t!==null&&t.memoizedState!==null||du;t=uu,i=du,uu=r,(du=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Wu(e,n,r)):Hu(e,n),uu=t,du=i}break;case 30:Hu(e,n),r&512&&jl(n,n.return);break;case 7:r&512&&jl(n,n.return);default:Hu(e,n)}}function Cu(e,t){for(e=e.child;e!==null;)wu(e,t),e=e.sibling}function wu(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){wf(e,e.return,t)}Tu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,qt=!0}catch(t){wf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Lp(s,!0):Lp(e.stateNode,!1)}catch(t){wf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&Cu(e,t);break;default:Cu(e,t)}}function Tu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:wu(n,r);break a;case 22:n.memoizedState===null&&Tu(n,r);break a;default:Tu(n,r)}}e=e.sibling}}function Eu(e){var t=e.alternate;t!==null&&(e.alternate=null,Eu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Mt(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 Du=null,Ou=!1;function ku(e,t,n){for(n=n.child;n!==null;)Au(e,t,n),n=n.sibling}function Au(e,t,n){if(Ze&&typeof Ze.onCommitFiberUnmount==`function`)try{Ze.onCommitFiberUnmount(Xe,n)}catch{}switch(n.tag){case 26:du||Ml(n,t),ku(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!du&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:du||Ml(n,t),Fl(n);var r=Du,i=Ou;Fp(n.type)&&(Du=n.stateNode,Ou=!1),ku(e,t,n),km(n.stateNode,n.type,n.memoizedProps),Du=r,Ou=i;break;case 5:du||Ml(n,t),Fl(n);case 6:if(n.tag===6&&Fl(n),r=Du,i=Ou,Du=null,ku(e,t,n),Du=r,Ou=i,Du!==null){if(Ou)try{(Du.nodeType===9?Du.body:Du.nodeName===`HTML`?Du.ownerDocument.body:Du).removeChild(n.stateNode),qt=!0}catch(e){wf(n,t,e)}else try{Du.removeChild(n.stateNode),qt=!0}catch(e){wf(n,t,e)}}break;case 18:Du!==null&&(Ou?(e=Du,Ip(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),tg(e)):Ip(Du,n.stateNode));break;case 4:r=Du,i=Ou,Du=n.stateNode.containerInfo,Ou=!0,ku(e,t,n),Du=r,Ou=i;break;case 0:case 11:case 14:case 15:Ol(2,n,t),du||Ol(4,n,t),ku(e,t,n);break;case 1:du||(Ml(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Al(n,t,r)),ku(e,t,n);break;case 21:ku(e,t,n);break;case 22:du=(r=du)||n.memoizedState!==null,ku(e,t,n),du=r;break;case 30:Ml(n,t),ku(e,t,n);break;case 7:du||Ml(n,t),ku(e,t,n);break;default:ku(e,t,n)}}function ju(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tg(e)}catch(e){wf(t,t.return,e)}}}function Mu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{tg(e)}catch(e){wf(t,t.return,e)}}function Nu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new mu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new mu),t;default:throw Error(i(435,e.tag))}}function Pu(e,t){var n=Nu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=kf.bind(null,e,t);t.then(r,r)}})}function Fu(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(Fp(l.type)){Du=l.stateNode,Ou=!1;break a}break;case 5:Du=l.stateNode,Ou=!1;break a;case 3:case 4:Du=l.stateNode.containerInfo,Ou=!0;break a}l=l.return}if(Du===null)throw Error(i(160));Au(s,c,o),Du=null,Ou=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Lu(t,e,n),t=t.sibling}var Iu=null;function Lu(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}Fu(t,e,n),Ru(e),a&4&&(Ol(3,e,e.return),Dl(3,e),Ol(5,e,e.return));break;case 1:Fu(t,e,n),Ru(e),a&512&&(du||r===null||Ml(r,r.return)),a&64&&uu&&(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=Iu,Fu(t,e,n),Ru(e),a&512&&(du||r===null||Ml(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(uu)e.stateNode=Tp(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[At]||r[Ct]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),hp(r,t,n),r[Ct]=e,Lt(r),t=r;break a;case`link`:if(o=ih(`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),hp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=ih(`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),hp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Ct]=e,Lt(r),t=r}e.stateNode=t}}else uu||ah(o,e.type,e.stateNode)}else e.stateNode=$m(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&zl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||du||t.parentNode.removeChild(t)):a.count--,n===null?uu||ah(o,e.type,e.stateNode):$m(o,n,e.memoizedProps))}break;case 27:Fu(t,e,n),Ru(e),a&512&&(du||r===null||Ml(r,r.return)),r!==null&&a&4&&zl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=fu,fu=!1,Fu(t,e,n),fu=o,Ru(e),a&512&&(du||r===null||Ml(r,r.return)),e.flags&32){t=e.stateNode;try{fn(t,``),qt=!0}catch(t){wf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,zl(e,t,r===null?t:r.memoizedProps)),a&1024&&(pu=!0);break;case 6:if(Fu(t,e,n),Ru(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,qt=!0}catch(t){wf(e,e.return,t)}}break;case 3:if(qt=!1,rh=null,o=Iu,Iu=Nm(t.containerInfo),Fu(t,e,n),Iu=o,Ru(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{tg(t.containerInfo)}catch(t){wf(e,e.return,t)}pu&&(pu=!1,zu(e)),qt=!1;break;case 4:a=fu,fu=uu,r=Jt(),o=Iu,Iu=Nm(e.stateNode.containerInfo),Fu(t,e,n),Ru(e),Iu=o,qt&&_u&&(vu=!0),qt=r,fu=a;break;case 12:Fu(t,e,n),Ru(e);break;case 31:Fu(t,e,n),Ru(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Pu(e,t)));break;case 13:Fu(t,e,n),Ru(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Ed=Ve()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Pu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=uu,l=du,u=fu;uu=c||o,fu=u||o,du=l||s,Fu(t,e,n),du=l,fu=u,uu=c,Ru(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||uu||du||(t=s||du,n=uu,r=du,uu=o||uu,du=t,Uu(e,2),uu=n,du=r),!o&&fu||Cu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Pu(e,n))));break;case 19:Fu(t,e,n),Ru(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Pu(e,t)));break;case 30:a&512&&(du||r===null||Ml(r,r.return)),a=Jt(),o=_u,s=(n&335544064)===n,c=e.memoizedProps,_u=s&&xi(c.default,c.update)!==`none`,Fu(t,e,n),Ru(e),s&&r!==null&&qt&&(e.flags|=4),_u=o,qt=a;break;case 21:break;case 7:a&512&&(du||r===null||Ml(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Fu(t,e,n),Ru(e)}}function Ru(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Bl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Ll(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Il(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Ul(e,Vl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(fn(l,``),n.flags&=-33),Ul(e,Vl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Hl(e,Vl(e),u,s);break;default:throw Error(i(161))}}catch(t){wf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;zu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,kh=!0,t.reset(),kh=!1),e=e.sibling}}function Bu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Vu(t,e),t=t.sibling;else lu(t,!1)}function Vu(e,t){var n=e.alternate;if(n===null)tu(e,!1);else switch(e.tag){case 3:if(yu=gu=!1,Yl(),Bu(t,e),!gu&&!vu){if(e=Jl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];zp(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`})),yu=!0}Jl=null;break;case 5:Bu(t,e);break;case 4:r=gu,gu=!1,Bu(t,e),gu&&(vu=!0),gu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Bu(t,e):tu(e,!1));break;case 30:r=gu,i=Yl(),gu=!1,Bu(t,e),gu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=yi(a,o),o=yi(n.memoizedProps,o);var s=xi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Xl=0,t=cu(e,n,t,o,s,a,!0),Xl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ud(e,e.memoizedProps.onUpdate),Jl=i):i!==null&&(i.push.apply(i,Jl),Jl=i),gu=e.flags&32?!0:r;break;default:Bu(t,e)}}function Hu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Su(e,t.alternate,t),t=t.sibling}function Uu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Ol(4,n,n.return),Uu(n,r);break;case 1:Ml(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Al(n,n.return,i),Uu(n,r);break;case 27:r&2&&km(n.stateNode,n.type,n.memoizedProps);case 5:Ml(n,n.return),n.tag!==5&&n.tag!==27||Fl(n),Uu(n,r);break;case 6:Fl(n);break;case 26:Ml(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||du||i.parentNode.removeChild(i),Uu(n,r);break;case 22:n.memoizedState===null&&Uu(n,r);break;case 30:Ml(n,n.return),Uu(n,r);break;case 7:Ml(n,n.return);default:Uu(n,r)}e=e.sibling}}function Wu(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:Wu(i,a,n),Dl(4,a);break;case 1:if(Wu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){wf(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++)Do(l[i],c)}catch(e){wf(r,r.return,e)}}s&&o&64&&kl(a),jl(a,a.return);break;case 27:n&2&&Wl(a);case 5:a.tag!==5&&a.tag!==27||Pl(a),Wu(i,a,n),s&&r===null&&o&4&&Rl(a),jl(a,a.return);break;case 6:Pl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||uu||ah(Nm(c.ownerDocument),a.type,c),Wu(i,a,n),s&&r===null&&o&4&&Rl(a),jl(a,a.return);break;case 12:Wu(i,a,n);break;case 31:Wu(i,a,n),s&&o&4&&ju(i,a);break;case 13:Wu(i,a,n),s&&o&4&&Mu(i,a);break;case 22:a.memoizedState===null&&Wu(i,a,n),jl(a,a.return);break;case 30:Wu(i,a,n),jl(a,a.return);break;case 7:jl(a,a.return);default:Wu(i,a,n)}t=t.sibling}}function Gu(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&&Ia(n))}function Ku(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ia(e))}function qu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Ju(e,t,n,r),t=t.sibling;else i&&su(t)}function Ju(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ou(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:qu(e,t,n,r),a&2048&&Dl(9,t);break;case 1:qu(e,t,n,r);break;case 3:qu(e,t,n,r),i&&yu&&(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&&Ia(a)));break;case 12:if(a&2048){qu(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){wf(t,t.return,e)}}else qu(e,t,n,r);break;case 31:qu(e,t,n,r);break;case 13:qu(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&&ou(t),o._visibility&2?qu(e,t,n,r):(o._visibility|=2,Yu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ou(s),o._visibility&2?qu(e,t,n,r):Xu(e,t)),a&2048&&Gu(s,t);break;case 24:qu(e,t,n,r),a&2048&&Ku(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&($l(a.child,!0),$l(t.child,!0))),qu(e,t,n,r);break;default:qu(e,t,n,r)}}function Yu(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:Yu(a,o,s,c,i),Dl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Yu(a,o,s,c,i)):u._visibility&2?Yu(a,o,s,c,i):Xu(a,o),i&&l&2048&&Gu(o.alternate,o);break;case 24:Yu(a,o,s,c,i),i&&l&2048&&Ku(o.alternate,o);break;default:Yu(a,o,s,c,i)}t=t.sibling}}function Xu(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:Xu(n,r),i&2048&&Gu(r.alternate,r);break;case 24:Xu(n,r),i&2048&&Ku(r.alternate,r);break;default:Xu(n,r)}t=t.sibling}}var Zu=8192;function Qu(e,t,n){if(e.subtreeFlags&Zu)for(e=e.child;e!==null;)$u(e,t,n),e=e.sibling}function $u(e,t,n){switch(e.tag){case 26:Qu(e,t,n),e.flags&Zu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&uh(n,e)):dh(n,Iu,e.memoizedState,e.memoizedProps));break;case 5:Qu(e,t,n),e.flags&Zu&&(e=e.stateNode,(t&335544128)===t&&uh(n,e));break;case 3:case 4:var r=Iu;Iu=Nm(e.stateNode.containerInfo),Qu(e,t,n),Iu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Zu,Zu=16777216,Qu(e,t,n),Zu=r):Qu(e,t,n));break;case 30:if((e.flags&Zu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Kl===null&&(Kl=new Map),Kl.set(r,i)}Qu(e,t,n);break;default:Qu(e,t,n)}}function ed(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 td(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hu=r,id(r,e)}ed(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)nd(e),e=e.sibling}function nd(e){switch(e.tag){case 0:case 11:case 15:td(e),e.flags&2048&&Ol(9,e,e.return);break;case 3:td(e);break;case 12:td(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,rd(e)):td(e);break;default:td(e)}}function rd(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hu=r,id(r,e)}ed(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ol(8,t,t.return),rd(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,rd(t));break;default:rd(t)}e=e.sibling}}function id(e,t){for(;hu!==null;){var n=hu;switch(n.tag){case 0:case 11:case 15:Ol(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:Ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,hu=r;else a:for(n=e;hu!==null;){r=hu;var i=r.sibling,a=r.return;if(Eu(r),r===n){hu=null;break a}if(i!==null){i.return=a,hu=i;break a}hu=a}}}var ad={getCacheForType:function(e){var t=Oa(Pa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Oa(Pa).controller.signal}},od=typeof WeakMap==`function`?WeakMap:Map,sd=0,cd=null,ld=null,ud=0,dd=0,fd=null,pd=!1,md=!1,hd=!1,gd=0,_d=0,vd=0,yd=0,bd=0,xd=0,Sd=0,Cd=null,wd=null,Td=!1,Ed=0,Dd=0,Od=1/0,kd=null,Ad=null,jd=0,Md=null,Nd=null,Pd=0,Fd=0,Id=null,Ld=null,z=null,Rd=null,B=null,zd=0,Bd=null;function Vd(){return sd&2&&ud!==0?ud&-ud:L.T===null?bt():Gf()}function Hd(){if(xd===0){if(!(ud&536870912)||sa){var e=it;it<<=1,!(it&3932160)&&(it=262144),xd=e}else xd=536870912}return e=Po.current,e!==null&&(e.flags|=32),xd}function Ud(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=qp(yi(e.memoizedProps,n))),Rd===null&&(Rd=[]),Rd.push(t.bind(null,r))}}function Wd(e,t,n){(e===cd&&(dd===2||dd===9)||e.cancelPendingCommit!==null)&&(Zd(e,0),Jd(e,ud,xd,!1)),pt(e,n),(!(sd&2)||e!==cd)&&(e===cd&&(!(sd&2)&&(yd|=n),_d===4&&Jd(e,ud,xd,!1)),Lf(e))}function Gd(e,t,n){if(sd&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ct(e,t),a=r?of(e,t):rf(e,t,!0),o=r;do{if(a===0){md&&!r&&Jd(e,t,0,!1);break}if(n=e.current.alternate,o&&!qd(n))a=rf(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=Cd;var l=c.current.memoizedState.isDehydrated;if(l&&(Zd(c,s).flags|=256),s=rf(c,s,!1),s!==2&&s!==6){if(hd&&!l){c.errorRecoveryDisabledLanes|=o,yd|=o,a=4;break a}o=wd,wd=a,o!==null&&(wd===null?wd=o:wd.push.apply(wd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Zd(e,0),Jd(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:Jd(r,t,xd,!pd);break a;case 2:wd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ed+300-Ve(),10<a)){if(Jd(r,t,xd,!pd),st(r,0,!0)!==0)break a;Pd=t,r.timeoutHandle=kp(Kd.bind(null,r,n,wd,kd,Td,t,xd,yd,Sd,pd,o,`Throttled`,-0,0),a);break a}Kd(r,n,wd,kd,Td,t,xd,yd,Sd,pd,o,null,-0,0)}break}}while(1);Lf(e)}function Kd(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:bn},Kl=null,$u(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=hh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Ed-Ve():(a&4194048)===a?Dd-Ve():0,m=ph(d,m),m!==null)?(Pd=a,e.cancelPendingCommit=m(pf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Jd(e,a,o,!l)):pf(e,t,a,n,r,i,o,s,c,l,u,d)}function qd(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(!Ur(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 Jd(e,t,n,r){t=lt(e,t),t&=~bd,t&=~yd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-$e(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ht(e,n,t)}function Yd(){return sd&6?!0:(Rf(0,!1),!1)}function Xd(){if(ld!==null){if(dd===0)var e=ld.return;else e=ld,ba=ya=null,ls(e),co=null,lo=0,e=ld;for(;e!==null;)El(e.alternate,e),e=e.return;ld=null}}function Zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Ap(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Pd=0,Xd(),cd=e,ld=n=Ii(e.current,null),ud=t,dd=0,fd=null,pd=!1,md=ct(e,t),hd=!1,Sd=xd=bd=yd=vd=_d=0,wd=Cd=null,Td=!1,gd=lt(e,t),Ei(),n}function Qd(e,t){R=null,L.H=yc,t===Qa||t===eo?(t=oo(),dd=3):t===$a?(t=oo(),dd=4):dd=t===Lc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,fd=t,ld===null&&(_d=1,jc(e,Wi(t,e.current)))}function $d(){var e=Po.current;return e===null?!0:(ud&4194048)===ud?Fo===null:(ud&62914560)===ud||ud&536870912?e===Fo:!1}function ef(){var e=L.H;return L.H=yc,e===null?yc:e}function tf(){var e=L.A;return L.A=ad,e}function nf(){_d=4,pd||(ud&4194048)!==ud&&Po.current!==null||(md=!0),!(vd&134217727)&&!(yd&134217727)||cd===null||Jd(cd,ud,xd,!1)}function rf(e,t,n){var r=sd;sd|=2;var i=ef(),a=tf();(cd!==e||ud!==t)&&(kd=null,Zd(e,t)),t=!1;var o=_d;a:do try{if(dd!==0&&ld!==null){var s=ld,c=fd;switch(dd){case 8:Xd(),o=6;break a;case 3:case 2:case 9:case 6:Po.current===null&&(t=!0);var l=dd;if(dd=0,fd=null,uf(e,s,c,l),n&&md){o=0;break a}break;default:l=dd,dd=0,fd=null,uf(e,s,c,l)}}af(),o=_d;break}catch(t){Qd(e,t)}while(1);return t&&e.shellSuspendCounter++,ba=ya=null,sd=r,L.H=i,L.A=a,ld===null&&(cd=null,ud=0,Ei()),o}function af(){for(;ld!==null;)cf(ld)}function of(e,t){var n=sd;sd|=2;var r=ef(),a=tf();cd!==e||ud!==t?(kd=null,Od=Ve()+500,Zd(e,t)):md=ct(e,t);a:do try{if(dd!==0&&ld!==null){t=ld;var o=fd;b:switch(dd){case 1:dd=0,fd=null,uf(e,t,o,1);break;case 2:case 9:if(no(o)){dd=0,fd=null,lf(t);break}t=function(){dd!==2&&dd!==9||cd!==e||(dd=7),Lf(e)},o.then(t,t);break a;case 3:dd=7;break a;case 4:dd=5;break a;case 7:no(o)?(dd=0,fd=null,lf(t)):(dd=0,fd=null,uf(e,t,o,7));break;case 5:var s=null;switch(ld.tag){case 26:s=ld.memoizedState;case 5:case 27:var c=ld;if(s?ch(s):c.stateNode.complete){dd=0,fd=null;var l=c.sibling;if(l!==null)ld=l;else{var u=c.return;u===null?ld=null:(ld=u,df(u))}break b}}dd=0,fd=null,uf(e,t,o,5);break;case 6:dd=0,fd=null,uf(e,t,o,6);break;case 8:Xd(),_d=6;break a;default:throw Error(i(462))}}sf();break}catch(t){Qd(e,t)}while(1);return ba=ya=null,L.H=r,L.A=a,sd=n,ld===null?(cd=null,ud=0,Ei(),_d):0}function sf(){for(;ld!==null&&!ze();)cf(ld)}function cf(e){var t=_l(e.alternate,e,gd);e.memoizedProps=e.pendingProps,t===null?df(e):ld=t}function lf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Zc(n,t,t.pendingProps,t.type,void 0,ud);break;case 11:t=Zc(n,t,t.pendingProps,t.type.render,t.ref,ud);break;case 5:ls(t);var r=t;r===aa&&(sa?(pa(r),r.tag===5&&r.stateNode!=null&&(oa=r.stateNode)):(pa(r),sa=!0));default:El(n,t),t=ld=Li(t,gd),t=_l(n,t,gd)}e.memoizedProps=e.pendingProps,t===null?df(e):ld=t}function uf(e,t,n,r){ba=ya=null,ls(t),co=null,lo=0;var i=t.return;try{if(Ic(e,i,t,n,ud)){_d=1,jc(e,Wi(n,e.current)),ld=null;return}}catch(t){if(i!==null)throw ld=i,t;_d=1,jc(e,Wi(n,e.current)),ld=null;return}t.flags&32768?(sa||r===1?e=!0:md||ud&536870912?e=!1:(pd=e=!0,(r===2||r===9||r===3||r===6)&&(r=Po.current,r!==null&&r.tag===13&&(r.flags|=16384))),ff(t,e)):df(t)}function df(e){var t=e;do{if(t.flags&32768){ff(t,pd);return}e=t.return;var n=wl(t.alternate,t,gd);if(n!==null){ld=n;return}if(t=t.sibling,t!==null){ld=t;return}ld=t=e}while(t!==null);_d===0&&(_d=5)}function ff(e,t){do{var n=Tl(e.alternate,e);if(n!==null){n.flags&=32767,ld=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ld=e;return}ld=e=n}while(e!==null);_d=6,ld=null}function pf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do xf();while(jd!==0);if(sd&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===cd&&(ld=cd=null,ud=0),Nd=t,Md=e,Pd=n,Id=a,Ld=r,mf(e,t,n,s,c,l,f)}}function mf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Fd=s,s|=Ti,mt(e,n,s,r,i,a),Rd=null,(n&335544064)===n?(B=za(e),r=10262):(B=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Af(Ge,function(){return Sf(),null})):(e.callbackNode=null,e.callbackPriority=0),Gl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=L.T,L.T=null,i=me.p,me.p=2,a=sd,sd|=4;try{bu(e,t,n)}finally{sd=a,me.p=i,L.T=r}}jd=1,Gl?z=Gp(o,e.containerInfo,B,_f,vf,gf,yf,Sf,hf,null,null):(_f(),vf(),yf())}function hf(e){if(jd!==0){var t=Md.onRecoverableError;t(e,{componentStack:null})}}function gf(){jd===3&&(jd=0,Vu(Nd,Md),jd=4)}function _f(){if(jd===1){jd=0;var e=Md,t=Nd,n=Pd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=L.T,L.T=null;var i=me.p;me.p=2;var a=sd;sd|=4;try{_u=vu=!1,Lu(t,e,n),n=xp;var o=Yr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Jr(s.ownerDocument.documentElement,s)){if(c!==null&&Xr(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 _=qr(s,h),v=qr(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}}kh=!!bp,xp=bp=null}finally{sd=a,me.p=i,L.T=r}}e.current=t,jd=2}}function vf(){if(jd===2){jd=0;var e=Md,t=Nd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=L.T,L.T=null;var r=me.p;me.p=2;var i=sd;sd|=4;try{Su(e,t.alternate,t)}finally{sd=i,me.p=r,L.T=n}}jd=3}}function yf(){if(jd===4||jd===3){jd=0;var e=z;z=null,Be();var t=Md,n=Nd,r=Pd,i=Ld,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?jd=5:(jd=0,Nd=Md=null,bf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Ad=null),yt(r),n=n.stateNode,Ze&&typeof Ze.onCommitFiberRoot==`function`)try{Ze.onCommitFiberRoot(Xe,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=L.T,a=me.p,me.p=2,L.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{L.T=n,me.p=a}}if(i=Rd,o=B,B=null,i!==null&&(Rd=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);Pd&3&&xf(),Lf(t),a=t.pendingLanes,r&261930&&a&42?t===Bd?zd++:(zd=0,Bd=t):(zd=0,Bd=null),Rf(0,!1)}}function bf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ia(t)))}function xf(){return z!==null&&(z.skipTransition(),z=null),_f(),vf(),yf(),Sf()}function Sf(){if(jd!==5)return!1;var e=Md,t=Fd;Fd=0;var n=yt(Pd),r=L.T,a=me.p;try{me.p=32>n?32:n,L.T=null,n=Id,Id=null;var o=Md,s=Pd;if(jd=0,Nd=Md=null,Pd=0,sd&6)throw Error(i(331));var c=sd;if(sd|=4,nd(o.current),Ju(o,o.current,s,n),sd=c,Rf(0,!1),Ze&&typeof Ze.onPostCommitFiberRoot==`function`)try{Ze.onPostCommitFiberRoot(Xe,o)}catch{}return!0}finally{me.p=a,L.T=r,bf(e,t)}}function Cf(e,t,n){t=Wi(n,t),t=Nc(e.stateNode,t,2),e=xo(e,t,2),e!==null&&(pt(e,2),Lf(e))}function wf(e,t,n){if(e.tag===3)Cf(e,e,n);else for(;t!==null;){if(t.tag===3){Cf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Ad===null||!Ad.has(r))){e=Wi(n,e),n=Pc(2),r=xo(t,n,2),r!==null&&(Fc(n,r,t,e),pt(r,2),Lf(r));break}}t=t.return}}function Tf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new od;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)||(hd=!0,i.add(n),e=Ef.bind(null,e,t,n),t.then(e,e))}function Ef(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,cd===e&&(ud&n)===n&&(_d===4||_d===3&&(ud&62914560)===ud&&300>Ve()-Ed?sd&2?bd|=n:Zd(e,0):bd|=n,Sd===ud&&(Sd=0)),Lf(e)}function Df(e,t){t===0&&(t=dt()),e=ki(e,t),e!==null&&(pt(e,t),Lf(e))}function Of(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Df(e,n)}function kf(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),Df(e,n)}function Af(e,t){return Le(e,t)}var jf=null,Mf=null,Nf=!1,Pf=!1,Ff=!1,If=0;function Lf(e){e!==Mf&&e.next===null&&(Mf===null?jf=Mf=e:Mf=Mf.next=e),Pf=!0,Nf||(Nf=!0,Wf())}function Rf(e,t){if(!Ff&&Pf){Ff=!0;do for(var n=!1,r=jf;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-$e(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Uf(r,a))}else a=ud,a=st(r,r===cd?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ct(r,a)||(n=!0,Uf(r,a))}r=r.next}while(n);Ff=!1}}function zf(){Bf()}function Bf(){Pf=Nf=!1;var e=0;If!==0&&Op()&&(e=If);for(var t=Ve(),n=null,r=jf;r!==null;){var i=r.next,a=Vf(r,t);a===0?(r.next=null,n===null?jf=i:n.next=i,i===null&&(Mf=n)):(n=r,(e!==0||a&3)&&(Pf=!0)),r=i}jd!==0&&jd!==5||Rf(e,!1),If!==0&&(If=0)}function Vf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-$e(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ut(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=cd,n=ud,n=st(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(dd===2||dd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Re(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ct(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Re(r),yt(n)){case 2:case 8:n=We;break;case 32:n=Ge;break;case 268435456:n=qe;break;default:n=Ge}return r=Hf.bind(null,e),n=Le(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Re(r),e.callbackPriority=2,e.callbackNode=null,2}function Hf(e,t){if(jd!==0&&jd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(xf()&&e.callbackNode!==n)return null;var r=ud;return r=st(e,e===cd?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Gd(e,r,t),Vf(e,Ve()),e.callbackNode!=null&&e.callbackNode===n?Hf.bind(null,e):null)}function Uf(e,t){if(xf())return null;Gd(e,t,!0)}function Wf(){Np(function(){sd&6?Le(Ue,zf):Bf()})}function Gf(){if(If===0){var e=Ha;e===0&&(e=rt,rt<<=1,!(rt&261888)&&(rt=256)),If=e}return If}function Kf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:yn(e)}function qf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Kf((i[wt]||null).action),o=r.submitter;o&&(t=(t=o[wt]||null)?Kf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Vn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(If!==0){var e=new FormData(i,o);ac(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),ac(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Jf=0;Jf<gi.length;Jf++){var Yf=gi[Jf];_i(Yf.toLowerCase(),`on`+(Yf[0].toUpperCase()+Yf.slice(1)))}_i(ci,`onAnimationEnd`),_i(li,`onAnimationIteration`),_i(ui,`onAnimationStart`),_i(`dblclick`,`onDoubleClick`),_i(`focusin`,`onFocus`),_i(`focusout`,`onBlur`),_i(di,`onTransitionRun`),_i(fi,`onTransitionStart`),_i(pi,`onTransitionCancel`),_i(mi,`onTransitionEnd`),Ht(`onMouseEnter`,[`mouseout`,`mouseover`]),Ht(`onMouseLeave`,[`mouseout`,`mouseover`]),Ht(`onPointerEnter`,[`pointerout`,`pointerover`]),Ht(`onPointerLeave`,[`pointerout`,`pointerover`]),Vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Xf=`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(` `),Zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Xf));function Qf(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){Si(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){Si(e)}i.currentTarget=null,a=c}}}}function $f(e,t){var n=t[Et];n===void 0&&(n=t[Et]=new Set);var r=e+`__bubble`;n.has(r)||(rp(t,e,2,!1),n.add(r))}function ep(e,t,n){var r=0;t&&(r|=4),rp(n,e,r,t)}var tp=`_reactListening`+Math.random().toString(36).slice(2);function np(e){if(!e[tp]){e[tp]=!0,zt.forEach(function(t){t!==`selectionchange`&&(Zf.has(t)||ep(t,!1,e),ep(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[tp]||(t[tp]=!0,ep(`selectionchange`,!1,t))}}function rp(e,t,n,r){switch(Ih(t)){case 2:var i=Ah;break;case 8:i=jh;break;default:i=Mh}n=i.bind(null,t,n,e),i=void 0,!An||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 ip(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=Nt(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}Dn(function(){var r=a,i=Sn(n),o=[];a:{var c=hi.get(e);if(c!==void 0){var l=Vn,u=e;switch(e){case`keypress`:if(In(n)===0)break a;case`keydown`:case`keyup`:l=ar;break;case`focusin`:u=`focus`,l=Xn;break;case`focusout`:u=`blur`,l=Xn;break;case`beforeblur`:case`afterblur`:l=Xn;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=Jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Yn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=cr;break;case ci:case li:case ui:l=Zn;break;case mi:l=lr;break;case`scroll`:case`scrollend`:l=Un;break;case`wheel`:l=ur;break;case`copy`:case`cut`:case`paste`:l=Qn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=or;break;case`submit`:l=sr;break;case`toggle`:case`beforetoggle`:l=dr}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=On(m,p),g!=null&&d.push(ap(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==xn&&(u=n.relatedTarget||n.fromElement)&&(Nt(u)||u[Tt]))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?Nt(l):null,l!==null&&(f=s(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Jn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=or,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Ft(c),h=l==null?u:Ft(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Nt(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,sp):null,c!==null&&cp(o,u,c,d,!1),l!==null&&f!==null&&cp(o,f,l,d,!0)))}a:{if(c=r?Ft(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=jr;else if(Tr(c)){if(Mr)_=Vr;else{_=zr;var v=Rr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&gn(r.elementType)&&(_=jr):_=Br;if(_&&=_(e,r)){Er(o,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ft(r):window,e){case`focusin`:(Tr(v)||v.contentEditable===`true`)&&(Qr=v,$r=r,ei=null);break;case`focusout`:ei=$r=Qr=null;break;case`mousedown`:ti=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ti=!1,ni(o,n,i);break;case`selectionchange`:if(Zr)break;case`keydown`:case`keyup`:ni(o,n,i)}var y;if(pr)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 xr?yr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(gr&&n.locale!==`ko`&&(xr||b!==`onCompositionStart`?b===`onCompositionEnd`&&xr&&(y=Fn()):(Mn=i,Nn=`value`in Mn?Mn.value:Mn.textContent,xr=!0)),v=op(r,b),0<v.length&&(b=new $n(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=br(n),y!==null&&(b.data=y)))),(y=hr?Sr(e,n):Cr(e,n))&&(b=op(r,`onBeforeInput`),0<b.length&&(v=new $n(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),qf(o,e,r,n,i)}Qf(o,t)})}function ap(e,t,n){return{instance:e,listener:t,currentTarget:n}}function op(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=On(e,n),i!=null&&r.unshift(ap(e,i,a)),i=On(e,t),i!=null&&r.push(ap(e,i,a))),e.tag===3)return r;e=e.return}return[]}function sp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cp(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=On(n,a),l!=null&&o.unshift(ap(n,l,c))):i||(l=On(n,a),l!=null&&o.push(ap(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var lp=/\r\n?/g,up=/\u0000|\uFFFD/g;function dp(e){return(typeof e==`string`?e:``+e).replace(lp,`
|
|
10
|
-
`).replace(up,``)}function fp(e,t){return t=dp(t),dp(e)===t}function pp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||fn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&fn(e,``+r);else return;break;case`className`:Xt(e,`class`,r);break;case`tabIndex`:Xt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Xt(e,n,r);break;case`style`:hn(e,r,o);return;case`data`:if(t!==`object`){Xt(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=yn(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`&&pp(e,t,`name`,a.name,a,null),pp(e,t,`formEncType`,a.formEncType,a,null),pp(e,t,`formMethod`,a.formMethod,a,null),pp(e,t,`formTarget`,a.formTarget,a,null)):(pp(e,t,`encType`,a.encType,a,null),pp(e,t,`method`,a.method,a,null),pp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=yn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=bn);return;case`onScroll`:r!=null&&$f(`scroll`,e);return;case`onScrollEnd`:r!=null&&$f(`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=yn(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`:$f(`beforetoggle`,e),$f(`toggle`,e),Yt(e,`popover`,r);break;case`xlinkActuate`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Yt(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=_n.get(n)||n,Yt(e,n,r);else return}qt=!0}function mp(e,t,n,r,a,o){switch(n){case`style`:hn(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`)fn(e,r);else if(typeof r==`number`||typeof r==`bigint`)fn(e,``+r);else return;break;case`onScroll`:r!=null&&$f(`scroll`,e);return;case`onScrollEnd`:r!=null&&$f(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=bn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Bt.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[wt]||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}qt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Yt(e,n,r)}return}qt=!0}function hp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$f(`error`,e),$f(`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:pp(e,t,o,s,n,null)}}a&&pp(e,t,`srcSet`,n.srcSet,n,null),r&&pp(e,t,`src`,n.src,n,null);return;case`input`:$f(`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:pp(e,t,r,d,n,null)}}sn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $f(`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:pp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&ln(e,!!r,n,!0):ln(e,!!r,t,!1);return;case`textarea`:for(s in $f(`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:pp(e,t,s,c,n,null)}dn(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:pp(e,t,l,r,n,null)}return;case`dialog`:$f(`beforetoggle`,e),$f(`toggle`,e),$f(`cancel`,e),$f(`close`,e);break;case`iframe`:case`object`:$f(`load`,e);break;case`video`:case`audio`:for(r=0;r<Xf.length;r++)$f(Xf[r],e);break;case`image`:$f(`error`,e),$f(`load`,e);break;case`details`:$f(`toggle`,e);break;case`embed`:case`source`:case`link`:$f(`error`,e),$f(`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:pp(e,t,u,r,n,null)}return;default:if(gn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&mp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&pp(e,t,c,r,n,null))}var gp={};function _p(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)||pp(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&&(qt=!0),o=m;break;case`name`:m!==f&&(qt=!0),a=m;break;case`checked`:m!==f&&(qt=!0),u=m;break;case`defaultChecked`:m!==f&&(qt=!0),d=m;break;case`value`:m!==f&&(qt=!0),s=m;break;case`defaultValue`:m!==f&&(qt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&pp(e,t,p,m,r,f)}}on(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)||pp(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&&(qt=!0),p=o;break;case`defaultValue`:o!==l&&(qt=!0),c=o;break;case`multiple`:o!==l&&(qt=!0),s=o;default:o!==l&&pp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?ln(e,!!n,n?[]:``,!1):ln(e,!!n,t,!0)):ln(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:pp(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&&(qt=!0),p=a;break;case`defaultValue`:a!==o&&(qt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&pp(e,t,s,a,r,o)}un(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:pp(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&&(qt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:pp(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)&&pp(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:pp(e,t,u,p,r,m)}return;default:if(gn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&mp(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||mp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&pp(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||pp(e,t,f,p,r,m)}function vp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function yp(){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&&vp(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&&vp(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 bp=null,xp=null;function Sp(e){return e.nodeType===9?e:e.ownerDocument}function Cp(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 wp(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 Tp(e,t,n,r){return n=Sp(n).createElement(e),n[Ct]=r,n[wt]=t,hp(n,e,t),Lt(n),n}function Ep(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 Dp=null;function Op(){var e=window.event;return e&&e.type===`popstate`?e!==Dp&&(Dp=e,!0):(Dp=null,!1)}var kp=typeof setTimeout==`function`?setTimeout:void 0,Ap=typeof clearTimeout==`function`?clearTimeout:void 0,jp=typeof Promise==`function`?Promise:void 0,Mp=typeof requestAnimationFrame==`function`?requestAnimationFrame:kp,Np=typeof queueMicrotask==`function`?queueMicrotask:jp===void 0?kp:function(e){return jp.resolve(null).then(e).catch(Pp)};function Pp(e){setTimeout(function(){throw e})}function Fp(e){return e===`head`}function Ip(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),tg(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Am(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Am(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[At]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Am(e.ownerDocument.body)}n=i}while(n);tg(t)}function Lp(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 Rp(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 zp(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 Bp(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 Vp(e){return Bp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Hp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Bp(t,n,e)}function Up(e){return e.documentElement.clientHeight}function Wp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Gp(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`&&(Up(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+=lh(f),u>fh){s.length=o;break}f=new Promise(Wp.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 Kp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Kp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Kp.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},Kp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function qp(e){return{name:e,group:new Kp(`group`,e),imagePair:new Kp(`image-pair`,e),old:new Kp(`old`,e),new:new Kp(`new`,e)}}function Jp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Jp.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($p(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=Zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Yp,e,s,r)}this._eventListeners=a}};function Yp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Jp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=$p(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Zp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Xp,e,n,i),r.splice(t,1),a!==null&&a()}};function Xp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function Zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Qp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function $p(e,t,n,r){if(e.length===0)return-1;r=Qp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Qp(a.optionsOrUseCapture)===r)return i}return-1}Jp.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(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,Zp(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,Zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Jp.prototype.focus=function(e){p(this._fragmentFiber.child,!0,em,e,void 0,void 0)};function em(e,t){return e.tag!==6&&(e=v(e),Em(e,t))}Jp.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,tm,t,void 0,void 0);for(var n=t.length-1;0<=n&&!em(t[n],e);n--);};function tm(e,t){return t.push(e),!1}Jp.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=Sp(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,nm,e,void 0,void 0))};function nm(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Jp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,rm,e,void 0,void 0)};function rm(e,t){return e.tag===6||(e=v(e),t.observe(e)),!1}Jp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,im,e,void 0,void 0);for(var n=t=0;n<am.length;n++){var r=am[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):am[t++]=r}am.length=t}};function im(e,t){return e.tag===6||(e=v(e),t.unobserve(e)),!1}var am=[],om=!1;function sm(e,t,n){am.push({fragmentInstance:e,observer:t,instance:n}),om||(om=!0,Dm(function(){om=!1;var e=am;am=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Jp.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,cm,e,void 0,void 0),e};function cm(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=v(e),t.push.apply(t,e.getClientRects());return!1}Jp.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Jp.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,tm,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(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=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(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=v(n[0]),i=v(n[n.length-1]);var a=h(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||lm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function lm(e,t,n,r,i){var a=Nt(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=m(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:(p(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:(p(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function um(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)}Jp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];p(this._fragmentFiber.child,!1,tm,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),um(e,n);return}if(r=v(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=v(a),um(a,n)):v(a).scrollIntoView(e),r+=n?-1:1}};function dm(e,t){return e=v(e),fm(e,t),!1}function fm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function pm(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,Zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<am.length;i++){var a=am[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(am[r++]=a)}am.length=r,n.observe(e)}),fm(e,t))}function mm(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,Zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?sm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function hm(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`:hm(n),Mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function gm(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[At])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=Sm(e.nextSibling),e===null)break}return null}function _m(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Sm(e.nextSibling),e===null))return null;return e}function vm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Sm(e.nextSibling),e===null))return null;return e}function ym(e){return e.data===`$?`||e.data===`$~`}function bm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function xm(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 Sm(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 Cm=null;function wm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Sm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Tm(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 Em(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 Dm(e){Mp(function(){Mp(function(t){return e(t)})})}function Om(e,t,n){switch(t=Sp(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 km(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&pp(e,t,r,null,gp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===bn&&(e.onclick=null),Mt(e)}function Am(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mt(e)}var jm=new Map,Mm=new Set;function Nm(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 Pm=me.d;me.d={f:Fm,r:Im,D:zm,C:Bm,L:Vm,m:Hm,X:Wm,S:Um,M:Gm};function Fm(){var e=Pm.f(),t=Yd();return e||t}function Im(e){var t=Pt(e);t!==null&&t.tag===5&&t.type===`form`?sc(t):Pm.r(e)}var Lm=typeof document>`u`?null:document;function Rm(e,t,n){var r=Lm;if(r&&typeof t==`string`&&t){var i=an(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Mm.has(i)||(Mm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),hp(t,`link`,e),Lt(t),r.head.appendChild(t)))}}function zm(e){Pm.D(e),Rm(`dns-prefetch`,e,null)}function Bm(e,t){Pm.C(e,t),Rm(`preconnect`,e,t)}function Vm(e,t,n){Pm.L(e,t,n);var r=Lm;if(r&&e&&t){var i=`link[rel="preload"][as="`+an(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+an(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+an(n.imageSizes)+`"]`)):i+=`[href="`+an(e)+`"]`;var a=i;switch(t){case`style`:a=qm(e);break;case`script`:a=Zm(e)}if(!(jm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),jm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Jm(a))||t===`script`&&r.querySelector(Qm(a))))){var o=r.createElement(`link`);hp(o,`link`,e),t===`style`&&(o[jt]=!0,o.onload=o.onerror=function(){Rt(o)}),Lt(o),r.head.appendChild(o)}}}function Hm(e,t){Pm.m(e,t);var n=Lm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+an(r)+`"][href="`+an(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Zm(e)}if(!jm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),jm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Qm(a)))return}r=n.createElement(`link`),hp(r,`link`,e),Lt(r),n.head.appendChild(r)}}}function Um(e,t,n){Pm.S(e,t,n);var r=Lm;if(r&&e){var i=It(r).hoistableStyles,a=qm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Jm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=jm.get(a))&&th(e,n);var c=o=r.createElement(`link`);Lt(c),hp(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,eh(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Wm(e,t){Pm.X(e,t);var n=Lm;if(n&&e){var r=It(n).hoistableScripts,i=Zm(e),a=r.get(i);a||(a=n.querySelector(Qm(i)),a||(e=T({src:e,async:!0},t),(t=jm.get(i))&&nh(e,t),a=n.createElement(`script`),Lt(a),hp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Gm(e,t){Pm.M(e,t);var n=Lm;if(n&&e){var r=It(n).hoistableScripts,i=Zm(e),a=r.get(i);a||(a=n.querySelector(Qm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=jm.get(i))&&nh(e,t),a=n.createElement(`script`),Lt(a),hp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Km(e,t,n,r){var a=(a=Ce.current)?Nm(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=qm(n.href),t=It(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=qm(n.href);var o=It(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(Jm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=jm.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},jm.set(e,o)),Xm(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=Zm(n),t=It(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 qm(e){return`href="`+an(e)+`"`}function Jm(e){return`link[rel="stylesheet"][`+e+`]`}function Ym(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Xm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[jt]){r.loading=1;return}}else t=e.createElement(`link`),t[jt]=!0,t.onload=t.onerror=Rt.bind(null,t),hp(t,`link`,n),Lt(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 Zm(e){return`[src="`+an(e)+`"]`}function Qm(e){return`script[async]`+e}function $m(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+an(n.href)+`"]`);if(r)return t.instance=r,Lt(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`),Lt(r),hp(r,`style`,a),eh(r,n.precedence,e),t.instance=r;case`stylesheet`:a=qm(n.href);var o=e.querySelector(Jm(a));if(o)return t.state.loading|=4,t.instance=o,Lt(o),o;r=Ym(n),(a=jm.get(a))&&th(r,a),o=(e.ownerDocument||e).createElement(`link`),Lt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),hp(o,`link`,r),t.state.loading|=4,eh(o,n.precedence,e),t.instance=o;case`script`:return o=Zm(n.src),(a=e.querySelector(Qm(o)))?(t.instance=a,Lt(a),a):(r=n,(a=jm.get(o))&&(r=T({},n),nh(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Lt(a),hp(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,eh(r,n.precedence,e));return t.instance}function eh(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 th(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function nh(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var rh=null;function ih(e,t,n){if(rh===null){var r=new Map,i=rh=new Map;i.set(n,r)}else i=rh,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[At]||a[Ct]||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 ah(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function oh(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 sh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function ch(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function lh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function uh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=lh(t),e.suspenseyImages.push(t)),e=gh.bind(e),t.decode().then(e,e))}function dh(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=qm(r.href),a=t.querySelector(Jm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=hh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Lt(a);return}a=t.ownerDocument||t,r=Ym(r),(i=jm.get(i))&&th(r,i),a=a.createElement(`link`),Lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),hp(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=hh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var fh=0;function ph(e,t){return e.stylesheets&&e.count===0&&vh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&vh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&fh===0&&(fh=62500*yp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>fh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function mh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)vh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function hh(){this.count--,mh(this)}function gh(){this.imgCount--,mh(this)}var _h=null;function vh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_h=new Map,t.forEach(yh,e),_h=null,hh.call(e))}function yh(e,t){if(!(t.state.loading&4)){var n=_h.get(e);if(n)var r=n.get(null);else{n=new Map,_h.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=hh.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 bh={$$typeof:ee,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function xh(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=ft(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ft(0),this.hiddenUpdates=ft(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 Sh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new xh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Pi(3,null,null,t),e.current=a,a.stateNode=e,t=Fa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},vo(a),e}function Ch(e){return e?(e=Mi,e):Mi}function wh(e,t,n,r,i,a){i=Ch(i),r.context===null?r.context=i:r.pendingContext=i,r=bo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=xo(e,r,t),n!==null&&(Wd(n,e,t),So(n,e,t))}function Th(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Eh(e,t){Th(e,t),(e=e.alternate)&&Th(e,t)}function Dh(e){if(e.tag===13||e.tag===31){var t=ki(e,67108864);t!==null&&Wd(t,e,67108864),Eh(e,67108864)}}function Oh(e){if(e.tag===13||e.tag===31){var t=Vd();t=vt(t);var n=ki(e,t);n!==null&&Wd(n,e,t),Eh(e,t)}}var kh=!0;function Ah(e,t,n,r){var i=L.T;L.T=null;var a=me.p;try{me.p=2,Mh(e,t,n,r)}finally{me.p=a,L.T=i}}function jh(e,t,n,r){var i=L.T;L.T=null;var a=me.p;try{me.p=8,Mh(e,t,n,r)}finally{me.p=a,L.T=i}}function Mh(e,t,n,r){if(kh){var i=Nh(r);if(i===null)ip(e,t,r,Ph,n),Gh(e,r);else if(qh(i,e,t,n,r))r.stopPropagation();else if(Gh(e,r),t&4&&-1<Wh.indexOf(e)){for(;i!==null;){var a=Pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ot(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-$e(o);s.entanglements[1]|=c,o&=~c}Lf(a),!(sd&6)&&(Od=Ve()+500,Rf(0,!1))}}break;case 31:case 13:s=ki(a,2),s!==null&&Wd(s,a,2),Yd(),Eh(a,2)}if(a=Nh(r),a===null&&ip(e,t,r,Ph,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ip(e,t,r,null,n)}}function Nh(e){return e=Sn(e),Fh(e)}var Ph=null;function Fh(e){if(Ph=null,e=Nt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(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 Ph=e,null}function Ih(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(He()){case Ue:return 2;case We:return 8;case Ge:case Ke:return 32;case qe:return 268435456;default:return 32}default:return 32}}var Lh=!1,Rh=null,zh=null,Bh=null,Vh=new Map,Hh=new Map,Uh=[],Wh=`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 Gh(e,t){switch(e){case`focusin`:case`focusout`:Rh=null;break;case`dragenter`:case`dragleave`:zh=null;break;case`mouseover`:case`mouseout`:Bh=null;break;case`pointerover`:case`pointerout`:Vh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Hh.delete(t.pointerId)}}function Kh(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=Pt(t),t!==null&&Dh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function qh(e,t,n,r,i){switch(t){case`focusin`:return Rh=Kh(Rh,e,t,n,r,i),!0;case`dragenter`:return zh=Kh(zh,e,t,n,r,i),!0;case`mouseover`:return Bh=Kh(Bh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Vh.set(a,Kh(Vh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Hh.set(a,Kh(Hh.get(a)||null,e,t,n,r,i)),!0}return!1}function Jh(e){var t=Nt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,xt(e.priority,function(){Oh(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,xt(e.priority,function(){Oh(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 Yh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);xn=r,n.target.dispatchEvent(r),xn=null}else return t=Pt(n),t!==null&&Dh(t),e.blockedOn=n,!1;t.shift()}return!0}function Xh(e,t,n){Yh(e)&&n.delete(t)}function Zh(){Lh=!1,Rh!==null&&Yh(Rh)&&(Rh=null),zh!==null&&Yh(zh)&&(zh=null),Bh!==null&&Yh(Bh)&&(Bh=null),Vh.forEach(Xh),Hh.forEach(Xh)}function Qh(e,n){e.blockedOn===n&&(e.blockedOn=null,Lh||(Lh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Zh)))}var $h=null;function eg(e){$h!==e&&($h=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){$h===e&&($h=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(Fh(r||n)===null)continue;break}var a=Pt(n);a!==null&&(e.splice(t,3),t-=3,ac(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function tg(e){function t(t){return Qh(t,e)}Rh!==null&&Qh(Rh,e),zh!==null&&Qh(zh,e),Bh!==null&&Qh(Bh,e),Vh.forEach(t),Hh.forEach(t);for(var n=0;n<Uh.length;n++){var r=Uh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Uh.length&&(n=Uh[0],n.blockedOn===null);)Jh(n),n.blockedOn===null&&Uh.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[wt]||null;if(typeof a==`function`)o||eg(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[wt]||null)s=o.formAction;else if(Fh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),eg(n)}}}function ng(){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 rg(e){this._internalRoot=e}ig.prototype.render=rg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;wh(n,Vd(),e,t,null,null)},ig.prototype.unmount=rg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wh(e.current,2,null,e,null,null),Yd(),t[Tt]=null}};function ig(e){this._internalRoot=e}ig.prototype.unstable_scheduleHydration=function(e){if(e){var t=bt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Uh.length&&t!==0&&t<Uh[n].priority;n++);Uh.splice(n,0,e),n===0&&Jh(e)}};var ag=n.version;if(ag!==`19.3.1`)throw Error(i(527,ag,`19.3.1`));me.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=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var og={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:L,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var sg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sg.isDisabled&&sg.supportsFiber)try{Xe=sg.inject(og),Ze=sg}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(i(299));var n=!1,r=``,a=Oc,s=kc,c=Ac;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Sh(e,1,!1,null,null,n,r,null,a,s,c,ng),e[Tt]=t.current,np(e),new rg(t)}})),N=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=M()})),P=((e={},t={})=>(t.locale??E())===`ja`?`設定を再読み込み`:`Reloaded the config`),ee=e=>`Conflict (kept ${e?.winner})`,F=e=>`コンフリクト(${e?.winner} を採用)`,I=((e,t={})=>(t.locale??E())===`ja`?F(e):ee(e)),te=((e={},t={})=>(t.locale??E())===`ja`?`削除 · file → DB`:`deleted · file → DB`),ne=((e={},t={})=>(t.locale??E())===`ja`?`削除 · DB → file`:`deleted · DB → file`),re=((e={},t={})=>(t.locale??E())===`ja`?`同期に失敗しました`:`sync failed`),ie=((e={},t={})=>(t.locale??E())===`ja`?`AI の設定を読み込めませんでした。ページを再読み込みしてから、もう一度お試しください。`:`AI settings could not be loaded. Reload the page to try again.`),ae=((e={},t={})=>(t.locale??E())===`ja`?`API キー`:`API key`),oe=((e={},t={})=>(t.locale??E())===`ja`?`キーは選んだプロバイダにだけ送られます。質問の内容と、AI が回答のために読んだデータも、そのプロバイダに送られます。`:`Your key is sent only to the provider you choose. What you ask, and the data the AI reads to answer, go to that provider too.`),se=((e={},t={})=>(t.locale??E())===`ja`?`空欄なら、YAMLite の起動時に渡されたキーを使います`:`Leave empty to use the key YAMLite was started with`),ce=((e={},t={})=>(t.locale??E())===`ja`?`プロバイダが API キーを受け付けませんでした。AI の設定でキーを確認してください。`:`The provider rejected the API key. Check it in the AI settings.`),le=((e={},t={})=>(t.locale??E())===`ja`?`会話が終了しました。次のメッセージは新しい会話で送られます。`:`The conversation has ended. Your next message starts a new one.`),ue=((e={},t={})=>(t.locale??E())===`ja`?`会話`:`Conversations`),de=((e={},t={})=>(t.locale??E())===`ja`?`接続が切れました。新しい会話を始めてください。`:`The connection was lost. Start a new conversation.`),fe=((e={},t={})=>(t.locale??E())===`ja`?`このリポジトリの AI のキーが拒否されました。リポジトリの管理者に確認を依頼してください。`:`The AI key for this repository was refused. Ask a repository admin to check it.`),pe=((e={},t={})=>(t.locale??E())===`ja`?`AI への依頼`:`Request to the AI`),L=((e={},t={})=>(t.locale??E())===`ja`?`データの検索や編集を頼めます。例:「来週締め切りのタスクを一覧して」「errand タグのタスクを全部完了にして」`:`Ask it to search or edit your data. For example: "List the tasks due next week" or "Mark every errand task as done".`),me=((e={},t={})=>(t.locale??E())===`ja`?`始めるには API キーを入力してください。`:`Enter an API key to start.`),he=((e={},t={})=>(t.locale??E())===`ja`?`モデル`:`Model`),ge=((e={},t={})=>(t.locale??E())===`ja`?`YAMLite で動作を確認していないモデルです。ツールをうまく使えないことがあります。`:`This model has not been checked with YAMLite; it may fail to use the tools.`),_e=((e={},t={})=>(t.locale??E())===`ja`?`新しい会話`:`New conversation`),ve=((e={},t={})=>(t.locale??E())===`ja`?`まだ会話はありません`:`No conversations yet`),ye=((e={},t={})=>(t.locale??E())===`ja`?`このリポジトリには AI のキーが設定されていません。リポジトリの管理者に設定を依頼してください。`:`No AI key is set up for this repository. Ask a repository admin to add one.`),be=((e={},t={})=>(t.locale??E())===`ja`?`AI の設定`:`AI settings`),xe=((e={},t={})=>(t.locale??E())===`ja`?`未適用の提案`:`Unapplied proposals`),Se=((e={},t={})=>(t.locale??E())===`ja`?`前の会話で作られ、まだ適用も破棄もしていない提案です。`:`Proposals from earlier conversations that were neither applied nor discarded.`),Ce=((e={},t={})=>(t.locale??E())===`ja`?`例: 来週締め切りのタスクを一覧して`:`e.g. List the tasks due next week`),we=((e={},t={})=>(t.locale??E())===`ja`?`プロバイダ`:`Provider`),Te=((e={},t={})=>(t.locale??E())===`ja`?`読み取りと提案のみ。適用するまで保存されません`:`Reads and proposes only. Nothing is saved until you apply it`),Ee=((e={},t={})=>(t.locale??E())===`ja`?`この端末にキーを保存する`:`Remember the key on this device`),De=e=>`${e?.tool}…`,Oe=e=>`${e?.tool} を実行中…`,ke=((e,t={})=>(t.locale??E())===`ja`?Oe(e):De(e)),Ae=((e={},t={})=>(t.locale??E())===`ja`?`保存`:`Save`),je=((e={},t={})=>(t.locale??E())===`ja`?`送信`:`Send`),Me=((e={},t={})=>(t.locale??E())===`ja`?`AI の設定`:`AI settings`),Ne=e=>`Sources (${e?.count})`,Pe=e=>`出典(${e?.count} 件)`,Fe=((e,t={})=>(t.locale??E())===`ja`?Pe(e):Ne(e)),Ie=((e={},t={})=>(t.locale??E())===`ja`?`停止`:`Stop`),Le=((e={},t={})=>(t.locale??E())===`ja`?`考えています…`:`Thinking…`),Re=((e={},t={})=>(t.locale??E())===`ja`?`ルールを確認`:`Checking rules`),ze=((e={},t={})=>(t.locale??E())===`ja`?`検索結果を絞り込み`:`Narrowing the search results`),Be=((e={},t={})=>(t.locale??E())===`ja`?`レコードを読み込み`:`Reading records`),Ve=((e={},t={})=>(t.locale??E())===`ja`?`変更を提案`:`Proposing changes`),He=((e={},t={})=>(t.locale??E())===`ja`?`テーブルを提案`:`Proposing a table`),Ue=((e={},t={})=>(t.locale??E())===`ja`?`検索`:`Searching`),We=((e={},t={})=>(t.locale??E())===`ja`?`テーブル構成を確認`:`Checking the tables`),Ge=((e={},t={})=>(t.locale??E())===`ja`?`ウェブを検索`:`Searching the web`),Ke=((e={},t={})=>(t.locale??E())===`ja`?`(メッセージなし)`:`(no messages)`),qe=((e={},t={})=>(t.locale??E())===`ja`?`すべての AI 機能(Ask AI と PR の下書き)`:`All AI features (Ask AI and pull request drafts)`),Je=((e={},t={})=>(t.locale??E())===`ja`?`例:英語で書く。tasks の status が todo なら未着手。`:`e.g. Write in English. In tasks, status todo means not started.`),Ye=((e={},t={})=>(t.locale??E())===`ja`?`編集中に yamlite.yaml が変更されました。いったん閉じて開き直すと、今のファイルから編集できます。`:`yamlite.yaml changed while you were editing. Close this and open it again to start from the current file.`),Xe=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml に保存され、このフォルダで作業する全員に使われます。ほかの変更と同じようにレビューに送ってください。`:`Saved in yamlite.yaml and used by everyone working in this folder. Send the change for review like any other.`),Ze=((e={},t={})=>(t.locale??E())===`ja`?`AI への指示を編集`:`Edit AI instructions`),Qe=((e={},t={})=>(t.locale??E())===`ja`?`PR の下書き(上の指示に追加)`:`Pull request drafts, in addition to the above`),$e=((e={},t={})=>(t.locale??E())===`ja`?`例:タイトルは動詞で始める。説明には変更の理由を書く。`:`e.g. Start titles with a verb. Say why in the description.`),et=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml に保存しました`:`Saved to yamlite.yaml`),tt=((e={},t={})=>(t.locale??E())===`ja`?`AI への指示`:`AI instructions`);function nt(e,t,n,r){if(typeof t!=`string`||n!==void 0&&!r)return new e(t,n);let i=nt;if(n!==void 0){let r=i.prototypeKeys??=new Set([`constructor`,`__defineGetter__`,`__defineSetter__`,`hasOwnProperty`,`__lookupGetter__`,`__lookupSetter__`,`isPrototypeOf`,`propertyIsEnumerable`,`toString`,`valueOf`,`__proto__`,`toLocaleString`]);if(Object.getOwnPropertyNames(Object.prototype).some(e=>!r.has(e)))return new e(t,n)}let a=[];for(let r of Object.keys(n??{}).sort()){let i=n[r];if(i!==void 0){if(i!==null&&![`string`,`number`,`boolean`].includes(typeof i)||typeof i==`number`&&!Number.isFinite(i))return new e(t,n);a.push([r,i])}}let o=JSON.stringify([t,a]),s=i.caches??=new WeakMap,c=s.get(e);if(c||(c=new Map,s.set(e,c)),c.has(o))return c.get(o);let l=new e(t,n);if(c.size>=256){let e=c.keys().next().value;e!==void 0&&c.delete(e)}return c.set(o,l),l}function rt(e,t,n,r=!1){return nt(Intl.PluralRules,e,n,r).select(Number(t)-Number(n?.offset??0))}var it=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`See the result`:t===`other`?`See all ${e?.count} results`:`cmd_all_results`},at=e=>`すべての結果を見る(${e?.count} 件)`,ot=((e,t={})=>(t.locale??E())===`ja`?at(e):it(e)),st=((e={},t={})=>(t.locale??E())===`ja`?`見つかりません`:`Nothing found`),ct=((e={},t={})=>(t.locale??E())===`ja`?`すべての結果`:`all results`),lt=((e={},t={})=>(t.locale??E())===`ja`?`移動`:`move`),ut=((e={},t={})=>(t.locale??E())===`ja`?`開く`:`open`),dt=((e={},t={})=>(t.locale??E())===`ja`?`テーブル・画面・レコードを検索…`:`Search tables, screens and records…`),ft=((e={},t={})=>(t.locale??E())===`ja`?`レコード`:`Records`),pt=((e={},t={})=>(t.locale??E())===`ja`?`検索中…`:`Searching…`),mt=((e={},t={})=>(t.locale??E())===`ja`?`ビュー`:`Views`),ht=((e={},t={})=>(t.locale??E())===`ja`?`キャンセル`:`Cancel`),gt=((e={},t={})=>(t.locale??E())===`ja`?`閉じる`:`Close`),_t=((e={},t={})=>(t.locale??E())===`ja`?`閉じる`:`close`),vt=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`Delete`),yt=((e={},t={})=>(t.locale??E())===`ja`?`切断中`:`disconnected`),bt=((e={},t={})=>(t.locale??E())===`ja`?`読み込み中…`:`Loading…`),xt=((e={},t={})=>(t.locale??E())===`ja`?`テーブルがありません`:`No tables`),St=((e={},t={})=>(t.locale??E())===`ja`?`保存`:`Save`),Ct=((e={},t={})=>(t.locale??E())===`ja`?`ファイルと DB の両方が変更されました。DB側を採用し、ファイル側の内容をバックアップしました。`:`Both the file and the DB changed. Kept the DB side and backed up the file side.`),wt=((e={},t={})=>(t.locale??E())===`ja`?`ファイルと DB の両方が変更されました。ファイル側を採用し、DB側の内容をバックアップしました。`:`Both the file and the DB changed. Kept the file side and backed up the DB side.`),Tt=e=>`Conflict in ${e?.table}/${e?.key}`,Et=e=>`${e?.table}/${e?.key} でコンフリクト`,Dt=((e,t={})=>(t.locale??E())===`ja`?Et(e):Tt(e)),Ot=((e={},t={})=>(t.locale??E())===`ja`?`差分を見る`:`View diff`),kt=((e={},t={})=>(t.locale??E())===`ja`?`+ 列`:`+ Column`),At=e=>`Add to ${e?.table}`,jt=e=>`${e?.table} に追加`,Mt=((e,t={})=>(t.locale??E())===`ja`?jt(e):At(e)),Nt=e=>`Add ${e?.table} to yamlite.yaml`,Pt=e=>`${e?.table} を yamlite.yaml に追加`,Ft=((e,t={})=>(t.locale??E())===`ja`?Pt(e):Nt(e)),It=e=>`column ${e?.n} name`,Lt=e=>`${e?.n} 列目の名前`,Rt=((e,t={})=>(t.locale??E())===`ja`?Lt(e):It(e)),zt=e=>`column ${e?.n} type`,Bt=e=>`${e?.n} 列目の型`,Vt=((e,t={})=>(t.locale??E())===`ja`?Bt(e):zt(e)),Ht=((e={},t={})=>(t.locale??E())===`ja`?`列(あとで YAML に書いても自動で増えます)`:`Columns (more are added automatically when you write them in YAML)`),Ut=((e={},t={})=>(t.locale??E())===`ja`?`作成`:`Create`),Wt=((e={},t={})=>(t.locale??E())===`ja`?`グループ(任意)`:`Group (optional)`),Gt=((e={},t={})=>(t.locale??E())===`ja`?`キー列`:`key column`),Kt=((e={},t={})=>(t.locale??E())===`ja`?`キー列`:`Key column`),qt=e=>`${e?.key} (becomes the file name)`,Jt=e=>`${e?.key}(ファイル名になります)`,Yt=((e,t={})=>(t.locale??E())===`ja`?Jt(e):qt(e)),Xt=e=>`${e?.key} (key)`,Zt=e=>`${e?.key}(キー)`,Qt=((e,t={})=>(t.locale??E())===`ja`?Zt(e):Xt(e)),$t=e=>`Folder (one file per record: ${e?.name}/*.yaml)`,en=e=>`フォルダ(1 レコード 1 ファイル: ${e?.name}/*.yaml)`,tn=((e,t={})=>(t.locale??E())===`ja`?en(e):$t(e)),nn=e=>`List in one file (${e?.name}.yaml)`,rn=e=>`1 ファイルのリスト(${e?.name}.yaml)`,an=((e,t={})=>(t.locale??E())===`ja`?rn(e):nn(e)),on=((e={},t={})=>(t.locale??E())===`ja`?`名前`:`Name`),sn=((e={},t={})=>(t.locale??E())===`ja`?`新しいキー`:`new key`),cn=((e={},t={})=>(t.locale??E())===`ja`?`新しいテーブル`:`New table`),ln=e=>`remove column ${e?.n}`,un=e=>`${e?.n} 列目を削除`,dn=((e,t={})=>(t.locale??E())===`ja`?un(e):ln(e)),fn=((e={},t={})=>(t.locale??E())===`ja`?`変更`:`Change`),pn=((e={},t={})=>(t.locale??E())===`ja`?`ファイル名が変わります。新しいファイルは DB の値から書き直されるので、元のファイルのコメントは失われます。`:`The file name changes. The new file is rewritten from the DB values, so comments in the original file are lost.`),mn=((e={},t={})=>(t.locale??E())===`ja`?`リスト内のレコードのキーが変わります。このレコードのコメントは失われることがあります。`:`The record's key in the list changes. Comments on this record may be lost.`),hn=((e={},t={})=>(t.locale??E())===`ja`?`キーを変更`:`Change key`),gn=((e={},t={})=>(t.locale??E())===`ja`?`テーブル名`:`table name`),_n=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`Add`),vn=((e={},t={})=>(t.locale??E())===`ja`?`+ 絞り込み`:`+ filter`),yn=((e={},t={})=>(t.locale??E())===`ja`?`列`:`column`),bn=((e={},t={})=>(t.locale??E())===`ja`?`含む`:`contains`),xn=((e={},t={})=>(t.locale??E())===`ja`?`要素に含む`:`has`),Sn=((e={},t={})=>(t.locale??E())===`ja`?`空でない`:`is set`),Cn=((e={},t={})=>(t.locale??E())===`ja`?`空`:`is empty`),wn=((e={},t={})=>(t.locale??E())===`ja`?`条件`:`operator`),Tn=((e={},t={})=>(t.locale??E())===`ja`?`検索`:`search`),En=((e={},t={})=>(t.locale??E())===`ja`?`すべての列を検索…`:`search all columns…`),Dn=((e={},t={})=>(t.locale??E())===`ja`?`値`:`value`),On=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`Add`),kn=((e={},t={})=>(t.locale??E())===`ja`?`+ 追加`:`+ add`),An=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`Add`),jn=e=>`add to ${e?.field}`,Mn=e=>`${e?.field} に追加`,Nn=((e,t={})=>(t.locale??E())===`ja`?Mn(e):jn(e)),Pn=e=>`${e?.field} as ${e?.kind}`,Fn=e=>`${e?.field} を ${e?.kind} で編集`,In=((e,t={})=>(t.locale??E())===`ja`?Fn(e):Pn(e)),Ln=((e={},t={})=>(t.locale??E())===`ja`?`種類を変える`:`Change type`),Rn=((e={},t={})=>(t.locale??E())===`ja`?`この項目を空にして、種類を選び直しますか?`:`Clear this field and choose another type?`),zn=e=>`Change type of ${e?.field}`,Bn=e=>`${e?.field} の種類を変える`,Vn=((e,t={})=>(t.locale??E())===`ja`?Bn(e):zn(e)),Hn=((e={},t={})=>(t.locale??E())===`ja`?`+ キー`:`+ key`),Un=e=>`new key in ${e?.field}`,Wn=e=>`${e?.field} の新しいキー`,Gn=((e,t={})=>(t.locale??E())===`ja`?Wn(e):Un(e)),Kn=e=>`remove ${e?.item}`,qn=e=>`${e?.item} を削除`,Jn=((e,t={})=>(t.locale??E())===`ja`?qn(e):Kn(e)),Yn=((e={},t={})=>(t.locale??E())===`ja`?`— (未設定)`:`— (unset)`),Xn=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} change`:t===`other`?`${e?.count} changes`:`git_changes`},Zn=e=>`${e?.count} 件の変更`,Qn=((e,t={})=>(t.locale??E())===`ja`?Zn(e):Xn(e)),$n=e=>`Commit: ${e?.message}`,er=e=>`コミット: ${e?.message}`,tr=((e,t={})=>(t.locale??E())===`ja`?er(e):$n(e)),nr=e=>`Create branch ${e?.name} and switch to it`,rr=e=>`ブランチ ${e?.name} を作成して切り替える`,ir=((e,t={})=>(t.locale??E())===`ja`?rr(e):nr(e)),ar=e=>`Create branch ${e?.name} from ${e?.from} and switch to it`,or=e=>`${e?.from} からブランチ ${e?.name} を作成して切り替える`,sr=((e,t={})=>(t.locale??E())===`ja`?or(e):ar(e)),cr=((e={},t={})=>(t.locale??E())===`ja`?`ブランチなし`:`no branch`),lr=((e={},t={})=>(t.locale??E())===`ja`?`完了`:`Done`),ur=((e={},t={})=>(t.locale??E())===`ja`?`失敗`:`Failed`),dr=((e={},t={})=>(t.locale??E())===`ja`?`変更なし`:`no changes`),fr=e=>`Open a draft pull request: ${e?.title}`,pr=e=>`Draft の PR を作成: ${e?.title}`,mr=((e,t={})=>(t.locale??E())===`ja`?pr(e):fr(e)),hr=((e={},t={})=>(t.locale??E())===`ja`?`GitHub で PR を作成する`:`Create the pull request on GitHub`),gr=((e={},t={})=>(t.locale??E())===`ja`?`PR を開く`:`Open the pull request`),_r=e=>`Pull ${e?.branch}`,vr=e=>`${e?.branch} を pull する`,yr=((e,t={})=>(t.locale??E())===`ja`?vr(e):_r(e)),br=e=>`Push ${e?.branch}`,xr=e=>`${e?.branch} を push する`,Sr=((e,t={})=>(t.locale??E())===`ja`?xr(e):br(e)),Cr=e=>`Restore from ${e?.branch}`,wr=e=>`${e?.branch} の内容に戻す`,Tr=((e,t={})=>(t.locale??E())===`ja`?wr(e):Cr(e)),Er=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Run ${e?.count} step`:t===`other`?`Run ${e?.count} steps`:`git_run`},Dr=e=>`${e?.count} 件の手順を実行`,Or=((e,t={})=>(t.locale??E())===`ja`?Dr(e):Er(e)),kr=((e={},t={})=>(t.locale??E())===`ja`?`手順を実行しています…`:`Running the steps…`),Ar=((e={},t={})=>(t.locale??E())===`ja`?`レビューに出す`:`Send for review`),jr=((e={},t={})=>(t.locale??E())===`ja`?`未実行`:`Not run`),Mr=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Git · ${e?.count} step`:t===`other`?`Git · ${e?.count} steps`:`git_summary`},Nr=e=>`Git · ${e?.count} 件の手順`,Pr=((e,t={})=>(t.locale??E())===`ja`?Nr(e):Mr(e)),Fr=e=>`Switch to ${e?.branch}`,Ir=e=>`${e?.branch} に切り替える`,Lr=((e,t={})=>(t.locale??E())===`ja`?Ir(e):Fr(e)),Rr=((e={},t={})=>(t.locale??E())===`ja`?`キー`:`key`),zr=((e={},t={})=>(t.locale??E())===`ja`?`キー列を固定`:`pin key column`),Br=((e={},t={})=>(t.locale??E())===`ja`?`キー列を常に表示します`:`Keep the key column in place`),Vr=e=>`Resize ${e?.column}`,Hr=e=>`${e?.column} の幅を変更`,Ur=((e,t={})=>(t.locale??E())===`ja`?Hr(e):Vr(e)),Wr=((e={},t={})=>(t.locale??E())===`ja`?`キー列の固定を解除`:`unpin key column`),Gr=((e={},t={})=>(t.locale??E())===`ja`?`キー列も一緒にスクロールします`:`Let the key column scroll`),Kr=((e={},t={})=>(t.locale??E())===`ja`?`作成`:`Created`),qr=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`Deleted`),Jr=((e={},t={})=>(t.locale??E())===`ja`?`フィールド`:`Fields`),Yr=((e={},t={})=>(t.locale??E())===`ja`?`たった今`:`just now`),Xr=((e={},t={})=>(t.locale??E())===`ja`?`さらに古い履歴を読み込む`:`Load older history`),Zr=((e={},t={})=>(t.locale??E())===`ja`?`まだコミットされていません`:`Not committed yet`),Qr=((e={},t={})=>(t.locale??E())===`ja`?`コミットすると、ここに変更が並びます。`:`Once you commit, changes show up here.`),$r=((e={},t={})=>(t.locale??E())===`ja`?`git の履歴はありません`:`No git history`),ei=((e={},t={})=>(t.locale??E())===`ja`?`このフォルダは git リポジトリの外にあります。`:`This folder is outside a git repository.`),ti=((e={},t={})=>(t.locale??E())===`ja`?`値の変更はありません`:`No value changes`),ni=((e={},t={})=>(t.locale??E())===`ja`?`(なし)`:`(none)`),ri=((e={},t={})=>(t.locale??E())===`ja`?`この版に戻す`:`Restore this version`),ii=((e={},t={})=>(t.locale??E())===`ja`?`この時点の値をフォームに入れます(保存はしません)`:`Puts this version's values into the form (does not save)`),ai=((e={},t={})=>(t.locale??E())===`ja`?`今の値と同じです`:`Same as the current values`),oi=((e={},t={})=>(t.locale??E())===`ja`?`未コミット`:`Uncommitted`),si=((e={},t={})=>(t.locale??E())===`ja`?`読めない版です`:`This version can't be read`),ci=((e={},t={})=>(t.locale??E())===`ja`?`未コミットの変更`:`Uncommitted changes`),li=((e={},t={})=>(t.locale??E())===`ja`?`YAML の差分`:`YAML diff`),ui=((e={},t={})=>(t.locale??E())===`ja`?`コピー`:`Copy`),di=((e={},t={})=>(t.locale??E())===`ja`?`言語`:`Language`),fi=((e={},t={})=>(t.locale??E())===`ja`?`AI に依頼`:`Ask AI`),pi=((e={},t={})=>(t.locale??E())===`ja`?`ER 図`:`ERD`),mi=((e={},t={})=>(t.locale??E())===`ja`?`メニュー`:`menu`),hi=((e={},t={})=>(t.locale??E())===`ja`?`+ 新しいレコード`:`+ New record`),gi=((e={},t={})=>(t.locale??E())===`ja`?`新しいテーブル`:`New table`),_i=((e={},t={})=>(t.locale??E())===`ja`?`ページ`:`Pages`),vi=((e={},t={})=>(t.locale??E())===`ja`?`名前を変更`:`rename`),yi=((e={},t={})=>(t.locale??E())===`ja`?`キーの名前を変更`:`rename key`),bi=((e={},t={})=>(t.locale??E())===`ja`?`設定`:`Config`),xi=((e={},t={})=>(t.locale??E())===`ja`?`データベース`:`Database`),Si=((e={},t={})=>(t.locale??E())===`ja`?`アドレス`:`Address`),Ci=((e={},t={})=>(t.locale??E())===`ja`?`データフォルダの詳細`:`Data folder details`),wi=((e={},t={})=>(t.locale??E())===`ja`?`検索`:`search`),Ti=((e={},t={})=>(t.locale??E())===`ja`?`検索…`:`Search…`),Ei=((e={},t={})=>(t.locale??E())===`ja`?`サイドバー`:`sidebar`),Di=((e={},t={})=>(t.locale??E())===`ja`?`サイドバーの幅を変更`:`Resize sidebar`),Oi=((e={},t={})=>(t.locale??E())===`ja`?`(なし)`:`(none)`),ki=((e={},t={})=>(t.locale??E())===`ja`?`SQL コンソール`:`SQL console`),Ai=((e={},t={})=>(t.locale??E())===`ja`?`同期`:`Sync`),ji=e=>`Items of ${e?.table}`,Mi=e=>`${e?.table} の項目`,Ni=((e,t={})=>(t.locale??E())===`ja`?Mi(e):ji(e)),Pi=((e={},t={})=>(t.locale??E())===`ja`?`テーブル`:`Tables`),Fi=((e={},t={})=>(t.locale??E())===`ja`?`ツール`:`Tools`),Ii=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} warning`:t===`other`?`${e?.count} warnings`:`nav_warnings`},Li=e=>`${e?.count} 件の警告`,Ri=((e,t={})=>(t.locale??E())===`ja`?Li(e):Ii(e)),zi=((e={},t={})=>(t.locale??E())===`ja`?`変更後`:`After`),Bi=((e={},t={})=>(t.locale??E())===`ja`?`適用しました`:`Applied`),Vi=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Apply ${e?.count} change`:t===`other`?`Apply ${e?.count} changes`:`proposal_apply`},Hi=e=>`${e?.count} 件を適用`,Ui=((e,t={})=>(t.locale??E())===`ja`?Hi(e):Vi(e)),Wi=((e={},t={})=>(t.locale??E())===`ja`?`変更前`:`Before`),Gi=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`added`),Ki=((e={},t={})=>(t.locale??E())===`ja`?`変更`:`changed`),qi=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`removed`),Ji=((e={},t={})=>(t.locale??E())===`ja`?`折りたたむ`:`Collapse`),Yi=((e={},t={})=>(t.locale??E())===`ja`?`破棄`:`Discard`),Xi=((e={},t={})=>(t.locale??E())===`ja`?`破棄しました`:`Discarded`),Zi=((e={},t={})=>(t.locale??E())===`ja`?`適用できませんでした`:`Couldn't apply`),Qi=e=>`Proposal: ${e?.title}`,$i=e=>`提案: ${e?.title}`,ea=((e,t={})=>(t.locale??E())===`ja`?$i(e):Qi(e)),ta=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`||t===`other`?`${e?.count} more`:`proposal_more`},na=e=>`ほか ${e?.count} 件`,ra=((e,t={})=>(t.locale??E())===`ja`?na(e):ta(e)),ia=e=>`New table ${e?.name}`,aa=e=>`新しいテーブル ${e?.name}`,oa=((e,t={})=>(t.locale??E())===`ja`?aa(e):ia(e)),sa=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`Delete`),ca=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`Add`),la=((e={},t={})=>(t.locale??E())===`ja`?`変更`:`Change`),ua=((e={},t={})=>(t.locale??E())===`ja`?`表示上の差分なし(並び順のみ)`:`No visible difference (order only)`),da=((e={},t={})=>(t.locale??E())===`ja`?`すべて表示`:`Show all`),fa=((e={},t={})=>(t.locale??E())===`ja`?`元のデータが変更されたため適用しませんでした`:`Not applied because the original data changed`),pa=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.tables} · ${e?.count} row`:t===`other`?`${e?.tables} · ${e?.count} rows`:`proposal_summary`},ma=e=>`${e?.tables} · ${e?.count} 件`,ha=((e,t={})=>(t.locale??E())===`ja`?ma(e):pa(e)),ga=e=>`${e?.name} (one file per record, key ${e?.key})`,_a=e=>`${e?.name}(1 件ごとにファイル、キー ${e?.key})`,va=((e,t={})=>(t.locale??E())===`ja`?_a(e):ga(e)),ya=e=>`${e?.name} (one file for all, key ${e?.key})`,ba=e=>`${e?.name}(1 ファイルにまとめる、キー ${e?.key})`,xa=((e,t={})=>(t.locale??E())===`ja`?ba(e):ya(e)),Sa=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`⋯ ${e?.count} unchanged line`:t===`other`?`⋯ ${e?.count} unchanged lines`:`proposal_unchanged_lines`},Ca=e=>`⋯ 変更のない ${e?.count} 行`,wa=((e,t={})=>(t.locale??E())===`ja`?Ca(e):Sa(e)),Ta=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} change · saving writes it to the file`:t===`other`?`${e?.count} changes · saving writes them to the file`:`record_changes`},Ea=e=>`変更 ${e?.count} 件 · 保存するとファイルに反映`,Da=((e,t={})=>(t.locale??E())===`ja`?Ea(e):Ta(e)),Oa=((e={},t={})=>(t.locale??E())===`ja`?`レコードを削除`:`delete record`),ka=e=>`It is also removed from ${e?.file}.`,Aa=e=>`${e?.file} からも削除されます。`,ja=((e,t={})=>(t.locale??E())===`ja`?Aa(e):ka(e)),Ma=e=>`Delete ${e?.key}?`,Na=e=>`${e?.key} を削除しますか?`,Pa=((e,t={})=>(t.locale??E())===`ja`?Na(e):Ma(e)),Fa=((e={},t={})=>(t.locale??E())===`ja`?`破棄`:`Discard`),Ia=((e={},t={})=>(t.locale??E())===`ja`?`接続が切れています`:`Connection lost`),La=((e={},t={})=>(t.locale??E())===`ja`?`レコードのファイル`:`record file`),Ra=((e={},t={})=>(t.locale??E())===`ja`?`レコードの JSON`:`record JSON`),za=((e={},t={})=>(t.locale??E())===`ja`?`レコードは JSON オブジェクトにしてください`:`a record must be a JSON object`),Ba=((e={},t={})=>(t.locale??E())===`ja`?`レコード`:`record`),Va=((e={},t={})=>(t.locale??E())===`ja`?`新規`:`new`),Ha=((e={},t={})=>(t.locale??E())===`ja`?`上書き`:`Overwrite`),Ua=e=>`⚠ Not reflected: ${e?.reason}`,Wa=e=>`⚠ 反映されませんでした: ${e?.reason}`,Ga=((e,t={})=>(t.locale??E())===`ja`?Wa(e):Ua(e)),Ka=((e={},t={})=>(t.locale??E())===`ja`?`反映待ち`:`Waiting to reflect`),qa=e=>`Reflected to ${e?.file}`,Ja=e=>`${e?.file} に反映済み`,Ya=((e,t={})=>(t.locale??E())===`ja`?Ja(e):qa(e)),Xa=((e={},t={})=>(t.locale??E())===`ja`?`反映中…`:`Reflecting…`),Za=((e={},t={})=>(t.locale??E())===`ja`?`最新を読み込む`:`Load latest`),Qa=((e={},t={})=>(t.locale??E())===`ja`?`必須`:`required`),$a=((e={},t={})=>(t.locale??E())===`ja`?`レコードパネルの幅を変更`:`Resize record panel`),eo=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Restored the values from ${e?.from} · ${e?.count} field unsaved`:t===`other`?`Restored the values from ${e?.from} · ${e?.count} fields unsaved`:`record_restored`},to=e=>`${e?.from} の値に戻しました · ${e?.count} 項目が未保存`,no=((e,t={})=>(t.locale??E())===`ja`?to(e):eo(e)),ro=((e={},t={})=>(t.locale??E())===`ja`?`保存 ⌘S`:`Save ⌘S`),io=((e={},t={})=>(t.locale??E())===`ja`?`読み込んだあとに、ファイルか DB で次のフィールドが変わりました。`:`After you loaded it, these fields changed in the file or the DB.`),ao=((e={},t={})=>(t.locale??E())===`ja`?`あなたの編集`:`Your edit`),oo=((e={},t={})=>(t.locale??E())===`ja`?`いまの値`:`Current value`),so=((e={},t={})=>(t.locale??E())===`ja`?`他で変更されました`:`Changed elsewhere`),co=((e={},t={})=>(t.locale??E())===`ja`?`ファイル`:`File`),lo=((e={},t={})=>(t.locale??E())===`ja`?`フォーム`:`Form`),uo=((e={},t={})=>(t.locale??E())===`ja`?`履歴`:`History`),fo=e=>`Choose files this review changes to write them back as ${e?.branch} has them. A file ${e?.branch} does not have is removed. They become edits you send as usual, adding a commit to this review.`,po=e=>`このレビューで変更したファイルを選ぶと、${e?.branch} の内容に書き戻します。${e?.branch} にないファイルは削除します。書き戻した内容は通常の編集と同じく、送信するとこのレビューにコミットとして追加されます。`,mo=((e,t={})=>(t.locale??E())===`ja`?po(e):fo(e)),ho=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Restored ${e?.count} file from ${e?.branch}; send it to add it to the review`:t===`other`?`Restored ${e?.count} files from ${e?.branch}; send them to add them to the review`:`restore_done`},go=e=>`${e?.count} 件を ${e?.branch} の内容に戻しました。送信するとレビューに追加されます`,_o=((e,t={})=>(t.locale??E())===`ja`?go(e):ho(e)),vo=e=>`This review changes no files from ${e?.branch}.`,yo=e=>`このレビューには ${e?.branch} から変更したファイルがありません。`,bo=((e,t={})=>(t.locale??E())===`ja`?yo(e):vo(e)),xo=((e={},t={})=>(t.locale??E())===`ja`?`戻しています…`:`Restoring…`),So=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Restore ${e?.count} file`:t===`other`?`Restore ${e?.count} files`:`restore_submit`},Co=e=>`${e?.count} 件を戻す`,wo=((e,t={})=>(t.locale??E())===`ja`?Co(e):So(e)),To=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Restore ${e?.count} file, losing unsent edits`:t===`other`?`Restore ${e?.count} files, losing unsent edits`:`restore_submit_confirm`},Eo=e=>`${e?.count} 件を戻す(未送信の編集は失われます)`,Do=((e,t={})=>(t.locale??E())===`ja`?Eo(e):To(e)),Oo=e=>`Restore from ${e?.branch}`,ko=e=>`${e?.branch} の内容に戻す`,Ao=((e,t={})=>(t.locale??E())===`ja`?ko(e):Oo(e)),jo=((e={},t={})=>(t.locale??E())===`ja`?`DB 側に戻す`:`Restore the DB side`),Mo=((e={},t={})=>(t.locale??E())===`ja`?`ファイル側に戻す`:`Restore the file side`),No=((e={},t={})=>(t.locale??E())===`ja`?`復元できません`:`Can't restore`),Po=((e={},t={})=>(t.locale??E())===`ja`?`未送信の編集あり`:`unsent edits`),Fo=((e={},t={})=>(t.locale??E())===`ja`?`選んだ変更を作業中のレビューに追加します。レビューがまだなければ新しく作成します。`:`The selected changes are added to the review you are working on, or open one if there is none yet.`),Io=((e={},t={})=>(t.locale??E())===`ja`?`選んだ変更を、作業中のレビューに新しいコミットとして追加します。`:`The selected changes are added to the open review as a new commit.`),Lo=((e={},t={})=>(t.locale??E())===`ja`?`選んだ変更で、このブランチからレビューを作成します。`:`The selected changes open a review from this branch.`),Ro=((e={},t={})=>(t.locale??E())===`ja`?`ブランチ名(任意。空欄なら日時から自動で付けます)`:`Branch name (optional; named after the time when blank)`),zo=((e={},t={})=>(t.locale??E())===`ja`?`コミットメッセージ`:`Commit message`),Bo=((e={},t={})=>(t.locale??E())===`ja`?`コミット時点`:`Committed`),Vo=((e={},t={})=>(t.locale??E())===`ja`?`レビューを作成する`:`Create the review`),Ho=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`Delete`),Uo=e=>`Delete ${e?.record}; it was never committed`,Wo=e=>`${e?.record} を削除(一度も commit されていません)`,Go=((e,t={})=>(t.locale??E())===`ja`?Wo(e):Uo(e)),R=((e={},t={})=>(t.locale??E())===`ja`?`AI で作成`:`Write with AI`),Ko=((e={},t={})=>(t.locale??E())===`ja`?`作成中…`:`Writing…`),qo=((e={},t={})=>(t.locale??E())===`ja`?`指示を編集`:`Edit instructions`),Jo=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} file selected`:t===`other`?`${e?.count} files selected`:`review_files`},Yo=e=>`${e?.count} 件のファイルを選択中`,Xo=((e,t={})=>(t.locale??E())===`ja`?Yo(e):Jo(e)),Zo=((e={},t={})=>(t.locale??E())===`ja`?`書式かコメントだけが変わっています。`:`Only formatting or comments changed.`),Qo=e=>`Include ${e?.file}`,$o=e=>`${e?.file} を含める`,es=((e,t={})=>(t.locale??E())===`ja`?$o(e):Qo(e)),ts=((e={},t={})=>(t.locale??E())===`ja`?`読み込み中…`:`Loading…`),ns=((e={},t={})=>(t.locale??E())===`ja`?`選んだ変更を新しいレビューとして送ります。レビューの間も、送った変更の上で作業を続けられます。`:`The selected changes go out as a new review. You keep working on them while it is reviewed.`),rs=((e={},t={})=>(t.locale??E())===`ja`?`現在`:`Now`),is=((e={},t={})=>(t.locale??E())===`ja`?`レビューを開く`:`Open the review`),as=((e={},t={})=>(t.locale??E())===`ja`?`その他のファイル`:`Other files`),os=((e={},t={})=>(t.locale??E())===`ja`?`説明(任意)`:`Description (optional)`),ss=((e={},t={})=>(t.locale??E())===`ja`?`タイトル`:`Title`),cs=((e={},t={})=>(t.locale??E())===`ja`?`戻す`:`Put back`),ls=e=>`Put ${e?.record} back as committed`,us=e=>`${e?.record} をコミット時点に戻す`,ds=((e,t={})=>(t.locale??E())===`ja`?us(e):ls(e)),fs=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Put back ${e?.count} change`:t===`other`?`Put back ${e?.count} changes`:`review_revert_selected`},ps=e=>`${e?.count} 件をコミット時点に戻す`,ms=((e,t={})=>(t.locale??E())===`ja`?ps(e):fs(e)),hs=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Put back ${e?.count} change (no undo)`:t===`other`?`Put back ${e?.count} changes (no undo)`:`review_revert_selected_confirm`},gs=e=>`${e?.count} 件を戻す(取り消せません)`,_s=((e,t={})=>(t.locale??E())===`ja`?gs(e):hs(e)),vs=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Put ${e?.count} change back as committed`:t===`other`?`Put ${e?.count} changes back as committed`:`review_reverted`},ys=e=>`${e?.count} 件の変更をコミット時点に戻しました`,bs=((e,t={})=>(t.locale??E())===`ja`?ys(e):vs(e)),xs=((e={},t={})=>(t.locale??E())===`ja`?`送信`:`Send`),Ss=((e={},t={})=>(t.locale??E())===`ja`?`送信中…`:`Sending…`),Cs=((e={},t={})=>(t.locale??E())===`ja`?`レビューに送りました。`:`Sent for review.`),ws=e=>`Show the changes in ${e?.file}`,Ts=e=>`${e?.file} の変更を表示`,Es=((e,t={})=>(t.locale??E())===`ja`?Ts(e):ws(e)),Ds=((e={},t={})=>(t.locale??E())===`ja`?`追加`:`added`),Os=((e={},t={})=>(t.locale??E())===`ja`?`削除`:`deleted`),ks=((e={},t={})=>(t.locale??E())===`ja`?`変更`:`changed`),As=((e={},t={})=>(t.locale??E())===`ja`?`レビューに出す`:`Send for review`),js=((e={},t={})=>(t.locale??E())===`ja`?`取り消す`:`Undo`),Ms=((e={},t={})=>(t.locale??E())===`ja`?`カラムを追加`:`Add column`),Ns=((e={},t={})=>(t.locale??E())===`ja`?`インデックスを追加`:`Add index`),Ps=((e={},t={})=>(t.locale??E())===`ja`?`ビューを追加`:`Add view`),Fs=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Saving adds ${e?.count} warning`:t===`other`?`Saving adds ${e?.count} warnings`:`rules_added`},Is=e=>`保存すると警告が ${e?.count} 件増えます`,Ls=((e,t={})=>(t.locale??E())===`ja`?Is(e):Fs(e)),Rs=((e={},t={})=>(t.locale??E())===`ja`?`カラム一覧`:`Columns`),zs=e=>`Back to ${e?.name}`,Bs=e=>`${e?.name} に戻る`,Vs=((e,t={})=>(t.locale??E())===`ja`?Bs(e):zs(e)),Hs=((e={},t={})=>(t.locale??E())===`ja`?`パンくずリスト`:`Breadcrumb`),Us=((e={},t={})=>(t.locale??E())===`ja`?`キャンセル`:`Cancel`),Ws=((e={},t={})=>(t.locale??E())===`ja`?`変更あり`:`changed`),Gs=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml が他で変更されました。下書きは残っています。`:`yamlite.yaml changed elsewhere. Your draft is kept.`),Ks=((e={},t={})=>(t.locale??E())===`ja`?`下書きを捨てて、最新のルールを読み込みますか?`:`Discard your draft and load the latest rules?`),qs=((e={},t={})=>(t.locale??E())===`ja`?`ルールを編集`:`Edit rules`),Js=((e={},t={})=>(t.locale??E())===`ja`?`キー`:`key`),Ys=((e={},t={})=>(t.locale??E())===`ja`?`形式`:`Format`),Xs=e=>`+ index ${e?.index}`,Zs=e=>`+ インデックス ${e?.index}`,Qs=((e,t={})=>(t.locale??E())===`ja`?Zs(e):Xs(e)),$s=((e={},t={})=>(t.locale??E())===`ja`?`カラム`:`Column`),ec=e=>`− index ${e?.index}`,tc=e=>`− インデックス ${e?.index}`,nc=((e,t={})=>(t.locale??E())===`ja`?tc(e):ec(e)),rc=((e={},t={})=>(t.locale??E())===`ja`?`最新を読み込む`:`Load latest`),ic=((e={},t={})=>(t.locale??E())===`ja`?`最大`:`Max`),ac=((e={},t={})=>(t.locale??E())===`ja`?`最小`:`Min`),oc=((e={},t={})=>(t.locale??E())===`ja`?`変更はありません`:`No changes`),sc=((e={},t={})=>(t.locale??E())===`ja`?`展開できる JSON 列がありません`:`No JSON columns to expand`),cc=((e={},t={})=>(t.locale??E())===`ja`?`なし`:`None`),lc=((e={},t={})=>(t.locale??E())===`ja`?`参照先`:`References`),uc=((e={},t={})=>(t.locale??E())===`ja`?`参照先のカラム`:`Referenced column`),dc=((e={},t={})=>(t.locale??E())===`ja`?`カラム(省略可)`:`column (optional)`),fc=e=>`Remove ${e?.column}`,pc=e=>`${e?.column} を外す`,mc=((e,t={})=>(t.locale??E())===`ja`?pc(e):fc(e)),hc=e=>`Remove ${e?.index}`,gc=e=>`${e?.index} を削除`,_c=((e,t={})=>(t.locale??E())===`ja`?gc(e):hc(e)),vc=e=>`Remove ${e?.value}`,yc=e=>`${e?.value} を削除`,bc=((e,t={})=>(t.locale??E())===`ja`?yc(e):vc(e)),xc=e=>`Remove ${e?.view}`,Sc=e=>`${e?.view} を削除`,Cc=((e,t={})=>(t.locale??E())===`ja`?Sc(e):xc(e)),wc=e=>`Removing ${e?.view} also removes its rules.`,Tc=e=>`${e?.view} を削除すると、そのルールも削除されます。`,Ec=((e,t={})=>(t.locale??E())===`ja`?Tc(e):wc(e)),Dc=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`Saving clears ${e?.count} warning`:t===`other`?`Saving clears ${e?.count} warnings`:`rules_removed`},Oc=e=>`保存すると警告が ${e?.count} 件なくなります`,kc=((e,t={})=>(t.locale??E())===`ja`?Oc(e):Dc(e)),Ac=((e={},t={})=>(t.locale??E())===`ja`?`必須`:`Required`),jc=((e={},t={})=>(t.locale??E())===`ja`?`値がないレコードを警告する`:`Warn about records without a value`),Mc=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml に保存`:`Save to yamlite.yaml`),Nc=e=>`${e?.type} — change it in yamlite.yaml`,Pc=e=>`${e?.type}(変更は yamlite.yaml で)`,Fc=((e,t={})=>(t.locale??E())===`ja`?Pc(e):Nc(e)),Ic=((e={},t={})=>(t.locale??E())===`ja`?`一意`:`Unique`),Lc=((e={},t={})=>(t.locale??E())===`ja`?`許可する値`:`Allowed values`),Rc=((e={},t={})=>(t.locale??E())===`ja`?`値を入力して Enter`:`Type a value and press Enter`),zc=((e={},t={})=>(t.locale??E())===`ja`?`JSON 列`:`JSON column`),Bc=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`⚠ ${e?.count} broken reference`:t===`other`?`⚠ ${e?.count} broken references`:`schema_broken_refs`},Vc=e=>`⚠ ${e?.count} 件の参照切れ`,Hc=((e,t={})=>(t.locale??E())===`ja`?Vc(e):Bc(e)),Uc=((e={},t={})=>(t.locale??E())===`ja`?`列`:`Columns`),Wc=((e={},t={})=>(t.locale??E())===`ja`?`作成済み`:`Created`),Gc=((e={},t={})=>(t.locale??E(),`DB`)),Kc=((e={},t={})=>(t.locale??E())===`ja`?`宣言済み`:`declared`),qc=((e={},t={})=>(t.locale??E())===`ja`?`変更は保存前にデータで確認してから yamlite.yaml に保存されます。`:`Changes are checked against your data before they are saved to yamlite.yaml.`),Jc=((e={},t={})=>(t.locale??E())===`ja`?`編集中`:`Editing`),Yc=((e={},t={})=>(t.locale??E())===`ja`?`展開ビュー`:`Expanded views`),Xc=((e={},t={})=>(t.locale??E())===`ja`?`識別子`:`identity`),Zc=((e={},t={})=>(t.locale??E())===`ja`?`インデックス`:`Indexes`),Qc=((e={},t={})=>(t.locale??E())===`ja`?`推論`:`inferred`),$c=((e={},t={})=>(t.locale??E())===`ja`?`キー`:`key`),el=((e={},t={})=>(t.locale??E())===`ja`?`なし`:`None`),tl=((e={},t={})=>(t.locale??E())===`ja`?`未作成`:`Not created`),nl=((e={},t={})=>(t.locale??E())===`ja`?`未作成の理由は同期画面の警告に出ます。`:`Why an index wasn't created is shown in the warnings on the Sync screen.`),rl=((e={},t={})=>(t.locale??E())===`ja`?`まだありません`:`Not yet`),il=((e={},t={})=>(t.locale??E())===`ja`?`親`:`parent`),al=((e={},t={})=>(t.locale??E())===`ja`?`パス`:`path`),ol=((e={},t={})=>(t.locale??E())===`ja`?`参照`:`References`),sl=((e={},t={})=>(t.locale??E())===`ja`?`必須`:`required`),cl=((e={},t={})=>(t.locale??E())===`ja`?`テーブル`:`Table`),ll=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml の宣言と、DB 上の状態です。変更は yamlite.yaml を編集してください。`:`What yamlite.yaml declares, and what is in the DB. To change it, edit yamlite.yaml.`),ul=((e={},t={})=>(t.locale??E())===`ja`?`テーブルあり`:`Table exists`),dl=e=>`Schema of ${e?.table}`,fl=e=>`${e?.table} のスキーマ`,pl=((e,t={})=>(t.locale??E())===`ja`?fl(e):dl(e)),ml=((e={},t={})=>(t.locale??E())===`ja`?`YAMLite の管理外(SQL などで作成)`:`Not managed by YAMLite (created with SQL or similar)`),hl=((e={},t={})=>(t.locale??E())===`ja`?`ビュー`:`View`),gl=((e={},t={})=>(t.locale??E())===`ja`?`VIEW は yamlite.yaml の expand から作られる読み取り専用の表です。`:`A VIEW is a read-only table built from expand in yamlite.yaml.`),_l=((e={},t={})=>(t.locale??E())===`ja`?`VIEW あり`:`VIEW exists`),vl=((e={},t={})=>(t.locale??E())===`ja`?`一致するレコードはありません。`:`No records match.`),yl=((e={},t={})=>(t.locale??E())===`ja`?`2 文字以上入力してください。`:`Type at least 2 characters.`),bl=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} match`:t===`other`?`${e?.count} matches`:`search_hits`},xl=e=>`${e?.count} 件`,Sl=((e,t={})=>(t.locale??E())===`ja`?xl(e):bl(e)),Cl=((e={},t={})=>(t.locale??E())===`ja`?`すべてのテーブルを検索…`:`Search every table…`),wl=e=>`Show all ${e?.count} in this table`,Tl=e=>`${e?.count} 件すべて表示`,El=((e,t={})=>(t.locale??E())===`ja`?Tl(e):wl(e)),Dl=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} table`:t===`other`?`${e?.count} tables`:`search_tables`},Ol=e=>`${e?.count} テーブル`,kl=((e,t={})=>(t.locale??E())===`ja`?Ol(e):Dl(e)),Al=((e={},t={})=>(t.locale??E())===`ja`?`検索`:`Search`),jl=e=>`Can't read yamlite.yaml. Syncing with the last good config: ${e?.error}`,Ml=e=>`yamlite.yaml を読み込めません。前回の設定で同期を続けています: ${e?.error}`,Nl=((e,t={})=>(t.locale??E())===`ja`?Ml(e):jl(e)),Pl=((e={},t={})=>(t.locale??E())===`ja`?`スナップショットを読み込めませんでした`:`Couldn't load the snapshot`),Fl=((e={},t={})=>(t.locale??E())===`ja`?`file:// では開けません。このフォルダを Web サーバー経由で開いてください(例: npx serve)。`:`This page can't be opened from file://. Serve this folder over a web server instead (e.g. npx serve).`),Il=e=>`${e?.title} (coming soon)`,Ll=e=>`${e?.title}(準備中)`,Rl=((e,t={})=>(t.locale??E())===`ja`?Ll(e):Il(e)),zl=((e={},t={})=>(t.locale??E())===`ja`?"セッションが切れました。`yamlite serve` が表示した URL を開き直してください。":"Your session has expired. Reopen the URL that `yamlite serve` printed."),Bl=((e={},t={})=>(t.locale??E())===`ja`?`yamlite.yaml に追加`:`Add to yamlite.yaml`),Vl=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`✓ ${e?.count} row changed`:t===`other`?`✓ ${e?.count} rows changed`:`sql_changed`},Hl=e=>`✓ ${e?.count} 行を変更`,Ul=((e,t={})=>(t.locale??E())===`ja`?Hl(e):Vl(e)),Wl=((e={},t={})=>(t.locale??E())===`ja`?`DROP は元に戻せません。`:`DROP can't be undone.`),Gl=((e={},t={})=>(t.locale??E())===`ja`?`WHERE がないため、すべての行が対象になります。`:`There is no WHERE, so every row is affected.`),Kl=((e={},t={})=>(t.locale??E())===`ja`?`実行しますか?`:`Run this?`),ql=((e={},t={})=>(t.locale??E())===`ja`?`実行`:`Run`),Jl=((e={},t={})=>(t.locale??E())===`ja`?`履歴`:`History`),Yl=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} row`:t===`other`?`${e?.count} rows`:`sql_rows`},Xl=e=>`${e?.count} 行`,Zl=((e,t={})=>(t.locale??E())===`ja`?Xl(e):Yl(e)),Ql=((e={},t={})=>(t.locale??E())===`ja`?`実行`:`Run`),$l=((e={},t={})=>(t.locale??E())===`ja`?`実行 ⌘↵`:`Run ⌘↵`),eu=((e={},t={})=>(t.locale??E())===`ja`?`変更されたファイル`:`Changed files`),tu=((e={},t={})=>(t.locale??E())===`ja`?`(先頭 1000 行)`:` (first 1000 rows)`),nu=e=>`${e?.table} is not in yamlite.yaml, so it is not synced.`,ru=e=>`${e?.table} は yamlite.yaml にないため同期されません。`,iu=((e,t={})=>(t.locale??E())===`ja`?ru(e):nu(e)),au=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`● ${e?.count} conflict`:t===`other`?`● ${e?.count} conflicts`:`status_conflicts`},ou=e=>`● 競合 ${e?.count} 件`,su=((e,t={})=>(t.locale??E())===`ja`?ou(e):au(e)),cu=((e={},t={})=>(t.locale??E())===`ja`?`接続中`:`connected`),lu=((e={},t={})=>(t.locale??E())===`ja`?`切断`:`disconnected`),uu=e=>`last sync ${e?.ago}`,du=e=>`最終同期 ${e?.ago}`,fu=((e,t={})=>(t.locale??E())===`ja`?du(e):uu(e)),pu=e=>`Read-only snapshot · ${e?.at} UTC`,mu=e=>`読み取り専用スナップショット · ${e?.at} UTC`,hu=((e,t={})=>(t.locale??E())===`ja`?mu(e):pu(e)),gu=e=>`theme: ${e?.theme}`,_u=e=>`テーマ: ${e?.theme}`,vu=((e,t={})=>(t.locale??E())===`ja`?_u(e):gu(e)),yu=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`⚠ ${e?.count} warning`:t===`other`?`⚠ ${e?.count} warnings`:`status_warnings`},bu=e=>`⚠ 警告 ${e?.count} 件`,xu=((e,t={})=>(t.locale??E())===`ja`?bu(e):yu(e)),Su=e=>`watching ${e?.root}`,Cu=e=>`${e?.root} を監視中`,wu=((e,t={})=>(t.locale??E())===`ja`?Cu(e):Su(e)),Tu=((e={},t={})=>(t.locale??E())===`ja`?`アクティビティ`:`Activity`),Eu=((e={},t={})=>(t.locale??E())===`ja`?`退避`:`Backup`),Du=((e={},t={})=>(t.locale??E())===`ja`?`コンフリクト`:`Conflicts`),Ou=((e={},t={})=>(t.locale??E())===`ja`?`退避された側では削除されていました`:`It had been deleted on the backed-up side`),ku=((e={},t={})=>(t.locale??E())===`ja`?`既読`:`Mark read`),Au=((e={},t={})=>(t.locale??E())===`ja`?`既読にしました`:`Marked as read`),ju=e=>`Kept: ${e?.winner}`,Mu=e=>`採用: ${e?.winner}`,Nu=((e,t={})=>(t.locale??E())===`ja`?Mu(e):ju(e)),Pu=e=>` · last sync ${e?.at}`,Fu=e=>` · 最終同期 ${e?.at}`,Iu=((e,t={})=>(t.locale??E())===`ja`?Fu(e):Pu(e)),Lu=((e={},t={})=>(t.locale??E())===`ja`?`まだ何も同期していません`:`Nothing synced yet`),Ru=((e={},t={})=>(t.locale??E())===`ja`?`コンフリクトはありません`:`No conflicts`),zu=((e={},t={})=>(t.locale??E())===`ja`?`ヘッダーなし(古い形式)`:`no header (old format)`),Bu=((e={},t={})=>(t.locale??E())===`ja`?`警告はありません`:`No warnings`),Vu=((e={},t={})=>(t.locale??E())===`ja`?`開く`:`Open`),Hu=((e={},t={})=>(t.locale??E())===`ja`?`現在の版は新しい退避として残るので、あとでもう一度戻せます。`:`The current version is kept as a new backup, so you can restore it again later.`),Uu=e=>`Restore ${e?.table} / ${e?.key}?`,Wu=e=>`${e?.table} / ${e?.key} を戻しますか?`,Gu=((e,t={})=>(t.locale??E())===`ja`?Wu(e):Uu(e)),Ku=((e={},t={})=>(t.locale??E())===`ja`?`キーが分からないため、手で戻してください`:`The key is unknown, so restore it by hand`),qu=e=>`Restored ${e?.table} / ${e?.key}`,Ju=e=>`${e?.table} / ${e?.key} を戻しました`,Yu=((e,t={})=>(t.locale??E())===`ja`?Ju(e):qu(e)),Xu=((e={},t={})=>(t.locale??E())===`ja`?`警告`:`Warnings`),Zu=((e={},t={})=>(t.locale??E())===`ja`?`監視中`:`watching`),Qu=e=>`kept ${e?.winner}`,$u=e=>`${e?.winner} を採用`,ed=((e,t={})=>(t.locale??E())===`ja`?$u(e):Qu(e)),td=((e={},t={})=>(t.locale??E())===`ja`?`列`:`Columns`),nd=((e={},t={})=>(t.locale??E())===`ja`?`展開ビュー`:`expanded view`),rd=e=>`from ${e?.parent}`,id=e=>`${e?.parent} から`,ad=((e,t={})=>(t.locale??E())===`ja`?id(e):rd(e)),od=((e={},t={})=>(t.locale??E())===`ja`?`グループ`:`Group`),sd=e=>`group: ${e?.group}`,cd=e=>`グループ: ${e?.group}`,ld=((e,t={})=>(t.locale??E())===`ja`?cd(e):sd(e)),ud=((e={},t={})=>(t.locale??E())===`ja`?`グループ名`:`group name`),dd=((e={},t={})=>(t.locale??E())===`ja`?`なし`:`none`),fd=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} record`:t===`other`?`${e?.count} records`:`table_records`},pd=e=>`${e?.count} 件`,md=((e,t={})=>(t.locale??E())===`ja`?pd(e):fd(e)),hd=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} row`:t===`other`?`${e?.count} rows`:`table_rows`},gd=e=>`${e?.count} 行`,_d=((e,t={})=>(t.locale??E())===`ja`?gd(e):hd(e)),vd=((e={},t={})=>(t.locale??E())===`ja`?`スキーマ`:`Schema`),yd=((e={},t={})=>(t.locale??E())===`ja`?`グループなし`:`No group`),bd=((e={},t={})=>(t.locale??E())===`ja`?`警告`:`warnings`),xd=e=>{let t=rt(`en`,e?.count,{},!0);return t===`one`?`${e?.count} warning`:t===`other`?`${e?.count} warnings`:`table_warnings`},Sd=e=>`${e?.count} 件の警告`,Cd=((e,t={})=>(t.locale??E())===`ja`?Sd(e):xd(e)),wd=((e={},t={})=>(t.locale??E())===`ja`?`ダーク`:`dark`),Td=((e={},t={})=>(t.locale??E())===`ja`?`ライト`:`light`),Ed=((e={},t={})=>(t.locale??E())===`ja`?`システム`:`system`),Dd=((e={},t={})=>(t.locale??E())===`ja`?`データベースが使用中です。少し待ってから再試行してください`:`The database is busy. Wait a moment and try again`),Od=e=>`Not reflected: ${e?.record}`,kd=e=>`反映されませんでした: ${e?.record}`,Ad=((e,t={})=>(t.locale??E())===`ja`?kd(e):Od(e)),jd=((e={},t={})=>(t.locale??E())===`ja`?`ビューの行`:`view row`),Md=((e={},t={})=>(t.locale??E())===`ja`?`この行は元のレコードにもうありません。`:`This row is no longer in its record.`),Nd=e=>`Open record in ${e?.table}`,Pd=e=>`${e?.table} のレコードを開く`,Fd=((e,t={})=>(t.locale??E())===`ja`?Pd(e):Nd(e)),Id=((e={},t={})=>(t.locale??E())===`ja`?`レコードが別の場所で変更されたため、最新の内容を表示しています。もう一度編集してください。`:`The record changed elsewhere; the form now shows the latest. Make the edit again.`),Ld=N(),z=l();function Rd({error:e,protocol:t=location.protocol}){let n=e instanceof Error?e.message:String(e);return(0,z.jsxs)(`div`,{role:`alert`,className:`flex h-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,z.jsx)(`p`,{className:`text-base font-semibold`,children:Pl()}),(0,z.jsx)(`p`,{className:`font-mono text-[12px] text-err`,children:n}),t===`file:`&&(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:Fl()})]})}var B=t(a(),1),zd=B.use,Bd=B.useLayoutEffect;function Vd(e){return e[e.length-1]}function Hd(e,t){return typeof e==`function`?e(t):e}var Ud=Object.prototype.hasOwnProperty;function Wd(e){for(let t in e)if(Ud.call(e,t))return!0;return!1}var Gd=()=>Object.create(null),Kd=(e,t)=>qd(e,t,!0);function qd(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&&!(Jd(e)&&Jd(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&&Vd(a)!==`${o-1}`||c&&Vd(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`?qd(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`?qd(d,o,n,r):o,i&&=u===d&&(a[l]===f||Ud.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?Gd():{};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`?qd(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function Jd(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function Yd(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&&!Yd(a,o,n,r))return!1}return!0}if(Jd(e)&&Jd(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!Yd(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||!Yd(e[a],t[a],n,r)))return!1;return i===0}return!1}function Xd(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 Zd=/[\x00-\x1f\x7f"<>`{}]/g;function Qd(e){return e.replace(Zd,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function $d(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 Qd(t)}var ef=[`http:`,`https:`,`mailto:`,`tel:`];function tf(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 nf=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function rf(e,t){if(!e)return!1;if(nf.test(e))return!0;let n=tf(e);return n?!t.has(n):!1}function af(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+=$d(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=$d(r?e.slice(r):e)}return t}function of(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function sf(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 cf(){throw Error(`Invariant failed`)}function lf(e){return e.replace(/\/{2,}/g,`/`)}function uf(e){return e===`/`?e:e.replace(/^\/+/,``)}function df(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function ff(e){return df(uf(e))}function pf(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function mf(e,t,n=`never`,r){if(t.includes(`//`)&&(t=lf(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=lf(e)),o=e.split(`/`);o.length>1&&Vd(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&&(Vd(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?lf(s):s)||`/`;return a&&r&&r.set(a,c),c}function hf(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 gf(e){return e==null||e===``}function _f(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 vf(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&&gf(f)){if(c===`/`&&!d)continue;f=``}o+=c+_f(s,f,r)+(d||``)}}return o+a||`/`}function yf(e){return e?.isNotFound===!0}function bf(){try{return sessionStorage}catch{return}}var xf=`tsr-scroll-restoration-v1_3`,Sf=bf();function Cf(){try{return JSON.parse(Sf?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var wf=Cf(),Tf=`data-scroll-restoration-id`,Ef=e=>e.state.__TSR_key||e.href;function Df(e){let t=e.getAttribute(Tf);if(t)return`[${Tf}="${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 Of=!1,kf=`window`;function Af(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function jf(e){let t=new Set;for(let n of e){if(n===kf)continue;let e=Af(n);e&&t.add(e)}return t}function Mf(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||Ef,a=new Set,o=e=>{let t=wf[e]||={};for(let e of a)e===document?t[kf]={scrollX,scrollY}:e.isConnected&&(t[Df(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,Of=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Of||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{Sf?.setItem(xf,JSON.stringify(wf))}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=wf[d];if(e){let t=wf[u];for(let n in e){if(n===kf){if(s)continue}else{let e=Af(n);if(!e||s&&o&&(l??=jf(o),l.has(e)))continue}t||=wf[u]={},t[n]??=e[n]}}}Of=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=jf(o));let t=e&&i&&c,s=r.e?wf[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===kf){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Af(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{Of=!1}}))}function Nf(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function Pf(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Ff(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Pf(r):Array.isArray(t)?t.push(Pf(r)):n[e]=[t,Pf(r)]}return n}var If=/^(?:\s|["[{\d-]|fa|nu|tr)/,Lf=zf(JSON.parse),Rf=Bf(JSON.stringify,JSON.parse);function zf(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=Ff(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!If.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Bf(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&&!If.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=Nf(e,r);return t?`?${t}`:``}}var Vf=`__root__`;function Hf(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Uf(e){return e instanceof Response&&!!e.options}function Wf(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 Gf=4,Kf=5;function qf(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 Jf(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 Yf(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=Vd(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=Jf(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=Zf(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=Zf(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=Zf(r,Kf);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=Zf(r,Gf);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 Xf(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 Zf(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 Qf(e,t){let n=Zf(),r=[];function i(e,t,n,a){let[o,s,c]=Yf(!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(Xf);t.masksTree=n,t.flatCache=Wf(1e3)}function $f(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=rp(e,t.masksTree);return t.flatCache.set(e,r),r}function ep(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Zf(),Yf(t,{from:e},1,o),i.singleCache.set(a,o)),rp(r,o,n)}function tp(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=rp(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ap(a.route)),t.matchCache.set(r,a),a}function np(e,t=!1){let n=Zf(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&cf(),i[e.id]=e,o!==0&&e.path){let t=df(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Yf(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Xf);return{processedTree:{segmentTree:n,singleCache:Wf(1e3),matchCache:Wf(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function rp(e,t,n=!1){let r=e.split(`/`),i=sp(e,r,t,n);if(!i)return null;let[a]=ip(e,r,i);return{route:i.node.route,rawParams:a}}function ip(e,t,n){let r=op(n.node),i=n.node.data&&qf(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===Gf)break;if(u.kind===Kf){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 ap(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function op(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function sp(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!Vd(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&&!dp(l,n))continue;if(i.parse){if(!up(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Gf&&dp(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Gf||i.kind===2)&&dp(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&&(up(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&lp(f,o))return n;dp(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+cp(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+cp(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+cp(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+cp(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 cp(e,t){return 2**(e-t-1)}function lp(e,t){return e===2**(t-1)-1}function up(e,t,n){let r,i;try{[r,i]=ip(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 dp(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===Gf)>(e.node.kind===Gf)||t.node.kind===Gf==(e.node.kind===Gf)&&t.node.depth>e.node.depth)))}function fp(e,t,n){let r=ff(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=lf(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>pp(n,s.input({url:e})),output:({url:e})=>s.output({url:mp(n,e)})}:s}function pp(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 mp(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 hp(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(()=>{sf(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 gp=`__TSR_index`,_p=`popstate`,vp=`beforeunload`,yp=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function bp(e){let t=yp.exec(e);return t?`/`+e.slice(t[0].length):e}function xp(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
11
|
-
\r`.includes(e)?``:encodeURIComponent(e))),bp(e)}function Sp(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=Dp(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[gp];i=Cp(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[gp];i=Cp(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[gp]!==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 Cp(e,t){let n=Op();return{...t,key:n,__TSR_key:n,[gp]:e}}function wp(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=>xp(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Dp(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Op();t.history.replaceState({[gp]: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=Dp(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[gp]-l.state[gp],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=Sp({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(vp,x,{capture:!0}),t.removeEventListener(_p,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(vp,x,{capture:!0}),t.addEventListener(_p,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 Tp(e){let t=e?.window??(typeof document<`u`?window:void 0);return wp({window:t,parseLocation:()=>{let e=t.location.hash,n=e.indexOf(`#`,1);return n<0&&(n=e.length),Dp(`${e?e.slice(1,n):`/`}${t.location.search}${e.slice(n)}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Ep(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,r=t.map((e,t)=>Cp(t,void 0)),i=()=>Dp(t[n],r[n]),a=[];return Sp({getLocation:i,getLength:()=>t.length,pushState:(e,i)=>{n=n<t.length-1?n+1:t.length,r[n]=i,t[n]=e,n<t.length-1&&(t.length=n+1,r.length=n+1)},replaceState:(e,i)=>{r[n]=i,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:xp,getBlockers:()=>a,setBlockers:e=>a=e})}function Dp(e,t){let n=xp(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Op();t={[gp]: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 Op(){return(Math.random()+1).toString(36).slice(7)}function kp(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Ap(e){return e.pathname+e.search+e.hash}function jp(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Mp(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Np({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Pp(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Fp(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 Ip=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:wp()),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!==`/`&&ff(n)?fp(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=hp(this.latestLocation,e),Mf(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=np(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Qf(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:Wf(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:af(e),external:!1,searchStr:o,search:Kd(t?.search,i),hash:af(r.slice(1)),state:qd(t?.state,a)}}let o=pp(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:af(bp(o.pathname)),external:!!this.rewrite&&kp(o,this.origin),searchStr:c,search:Kd(t?.search,s),hash:af(o.hash.slice(1)),state:qd(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=tp(df(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=Dp(n.href,{});n={...n,to:pp(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=mf(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[df(c)],u=c.includes(`$`),d;if(l)d=l._branch??=ap(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??Yf(!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??=Vp(n.params,e),!Wd(p))break;p===e&&(p=Object.assign(Gd(),p));try{Object.assign(p,t(p))}catch{}}}p??=Vp(n.params,Hp(n.params,f)?o()[3]:Up);let m=e.leaveParams?c:bp(af(f?vf(c,f,p,this.pathParamsDecoder):c)),h=Wp(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,Bp(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?Gp(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||Up,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:Up,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=mp(this.rewrite,e);C=Ap(e),kp(n,t)?(w=n.href,T=!0):w=bp(Ap(n))}else C=of(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=$f(r.pathname,this.processedTree);if(t){let i=Object.assign(Gd(),t.rawParams),{from:a,params:o,...s}=t.route,c=Vp(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 Lp(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=df(this.latestLocation.href)===df(n.href)&&Yd(Np(n.state),Np(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?tf(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 Lp(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 Rm(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(Mp(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`)&&jp(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(nf.test(n)||(r=tf(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:kp(e,this.origin)||(n=Ap(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=Xp,this.preloadRoute=e=>zm(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?mf(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=ep(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Yd(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?Yd(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=hf(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??Rf,parseSearch:e.parseSearch??Lf,protocolAllowlist:e.protocolAllowlist??ef}),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=Yf(!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[`**`]:df(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Kp(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=Bp(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof Rp||(r=new Rp(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=Gd(),_=i._interpolation?vf(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{qp(i,d)}catch(e){if(x=yf(e)||Uf(e)?e:new zp(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:Kd(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=jp(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?Kd(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?qd(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`?Kd(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=Vd(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=Vd(a),c={...e.search};for(let e of a)try{Object.assign(c,Bp(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{qp(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Lp(e,t,{replace:n,ignoreBlocker:r}){if(!rf(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 Rp=class extends Error{},zp=class extends Error{};function Bp(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Rp(`Async validation not supported`);if(n.issues)throw new Rp(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 Vp(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 Hp(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!Ud.call(e,t[1]))}var Up=Object.freeze({});function Wp(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=Bp(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 Gp(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=Hd(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 Kp(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 Vf}function qp(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Jp(e,t){return e.options[t]?.preload?.()}function Yp(e,t){let n=Jp(e,`component`),r=Jp(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Xp(e,t,n){let r=()=>t===!1?void 0:t?Jp(e,t):Yp(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 Zp(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function Qp(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var $p=0,em=1,tm=2,nm=3,rm=[4];function im(e){return typeof e[0]==`number`}function am(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 om(e,t){return e.routesById[t.routeId]}function sm(e,t,n){return Uf(e)?[nm,e]:yf(e)?(e.routeId||=n,[tm,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[em,e]):[$p,e]}function cm(e,t){let n=sm(t,!0,e.id);if(n[0]!==em)return n;try{e.options.onError?.(n[1])}catch(t){n=sm(t,!0,e.id)}return n}function lm(e,t,n,r,i){return i[0].signal.aborted?rm:Tm(e,t,n,cm(n,r),i)}async function um(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=om(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 fm(e,r),[i,lm(e,t,u,a,n)]}if(c.aborted)return[i,rm];let p=r.paramsError??r.searchError;if(p!==void 0)return fm(e,r),[i,lm(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{hm(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?am(a,c):a);if(c.aborted)return[i,rm];let s=Tm(e,t,u,sm(o,!1,u.id),n);if(s[0]!==$p)return fm(e,r),[i,s];r.context={...r.context,...o}}catch(a){return fm(e,r),[i,lm(e,t,u,a,n)]}finally{r.status=h,hm(e,r,!1,n[0])}}i()}function dm(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 fm(e,t){let n=t._flight;t._flight=void 0,dm(e,t,n)?.abort()}function pm(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=dm(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function mm(e){for(let t of e){let e=t._flight;e&&e[2]++}}function hm(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 gm(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 _m(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return rm;if(!i)return[$p,void 0];let l=n._flight;hm(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(gm(e,t,n,r,s,a,!!o[3]))).then(e=>sm(e,!1,r.id),e=>sm(e,!0,r.id)).then(t=>(t[0]!==$p&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===em&&l[2]?cm(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Tm(e,t,r,await am(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return fm(e,n),rm}finally{hm(e,n,!1,s)}}function vm(e,t,n){t[0]!==nm&&(e.status=`success`,e.error=void 0,t[0]===$p?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function ym(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&&fm(e,r)}function bm(e,t){return t[0]===em||t[0]===tm?{...e,status:t[0]===em?`error`:`notFound`,error:t[1],_flight:void 0}:e}function xm(e,t,n,r,i,a,o){let s=t[1][n],c=om(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(gm(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=rm)),!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,fm(e,s),p=lm(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,dm(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?_m(e,t,s,c,g,i,a).then(t=>(vm(s,t,l),t[0]===$p&&(m&&!a[0].signal.aborted&&ym(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[$p,s.loaderData]),T=(async()=>{try{let e=Xp(c,void 0,C);e&&await am(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,lm(e,t,c,r,a)]}let r=await w;x&&r[0]===$p&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>bm(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=_m(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,vm(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>bm(E,e))}async function Sm(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=om(e,t[n]);try{let e=Xp(i,!1);e&&await am(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Cm(e,t){t[2]&&=(pm(e,t[2].map(e=>e[3])),void 0)}async function wm(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]>=nm)throw[a,t];!i&&t[0]!==$p&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===nm)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Tm(e,t,n,r,i,a){for(;r[0]===nm;){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]?[nm,t]:[nm,t,a]}return[nm,o,n]}catch(e){r=a?[em,e]:cm(n,e),a=!0}}return r}async function Em(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]===tm?Sm(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=nm)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]!==$p&&t[0]<nm&&!(`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)>=nm){let n=s[1];if(n[0]!==nm||n[1].options.reloadDocument||n[2])return Cm(e,t),n;c=!0,s=[0,[em,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===em?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=om(e,u);try{await am(i?Promise.resolve().then(()=>Xp(m,l===em?`errorComponent`:`notFoundComponent`)):Promise.all([Xp(m),Xp(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Cm(e,t),rm}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Cm(e,t),pm(e,o),p()):u.status=`success`}return t}async function Dm(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=om(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 am(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 Om(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 Sm(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=xm(e,i,t,u,f,r,l)},m=await um(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===tm){let t=await Sm(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=nm&&(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=Em(e,i,u,r[0],wm(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=wm(i[2],void 0,void 0,h.then(e=>im(e)?0:Zp(n).length,()=>0))),o=await h}catch(t){if(Cm(e,i),t===a&&a.aborted)return rm;throw t}return im(o)?o:Dm(e,o,a,r[6]===n.length?r[6]:0)}function km(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=om(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(()=>km(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 Am(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 jm(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Zp(t[3]).some(e=>e.id===n[1]))return;let i;try{await am(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Mm(e,t){e._committed=t,e.stores.setMatches(t)}function Nm(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=Zp(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=om(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=Pp(n);Mm(e,n),pm(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Fp(e,i,n,a,l,t)}async function Pm(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Fm(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 Im(e,t,n,r,i){let a=n.map(e=>({...e}));mm(a);for(let t of r)fm(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Em(e,o,r,t[0],i)}catch(t){throw pm(e,a),t}if(im(s))pm(e,a),s[0]===nm&&e._tx===t&&e._committed===n&&await Fm(e,t,s);else if(await Dm(e,s,t[0].signal),e._tx!==t||e._committed!==n)pm(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),fm(e,n))}Mm(e,a),pm(e,n,a)}}async function Lm(e,t,n,r,i,a){let o=await Om(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(im(o)){let n=o[0]===nm&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Am(e,t),pm(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Am(e,t);return}await Fm(e,t,o);return}let s=o[1];if(e._tx===t&&await jm(e,t),e._tx!==t){Am(e,t),pm(e,s),Cm(e,o);return}let c=t[2],l=Mp(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await jm(e,t),e._tx!==t){Am(e,t),pm(e,s),Cm(e,o);return}let n=await e.startTransition(()=>{Am(e,t),Nm(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&&Im(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)):Cm(e,o)})}async function Rm(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=Mp(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Pm(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});mm(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){pm(e,m),await Pm(e,n);return}e._preflight=void 0;let g,_=()=>Lm(e,y,f,()=>km(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(()=>Pm(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&hm(e,t,!1)}n[0].abort(),pm(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))&&km(e,y),g?.(_()),await y[5]):(pm(e,y[3]),y[3]=[],g?.(),await Pm(e,y))}async function zm(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}),mm(a),o=(e._preloads??=new Map).set(i,a),s=await Om(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),pm(e,a)),i.abort()}if(!im(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){yf(e)||console.error(e);return}}}var Bm=`Error preloading route! ☝️`,Vm=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=Vf:this.parentRoute||cf();let r=n?Vf:t?.path;r&&r!==`/`&&(r=uf(r));let i=t?.id||r,a=n?Vf:lf((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:lf(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=df(o)},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=>Hf({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.`)}},Hm=class extends Vm{constructor(e){super(e)}},Um=class extends B.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?B.createElement(this.props.errorComponent??Wm,{error:e[0],reset:this.reset}):this.props.children}};function Wm({error:e}){let[t,n]=B.useState(!1);return(0,z.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,z.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,z.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,z.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,z.jsx)(`div`,{children:(0,z.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,z.jsx)(`code`,{children:e.message}):null})}):null]})}var Gm=()=>!0,Km=()=>!1;function qm({children:e,fallback:t=null}){return(0,z.jsx)(B.Fragment,{children:Jm()?e:t})}function Jm(e=!0){return B.useSyncExternalStore(Ym,Gm,e?Km:Gm)}function Ym(){return()=>{}}var Xm=B.createContext(null);function Zm(e){return B.useContext(Xm)}function Qm(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{Qp(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 $m=B.createContext(void 0),eh=B.createContext(void 0);function th({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 nh(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 rh=[],ih=0,{link:ah,unlink:oh,propagate:sh,checkDirty:ch,shallowPropagate:lh}=th({update(e){return e._update()},notify(e){rh[dh++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,hh(e))}}),uh=0,dh=0,fh,ph=0;function mh(e){try{++ph,e()}finally{--ph||gh()}}function hh(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=oh(n,e)}function gh(){if(!(ph>0)){for(;uh<dh;){let e=rh[uh];rh[uh++]=void 0,e.notify()}uh=0,dh=0}}function _h(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 fh!==void 0&&ah(i,fh,ih),i._snapshot},subscribe(e){let t=nh(e),n={current:!1},r=vh(()=>{i.get(),n.current?(fh=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=fh,o=t?.compare??Object.is;if(n)fh=i,++ih,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{fh=a,n&&(i.flags&=-5),hh(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&ch(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&lh(e)}}else e&32&&(i.flags=e&-33);return fh!==void 0&&ah(i,fh,ih),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(sh(e),lh(e),gh())}},i}function vh(e){let t=()=>{let t=fh;fh=n,++ih,n.depsTail=void 0,n.flags=6;try{return e()}finally{fh=t,n.flags&=-5,hh(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&&ch(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,hh(this)}};return t(),n}var yh=n((e=>{var t=a();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),a=r[0].inst,l=r[1];return s(function(){a.value=n,a.getSnapshot=t,u(a)&&l({inst:a})},[e,n,t]),o(function(){return u(a)&&l({inst:a}),e(function(){u(a)&&l({inst:a})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bh=n(((e,t)=>{t.exports=yh()})),xh=n((e=>{var t=a(),n=bh();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,a){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),a!==void 0&&f.hasValue){var t=f.value;if(a(t,e))return c=t}return c=e}if(t=c,i(s,e))return t;var n=r(e);return a!==void 0&&a(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,a]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Sh=n(((e,t)=>{t.exports=xh()})),Ch=t(Sh(),1);function wh(e,t){return e===t}function Th(e,t=e=>e,n){let r=n?.compare??wh,i=(0,B.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,B.useCallback)(()=>e.get(),[e]);return(0,Ch.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Eh={};function Dh(e,t){let n=B.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=qd(n.current,i):i}}function Oh(e){let t=Zm(),n=B.useContext(e.from?eh:$m),r=e.from??n,i=t.stores.getMatchStore(r),a=Dh(e,t),o=Th(i,e=>e?a(e):Eh);if(o!==Eh)return o;(e.shouldThrow??!0)&&cf()}function kh(e){return Oh({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ah(e){let{select:t,...n}=e;return Oh({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function jh(e){return Oh({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 Mh(e){return Oh({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Nh(e){let t=Zm();return B.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ph(e){let t=Zm(),n=Nh(),r=B.useRef(null);return Bd(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Fh(e){return Oh({...e,select:t=>e.select?e.select(t.context):t.context})}function Ih(...e){let t=B.useRef(e),n=t.current;return e.forEach((e,t)=>{Yd(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Lh(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(Bm)})}function Rh(e,t){let n=typeof e==`string`&&tf(e);if(n)return t.has(n)?e:null}function zh(e,t,n,r){let i=pf(e.pathname,r),a=pf(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!Yd(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function Bh(e,t,n){let r=Zm(),i=B.useRef(null),a=B.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]=Ih(e.search,e.params,o),x=B.useContext($m),S=(r.stores._linkScopes??={})[x]??=Qm(r,x),[C,w,T]=B.useMemo(()=>{let t=Rh(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=Jh(t,r,u),s=u||o&&!tf(o)?zh(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]=B.useSyncExternalStore(S[1],w,T||w),O=D===void 0&&E,k=u||E===void 0,A=B.useRef(!1),j=e.reloadDocument||O||k?!1:c??r.options.defaultPreload,M=l??r.options.defaultPreloadDelay??0,N=B.useCallback(e=>{let t=e?.isIntersecting;t??j===`intent`?M?i.t??=setTimeout(()=>{i.t=void 0,Lh(r,C)},M):Lh(r,C):t===!1&&Kh(i)},[r,C,i,j,M]);B.useEffect(()=>{if(!j)return;j===`render`&&!A.current&&(A.current=!0,Lh(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(),Kh(i)}},[r,C,j,N,i]);let P=Wh(e,n);if(P.ref=t?a:i,O)return P.href=O,P;let ee=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(),Kh(i),r.navigate({...e,_fromLocation:C._fromLocation}))},F=()=>{j===`intent`&&Lh(r,C)},I=()=>{j===`intent`&&Kh(i)};return P.onClick=qh(f,ee),P.onBlur=qh(p,I),P.onFocus=qh(m,N),P.onMouseEnter=qh(h,N),P.onMouseLeave=qh(g,I),P.onTouchStart=qh(_,F),Gh(P,e,D,E,k,n)}var Vh={},Hh={className:`active`},Uh=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 Wh(e,t){let n={};for(let r in e)Uh.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Gh(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=Hd(n?o:s,{})??(n?Hh:Vh);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 Kh=e=>{clearTimeout(e.t),e.t=void 0},qh=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function Jh(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||!rf(i,t.protocolAllowlist))return i}var Yh=B.memo(B.forwardRef((e,t)=>{let n=e._asChild||`a`,r=Bh(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return B.createElement(n,r,i)}),Xh);function Xh(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Uh.has(r)||!Yd(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var Zh=class extends Vm{constructor(e){super(e),this.useMatch=e=>Oh({...e,from:this.id}),this.useRouteContext=e=>Fh({...e,from:this.id}),this.useSearch=e=>Mh({...e,from:this.id}),this.useParams=e=>jh({...e,from:this.id}),this.useLoaderDeps=e=>Ah({...e,from:this.id}),this.useLoaderData=e=>kh({...e,from:this.id}),this.useNavigate=()=>Nh({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,z.jsx)(Yh,{ref:t,from:this.fullPath,...e}))}};function Qh(e){return new Zh(e)}function $h(){return e=>tg(e)}var eg=class extends Hm{constructor(e){super(e),this.useMatch=e=>Oh({...e,from:this.id}),this.useRouteContext=e=>Fh({...e,from:this.id}),this.useSearch=e=>Mh({...e,from:this.id}),this.useParams=e=>jh({...e,from:this.id}),this.useLoaderDeps=e=>Ah({...e,from:this.id}),this.useLoaderData=e=>kh({...e,from:this.id}),this.useNavigate=()=>Nh({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,z.jsx)(Yh,{ref:t,from:this.fullPath,...e}))}};function tg(e){return new eg(e)}function ng(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(Xd(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(zd)zd(a());else throw a()}return B.createElement(r,e)};return o.preload=a,o}function rg(e){let t=Zm(),n=`not-found-${Th(t.stores.location,e=>e.pathname)}-${Th(t.stores.status)}`;return(0,z.jsx)(Um,{getResetKey:()=>n,onCatch:(t,n)=>{if(yf(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(yf(t))return e.fallback?.(t);throw t},children:e.children})}function ig(){return(0,z.jsx)(`p`,{children:`Not Found`})}function ag(e,t,n){return t.options.notFoundComponent?(0,z.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,z.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,z.jsx)(ig,{})}function og(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,z.jsx)(n,{}):null}var sg=(e,t)=>e[0]===t[0]&&e[1]===t[1],cg=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,lg=B.memo(function({routeId:e}){let t=Zm();return eee(t,Th(t.stores.getMatchStore(e)))});function eee(e,t){let n=e.routesById[t.routeId],r=og(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=cg(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,z.jsx)(ug,{match:t});s&&(l=(0,z.jsx)(qm,{fallback:r,children:l})),o&&(l=(0,z.jsx)(rg,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return B.createElement(o,e)},children:l})),i&&(l=(0,z.jsx)(Um,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(yf(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,z.jsx)(B.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,z.jsx)($m.Provider,{value:t.routeId,children:(0,z.jsxs)(u,{children:[l,null]})}):(0,z.jsxs)($m.Provider,{value:t.routeId,children:[l,null]})}var ug=B.memo(function({match:e}){let t=Zm(),n=e.routeId,r=t.routesById[n],i=B.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=B.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,z.jsx)(e,{},i):(0,z.jsx)(dg,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!cg(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return og(t,r)}if(e.status===`notFound`)return ag(t,r,e.error);if(e.status===`error`)throw e.error;return a}),dg=B.memo(function(){let e=Zm(),t=B.useContext($m),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Th(a,e=>[!!e._notFound,e.error],{compare:sg}),i=Th(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return ag(e,e.routesById[t],r);if(!i)return null;let a=(0,z.jsx)(lg,{routeId:i});return t===`__root__`?(0,z.jsx)(B.Suspense,{fallback:og(e),children:a}):a});function fg(e,t){let n=e[1];e.length=0,n?.(t)}function pg({t:e}){let t=Zm(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{fg(n,!1),n.push(i,a),e(t),B.startTransition(r)}),Bd(()=>{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(df(r.publicHref)!==df(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`,...Mp(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function mg(){let e=Zm(),t=e.routesById[Vf],n=og(e,t),r=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(pg,{t:B.useState()[1]}),e.ssr?(0,z.jsx)(hg,{}):(0,z.jsx)(B.Suspense,{fallback:n,children:(0,z.jsx)(hg,{})})]});return e.options.InnerWrap?(0,z.jsx)(e.options.InnerWrap,{children:r}):r}function hg(){let e=Zm(),t=e._rendered,n=Th(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Bd(()=>{t[0]===n&&fg(t,!0)},[t,n]);let a=i?(0,z.jsx)(lg,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,z.jsx)(Um,{getResetKey:()=>r,onCatch:void 0,children:a})}var gg=e=>({createMutableStore:_h,createReadonlyStore:_h,batch:mh}),_g=e=>new vg(e),vg=class extends Ip{constructor(e){super(e,gg)}};function yg({router:e,children:t,...n}){Wd(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,z.jsx)(Xm.Provider,{value:e,children:t});return e.options.Wrap?(0,z.jsx)(e.options.Wrap,{children:r}):r}function bg({router:e,...t}){return(0,z.jsx)(yg,{router:e,...t,children:(0,z.jsx)(mg,{})})}function xg(e){let t=Zm({warn:e?.router===void 0}),n=e?.router||t;return Th(n.stores.__store,Dh(e,n))}var Sg=B.createContext(void 0),Cg=e=>{let t=B.useContext(Sg);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},wg=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,z.jsx)(Sg.Provider,{value:e,children:t})),Tg={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Eg=new class{#e=Tg;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Dg(e){setTimeout(e,0)}var Og=typeof window>`u`||`Deno`in globalThis;function kg(){}function Ag(e,t){return typeof e==`function`?e(t):e}function jg(e){return typeof e==`number`&&e>=0&&e!==1/0}function Mg(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ng(e,t){return typeof e==`function`?e(t):e}function Pg(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ig(o,t.options))return!1}else if(!Rg(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Fg(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Lg(t.options.mutationKey)!==Lg(a))return!1}else if(!Rg(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ig(e,t){return(t?.queryKeyHashFn||Lg)(e)}function Lg(e){return JSON.stringify(e,(e,t)=>Ug(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Rg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!Rg(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Rg(e[r],t[r]))return!1;return!0}return!1}var zg=Object.prototype.hasOwnProperty;function Bg(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Hg(e)&&Hg(t);if(!r&&!(Ug(e)&&Ug(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:zg.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Bg(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Vg(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Hg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ug(e){if(!Wg(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Wg(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Wg(e){return Object.prototype.toString.call(e)===`[object Object]`}function Gg(e){return new Promise(t=>{Eg.setTimeout(t,e)})}function Kg(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Bg(e,t)}function qg(e){return e}function Jg(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yg(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xg=Symbol();function Zg(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Xg?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qg(e,t){return typeof e==`function`?e(...t):!!e}function tee(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var nee=()=>Og,$g=()=>nee(),e_=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},t_=new class extends e_{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ree=Dg;function iee(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ree,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var n_=iee(),r_=new class extends e_{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function aee(e){return Math.min(1e3*2**e,3e4)}function i_(e){return(e??`online`)!==`online`||r_.isOnline()}var a_=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function o_(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(kg);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new a_(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>t_.isFocused()&&(e.networkMode===`always`||r_.isOnline())&&e.canRun(),p=()=>i_(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??($g()?0:3),a=e.retryDelay??aee,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),Gg(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var s_=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jg(this.gcTime)&&(this.#e=Eg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($g()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Eg.clearTimeout(this.#e),this.#e=void 0)}};function c_(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{tee(e,()=>t.signal,()=>n=!0)},u=Zg(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Yg:Jg;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?u_:l_,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:l_(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function l_(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function u_(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function d_(e,t){return t?l_(e,t)!=null:!1}function f_(e,t){return!t||!e.getPreviousPageParam?!1:u_(e,t)!=null}var p_=class extends s_{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=g_(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=g_(this.options);e.data!==void 0&&(this.setState(h_(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Kg(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(kg).catch(kg):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ng(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Ng(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Mg(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Zg(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?c_(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=o_({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof a_&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof a_){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...m_(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...h_(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),n_.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function m_(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:i_(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function h_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function g_(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var __=class extends e_{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),y_(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return b_(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return b_(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ng(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Vg(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&x_(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Ng(this.options.enabled,this.#t)!==Ng(t.enabled,this.#t)||Ng(this.options.staleTime,this.#t)!==Ng(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ng(this.options.enabled,this.#t)!==Ng(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Vg(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(kg)),t}#h(e){return!$g()&&Ng(this.options.enabled,this.#t)!==!1&&jg(e)}#g(){this.#b();let e=Ng(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Mg(this.#r.dataUpdatedAt,e)+1;this.#u=Eg.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Ng(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Eg.setInterval(()=>{(this.options.refetchIntervalInBackground||t_.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Eg.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Eg.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&y_(e,t),o=i&&x_(e,n,t,r);(a||o)&&(l={...l,...m_(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Kg(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Kg(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:S_(e,t),refetch:this.refetch,isEnabled:Ng(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Vg(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n_.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function v_(e,t){return Ng(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Ng(t.retryOnMount,e)!==!1)}function y_(e,t){return v_(e,t)||e.state.data!==void 0&&b_(e,t,t.refetchOnMount)}function b_(e,t,n){if(Ng(t.enabled,e)!==!1&&Ng(t.staleTime,e)!==`static`){let r=Ng(n,e);return r===`always`||r!==!1&&S_(e,t)}return!1}function x_(e,t,n,r){return(e!==t||Ng(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&S_(e,n)}function S_(e,t){return Ng(t.enabled,e)!==!1&&e.isStaleByTime(Ng(t.staleTime,e))}var C_=class extends __{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:d_(t,n.data),hasPreviousPage:f_(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},w_=class extends s_{#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||T_(),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=o_({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),n_.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function T_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var E_=class extends e_{#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 w_({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=D_(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=D_(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=D_(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=D_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){n_.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Fg(t,e))}findAll(e={}){return this.getAll().filter(t=>Fg(e,t))}notify(e){n_.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n_.batch(()=>Promise.all(e.map(e=>e.continue().catch(kg))))}};function D_(e){return e.options.scope?.id}var O_=class extends e_{#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),Vg(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Lg(t.mutationKey)!==Lg(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??T_();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){n_.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)})})}},k_=class extends e_{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ig(r,t),a=this.get(i);return a||(a=new p_({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(){n_.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=>Pg(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Pg(e,t)):t}notify(e){n_.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n_.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n_.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},A_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new k_,this.#t=e.mutationCache||new E_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=t_.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=r_.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(Ng(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=Ag(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return n_.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;n_.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return n_.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=n_.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(kg).catch(kg)}invalidateQueries(e,t={}){return n_.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=n_.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(kg)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(kg)}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(Ng(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(Ng(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kg).catch(kg)}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(kg).catch(kg)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return r_.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(Lg(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Rg(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Lg(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Rg(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||=Ig(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===Xg&&(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()}},j_=B.createContext(!1),M_=()=>B.useContext(j_);j_.Provider;function N_(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var P_=B.createContext(N_()),F_=()=>B.useContext(P_),I_=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Qg(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},L_=e=>{B.useEffect(()=>{e.clearReset()},[e])},R_=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Qg(n,[e.error,r])),z_=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},B_=(e,t)=>e?.suspense&&t.isPending,V_=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function H_(e,t,n){let r=M_(),i=F_(),a=Cg(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,z_(o),I_(o,i,s),L_(i);let[l]=B.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(B.useSyncExternalStore(B.useCallback(e=>{let t=d?l.subscribe(n_.batchCalls(e)):kg;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),B.useEffect(()=>{l.setOptions(o)},[o,l]),B_(o,u))throw V_(o,l,i);if(R_({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function U_(e,t){return H_(e,__,t)}function W_(e,t){let n=Cg(t),[r]=B.useState(()=>new O_(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);let i=B.useSyncExternalStore(B.useCallback(e=>r.subscribe(n_.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=B.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(kg)},[r]);if(i.error&&Qg(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function G_(e,t){return H_(e,C_,t)}var K_=t(D(),1);function q_(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var J_=e=>{switch(e){case`success`:return Z_;case`info`:return $_;case`warning`:return Q_;case`error`:return ev;default:return null}},Y_=Array(12).fill(0),X_=({visible:e,className:t})=>B.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},B.createElement(`div`,{className:`sonner-spinner`},Y_.map((e,t)=>B.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Z_=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},B.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Q_=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},B.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),$_=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),ev=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),tv=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),B.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),nv=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},rv=1,iv=100,av=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:rv++,ov=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-iv;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=av(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],B.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(oee(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=av(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},sv=(e,t)=>ov.message(e,t),oee=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,cv=Object.assign(sv,{success:ov.success,info:ov.info,warning:ov.warning,error:ov.error,custom:ov.custom,message:ov.message,promise:ov.promise,dismiss:ov.dismiss,loading:ov.loading},{getHistory:()=>ov.toasts,getToasts:()=>ov.getActiveToasts()});q_(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function lv(e){return e.label!==void 0}var see=3,cee=`24px`,lee=`16px`,uv=4e3,uee=356,dee=14,fee=45,pee=200;function dv(...e){return e.filter(Boolean).join(` `)}function mee(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var hee=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=B.useState(null),[O,k]=B.useState(null),[A,j]=B.useState(!1),[M,N]=B.useState(!1),[P,ee]=B.useState(!1),[F,I]=B.useState(!1),[te,ne]=B.useState(!1),[re,ie]=B.useState(0),[ae,oe]=B.useState(0),se=B.useRef(n.duration||y||uv),ce=B.useRef(null),le=B.useRef(null),ue=c===0,de=c+1<=o,fe=n.type,pe=fe??`default`,L=n.dismissible!==!1,me=n.className||``,he=n.descriptionClassName||``,ge=B.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=B.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=B.useMemo(()=>n.duration||y||uv,[n.duration,y]),ye=B.useRef(0),be=B.useRef(0),xe=B.useRef(0),Se=B.useRef(null),[Ce,we]=b.split(`-`),Te=B.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=nv(),De=B.useMemo(()=>e.swipeDirections??mee(b),[e.swipeDirections,b]),Oe=n.invert||t,ke=fe===`loading`;be.current=B.useMemo(()=>ge*x+Te,[ge,Te]),B.useEffect(()=>{se.current=ve},[ve]),B.useEffect(()=>{j(!0)},[]),B.useEffect(()=>{let e=le.current;if(e){let t=e.getBoundingClientRect().height;return oe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),B.useLayoutEffect(()=>{if(!A)return;let e=le.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,oe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ae=B.useCallback(()=>{N(!0),ie(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},pee)},[n,d,a,be]);B.useEffect(()=>{if(n.promise&&fe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ee?(()=>{if(xe.current<ye.current){let e=new Date().getTime()-ye.current;se.current-=e}xe.current=new Date().getTime()})():se.current!==1/0&&(ye.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ae()},se.current)),()=>clearTimeout(e)},[u,i,n,fe,Ee,Ae]),B.useEffect(()=>{n.delete&&(Ae(),n.onDismiss==null||n.onDismiss.call(n,n))},[Ae,n.delete]);function je(){return w?.loading?B.createElement(`div`,{className:dv(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":fe===`loading`},w.loading):B.createElement(X_,{className:dv(C?.loader,n?.classNames?.loader),visible:fe===`loading`})}let Me=n.icon||w?.[fe]||J_(fe);return B.createElement(`li`,{tabIndex:0,ref:le,className:dv(_,me,C?.toast,n?.classNames?.toast,C?.[pe],n?.classNames?.[pe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":te,"data-removed":M,"data-visible":de,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":ue,"data-swiping":P,"data-dismissible":L,"data-type":fe,"data-invert":Oe,"data-swipe-out":F,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?re:be.current}px`,"--initial-height":S?`auto`:`${ae}px`,...m,...n.style},onDragEnd:()=>{ee(!1),D(null),Se.current=null},onPointerDown:e=>{e.button!==2&&!ke&&L&&(ce.current=new Date,ie(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(ee(!0),Se.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(F||!L)return;Se.current=null;let e=Number(le.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(le.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ce.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?De.includes(e>0?`right`:`left`):De.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=fee||a>.11))ie(be.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ae(),I(!0);else{var o,s;(o=le.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=le.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ne(!1),ee(!1),D(null)}},onPointerMove:e=>{var t,n;if(!Se.current||!L||window.getSelection()?.toString().length>0)return;let r=e.clientY-Se.current.y,i=e.clientX-Se.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(De.includes(`top`)||De.includes(`bottom`)){if(De.includes(`top`)&&r<0||De.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(De.includes(`left`)||De.includes(`right`))){if(De.includes(`left`)&&i<0||De.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&ne(!0),(t=le.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=le.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},_e&&!n.jsx&&fe!==`loading`?B.createElement(`button`,{"aria-label":T,"data-disabled":ke,"data-close-button":!0,onClick:ke||!L?()=>{}:()=>{Ae(),n.onDismiss==null||n.onDismiss.call(n,n)},className:dv(C?.closeButton,n?.classNames?.closeButton)},w?.close??tv):null,(fe||n.icon||n.promise)&&n.icon!==null&&(w?.[fe]!==null||n.icon)?B.createElement(`div`,{"data-icon":``,className:dv(C?.icon,n?.classNames?.icon)},fe===`loading`?n.icon||je():n.promise?je():null,fe===`loading`?null:Me):null,B.createElement(`div`,{"data-content":``,className:dv(C?.content,n?.classNames?.content)},B.createElement(`div`,{"data-title":``,className:dv(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?B.createElement(`div`,{"data-description":``,className:dv(v,he,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),B.isValidElement(n.cancel)?n.cancel:n.cancel&&lv(n.cancel)?B.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{lv(n.cancel)&&L&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ae())},className:dv(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,B.isValidElement(n.action)?n.action:n.action&&lv(n.action)?B.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{lv(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ae())},className:dv(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function fv(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function pv(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?lee:cee;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var gee=B.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=see,toastOptions:g,dir:_=fv(),gap:v=dee,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=B.useState([]),w=B.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=B.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=B.useState([]),[O,k]=B.useState(!1),[A,j]=B.useState(!1),[M,N]=B.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=B.useRef(null),ee=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),F=B.useRef(null),I=B.useRef(!1),te=B.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||ov.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return B.useEffect(()=>ov.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{K_.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),B.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),B.useEffect(()=>{S.length<=1&&k(!1)},[S]),B.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),B.useEffect(()=>{if(P.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,I.current=!1)}},[P.current]),B.createElement(`section`,{ref:t,"aria-label":b??`${x} ${ee}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?B.createElement(`ol`,{key:t,dir:_===`auto`?fv():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${uee}px`,"--gap":`${v}px`,...m,...pv(l,u)},onBlur:e=>{I.current&&!e.currentTarget.contains(e.relatedTarget)&&(I.current=!1,F.current&&=(F.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||I.current||(I.current=!0,F.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>B.createElement(hee,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:te,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))}),mv={fetch:(...e)=>globalThis.fetch(...e),eventSource:e=>new EventSource(e)},hv=()=>mv,gv=class extends Error{status;body;constructor(e,t,n){super(t),this.status=e,this.body=n}},_v=!1,vv=new Set,yv={expired:()=>_v,subscribe(e){return vv.add(e),()=>vv.delete(e)}};function bv(){if(!_v){_v=!0;for(let e of vv)e()}}var xv=3;async function Sv(e,t,n,r={}){let i=r.fetcher??hv().fetch,a=r.retryDelayMs??200;for(let r=0;;r++){let o=await i(t,{method:e,credentials:`same-origin`,headers:e===`GET`&&n===void 0?{}:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)});if(o.status===503&&r<xv)await new Promise(e=>setTimeout(e,a*2**r));else return Cv(o)}}async function Cv(e){e.status===401&&bv();let t=await e.text(),n=null;try{n=t?JSON.parse(t):null}catch{if(e.ok)throw new gv(e.status,`invalid response from server`,{});n={error:t||e.statusText}}if(!e.ok)throw new gv(e.status,String(n?.error??e.statusText),n??{});return n}var wv=(e,t,n)=>hv().fetch(e,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:n});function _ee(e){let t=`message`,n=[];for(let r of e.split(`
|
|
12
|
-
`)){if(r===``||r.startsWith(`:`))continue;let e=r.indexOf(`:`),i=e===-1?r:r.slice(0,e),a=e===-1?``:r.slice(e+1).replace(/^ /,``);i===`event`?t=a:i===`data`&&n.push(a)}return n.length===0?null:{event:t,data:n.join(`
|
|
13
|
-
`)}}function Tv(){let e=`the AI answer ended before it was complete`;return new gv(502,e,{error:e})}async function*vee(e,t,n){let r=await wv(e,t,n);if(r.ok||await Cv(r),r.body===null)throw Tv();let i=r.body.pipeThrough(new TextDecoderStream).getReader(),a=``;try{for(;;){let{value:e,done:t}=await i.read();if(t)break;a=(a+e).replace(/\r\n?/g,`
|
|
14
|
-
`);for(let e=a.indexOf(`
|
|
15
|
-
|
|
16
|
-
`);e!==-1;e=a.indexOf(`
|
|
17
|
-
|
|
18
|
-
`)){let t=_ee(a.slice(0,e));if(a=a.slice(e+2),t===null)continue;let n=JSON.parse(t.data);if(t.event===`delta`&&typeof n.text==`string`)yield n.text;else if(t.event===`done`)return;else if(t.event===`error`){let{status:e,...t}=n;throw new gv(typeof e==`number`?e:502,String(t.error),t)}}}}finally{i.cancel().catch(()=>{})}throw Tv()}var Ev=encodeURIComponent,Dv=e=>`/api/tables/${Ev(e)}/rows`,Ov=(e,t)=>`${Dv(e)}/${Ev(t)}`;function kv(e,t){return new URLSearchParams({q:e,per:String(t)})}function Av(e){let t=new URLSearchParams({limit:String(e.limit),offset:String(e.offset)});return e.sort&&t.set(`sort`,e.sort),e.filters.length>0&&t.set(`filter`,JSON.stringify(e.filters)),e.search&&t.set(`q`,e.search),t}var jv={meta:()=>Sv(`GET`,`/api/meta`),rows:(e,t)=>Sv(`GET`,`${Dv(e)}?${Av(t)}`),search:(e,t)=>Sv(`GET`,`/api/search?${kv(e,t)}`),schema:e=>Sv(`GET`,`/api/tables/${Ev(e)}/schema`),record:(e,t)=>Sv(`GET`,Ov(e,t)),create:(e,t,n)=>Sv(`POST`,Dv(e),{key:t,values:n}),update:(e,t,n,r)=>Sv(`PATCH`,Ov(e,t),{values:n,base:r}),rename:(e,t,n)=>Sv(`POST`,`${Ov(e,t)}/rename`,{to:n}),remove:(e,t)=>Sv(`DELETE`,Ov(e,t)),history:(e,t,n)=>Sv(`GET`,`${Ov(e,t)}/history${n===void 0?``:`?cursor=${encodeURIComponent(n)}`}`),historyDiff:(e,t,n)=>Sv(`GET`,`${Ov(e,t)}/history/${Ev(n)}/diff`),createTable:e=>Sv(`POST`,`/api/tables`,e),setGroup:(e,t)=>Sv(`PATCH`,`/api/tables/${Ev(e)}`,{group:t}),sql:e=>Sv(`POST`,`/api/sql`,{sql:e}),previewRules:(e,t,n,r={})=>Sv(`POST`,`/api/rules/preview`,{target:e,rules:t,base:n,...r}),saveRules:(e,t,n,r={})=>Sv(`PUT`,`/api/rules`,{target:e,rules:t,base:n,...r}),pageHtml:e=>Sv(`GET`,`/api/pages/${Ev(e)}/html`).then(e=>e.html),pageSql:(e,t)=>Sv(`POST`,`/api/sql`,{sql:t,page:e}),pageAi:(e,t,n)=>wv(`/api/pages/${Ev(e)}/ai`,t,n).then(e=>Cv(e)),pageAiStream:(e,t,n)=>vee(`/api/pages/${Ev(e)}/ai/stream`,t,n),conflicts:()=>Sv(`GET`,`/api/conflicts`),conflict:e=>Sv(`GET`,`/api/conflicts/${Ev(e)}`),restore:(e,t)=>Sv(`POST`,`/api/conflicts/${Ev(e)}/restore`,t===void 0?void 0:{expected:t}),dismiss:e=>Sv(`POST`,`/api/conflicts/${Ev(e)}/dismiss`)};function Mv(e){jv=e}var Nv={meta:()=>jv.meta(),rows:(e,t)=>jv.rows(e,t),search:(e,t)=>jv.search(e,t),schema:e=>jv.schema(e),record:(e,t)=>jv.record(e,t),create:(e,t,n)=>jv.create(e,t,n),update:(e,t,n,r)=>jv.update(e,t,n,r),rename:(e,t,n)=>jv.rename(e,t,n),remove:(e,t)=>jv.remove(e,t),history:(e,t,n)=>jv.history(e,t,n),historyDiff:(e,t,n)=>jv.historyDiff(e,t,n),createTable:e=>jv.createTable(e),setGroup:(e,t)=>jv.setGroup(e,t),previewRules:(e,t,n,r)=>jv.previewRules(e,t,n,r),saveRules:(e,t,n,r)=>jv.saveRules(e,t,n,r),sql:e=>jv.sql(e),pageHtml:e=>jv.pageHtml(e),pageSql:(e,t)=>jv.pageSql(e,t),pageAi:(e,t,n)=>jv.pageAi(e,t,n),pageAiStream:(e,t,n)=>jv.pageAiStream(e,t,n),conflicts:()=>jv.conflicts(),conflict:e=>jv.conflict(e),restore:(e,t)=>jv.restore(e,t),dismiss:e=>jv.dismiss(e)},Pv=null,Fv=()=>document.querySelector(`meta[name="yamlite-mode"]`)?.getAttribute(`content`)===`static`;function Iv(e){Pv=e}var Lv=()=>Pv,Rv=!1,zv=()=>Pv!==null||Rv,Bv={connected:!1,activity:[],warnings:{},configError:null,lastSyncAt:null,unseenConflicts:0},Vv=2,Hv=[`sync`,`conflict`,`error`,`reload`,`page`];function Uv(e){if(!(e instanceof MessageEvent)||typeof e.data!=`string`)return null;try{return JSON.parse(e.data)}catch{return null}}var Wv=class{state=Bv;subscribers=new Set;listeners=new Set;source=null;connect(e=`/api/events`,t=e=>hv().eventSource(e)){let n=t(e);this.source=n,n.addEventListener(`hello`,e=>{let t=Uv(e);t&&this.hello(t)});for(let e of Hv)n.addEventListener(e,e=>{let t=Uv(e);t&&this.apply(t)});n.onerror=()=>{this.set({connected:!1}),n.readyState===Vv&&Nv.meta().catch(()=>{})}}close(){this.source?.close(),this.source=null}getSnapshot=()=>this.state;subscribe=e=>(this.subscribers.add(e),()=>this.subscribers.delete(e));listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}hello(e){let t=[...e.activity].reverse().find(e=>e.type===`sync`);this.set({connected:!0,activity:e.activity,warnings:e.warnings,configError:e.configError,lastSyncAt:t?.at??this.state.lastSyncAt}),this.emit({type:`hello`})}apply(e){if(e.type===`page`){this.emit(e);return}let t={activity:[...this.state.activity,e].slice(-200)};e.type===`sync`?(t.warnings={...this.state.warnings,[e.table]:e.warnings},t.lastSyncAt=e.at):e.type===`conflict`?t.unseenConflicts=this.state.unseenConflicts+1:e.type===`reload`?t.configError=null:e.table===void 0&&e.message.endsWith(`keeping the previous configuration`)&&(t.configError=e.message),this.set(t),this.emit(e)}markConflictsSeen(){this.state.unseenConflicts>0&&this.set({unseenConflicts:0})}set(e){this.state={...this.state,...e};for(let e of this.subscribers)e()}emit(e){for(let t of this.listeners)t(e)}};function Gv(e){switch(e.type){case`hello`:return[[]];case`sync`:return e.changes.length===0&&e.schema.length===0?[]:[[`rows`,e.table],[`record`,e.table],[`history`,e.table],[`refKeys`,e.table],[`schema`],[`meta`],[`git`],[`gitdiff`],[`search`]];case`reload`:return[[`meta`],[`page`],[`schema`],[`git`],[`gitdiff`]];case`page`:return e.pages.map(e=>[`page`,e]);case`conflict`:return[[`conflicts`]];case`error`:return[]}}var Kv=(e,t)=>`${e}\u0000${t}`,qv=e=>e?.state===`pending`||e?.state===`waiting`;function Jv(e,t,n){if(t.type===`saved`)return{...e,[Kv(t.table,t.key)]:{state:`pending`,since:t.at}};if(t.type===`cancelled`){let{[Kv(t.table,t.key)]:n,...r}=e;return r}if(t.type===`tick`){let n=e;for(let[r,i]of Object.entries(e))i.state===`pending`&&t.now-i.since>=5e3&&(n={...n,[r]:{state:`waiting`}});return n}let r=t.event;if(r.type!==`sync`)return e;let i=e,a=`${r.table}\u0000`;for(let[t,o]of Object.entries(e)){if(!t.startsWith(a)||!qv(o))continue;let e=t.slice(a.length);if(!r.ok){i={...i,[t]:{state:`failed`,reason:r.error??re()}};continue}if(r.changes.some(t=>t.key===e&&(t.op===`toFile`||t.op===`deleteFile`))){i={...i,[t]:{state:`applied`,file:n(r.table,e)}};continue}let s=r.warnings.find(t=>t.startsWith(`${e}: `));s&&(i={...i,[t]:{state:`failed`,reason:s.slice(e.length+2)}})}return i}function Yv(e){return(t,n)=>{let r=e?.tables.find(e=>e.name===t);return r?r.mode===`list`?r.path:`${r.path}/${n}.yaml`:`${t}/${n}`}}var Xv=(0,B.createContext)(null),Zv=(0,B.createContext)(null),Qv=e=>{e instanceof gv&&e.status===503&&cv.error(Dd(),{id:`db-busy`})},$v=new A_({queryCache:new k_({onError:Qv}),mutationCache:new E_({onError:Qv}),defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}}}),ey=()=>U_({queryKey:[`meta`],queryFn:Nv.meta});function ty(){let e=(0,B.useContext)(Xv);if(!e)throw Error(`useEventStore outside <Providers>`);return e}function ny(){let e=ty();return(0,B.useSyncExternalStore)(e.subscribe,e.getSnapshot)}function ry(e,t){return(0,B.useContext)(Zv)?.state[Kv(e,t)]}function iy(){let e=(0,B.useContext)(Zv);if(!e)throw Error(`useReflectDispatch outside <Providers>`);return e.dispatch}function ay({store:e,children:t}){let n=Cg(),{data:r}=ey(),i=(0,B.useMemo)(()=>Yv(r),[r]),[a,o]=(0,B.useReducer)((e,t)=>Jv(e,t,i),{});(0,B.useEffect)(()=>{let t=e.listen(e=>{for(let t of Gv(e))n.invalidateQueries({queryKey:t});e.type!==`hello`&&o({type:`event`,event:e})}),r=Lv();return r?e.hello({activity:[],warnings:r.warnings,configError:null}):e.connect(),()=>{t(),e.close()}},[e,n]),(0,B.useEffect)(()=>{let e=setInterval(()=>o({type:`tick`,now:Date.now()}),1e3);return()=>clearInterval(e)},[]);let s=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{for(let[e,t]of Object.entries(a))t.state===`failed`?s.current.get(e)!==t.reason&&(s.current.set(e,t.reason),cv.error(Ad({record:e.replace(`\0`,`/`)}),{id:e,description:t.reason})):s.current.delete(e)},[a]);let c=(0,B.useMemo)(()=>({state:a,dispatch:o}),[a]);return(0,z.jsx)(Zv.Provider,{value:c,children:t})}function oy({children:e}){let t=(0,B.useMemo)(()=>new Wv,[]);return(0,z.jsx)(wg,{client:$v,children:(0,z.jsx)(Xv.Provider,{value:t,children:(0,z.jsx)(ay,{store:t,children:e})})})}var sy=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),cy=Object.defineProperty,ly=(e,t)=>cy(e,`name`,{value:t,configurable:!0});function uy(e){let t=e+`CollectionProvider`,[n,r]=d(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=ly(e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,z.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let c=e+`CollectionSlot`,l=m(c),u=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(c,n),o=s(t,i.collectionRef);return(0,z.jsx)(l,{ref:o,children:r})});u.displayName=c;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,h=m(f),g=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),c=s(t,o),l=a(f,n);return B.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,z.jsx)(h,{[p]:``,ref:c,children:r})});g.displayName=f;function _(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return ly(_,`useCollection`),[{Provider:o,Slot:u,ItemSlot:g},_,r]}ly(uy,`createCollection`);var dy=new WeakMap,fy=class e extends Map{static{ly(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],dy.set(this,!0)}set(e,t){return dy.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=hy(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=py(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=py(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return py(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function py(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=my(e,t);return n===-1?void 0:e[n]}ly(py,`at`);function my(e,t){let n=e.length,r=hy(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}ly(my,`toSafeIndex`);function hy(e){return e!==e||e===0?0:Math.trunc(e)}ly(hy,`toSafeInteger`);function gy(e){let t=e+`CollectionProvider`,[n,r]=d(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,c]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let l=ly(({state:e,...t})=>e?(0,z.jsx)(f,{...t,state:e}):(0,z.jsx)(u,{...t}),`CollectionProvider`);l.displayName=t;let u=ly(e=>{let t=b();return(0,z.jsx)(f,{...e,state:t})},`CollectionInit`);u.displayName=e+`CollectionInit`;let f=ly(e=>{let{scope:t,children:n,state:r}=e,a=B.useRef(null),[c,l]=B.useState(null),u=s(a,l),[d,f]=r,p=B.useRef(new fy),m=B.useCallback(()=>{let e=p.current;return yy(e)||e.sort(by),e},[]);return B.useEffect(()=>{if(!c)return;let e=xy(()=>{f(e=>{let t=e.toSorted(by);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(c,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[c,f]),(0,z.jsx)(i,{scope:t,collectionElementRef:u,collectionElementRefObject:a,getCollection:m,setCollection:f,registryRef:p,children:(0,z.jsx)(o,{scope:t,collectionElement:c,collection:d,children:n})})},`CollectionProviderImpl`);f.displayName=e+`CollectionProviderImpl`;let p=e+`CollectionSlot`,h=m(p),g=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(p,n),o=s(t,i.collectionElementRef);return(0,z.jsx)(h,{ref:o,children:r})});g.displayName=p;let _=e+`CollectionItemSlot`,v=m(_),y=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),{setCollection:c,registryRef:l}=a(_,n),u=B.useRef(i);_y(u.current,i)||(u.current=i);let d=u.current,f=B.useCallback(e=>{let t=l.current;e?t.set(e,{...u.current,element:e}):o.current&&t.delete(o.current)},[l]),p=s(t,f,o);w(()=>{let e=o.current,t=l.current;e&&t.has(e)&&t.set(e,{...d,element:e})},[d,l]);let m=B.useRef(null);return B.useEffect(()=>{let e=o.current,t=m.current;((t?.element??null)!==e||e&&t?.itemData!==d)&&(m.current=e?{element:e,itemData:d}:null,c(n=>{let r=new fy(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...d,element:e}),r.sort(by)}))}),B.useEffect(()=>()=>{let e=m.current;m.current=null,e&&c(t=>{if(!t.has(e.element))return t;let n=new fy(t);return n.delete(e.element),n})},[c]),(0,z.jsx)(v,{"data-radix-collection-item":``,ref:p,children:r})});y.displayName=_;function b(){return B.useState(new fy)}ly(b,`useInitCollection`);function x(t){let{collection:n}=c(e+`CollectionConsumer`,t);return n}ly(x,`useCollection`);function S(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return ly(S,`useGetCollection`),[{Provider:l,Slot:g,ItemSlot:y},{createCollectionScope:r,useCollection:x,useGetCollection:S,useInitCollection:b}]}ly(gy,`createCollection`);function _y(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}ly(_y,`shallowEqual`);function vy(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ly(vy,`isElementPreceding`);function yy(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}ly(yy,`isInDocumentOrder`);function by(e,t){return!e[1].element||!t[1].element?0:vy(e[1].element,t[1].element)?-1:1}ly(by,`sortByDocumentPosition`);function xy(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}ly(xy,`getChildListObserver`);var Sy=Object.defineProperty,Cy=(e,t)=>Sy(e,`name`,{value:t,configurable:!0}),wy={LTR:`ltr`,RTL:`rtl`},yee=B.createContext(void 0);function Ty(e){let t=B.useContext(yee);return e||t||wy.LTR}Cy(Ty,`useDirection`);var bee=Object.defineProperty,Ey=(e,t)=>bee(e,`name`,{value:t,configurable:!0}),Dy=`dismissableLayer.update`,xee=`dismissableLayer.pointerDownOutside`,See=`dismissableLayer.focusOutside`,Oy,ky=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ay=B.forwardRef(Ey(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...d}=e,p=B.useContext(ky),[m,h]=B.useState(null),_=m?.ownerDocument??globalThis?.document,[,v]=B.useState({}),y=s(t,h),b=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),S=x?b.indexOf(x):-1,C=m?b.indexOf(m):-1,w=p.layersWithOutsidePointerEventsDisabled.size>0,T=C>=S,E=B.useRef(!1),D=My(e=>{a?.(e),l?.(e),e.defaultPrevented||u?.()},{ownerDocument:_,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...p.branches].some(t=>t.contains(e));return T&&!t},[p.branches,T])}),O=Ny(e=>{if(r&&E.current)return;let t=e.target;[...p.branches].some(e=>e.contains(t))||(o?.(e),l?.(e),e.defaultPrevented||u?.())},_),k=m?C===b.length-1:!1,A=c(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))});return B.useEffect(()=>{if(k)return _.addEventListener(`keydown`,A,{capture:!0}),()=>_.removeEventListener(`keydown`,A,{capture:!0})},[_,k,A]),B.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Oy=_.body.style.pointerEvents,_.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),Py(),()=>{n&&(p.layersWithOutsidePointerEventsDisabled.delete(m),p.layersWithOutsidePointerEventsDisabled.size===0&&(_.body.style.pointerEvents=Oy))}},[m,_,n,p]),B.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),Py())},[m,p]),B.useEffect(()=>{let e=Ey(()=>v({}),`handleUpdate`);return document.addEventListener(Dy,e),()=>document.removeEventListener(Dy,e)},[]),(0,z.jsx)(f.div,{...d,ref:y,style:{pointerEvents:w?T?`auto`:`none`:void 0,...e.style},onFocusCapture:g(e.onFocusCapture,O.onFocusCapture),onBlurCapture:g(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:g(e.onPointerDownCapture,D.onPointerDownCapture)})},`DismissableLayer`));function jy(){let e=B.useContext(ky),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Ey(jy,`useDismissableLayerSurface`);var Cee=Ey(()=>!0,`IS_TRUE`);function My(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Cee}=t,s=c(e),l=B.useRef(!1),u=B.useRef(!1),d=B.useRef(new Map),f=B.useRef(()=>{});return B.useEffect(()=>{function e(){u.current=!1,i.current=!1,d.current.clear()}Ey(e,`resetOutsideInteraction`);function t(){return Array.from(d.current.values()).some(Boolean)}Ey(t,`isOutsideInteractionIntercepted`);function c(e){if(!u.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||d.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{u.current&&f.current()},0)}Ey(c,`handleInteractionCapture`);function p(e){u.current&&d.current.set(e.type,!1)}Ey(p,`handleInteractionBubble`);let m=Ey(a=>{if(a.target&&!l.current){let c=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||Fy(xee,s,p,{discrete:!0})};if(Ey(c,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),l.current=!1;return}let p={originalEvent:a};u.current=!0,i.current=r&&a.button===0,d.current.clear(),!r||a.button!==0?c():(n.removeEventListener(`click`,f.current),f.current=c,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();l.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,c,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,c,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:Ey(()=>l.current=!0,`onPointerDownCapture`)}}Ey(My,`usePointerDownOutside`);function Ny(e,t=globalThis?.document){let n=c(e),r=B.useRef(!1);return B.useEffect(()=>{let e=Ey(e=>{e.target&&!r.current&&Fy(See,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:Ey(()=>r.current=!0,`onFocusCapture`),onBlurCapture:Ey(()=>r.current=!1,`onBlurCapture`)}}Ey(Ny,`useFocusOutside`);function Py(){let e=new CustomEvent(Dy);document.dispatchEvent(e)}Ey(Py,`dispatchUpdate`);function Fy(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?b(i,a):i.dispatchEvent(a)}Ey(Fy,`handleAndDispatchCustomEvent`);var wee=Object.defineProperty,Iy=(e,t)=>wee(e,`name`,{value:t,configurable:!0}),Ly=`focusScope.autoFocusOnMount`,Ry=`focusScope.autoFocusOnUnmount`,zy={bubbles:!1,cancelable:!0},By=B.forwardRef(Iy(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=B.useState(null),p=c(a),m=c(o),h=B.useRef(null),g=s(t,d),_=B.useRef(i);B.useEffect(()=>{_.current=i});let v=B.useCallback(e=>e?u?.contains(e)?!0:!!_.current?.some(t=>t.contains(e)):!1,[u]),y=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(y.paused||!u)return;let t=e.target;v(t)?h.current=t:Zy(h.current,{select:!0})},t=function(e){if(y.paused||!u)return;let t=e.relatedTarget;t!==null&&(v(t)||Zy(h.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Zy(u)};Iy(e,`handleFocusIn`),Iy(t,`handleFocusOut`),Iy(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,y.paused,v]),B.useEffect(()=>{if(u){Qy.add(y);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(Ly,zy);u.addEventListener(Ly,p),u.dispatchEvent(t),t.defaultPrevented||(Gy(tb(qy(u)),{select:!0}),document.activeElement===e&&Zy(u))}return()=>{u.removeEventListener(Ly,p);let t=u.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(Ry,zy);u.addEventListener(Ry,m),u.dispatchEvent(r),r.defaultPrevented||Zy(e??t.body,{select:!0}),u.removeEventListener(Ry,m),Qy.remove(y)},0)}}},[u,p,m,y]);let b=B.useCallback(e=>{if(!n&&!r||y.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Ky(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Zy(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Zy(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,y.paused]);return(0,z.jsx)(f.div,{tabIndex:-1,...l,ref:g,onKeyDown:b})},`FocusScope`)),Vy=B.createContext(null);function Hy({registry:e,children:t}){return e?(0,z.jsx)(Vy.Provider,{value:e,children:t}):t}Iy(Hy,`FocusScopeBranchProvider`);function Uy(){let[e,t]=B.useState([]);return{nodes:e,registry:B.useMemo(()=>({add:Iy(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:Iy(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}Iy(Uy,`useFocusScopeBranchRegistry`);function Wy(e){let t=B.useContext(Vy);B.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}Iy(Wy,`useFocusScopeBranch`);function Gy(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Zy(r,{select:t}),document.activeElement!==n)return}Iy(Gy,`focusFirst`);function Ky(e){let t=qy(e);return[Jy(t,e),Jy(t.reverse(),e)]}Iy(Ky,`getTabbableEdges`);function qy(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Iy(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Iy(qy,`getTabbableCandidates`);function Jy(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Yy(r,{upTo:t})))return r}Iy(Jy,`findVisible`);function Yy(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Iy(Yy,`isHidden`);function Xy(e){return e.tagName===`INPUT`&&typeof e.select==`function`}Iy(Xy,`isSelectableInput`);function Zy(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&Xy(e)&&t&&e.select()}}Iy(Zy,`focus`);var Qy=$y();function $y(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=eb(e,t),e.unshift(t)},remove(t){e=eb(e,t),e[0]?.resume()}}}Iy($y,`createFocusScopesStack`);function eb(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Iy(eb,`arrayRemove`);function tb(e){return e.filter(e=>e.tagName!==`A`)}Iy(tb,`removeLinks`);var nb=Object.defineProperty,rb=B.forwardRef(((e,t)=>nb(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=B.useState(!1);w(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?K_.createPortal((0,z.jsx)(f.div,{...r,ref:t}),o):null},`Portal`)),ib=Object.defineProperty,ab=(e,t)=>ib(e,`name`,{value:t,configurable:!0}),ob=0,sb=null;function cb(e){return lb(),e.children}ab(cb,`FocusGuards`);function lb(){B.useEffect(()=>{sb||={start:ub(),end:ub()};let{start:e,end:t}=sb;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ob++,()=>{ob===1&&(sb?.start.remove(),sb?.end.remove(),sb=null),ob=Math.max(0,ob-1)}},[])}ab(lb,`useFocusGuards`);function ub(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}ab(ub,`createFocusGuard`);var db=function(){return db=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},db.apply(this,arguments)};function fb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function pb(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var mb=`right-scroll-bar-position`,hb=`width-before-scroll-bar`,gb=`with-scroll-bars-hidden`,_b=`--removed-body-scroll-bar-size`;function vb(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function yb(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var bb=typeof window<`u`?B.useLayoutEffect:B.useEffect,xb=new WeakMap;function Sb(e,t){var n=yb(t||null,function(t){return e.forEach(function(e){return vb(e,t)})});return bb(function(){var t=xb.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||vb(e,null)}),i.forEach(function(e){r.has(e)||vb(e,a)})}xb.set(n,e)},[e]),n}function Cb(e){return e}function wb(e,t){t===void 0&&(t=Cb);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Tb(e){e===void 0&&(e={});var t=wb(null);return t.options=db({async:!0,ssr:!1},e),t}var Eb=function(e){var t=e.sideCar,n=fb(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,db({},n))};Eb.isSideCarExport=!0;function Db(e,t){return e.useMedium(t),Eb}var Ob=Tb(),kb=function(){},Ab=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:kb,onWheelCapture:kb,onTouchMoveCapture:kb}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=fb(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Sb([n,t]),C=db(db({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:Ob,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),db(db({},C),{ref:S})):B.createElement(v,db({},C,{className:c,ref:S}),s))});Ab.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ab.classNames={fullWidth:hb,zeroRight:mb};var jb=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Mb(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=jb();return t&&e.setAttribute(`nonce`,t),e}function Nb(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Pb(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Fb=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mb())&&(Nb(t,n),Pb(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ib=function(){var e=Fb();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Lb=function(){var e=Ib();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Rb={left:0,top:0,right:0,gap:0},zb=function(e){return parseInt(e||``,10)||0},Bb=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[zb(n),zb(r),zb(i)]},Vb=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Rb;var t=Bb(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Hb=Lb(),Ub=`data-scroll-locked`,Wb=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
19
|
-
.${gb} {
|
|
20
|
-
overflow: hidden ${r};
|
|
21
|
-
padding-right: ${s}px ${r};
|
|
22
|
-
}
|
|
23
|
-
body[${Ub}] {
|
|
24
|
-
overflow: hidden ${r};
|
|
25
|
-
overscroll-behavior: contain;
|
|
26
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
27
|
-
padding-left: ${i}px;
|
|
28
|
-
padding-top: ${a}px;
|
|
29
|
-
padding-right: ${o}px;
|
|
30
|
-
margin-left:0;
|
|
31
|
-
margin-top:0;
|
|
32
|
-
margin-right: ${s}px ${r};
|
|
33
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.${mb} {
|
|
37
|
-
right: ${s}px ${r};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.${hb} {
|
|
41
|
-
margin-right: ${s}px ${r};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.${mb} .${mb} {
|
|
45
|
-
right: 0 ${r};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.${hb} .${hb} {
|
|
49
|
-
margin-right: 0 ${r};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
body[${Ub}] {
|
|
53
|
-
${_b}: ${s}px;
|
|
54
|
-
}
|
|
55
|
-
`},Gb=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Kb=function(){B.useEffect(function(){return document.body.setAttribute(Ub,(Gb()+1).toString()),function(){var e=Gb()-1;e<=0?document.body.removeAttribute(Ub):document.body.setAttribute(Ub,e.toString())}},[])},qb=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Kb();var a=B.useMemo(function(){return Vb(i)},[i]);return B.createElement(Hb,{styles:Wb(a,!t,i,n?``:`!important`)})},Jb=!1;if(typeof window<`u`)try{var Yb=Object.defineProperty({},"passive",{get:function(){return Jb=!0,!0}});window.addEventListener(`test`,Yb,Yb),window.removeEventListener(`test`,Yb,Yb)}catch{Jb=!1}var Xb=Jb?{passive:!1}:!1,Zb=function(e){return e.tagName===`TEXTAREA`},Qb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Zb(e)&&n[t]===`visible`)},$b=function(e){return Qb(e,`overflowY`)},ex=function(e){return Qb(e,`overflowX`)},tx=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),nx(e,r)){var i=rx(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Tee=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Eee=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},nx=function(e,t){return e===`v`?$b(t):ex(t)},rx=function(e,t){return e===`v`?Tee(t):Eee(t)},Dee=function(e,t){return e===`h`&&t===`rtl`?-1:1},Oee=function(e,t,n,r,i){var a=Dee(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=rx(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&nx(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},ix=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ax=function(e){return[e.deltaX,e.deltaY]},ox=function(e){return e&&`current`in e?e.current:e},kee=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Aee=function(e){return`
|
|
56
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
57
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
58
|
-
`},jee=0,sx=[];function Mee(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(jee++)[0],a=B.useState(Lb)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=pb([e.lockRef.current],(e.shards||[]).map(ox),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ix(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=tx(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=tx(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Oee(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(sx.length&&sx[sx.length-1]===a){var r=`deltaY`in n?ax(n):ix(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&kee(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(ox).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Nee(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=ix(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,ax(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,ix(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return sx.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Xb),document.addEventListener(`touchmove`,c,Xb),document.addEventListener(`touchstart`,u,Xb),function(){sx=sx.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Xb),document.removeEventListener(`touchmove`,c,Xb),document.removeEventListener(`touchstart`,u,Xb)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:Aee(i)}):null,p?B.createElement(qb,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Nee(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Pee=Db(Ob,Mee),cx=B.forwardRef(function(e,t){return B.createElement(Ab,db({},e,{ref:t,sideCar:Pee}))});cx.classNames=Ab.classNames;var Fee=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},lx=new WeakMap,ux=new WeakMap,dx={},fx=0,px=function(e){return e&&(e.host||px(e.parentNode))},mx=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=px(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},hx=function(e,t,n,r){var i=mx(t,Array.isArray(e)?e:[e]);dx[n]||(dx[n]=new WeakMap);var a=dx[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(lx.get(e)||0)+1,l=(a.get(e)||0)+1;lx.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ux.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),fx++,function(){o.forEach(function(e){var t=lx.get(e)-1,i=a.get(e)-1;lx.set(e,t),a.set(e,i),t||(ux.has(e)||e.removeAttribute(r),ux.delete(e)),i||e.removeAttribute(n)}),fx--,fx||(lx=new WeakMap,lx=new WeakMap,ux=new WeakMap,dx={})}},gx=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Fee(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),hx(r,i,n,`aria-hidden`)):function(){return null}},_x=Object.defineProperty,vx=(e,t)=>_x(e,`name`,{value:t,configurable:!0}),yx=`Dialog`,[bx,Iee]=d(yx),[xx,Sx]=bx(yx),Cx=vx(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),{nodes:l,registry:d}=Uy(),[f,p]=u({prop:r,defaultProp:i??!1,onChange:a,caller:yx}),[m,h]=B.useState(0),[g,_]=B.useState(0);return(0,z.jsx)(xx,{scope:t,triggerRef:s,contentRef:c,contentId:y(),titleId:y(),descriptionId:y(),titlePresent:m>0,descriptionPresent:g>0,setTitleCount:h,setDescriptionCount:_,open:f,onOpenChange:p,onOpenToggle:B.useCallback(()=>p(e=>!e),[p]),modal:o,branchNodes:l,branchRegistry:d,children:n})},`Dialog`),wx=`DialogPortal`,[Tx,Ex]=bx(wx,{forceMount:void 0}),Dx=vx(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Sx(wx,t);return(0,z.jsx)(Tx,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,z.jsx)(S,{present:n||a.open,children:(0,z.jsx)(rb,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ox=`DialogOverlay`,kx=B.forwardRef(vx(function(e,t){let n=Ex(Ox,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Sx(Ox,e.__scopeDialog);return a.modal?(0,z.jsx)(S,{present:r||a.open,children:(0,z.jsx)(jx,{...i,ref:t})}):null},`DialogOverlay`)),Ax=m(`DialogOverlay.RemoveScroll`),jx=B.forwardRef(vx(function(e,t){let{__scopeDialog:n,...r}=e,i=Sx(Ox,n),a=jy(),o=s(t,a);return(0,z.jsx)(cx,{as:Ax,allowPinchZoom:!0,shards:B.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,z.jsx)(f.div,{"data-state":Hx(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Mx=`DialogContent`,Nx=B.forwardRef(vx(function(e,t){let n=Ex(Mx,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Sx(Mx,e.__scopeDialog);return(0,z.jsx)(S,{present:r||a.open,children:a.modal?(0,z.jsx)(Px,{...i,ref:t}):(0,z.jsx)(Fx,{...i,ref:t})})},`DialogContent`)),Px=B.forwardRef(vx(function(e,t){let n=Sx(Mx,e.__scopeDialog),r=B.useRef(null),i=s(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return gx(e)},[]),(0,z.jsx)(Ix,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Fx=B.forwardRef(vx(function(e,t){let n=Sx(Mx,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,z.jsx)(Ix,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Ix=B.forwardRef(vx(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Sx(Mx,n);return lb(),(0,z.jsx)(Hy,{registry:l.branchRegistry,children:(0,z.jsx)(By,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(Ay,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?Vx(o,l.descriptionId):o,"data-state":Hx(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Lx=B.forwardRef(vx(function(e,t){let{__scopeDialog:n,...r}=e,i=Sx(`DialogTitle`,n),{setTitleCount:a}=i;return w(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(f.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Rx=B.forwardRef(vx(function(e,t){let{__scopeDialog:n,...r}=e,i=Sx(`DialogDescription`,n),{setDescriptionCount:a}=i;return w(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(f.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),zx=`DialogClose`,Bx=B.forwardRef(vx(function(e,t){let{__scopeDialog:n,...r}=e,i=Sx(zx,n);return(0,z.jsx)(f.button,{type:`button`,...r,ref:t,onClick:g(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Vx(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}vx(Vx,`concatAriaDescribedby`);function Hx(e){return e?`open`:`closed`}vx(Hx,`getState`);var Ux=Object.defineProperty,Wx=(e,t)=>Ux(e,`name`,{value:t,configurable:!0});function Gx(e){let[t,n]=B.useState(void 0);return w(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}Wx(Gx,`useSize`);var Kx=[`top`,`right`,`bottom`,`left`],qx=Math.min,Jx=Math.max,Yx=Math.round,Xx=Math.floor,Zx=e=>({x:e,y:e}),Qx={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function $x(e,t,n){return Jx(e,qx(t,n))}function eS(e,t){return typeof e==`function`?e(t):e}function tS(e){return e.split(`-`)[0]}function nS(e){return e.split(`-`)[1]}function rS(e){return e===`x`?`y`:`x`}function iS(e){return e===`y`?`height`:`width`}function aS(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function oS(e){return rS(aS(e))}function sS(e,t,n){n===void 0&&(n=!1);let r=nS(e),i=oS(e),a=iS(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=gS(o)),[o,gS(o)]}function cS(e){let t=gS(e);return[lS(e),t,lS(t)]}function lS(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var uS=[`left`,`right`],dS=[`right`,`left`],fS=[`top`,`bottom`],pS=[`bottom`,`top`];function mS(e,t,n){switch(e){case`top`:case`bottom`:return n?t?dS:uS:t?uS:dS;case`left`:case`right`:return t?fS:pS;default:return[]}}function hS(e,t,n,r){let i=nS(e),a=mS(tS(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(lS)))),a}function gS(e){let t=tS(e);return Qx[t]+e.slice(t.length)}function _S(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function vS(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:_S(e)}function yS(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 bS(e,t,n){let{reference:r,floating:i}=e,a=aS(t),o=oS(t),s=iS(o),c=tS(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=nS(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function xS(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}=eS(t,e),p=vS(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=yS(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=yS(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 SS=50,CS=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xS},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bS(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<SS&&(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}=bS(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},wS=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}=eS(e,t)||{};if(l==null)return{};let d=vS(u),f={x:n,y:r},p=oS(i),m=iS(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=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=qx(d[_],T),D=qx(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=$x(E,k,O),j=!c.arrow&&nS(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),TS=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}=eS(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=tS(r),_=aS(o),v=tS(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[gS(o)]:cS(o)),x=p!==`none`;!d&&x&&b.push(...hS(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=sS(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`||_===aS(t)||T.every(e=>aS(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=aS(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{}}}};function ES(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function DS(e){return Kx.some(t=>e[t]>=0)}var OS=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=eS(e,t);switch(i){case`referenceHidden`:{let e=ES(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:DS(e)}}}case`escaped`:{let e=ES(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:DS(e)}}}default:return{}}}}},kS=new Set([`left`,`top`]);async function AS(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=tS(n),s=nS(n),c=aS(n)===`y`,l=kS.has(o)?-1:1,u=a&&c?-1:1,d=eS(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 jS=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 AS(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}}}}},MS=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}=eS(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=aS(i),p=rS(f),m=u[p],h=u[f],g=(e,t)=>$x(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}}}}}},NS=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}=eS(e,t),u={x:n,y:r},d=aS(i),f=rS(d),p=u[f],m=u[d],h=eS(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=kS.has(tS(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}}}},PS=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}=eS(e,t),c=await i.detectOverflow(t,s),l=tS(n),u=nS(n),d=aS(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=qx(p-c[m],g),y=qx(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*Jx(c.left,c.right):S=p-2*Jx(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 FS(){return typeof window<`u`}function IS(e){return zS(e)?(e.nodeName||``).toLowerCase():`#document`}function LS(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function RS(e){return((zS(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function zS(e){return FS()?e instanceof Node||e instanceof LS(e).Node:!1}function BS(e){return FS()?e instanceof Element||e instanceof LS(e).Element:!1}function VS(e){return FS()?e instanceof HTMLElement||e instanceof LS(e).HTMLElement:!1}function HS(e){return!FS()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof LS(e).ShadowRoot}function US(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=$S(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lee(e){return/^(table|td|th)$/.test(IS(e))}function WS(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var GS=/transform|translate|scale|rotate|perspective|filter/,KS=/paint|layout|strict|content/,qS=e=>!!e&&e!==`none`,JS;function YS(e){let t=BS(e)?$S(e):e;return qS(t.transform)||qS(t.translate)||qS(t.scale)||qS(t.rotate)||qS(t.perspective)||!ZS()&&(qS(t.backdropFilter)||qS(t.filter))||GS.test(t.willChange||``)||KS.test(t.contain||``)}function XS(e){let t=tC(e);for(;VS(t)&&!QS(t);){if(YS(t))return t;if(WS(t))return null;t=tC(t)}return null}function ZS(){return JS??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),JS}function QS(e){return/^(html|body|#document)$/.test(IS(e))}function $S(e){return LS(e).getComputedStyle(e)}function eC(e){return BS(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tC(e){if(IS(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||HS(e)&&e.host||RS(e);return HS(t)?t.host:t}function nC(e){let t=tC(e);return QS(t)?(e.ownerDocument||e).body:VS(t)&&US(t)?t:nC(t)}function rC(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=nC(e),i=r===e.ownerDocument?.body,a=LS(r);if(i){let e=iC(a);return t.concat(a,a.visualViewport||[],US(r)?r:[],e&&n?rC(e):[])}return t.concat(r,rC(r,[],n))}function iC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aC(e){let t=$S(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=VS(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Yx(n)!==a||Yx(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function oC(e){return BS(e)?e:e.contextElement}function sC(e){let t=oC(e);if(!VS(t))return Zx(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=aC(t),o=(a?Yx(n.width):n.width)/r,s=(a?Yx(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ree=Zx(0);function cC(e){let t=LS(e);return!ZS()||!t.visualViewport?Ree:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zee(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===LS(e)}function lC(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=oC(e),o=Zx(1);t&&(r?BS(r)&&(o=sC(r)):o=sC(e));let s=zee(a,n,r)?cC(a):Zx(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=LS(a),t=BS(r)?LS(r):r,n=e,i=iC(n);for(;i&&t!==n;){let e=sC(i),t=i.getBoundingClientRect(),r=$S(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=LS(i),i=iC(n)}}return yS({width:u,height:d,x:c,y:l})}function uC(e,t){let n=eC(e).scrollLeft;return t?t.left+n:lC(RS(e)).left+n}function dC(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-uC(e,n),y:n.top+t.scrollTop}}function Bee(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=RS(r),s=t?WS(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Zx(1),u=Zx(0),d=VS(r);if((d||!a)&&((IS(r)!==`body`||US(o))&&(c=eC(r)),d)){let e=lC(r);l=sC(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?dC(o,c):Zx(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 Vee(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hee(e){let t=eC(e),n=e.ownerDocument.body,r=Jx(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Jx(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+uC(e),o=-t.scrollTop;return $S(n).direction===`rtl`&&(a+=Jx(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Uee=25;function Wee(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=LS(e),a=RS(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ZS()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(uC(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<=Uee&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Gee(e,t){let n=lC(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=sC(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fC(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Wee(e,n,t);else if(t===`document`)r=Hee(RS(e));else if(BS(t))r=Gee(t,n);else{let n=cC(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return yS(r)}function Kee(e,t){let n=t.get(e);if(n)return n;let r=rC(e,[],!1).filter(e=>BS(e)&&IS(e)!==`body`),i=null,a=$S(e).position===`fixed`,o=a?tC(e):e;for(;BS(o)&&!QS(o);){let e=$S(o),t=YS(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=tC(o)}return t.set(e,r),r}function qee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?WS(t)?[]:Kee(t,this._c):[].concat(n),r],o=fC(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=fC(t,a[e],i);s=Jx(n.top,s),c=qx(n.right,c),l=qx(n.bottom,l),u=Jx(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Jee(e){let{width:t,height:n}=aC(e);return{width:t,height:n}}function Yee(e,t,n){let r=VS(t),i=RS(t),a=n===`fixed`,o=lC(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Zx(0);if((r||!a)&&((IS(t)!==`body`||US(i))&&(s=eC(t)),r)){let e=lC(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=uC(i));let l=i&&!r&&!a?dC(i,s):Zx(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 pC(e){return $S(e).position===`static`}function mC(e,t){if(!VS(e)||$S(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return RS(e)===n&&(n=n.ownerDocument.body),n}function hC(e,t){let n=LS(e);if(WS(e))return n;if(!VS(e)){let t=tC(e);for(;t&&!QS(t);){if(BS(t)&&!pC(t))return t;t=tC(t)}return n}let r=mC(e,t);for(;r&&Lee(r)&&pC(r);)r=mC(r,t);return r&&QS(r)&&pC(r)&&!YS(r)?n:r||XS(e)||n}var Xee=async function(e){let t=this.getOffsetParent||hC,n=this.getDimensions,r=await n(e.floating);return{reference:Yee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zee(e){return $S(e).direction===`rtl`}var Qee={convertOffsetParentRelativeRectToViewportRelativeRect:Bee,getDocumentElement:RS,getClippingRect:qee,getOffsetParent:hC,getElementRects:Xee,getClientRects:Vee,getDimensions:Jee,getScale:sC,isElement:BS,isRTL:Zee};function gC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $ee(e,t,n){let r=null,i,a=RS(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=Xx(d),h=Xx(a.clientWidth-(u+f)),g=Xx(a.clientHeight-(d+p)),_=Xx(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Jx(0,qx(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!gC(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=LS(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ete(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=oC(e),u=i||a?[...l?rC(l):[],...t?rC(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$ee(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?lC(e):null;c&&g();function g(){let t=lC(e);h&&!gC(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 tte=jS,nte=MS,rte=TS,ite=PS,ate=OS,_C=wS,ote=NS,ste=(e,t,n)=>{let r=new Map,i=n??{},a={...Qee,...i.platform,_c:r};return CS(e,t,{...i,platform:a})},vC=typeof document<`u`?B.useLayoutEffect:function(){};function yC(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(!yC(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)&&!yC(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bC(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xC(e,t){let n=bC(e);return Math.round(t*n)/n}function SC(e){let t=B.useRef(e);return vC(()=>{t.current=e}),t}function CC(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]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);yC(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=SC(c),D=SC(i),O=SC(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),ste(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!yC(w.current,t)&&(w.current=t,K_.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);vC(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);vC(()=>(A.current=!0,()=>{A.current=!1}),[]),vC(()=>{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=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=xC(M.floating,u.x),r=xC(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bC(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var wC=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:_C({element:r.current,padding:i}).fn(n):r?_C({element:r,padding:i}).fn(n):{}}}},TC=(e,t)=>{let n=tte(e);return{name:n.name,fn:n.fn,options:[e,t]}},EC=(e,t)=>{let n=nte(e);return{name:n.name,fn:n.fn,options:[e,t]}},DC=(e,t)=>({fn:ote(e).fn,options:[e,t]}),OC=(e,t)=>{let n=rte(e);return{name:n.name,fn:n.fn,options:[e,t]}},kC=(e,t)=>{let n=ite(e);return{name:n.name,fn:n.fn,options:[e,t]}},AC=(e,t)=>{let n=ate(e);return{name:n.name,fn:n.fn,options:[e,t]}},jC=(e,t)=>{let n=wC(e);return{name:n.name,fn:n.fn,options:[e,t]}},MC=Object.defineProperty,NC=(e,t)=>MC(e,`name`,{value:t,configurable:!0}),PC={Partial:`partial`,Always:`always`},FC={Optimized:`optimized`,Always:`always`},IC=`Popper`,[LC,RC]=d(IC),[zC,BC]=LC(IC),VC=NC(e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,z.jsx)(zC,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),HC=`PopperAnchor`,UC=B.forwardRef(NC(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=BC(HC,n),o=B.useRef(null),c=a.onAnchorChange,l=B.useCallback(e=>{o.current=e,e&&c(e)},[c]),u=s(t,l),d=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&c(d.current)});let p=a.placementState&&YC(a.placementState),m=p?.[0],h=p?.[1];return r?null:(0,z.jsx)(f.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...i,ref:u})},`PopperAnchor`)),WC=`PopperContent`,[GC,cte]=LC(WC),KC=B.forwardRef(NC(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m=PC.Partial,hideWhenDetached:h=!1,updatePositionStrategy:g=FC.Optimized,onPlaced:_,...v}=e,y=BC(WC,n),[b,x]=B.useState(null),S=s(t,x),[C,T]=B.useState(null),E=Gx(C),D=E?.width??0,O=E?.height??0,k=r+(a===`center`?``:`-`+a),A=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},j=Array.isArray(d)?d:[d],M=j.length>0,N={padding:A,boundary:j.filter(qC),altBoundary:M},{refs:P,floatingStyles:ee,placement:F,isPositioned:I,middlewareData:te}=CC({strategy:`fixed`,placement:k,whileElementsMounted:NC((...e)=>ete(...e,{animationFrame:g===FC.Always}),`whileElementsMounted`),elements:{reference:y.anchor},middleware:[TC({mainAxis:i+O,alignmentAxis:o}),u&&EC({mainAxis:!0,crossAxis:!1,...m===PC.Partial?{limiter:DC()}:{},...N}),u&&OC({...N}),kC({...N,apply:NC(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),C&&jC({element:C,padding:l}),JC({arrowWidth:D,arrowHeight:O}),h&&AC(M?{strategy:`referenceHidden`,...N}:{strategy:`referenceHidden`,padding:N.padding,altBoundary:N.altBoundary})]}),ne=y.setPlacementState;w(()=>(ne(F),()=>{ne(void 0)}),[F,ne]);let[re,ie]=YC(F),ae=c(_);w(()=>{I&&ae?.()},[I,ae]);let oe=te.arrow?.x,se=te.arrow?.y,ce=te.arrow?.centerOffset!==0,[le,ue]=B.useState();return w(()=>{b&&ue(window.getComputedStyle(b).zIndex)},[b]),(0,z.jsx)(`div`,{ref:P.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:I?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(` `),...te.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,z.jsx)(GC,{scope:n,placedSide:re,placedAlign:ie,onArrowChange:T,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,z.jsx)(f.div,{"data-side":re,"data-align":ie,...v,ref:S,style:{...v.style,animation:I?v.style?.animation:`none`}})})})},`PopperContent`));function qC(e){return e!==null}NC(qC,`isNotNull`);var JC=NC(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=YC(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function YC(e){let[t,n=`center`]=e.split(`-`);return[t,n]}NC(YC,`getSideAndAlignFromPlacement`);var XC=Object.defineProperty,ZC=(e,t)=>XC(e,`name`,{value:t,configurable:!0}),QC=!1;function $C(){let[e,t]=B.useState(QC);return B.useEffect(()=>{QC||(QC=!0,t(!0))},[]),e}ZC($C,`useIsHydrated`);var ew=B.useSyncExternalStore;function tw(){return()=>{}}ZC(tw,`subscribe`);function nw(){return ew(tw,()=>!0,()=>!1)}ZC(nw,`useIsHydratedModern`);var rw=typeof ew==`function`?nw:$C,iw=Object.defineProperty,aw=(e,t)=>iw(e,`name`,{value:t,configurable:!0}),ow=`rovingFocusGroup.onEntryFocus`,sw={bubbles:!1,cancelable:!0},cw=`RovingFocusGroup`,[lw,uw,dw]=uy(cw),[fw,pw]=d(cw,[dw]),mw={Vertical:`vertical`,Horizontal:`horizontal`},hw={LTR:`ltr`,RTL:`rtl`},[gw,_w]=fw(cw),vw=B.forwardRef(aw(function(e,t){return(0,z.jsx)(lw.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(lw.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(yw,{...e,ref:t})})})},`RovingFocusGroup`)),yw=B.forwardRef(aw(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:p,preventScrollOnEntryFocus:m=!1,...h}=e,_=B.useRef(null),v=s(t,_),y=Ty(a),[b,x]=u({prop:o,defaultProp:l??null,onChange:d,caller:cw}),[S,C]=B.useState(!1),w=c(p),T=uw(n),E=B.useRef(!1),[D,O]=B.useState(0);return B.useEffect(()=>{let e=_.current;if(e)return e.addEventListener(ow,w),()=>e.removeEventListener(ow,w)},[w]),(0,z.jsx)(gw,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:b,onItemFocus:B.useCallback(e=>x(e),[x]),onItemShiftTab:B.useCallback(()=>C(!0),[]),onFocusableItemAdd:B.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>O(e=>e-1),[]),children:(0,z.jsx)(f.div,{tabIndex:S||D===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:`none`,...e.style},onMouseDown:g(e.onMouseDown,()=>{E.current=!0}),onFocus:g(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(ow,sw);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Tw([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),m)}}E.current=!1}),onBlur:g(e.onBlur,()=>C(!1))})})},`RovingFocusGroupImpl`)),bw=`RovingFocusGroupItem`,xw=B.forwardRef(aw(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=y(),l=a||c,u=_w(bw,n),d=u.currentTabStopId===l,p=uw(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:_}=u,v=rw();return w(()=>{if(v&&r)return m(),()=>h()},[v,r,m,h]),B.useEffect(()=>{if(!v&&r)return m(),()=>h()},[v,r,m,h]),(0,z.jsx)(lw.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,z.jsx)(f.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:g(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:g(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:g(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ww(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ew(n,r+1):n.slice(r+1)}setTimeout(()=>Tw(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Sw={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Cw(e,t){return t===hw.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}aw(Cw,`getDirectionAwareKey`);function ww(e,t,n){let r=Cw(e.key,n);if(!(t===mw.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===mw.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Sw[r]}aw(ww,`getFocusIntent`);function Tw(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}aw(Tw,`focusFirst`);function Ew(e,t){return e.map((n,r)=>e[(t+r)%e.length])}aw(Ew,`wrapArray`);var Dw=Object.defineProperty,Ow=(e,t)=>Dw(e,`name`,{value:t,configurable:!0}),kw=[`Enter`,` `],Aw=[`ArrowDown`,`PageUp`,`Home`],jw=[`ArrowUp`,`PageDown`,`End`],Mw=[...Aw,...jw];[...kw],[...kw];var Nw=`Menu`,[Pw,Fw,Iw]=uy(Nw),[Lw,Rw]=d(Nw,[Iw,RC,pw]),zw=RC(),Bw=pw(),[Vw,Hw]=Lw(Nw),[Uw,Ww]=Lw(Nw),Gw=Ow(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=zw(t),[l,u]=B.useState(null),d=B.useRef(!1),f=c(a),p=Ty(i);return B.useEffect(()=>{let e=Ow(()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Ow(()=>d.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),B.useEffect(()=>{if(!n)return;let e=Ow(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,z.jsx)(VC,{...s,children:(0,z.jsx)(Vw,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,z.jsx)(Uw,{scope:t,onClose:B.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})},`Menu`),Kw=B.forwardRef(Ow(function(e,t){let{__scopeMenu:n,...r}=e,i=zw(n);return(0,z.jsx)(UC,{...i,...r,ref:t})},`MenuAnchor`)),qw=`MenuPortal`,[Jw,Yw]=Lw(qw,{forceMount:void 0}),Xw=Ow(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Hw(qw,t);return(0,z.jsx)(Jw,{scope:t,forceMount:n,children:(0,z.jsx)(S,{present:n||a.open,children:(0,z.jsx)(rb,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Zw=`MenuContent`,[Qw,$w]=Lw(Zw),eT=B.forwardRef(Ow(function(e,t){let n=Yw(Zw,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Hw(Zw,e.__scopeMenu),o=Ww(Zw,e.__scopeMenu);return(0,z.jsx)(Pw.Provider,{scope:e.__scopeMenu,children:(0,z.jsx)(S,{present:r||a.open,children:(0,z.jsx)(Pw.Slot,{scope:e.__scopeMenu,children:o.modal?(0,z.jsx)(tT,{...i,ref:t}):(0,z.jsx)(nT,{...i,ref:t})})})})},`MenuContent`)),tT=B.forwardRef(Ow(function(e,t){let n=Hw(Zw,e.__scopeMenu),r=B.useRef(null),i=s(t,r);return B.useEffect(()=>{let e=r.current;if(e)return gx(e)},[]),(0,z.jsx)(iT,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),nT=B.forwardRef(Ow(function(e,t){let n=Hw(Zw,e.__scopeMenu);return(0,z.jsx)(iT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),rT=m(`MenuContent.ScrollLock`),iT=B.forwardRef(Ow(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,..._}=e,v=Hw(Zw,n),y=Ww(Zw,n),b=zw(n),x=Bw(n),S=Fw(n),[C,w]=B.useState(null),T=B.useRef(null),[E,D]=B.useState(null);Wy(E);let{nodes:O,registry:k}=Uy(),A=!!(i||h),j=s(t,T,v.onContentChange,D),M=B.useRef(0),N=B.useRef(``),P=B.useRef(0),ee=B.useRef(null),F=B.useRef(`right`),I=B.useRef(0),te=B.useMemo(()=>h?[T,...O.map(e=>({current:e}))]:[],[T,O,h]),ne=h?cx:B.Fragment,re=h?{as:rT,allowPinchZoom:!0,shards:te}:void 0,ie=Ow(e=>{let t=N.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=yT(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){N.current=e,window.clearTimeout(M.current),e!==``&&(M.current=window.setTimeout(()=>s(``),1e3))}Ow(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);B.useEffect(()=>()=>window.clearTimeout(M.current),[]),lb();let ae=B.useCallback(e=>F.current===ee.current?.side&&xT(e,ee.current?.area),[]);return(0,z.jsx)(Qw,{scope:n,searchRef:N,onItemEnter:B.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:B.useCallback(e=>{ae(e)||(T.current?.focus(),w(null))},[ae]),onTriggerLeave:B.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:P,onPointerGraceIntentChange:B.useCallback(e=>{ee.current=e},[]),children:(0,z.jsx)(Hy,{registry:A?k:null,children:(0,z.jsx)(ne,{...re,children:(0,z.jsx)(By,{asChild:!0,trapped:i,branches:O,onMountAutoFocus:g(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,z.jsx)(Ay,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,z.jsx)(vw,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:g(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,z.jsx)(KC,{role:`menu`,"aria-orientation":`vertical`,"data-state":mT(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:j,style:{outline:`none`,..._.style},onKeyDown:g(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=T.current;if(e.target!==i||!Mw.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);jw.includes(e.key)&&a.reverse(),_T(a)}),onBlur:g(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),N.current=``)}),onPointerMove:g(e.onPointerMove,ST(e=>{let t=e.target,n=I.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>I.current?`right`:`left`;F.current=t,I.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),aT=`MenuItem`,oT=`menu.itemSelect`,sT=B.forwardRef(Ow(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=Ww(aT,e.__scopeMenu),c=$w(aT,e.__scopeMenu),l=s(t,a),u=B.useRef(!1),d=Ow(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(oT,{bubbles:!0,cancelable:!0});e.addEventListener(oT,e=>r?.(e),{once:!0}),b(e,t),t.defaultPrevented?u.current=!1:o.onClose()}},`handleSelect`);return(0,z.jsx)(cT,{...i,ref:l,disabled:n,onClick:g(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:g(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:g(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(c.searchRef.current===``||e.key!==` `)&&kw.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),cT=B.forwardRef(Ow(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=$w(aT,n),c=Bw(n),l=B.useRef(null),u=s(t,l),[d,p]=B.useState(!1),[m,h]=B.useState(``);return B.useEffect(()=>{let e=l.current;e&&h((e.textContent??``).trim())},[a.children]),(0,z.jsx)(Pw.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,z.jsx)(xw,{asChild:!0,...c,focusable:!r,children:(0,z.jsx)(f.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:g(e.onPointerMove,ST(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:g(e.onPointerLeave,ST(e=>o.onItemLeave(e))),onFocus:g(e.onFocus,()=>p(!0)),onBlur:g(e.onBlur,()=>p(!1))})})})},`MenuItemImpl`)),lT=B.forwardRef(Ow(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,z.jsx)(dT,{scope:e.__scopeMenu,checked:n,children:(0,z.jsx)(sT,{role:`menuitemcheckbox`,"aria-checked":hT(n)?`mixed`:n,...i,ref:t,"data-state":gT(n),onSelect:g(i.onSelect,()=>r?.(hT(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[lte,ute]=Lw(`MenuRadioGroup`,{value:void 0,onValueChange:Ow(()=>{},`onValueChange`)}),uT=`MenuItemIndicator`,[dT,fT]=Lw(uT,{checked:!1}),pT=B.forwardRef(Ow(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=fT(uT,n);return(0,z.jsx)(S,{present:r||hT(a.checked)||a.checked===!0,children:(0,z.jsx)(f.span,{...i,ref:t,"data-state":gT(a.checked)})})},`MenuItemIndicator`)),[dte,fte]=Lw(`MenuSub`);function mT(e){return e?`open`:`closed`}Ow(mT,`getOpenState`);function hT(e){return e===`indeterminate`}Ow(hT,`isIndeterminate`);function gT(e){return hT(e)?`indeterminate`:e?`checked`:`unchecked`}Ow(gT,`getCheckedState`);function _T(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Ow(_T,`focusFirst`);function vT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ow(vT,`wrapArray`);function yT(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vT(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Ow(yT,`getNextMatch`);function bT(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Ow(bT,`isPointInPolygon`);function xT(e,t){return t?bT({x:e.clientX,y:e.clientY},t):!1}Ow(xT,`isPointerInGraceArea`);function ST(e){return t=>t.pointerType===`mouse`?e(t):void 0}Ow(ST,`whenMouse`);var CT=Object.defineProperty,wT=(e,t)=>CT(e,`name`,{value:t,configurable:!0}),TT=`DropdownMenu`,[ET,pte]=d(TT,[Rw]),DT=Rw(),[OT,kT]=ET(TT),AT=wT(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=DT(t),l=B.useRef(null),[d,f]=u({prop:i,defaultProp:a??!1,onChange:o,caller:TT});return(0,z.jsx)(OT,{scope:t,triggerId:y(),triggerRef:l,contentId:y(),open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,z.jsx)(Gw,{...c,open:d,onOpenChange:f,dir:r,modal:s,children:n})})},`DropdownMenu`),jT=`DropdownMenuTrigger`,MT=B.forwardRef(wT(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=kT(jT,n),o=DT(n),c=s(t,a.triggerRef);return(0,z.jsx)(Kw,{asChild:!0,...o,children:(0,z.jsx)(f.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:c,onPointerDown:g(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:g(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),NT=wT(e=>{let{__scopeDropdownMenu:t,...n}=e,r=DT(t);return(0,z.jsx)(Xw,{...r,...n})},`DropdownMenuPortal`),PT=`DropdownMenuContent`,FT=B.forwardRef(wT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=kT(PT,n),a=DT(n),o=B.useRef(!1);return(0,z.jsx)(eT,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:g(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),IT=B.forwardRef(wT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=DT(n);return(0,z.jsx)(sT,{...i,...r,ref:t})},`DropdownMenuItem`)),LT=B.forwardRef(wT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=DT(n);return(0,z.jsx)(lT,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),RT=B.forwardRef(wT(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=DT(n);return(0,z.jsx)(pT,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),zT=Object.defineProperty,BT=(e,t)=>zT(e,`name`,{value:t,configurable:!0});function VT(e,[t,n]){return Math.min(n,Math.max(t,e))}BT(VT,`clamp`);var HT=Object.defineProperty,UT=(e,t)=>HT(e,`name`,{value:t,configurable:!0}),WT=`Popover`,[GT,mte]=d(WT,[RC]),KT=RC(),[qT,JT]=GT(WT),YT=UT(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=KT(t),c=B.useRef(null),[l,d]=B.useState(!1),[f,p]=B.useState(0),[m,h]=B.useState(0),[g,_]=u({prop:r,defaultProp:i??!1,onChange:a,caller:WT});return(0,z.jsx)(VC,{...s,children:(0,z.jsx)(qT,{scope:t,contentId:y(),titleId:y(),descriptionId:y(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:B.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>d(!0),[]),onCustomAnchorRemove:B.useCallback(()=>d(!1),[]),modal:o,children:n})})},`Popover`),XT=`PopoverTrigger`,ZT=B.forwardRef(UT(function(e,t){let{__scopePopover:n,...r}=e,i=JT(XT,n),a=KT(n),o=s(t,i.triggerRef),c=(0,z.jsx)(f.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":cE(i.open),...r,ref:o,onClick:g(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,z.jsx)(UC,{asChild:!0,...a,children:c})},`PopoverTrigger`)),QT=`PopoverPortal`,[$T,eE]=GT(QT,{forceMount:void 0}),tE=UT(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=JT(QT,t);return(0,z.jsx)($T,{scope:t,forceMount:n,children:(0,z.jsx)(S,{present:n||a.open,children:(0,z.jsx)(rb,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),nE=`PopoverContent`,rE=B.forwardRef(UT(function(e,t){let n=eE(nE,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=JT(nE,e.__scopePopover);return(0,z.jsx)(S,{present:r||a.open,children:a.modal?(0,z.jsx)(aE,{...i,ref:t}):(0,z.jsx)(oE,{...i,ref:t})})},`PopoverContent`)),iE=m(`PopoverContent.RemoveScroll`),aE=B.forwardRef(UT(function(e,t){let n=JT(nE,e.__scopePopover),r=B.useRef(null),i=s(t,r),a=B.useRef(!1),{nodes:o,registry:c}=Uy();return B.useEffect(()=>{let e=r.current;if(e)return gx(e)},[]),(0,z.jsx)(cx,{as:iE,allowPinchZoom:!0,shards:B.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,z.jsx)(sE,{...e,ref:i,branchNodes:o,branchRegistry:c,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),oE=B.forwardRef(UT(function(e,t){let n=JT(nE,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,z.jsx)(sE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),sE=B.forwardRef(UT(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=JT(nE,n),_=KT(n),[v,y]=B.useState(null),b=s(t,y);return Wy(v),lb(),(0,z.jsx)(Hy,{registry:m,children:(0,z.jsx)(By,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(Ay,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,z.jsx)(KC,{"data-state":cE(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?lE(f,g.descriptionId):f,..._,...h,ref:b,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function cE(e){return e?`open`:`closed`}UT(cE,`getState`);function lE(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}UT(lE,`concatAriaDescribedby`);var uE=Object.defineProperty,dE=(e,t)=>uE(e,`name`,{value:t,configurable:!0}),fE={ItemAligned:`item-aligned`,Popper:`popper`},pE={LTR:`ltr`,RTL:`rtl`},mE=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hE=[` `,`Enter`],gE=`Select`,[_E,vE,yE]=uy(gE),[bE,hte]=d(gE,[yE,RC]),xE=RC(),[SE,CE]=bE(gE),[wE,TE]=bE(gE);function EE(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=xE(t),[v,b]=B.useState(null),[x,S]=B.useState(null),[C,w]=B.useState(!1),T=Ty(l),[E,D]=u({prop:r,defaultProp:i??!1,onChange:a,caller:gE}),[O,k]=u({prop:o,defaultProp:s,onChange:c,caller:gE}),A=B.useRef(null),j=B.useRef(!1),[M,N]=B.useState(null),P=dE(e=>{N({value:e,hasConsumerStoppedPropagation:j.current}),k(e)},`handleUserSelect`),ee=B.useRef(O);B.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=dE(()=>k(ee.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,k]);let F=!v||!!h||!!v.closest(`form`),[I,te]=B.useState(new Set),ne=y(),re=Array.from(I).map(e=>e.props.value).join(`;`),ie=B.useCallback(e=>{te(t=>new Set(t).add(e))},[]),ae=B.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),oe={required:m,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:ne,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:j,userSelection:M,onUserSelect:P,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:I,nativeSelectKey:re,isFormControl:F};return(0,z.jsx)(VC,{..._,children:(0,z.jsx)(SE,{scope:t,...oe,children:(0,z.jsx)(_E.Provider,{scope:t,children:(0,z.jsx)(wE,{scope:t,onNativeOptionAdd:ie,onNativeOptionRemove:ae,children:dD(g)?g(oe):n})})})})}dE(EE,`SelectProvider`);var DE=dE(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,z.jsx)(EE,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,z.jsxs)(z.Fragment,{children:[n,e?(0,z.jsx)(uD,{__scopeSelect:t}):null]})})},`Select`),OE=`SelectTrigger`,kE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xE(n),o=CE(OE,n),c=o.disabled||r,l=s(t,o.onTriggerChange),u=vE(n),d=B.useRef(`touch`),[p,m,h]=pD(e=>{let t=u().filter(e=>!e.disabled),n=mD(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),_=dE(e=>{c||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,z.jsx)(UC,{asChild:!0,...a,children:(0,z.jsx)(f.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":fD(o.value)?``:void 0,...i,ref:l,onClick:g(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&_(e)}),onPointerDown:g(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:g(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),m(e.key)),!(t&&e.key===` `)&&mE.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),AE=`SelectValue`,jE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...c}=e,l=CE(AE,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,p=s(t,l.onValueNodeChange);w(()=>{u(d)},[u,d]);let m=fD(l.value);return(0,z.jsx)(f.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,z.jsx)(B.Fragment,{children:m?o:a},m?`placeholder`:`value`)})},`SelectValue`)),ME=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,z.jsx)(f.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[NE,PE]=bE(`SelectPortal`,{forceMount:void 0}),FE=dE(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,z.jsx)(NE,{scope:e.__scopeSelect,forceMount:n,children:(0,z.jsx)(rb,{asChild:!0,...r})})},`SelectPortal`),IE=`SelectContent`,LE=B.forwardRef(dE(function(e,t){let n=PE(IE,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=CE(IE,e.__scopeSelect),[o,s]=B.useState();return w(()=>{s(new DocumentFragment)},[]),(0,z.jsx)(S,{present:r||a.open,children:({present:e})=>e?(0,z.jsx)(UE,{...i,ref:t}):(0,z.jsx)(RE,{...i,fragment:o})})},`SelectContent`)),RE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?K_.createPortal((0,z.jsx)(BE,{scope:n,children:(0,z.jsx)(_E.Slot,{scope:n,children:(0,z.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),zE=10,[BE,VE]=bE(IE),HE=m(`SelectContent.RemoveScroll`),UE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n}=e,{position:r=fE.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=CE(IE,n),[x,S]=B.useState(null),[C,w]=B.useState(null),T=s(t,S),[E,D]=B.useState(null),[O,k]=B.useState(null),A=vE(n),[j,M]=B.useState(!1),N=B.useRef(!1),P=B.useRef(!1),ee=B.useRef(!1);B.useEffect(()=>{if(x)return gx(x)},[x]),lb();let F=B.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),I=B.useCallback(()=>F([E,x]),[F,E,x]);B.useEffect(()=>{j&&I()},[j,I]);let{onOpenChange:te,triggerPointerDownPosRef:ne}=b;B.useEffect(()=>{if(x){let e={x:0,y:0},t=dE(t=>{e={x:Math.abs(Math.round(t.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ne.current?.y??0))}},`handlePointerMove`),n=dE(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||te(!1),document.removeEventListener(`pointermove`,t),ne.current=null},`handlePointerUp`);return ne.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,te,ne]),B.useEffect(()=>{let e=dE(()=>te(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[te]);let[re,ie]=pD(e=>{let t=A().filter(e=>!e.disabled),n=mD(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ae=B.useCallback((e,t,n)=>{let r=!P.current;r&&(P.current=!0);let i=!N.current&&!n;b.value!==void 0&&b.value===t||i?(D(e),i&&(N.current=!0)):r&&D(e)},[b.value]),oe=B.useCallback(()=>x?.focus(),[x]),se=B.useCallback((e,t,n)=>{if(!e)return;let r=!ee.current;r&&(ee.current=!0);let i=!N.current&&!n;(b.value!==void 0&&b.value===t||i||r)&&k(e)},[b.value]),ce=r===fE.Popper?GE:WE,le=ce===GE?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v}:{};return(0,z.jsx)(BE,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:ae,selectedItem:E,onItemLeave:oe,itemTextRefCallback:se,focusSelectedItem:I,selectedItemText:O,position:r,isPositioned:j,searchRef:re,children:(0,z.jsx)(cx,{as:HE,allowPinchZoom:!0,children:(0,z.jsx)(By,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:g(i,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,z.jsx)(Ay,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,z.jsx)(ce,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...le,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:g(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),WE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=CE(IE,n),o=VE(IE,n),[c,l]=B.useState(null),[u,d]=B.useState(null),p=s(t,d),m=vE(n),h=B.useRef(!1),g=B.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=B.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==pE.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-zE,d=VT(a,[zE,Math.max(zE,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-zE,d=VT(a,[zE,Math.max(zE,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=m(),s=window.innerHeight-zE*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-zE,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${zE}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,c,u,_,v,y,a.dir,r]);w(()=>x(),[x]);let[S,C]=B.useState();w(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);let T=B.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]);return(0,z.jsx)(KE,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:T,children:(0,z.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,z.jsx)(f.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),GE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=zE,...a}=e,o=xE(n);return(0,z.jsx)(KC,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[KE,qE]=bE(IE,{}),JE=`SelectViewport`,YE=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=VE(JE,n),o=qE(JE,n),c=s(t,a.onViewportChange),l=B.useRef(0);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,z.jsx)(_E.Slot,{scope:n,children:(0,z.jsx)(f.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:g(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-zE*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[gte,_te]=bE(`SelectGroup`),XE=`SelectItem`,[ZE,QE]=bE(XE),$E=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=CE(XE,n),u=VE(XE,n),d=l.value===r,[p,m]=B.useState(a??``),[h,_]=B.useState(!1),v=c(e=>u.itemRefCallback?.(e,r,i)),b=s(t,v),x=y(),S=B.useRef(`touch`);function C(e){l.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),l.onUserSelect(r),l.onOpenChange(!1)}return dE(C,`handleSelect`),(0,z.jsx)(ZE,{scope:n,value:r,disabled:i,textId:x,isSelected:d,onItemTextChange:B.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,z.jsx)(_E.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:(0,z.jsx)(f.div,{role:`option`,"aria-labelledby":x,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:g(o.onFocus,()=>_(!0)),onBlur:g(o.onBlur,()=>_(!1)),onClick:g(o.onClick,e=>{i||S.current!==`mouse`&&C(e)}),onPointerUp:g(o.onPointerUp,e=>{i||S.current===`mouse`&&C(e)}),onPointerDown:g(o.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:g(o.onPointerMove,e=>{S.current=e.pointerType,i?u.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:g(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:g(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(u.searchRef?.current===``||e.key!==` `)&&(hE.includes(e.key)&&C(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),eD=`SelectItemText`,tD=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=CE(eD,n),l=VE(eD,n),u=QE(eD,n),d=TE(eD,n),[p,m]=B.useState(null),h=c(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),g=s(t,m,u.onItemTextChange,h),_=p?.textContent,v=B.useMemo(()=>(0,z.jsx)(`option`,{value:u.value,disabled:u.disabled,children:_},u.value),[u.disabled,u.value,_]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=d;return w(()=>(y(v),()=>b(v)),[y,b,v]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!fD(o.value)?K_.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),nD=`SelectItemIndicator`,rD=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,...r}=e;return QE(nD,n).isSelected?(0,z.jsx)(f.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),iD=`SelectScrollUpButton`,aD=B.forwardRef(dE(function(e,t){let n=VE(iD,e.__scopeSelect),r=qE(iD,e.__scopeSelect),[i,a]=B.useState(!1),o=s(t,r.onScrollButtonChange);return w(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};dE(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(cD,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),oD=`SelectScrollDownButton`,sD=B.forwardRef(dE(function(e,t){let n=VE(oD,e.__scopeSelect),r=qE(oD,e.__scopeSelect),[i,a]=B.useState(!1),o=s(t,r.onScrollButtonChange);return w(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};dE(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(cD,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),cD=B.forwardRef(dE(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=VE(`SelectScrollButton`,n),o=B.useRef(null),s=vE(n),c=B.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return B.useEffect(()=>()=>c(),[c]),w(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,z.jsx)(f.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:g(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:g(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:g(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),lD=`SelectBubbleInput`,uD=B.forwardRef(dE(function({__scopeSelect:e,...t},n){let r=CE(lD,e),{value:i,onValueChange:a,required:o,disabled:c,name:l,autoComplete:u,form:d,userSelection:p}=r,{nativeOptions:m,nativeSelectKey:h}=r,g=B.useRef(null),_=s(n,g),v=i??``,y=B.useRef(v),b=B.useRef(p),x=B.useRef(!1),S=Array.from(m).some(e=>(e.props.value??``)===``);return B.useEffect(()=>{let e=g.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=p!==null&&p!==b.current;b.current=p;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&p.value!==v&&!p.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,p.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!p.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,p]),(0,z.jsxs)(f.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>{x.current||a(e.target.value)},...t,style:{...sy,...t.style},ref:_,defaultValue:v,children:[fD(i)&&!S?(0,z.jsx)(`option`,{value:``}):null,Array.from(m)]},h)},`SelectBubbleInput`));function dD(e){return typeof e==`function`}dE(dD,`isFunction`);function fD(e){return e===``||e===void 0}dE(fD,`shouldShowPlaceholder`);function pD(e){let t=c(e),n=B.useRef(``),r=B.useRef(0),i=B.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}dE(a,`updateSearch`),a(i)},[t]),a=B.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}dE(pD,`useTypeaheadSearch`);function mD(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=hD(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}dE(mD,`findNextItem`);function hD(e,t){return e.map((n,r)=>e[(t+r)%e.length])}dE(hD,`wrapArray`);var gD=Object.defineProperty,_D=(e,t)=>gD(e,`name`,{value:t,configurable:!0}),vD=`Switch`,[yD,vte]=d(vD),[bD,xD]=yD(vD);function SD(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=u({prop:n,defaultProp:i??!1,onChange:c,caller:vD}),[h,g]=B.useState(null),[_,v]=B.useState(null),[y,b]=B.useState(null),x={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,userClick:y,onUserClick:b,required:l,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,z.jsx)(bD,{scope:t,...x,children:CD(f)?f(x):r})}_D(SD,`SwitchProvider`);var yte=`SwitchTrigger`,bte=B.forwardRef(_D(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:c,checked:l,required:u,setControl:d,setChecked:p,onUserClick:m,isFormControl:h,bubbleInput:_}=xD(yte,e),v=s(r,d),y=B.useRef(l);return B.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=_D(()=>p(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,p]),(0,z.jsx)(f.button,{type:`button`,role:`switch`,"aria-checked":l,"aria-required":u,"data-state":wD(l),"data-disabled":c?``:void 0,disabled:c,value:o,...n,ref:v,onClick:g(t,e=>{let t=e.isPropagationStopped();m({requestedChecked:!l,hasConsumerStoppedPropagation:t}),p(e=>!e),_&&h&&(t||e.stopPropagation())})})},`SwitchTrigger`)),xte=B.forwardRef(_D(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,z.jsx)(SD,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(bte,{...d,ref:t,__scopeSwitch:n}),e&&(0,z.jsx)(Tte,{__scopeSwitch:n})]})})},`Switch`)),Ste=`SwitchThumb`,Cte=B.forwardRef(_D(function(e,t){let{__scopeSwitch:n,...r}=e,i=xD(Ste,n);return(0,z.jsx)(f.span,{"data-state":wD(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),wte=`SwitchBubbleInput`,Tte=B.forwardRef(_D(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:c,required:l,disabled:u,name:d,value:p,form:m,bubbleInput:h,setBubbleInput:_}=xD(wte,e),v=s(r,_),y=Gx(i),b=B.useRef(!1),x=B.useRef(o),S=B.useRef(a),C=B.useRef(null);B.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=x.current!==o;x.current=o;let i=a!==null&&a!==S.current;if(S.current=a,i)C.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=C.current;C.current=null;let r=t?.requestedChecked===o;b.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),b.current=!1}},[h,o,a]);let w=B.useRef(o);return(0,z.jsx)(f.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??w.current,required:l,disabled:u,name:d,value:p,form:m,...n,tabIndex:-1,ref:v,onClick:g(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function CD(e){return typeof e==`function`}_D(CD,`isFunction`);function wD(e){return e?`checked`:`unchecked`}_D(wD,`getState`);var Ete=Object.defineProperty,TD=(e,t)=>Ete(e,`name`,{value:t,configurable:!0}),ED={Automatic:`automatic`,Manual:`manual`},DD=`Tabs`,[Dte,Ote]=d(DD,[pw]),OD=pw(),[kte,kD]=Dte(DD),Ate=B.forwardRef(TD(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=ED.Automatic,...l}=e,d=Ty(s),[p,m]=u({prop:r,onChange:i,defaultProp:a??``,caller:DD});return(0,z.jsx)(kte,{scope:n,baseId:y(),value:p,onValueChange:m,orientation:o,dir:d,activationMode:c,children:(0,z.jsx)(f.div,{dir:d,"data-orientation":o,...l,ref:t})})},`Tabs`)),jte=`TabsList`,Mte=B.forwardRef(TD(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=kD(jte,n),o=OD(n);return(0,z.jsx)(vw,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,z.jsx)(f.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Nte=`TabsTrigger`,Pte=B.forwardRef(TD(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=kD(Nte,n),s=OD(n),c=AD(o.baseId,r),l=jD(o.baseId,r),u=r===o.value;return(0,z.jsx)(xw,{asChild:!0,...s,focusable:!i,active:u,children:(0,z.jsx)(f.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:g(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:g(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:g(e.onFocus,()=>{let e=o.activationMode!==ED.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),Fte=`TabsContent`,Ite=B.forwardRef(TD(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=kD(Fte,n),c=AD(s.baseId,r),l=jD(s.baseId,r),u=r===s.value,d=B.useRef(u);return B.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,z.jsx)(S,{present:i||u,children:({present:n})=>(0,z.jsx)(f.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function AD(e,t){return`${e}-trigger-${t}`}TD(AD,`makeTriggerId`);function jD(e,t){return`${e}-content-${t}`}TD(jD,`makeContentId`);var Lte=O(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function V({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?_:`button`;return(0,z.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:T(Lte({variant:t,size:n,className:e})),...i})}var Rte=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function zte(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:Rte(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Bte=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Vte=e=>{let t=Bte(e);return t.charAt(0).toUpperCase()+t.slice(1)},MD=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ND={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function PD(e){return e!=null}function Hte(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??ND.width,a=e.size??e.height??ND.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?MD(...c):MD(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??ND[`stroke-width`])*Number(e.size??e.width??ND.width)/Number(t.size??t.width??ND.width):t.strokeWidth??ND[`stroke-width`];return[`svg`,{...Object.entries(ND).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&PD(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&PD(t.width)&&{[r(`width`)]:t.width},...`height`in t&&PD(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Ute(e,t={}){return Hte(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Wte=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Gte=(0,B.createContext)({}),Kte=()=>(0,B.useContext)(Gte),qte=(0,B.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Kte()??{},y=!!c||Wte(d),[b,x,S=[]]=Ute(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:MD(v,s),hasA11yProp:y,attributes:d});return(0,B.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function H(e,t=[],n=[]){let r=typeof e==`string`?zte(e,t,n):e,i=(0,B.forwardRef)(({className:e,...t},n)=>(0,B.createElement)(qte,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Vte(r.name)),i}var FD={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};FD.node;var Jte=H(FD),ID={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};ID.node;var Yte=H(ID),LD={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};LD.node;var RD=H(LD),zD={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};zD.node;var BD=H(zD),VD={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};VD.node;var HD=H(VD),UD={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};UD.node;var WD=H(UD),GD={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};GD.node;var Xte=H(GD),KD={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};KD.node;var qD=H(KD),JD={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};JD.node;var YD=H(JD),XD={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};XD.node;var Zte=H(XD),ZD={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ZD.node;var QD=H(ZD),$D={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};$D.node;var Qte=H($D),eO={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};eO.node;var $te=H(eO),tO={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};tO.node;var ene=H(tO),nO={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};nO.node;var tne=H(nO),rO={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};rO.node;var iO=H(rO),aO={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};aO.node;var nne=H(aO),oO={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};oO.node;var rne=H(oO),sO={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};sO.node;var ine=H(sO),cO={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};cO.node;var lO=H(cO),uO={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};uO.node;var ane=H(uO),dO={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};dO.node;var one=H(dO),fO={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};fO.node;var sne=H(fO),pO={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};pO.node;var cne=H(pO),mO={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};mO.node;var hO=H(mO),gO={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};gO.node;var _O=H(gO),vO={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};vO.node;var yO=H(vO),bO={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};bO.node;var xO=H(bO),SO={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};SO.node;var CO=H(SO),wO={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};wO.node;var TO=H(wO),EO={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};EO.node;var DO=H(EO),OO={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};OO.node;var lne=H(OO),kO={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};kO.node;var AO=H(kO),jO={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};jO.node;var MO=H(jO),NO={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};NO.node;var PO=H(NO),FO={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};FO.node;var IO=H(FO),LO={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};LO.node;var une=H(LO),RO={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};RO.node;var zO=H(RO),BO={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};BO.node;var VO=H(BO),HO={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};HO.node;var UO=H(HO),WO={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};WO.node;var GO=H(WO),KO={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};KO.node;var qO=H(KO),JO={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};JO.node;var dne=H(JO),YO={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};YO.node;var XO=H(YO),ZO={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ZO.node;var QO=H(ZO),$O={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};$O.node;var ek=H($O),tk={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};tk.node;var nk=H(tk),rk={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};rk.node;var ik=H(rk);function ak({className:e,type:t,...n}){return(0,z.jsx)(`input`,{type:t,"data-slot":`input`,className:T(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function ok({...e}){return(0,z.jsx)(YT,{"data-slot":`popover`,...e})}function sk({...e}){return(0,z.jsx)(ZT,{"data-slot":`popover-trigger`,...e})}function ck({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,z.jsx)(tE,{children:(0,z.jsx)(rE,{"data-slot":`popover-content`,align:t,sideOffset:n,className:T(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function lk(e){let t=new Map([[null,[]]]);for(let n of e){let e=t.get(n.group);e?e.push(n):t.set(n.group,[n])}return[...t].filter(([,e])=>e.length>0).map(([e,t])=>({group:e,tables:t}))}function uk(e){return[...new Set(e.flatMap(e=>e.group===null?[]:[e.group]))]}function dk(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function fk(e){let[t,n]=(0,B.useState)(()=>dk(e));return[t,r=>{let i=new Set(t);i.delete(r)||i.add(r),n(i);try{localStorage.setItem(e,JSON.stringify([...i]))}catch{}}]}var pk=()=>fk(`yamlite-collapsed-groups`),mk=()=>fk(`yamlite-expanded-tables`);function hk({table:e}){let t=Cg(),{connected:n}=ny(),{data:r}=ey(),i=(0,B.useId)(),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(e.group??``),l=W_({mutationFn:t=>Nv.setGroup(e.name,t),onSuccess:async()=>{o(!1),await t.invalidateQueries({queryKey:[`meta`]})}});return(0,z.jsxs)(ok,{open:a,onOpenChange:t=>{t&&(c(e.group??``),l.reset()),o(t)},children:[(0,z.jsx)(sk,{asChild:!0,children:(0,z.jsxs)(V,{variant:`outline`,size:`sm`,"aria-label":ld({group:e.group??dd()}),children:[(0,z.jsx)(qO,{className:`size-3.5`}),` `,e.group??od()]})}),(0,z.jsx)(ck,{align:`end`,className:`flex w-[min(16rem,calc(100vw-2rem))] flex-col gap-2 p-3`,children:(0,z.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),l.mutate(s.trim()===``?null:s.trim())},children:[(0,z.jsxs)(`label`,{className:`text-[11.5px] font-semibold text-muted-foreground`,children:[od(),(0,z.jsx)(ak,{"aria-label":ud(),role:`combobox`,list:i,value:s,autoFocus:!0,onChange:e=>c(e.target.value),className:`mt-1`})]}),(0,z.jsx)(`datalist`,{id:i,children:uk(r?.tables??[]).map(e=>(0,z.jsx)(`option`,{value:e},e))}),l.error&&(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:l.error.message}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.group!==null&&(0,z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:l.isPending||!n,onClick:()=>l.mutate(null),children:yd()}),(0,z.jsx)(V,{type:`submit`,size:`sm`,disabled:l.isPending||!n,children:St()})]})]})})]})}function gk({...e}){return(0,z.jsx)(Cx,{"data-slot":`dialog`,...e})}function _k({...e}){return(0,z.jsx)(Dx,{"data-slot":`dialog-portal`,...e})}function fne({className:e,...t}){return(0,z.jsx)(kx,{"data-slot":`dialog-overlay`,className:T(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}var pne=`flex flex-col gap-0 overflow-hidden p-0 max-md:overflow-hidden md:max-h-[85vh]`,vk=`shrink-0 border-t bg-background px-6 py-3 max-md:pb-[calc(0.75rem+env(safe-area-inset-bottom))]`;function yk({className:e,children:t,showCloseButton:n=!0,pinned:r=!1,...i}){return(0,z.jsxs)(_k,{"data-slot":`dialog-portal`,children:[(0,z.jsx)(fne,{}),(0,z.jsxs)(Nx,{"data-slot":`dialog-content`,className:T(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,`max-md:inset-0 max-md:top-0 max-md:left-0 max-md:h-dvh max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:flex max-md:flex-col max-md:overflow-auto max-md:rounded-none max-md:border-0 max-md:pt-[calc(1.5rem+env(safe-area-inset-top))]`,r&&pne,e),...i,children:[t,n&&(0,z.jsxs)(Bx,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs max-md:top-[calc(0.75rem+env(safe-area-inset-top))] max-md:right-2 max-md:grid max-md:size-10 max-md:place-items-center opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,z.jsx)(ik,{}),(0,z.jsx)(`span`,{className:`sr-only`,children:gt()})]})]})]})}function bk({className:e,pinned:t=!1,...n}){return(0,z.jsx)(`div`,{"data-slot":`dialog-header`,className:T(`flex flex-col gap-2 text-center sm:text-left`,t&&`shrink-0 border-b px-6 pt-6 pr-12 pb-4 max-md:pt-0`,e),...n})}function xk({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`dialog-body`,className:T(`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-4`,e),...t})}function Sk({className:e,showCloseButton:t=!1,pinned:n=!1,children:r,...i}){return(0,z.jsxs)(`div`,{"data-slot":`dialog-footer`,className:T(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n?vk:`max-md:sticky max-md:bottom-0 max-md:-mx-6 max-md:-mb-6 max-md:mt-auto max-md:border-t max-md:bg-background max-md:px-6 max-md:pt-3 max-md:pb-[calc(0.75rem+env(safe-area-inset-bottom))]`,e),...i,children:[r,t&&(0,z.jsx)(Bx,{asChild:!0,children:(0,z.jsx)(V,{variant:`outline`,children:gt()})})]})}function Ck({className:e,...t}){return(0,z.jsx)(Lx,{"data-slot":`dialog-title`,className:T(`text-lg leading-none font-semibold`,e),...t})}function wk({className:e,...t}){return(0,z.jsx)(Rx,{"data-slot":`dialog-description`,className:T(`text-sm text-muted-foreground`,e),...t})}var Tk=`text-[12px] font-semibold tracking-wider text-muted-foreground uppercase max-md:text-[13px]`,Ek=`text-[12px] font-semibold text-muted-foreground max-md:text-[13px]`,Dk=`h-9 rounded-md border bg-background px-2 text-base md:text-sm`,Ok=`w-56 max-md:w-full`,kk=`inline-flex items-center rounded-full bg-chip py-0.5 pr-1 pl-2.5 text-[13px] text-chip-foreground`;function Ak(e){return e?e instanceof gv?{field:typeof e.body.field==`string`?e.body.field:null,message:e.message}:{field:null,message:e instanceof Error?e.message:String(e)}:null}var jk=1024,Mk=0,Nk=class{constructor(e,t){this.from=e,this.to=t}},Pk=class{constructor(e={}){this.id=Mk++,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=Lk.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Pk.closedBy=new Pk({deserialize:e=>e.split(` `)}),Pk.openedBy=new Pk({deserialize:e=>e.split(` `)}),Pk.group=new Pk({deserialize:e=>e.split(` `)}),Pk.isolate=new Pk({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Pk.contextHash=new Pk({perNode:!0}),Pk.lookAhead=new Pk({perNode:!0}),Pk.mounted=new Pk({perNode:!0});var Fk=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[Pk.mounted.id]}},Ik=Object.create(null),Lk=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):Ik,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(Pk.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(Pk.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Lk.none=new Lk(``,Object.create(null),0,8);var Rk=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 Lk(e.name,r,e.id,e.flags):e)}return new e(n)}},zk=new WeakMap,Bk=new WeakMap,Vk;(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`})(Vk||={});var Hk=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=Fk.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 nA(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new nA(zk.get(this)||this.topNode);return r.moveTo(e,t),zk.set(this,r._tree),r}get topNode(){return new Jk(this,0,0,null)}resolve(e,t=0){let n=Kk(zk.get(this)||this.topNode,e,t,!1);return zk.set(this,n),n}resolveInner(e,t=0){let n=Kk(Bk.get(this)||this.topNode,e,t,!0);return Bk.set(this,n),n}resolveStack(e,t=0){return tA(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Vk.IncludeAnonymous)>0;for(let e=this.cursor(a|Vk.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:sA(Lk.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(Lk.none,t,n,r)))}static build(e){return iA(e)}};Hk.empty=new Hk(Lk.none,[],[],0);var Uk=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)}},Wk=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Lk.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&&!(Gk(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 Gk(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 Kk(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 Jk&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Vk.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Jk&&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 qk=class{cursor(e=0){return new nA(this,e)}getChild(e,t=null,n=null){let r=Yk(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Yk(this,e,t,n)}resolve(e,t=0){return Kk(this,e,t,!1)}resolveInner(e,t=0){return Kk(this,e,t,!0)}matchContext(e){return Xk(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}},Jk=class e extends qk{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&Vk.EnterBracketed&&l instanceof Hk&&(d=Fk.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||Gk(i,r,u,u+l.length)){if(l instanceof Wk){if(a&Vk.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Qk(new Zk(o,l,t,u),null,e)}else if(a&Vk.IncludeAnonymous||!l.type.isAnonymous||rA(l)){let s;if(!(a&Vk.IgnoreMounts)&&(s=Fk.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Vk.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Vk.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&Vk.IgnoreOverlays)&&(i=Fk.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Vk.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 Yk(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 Xk(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 Zk=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Qk=class e extends qk{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&Vk.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 Hk(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function $k(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 Jk&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new eA(i,n)}var eA=class{constructor(e,t){this.heads=e,this.node=t}get next(){return $k(this.heads)}};function tA(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Jk?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=Fk.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Jk(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Kk(o,t,n,!1))}}return i?$k(i):r}var nA=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&~Vk.EnterBracketed,e instanceof Jk)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 Jk?(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&Vk.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Vk.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Vk.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&Vk.IncludeAnonymous||e instanceof Wk||!e.type.isAnonymous||rA(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 Qk(this.buffer,t,this.stack[e]);return this.bufferNode=new Qk(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 Xk(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 Xk(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 rA(e){return e.children.some(e=>e instanceof Wk||!e.type.isAnonymous||rA(e))}function iA(e){let{buffer:t,nodeSet:n,maxBufferLength:r=jk,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Uk(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 Wk(t,C-k.start,n),A=k.start-e}else{let e=o.pos-w;o.next();let t=[],n=[],i=x>=a?x:-1,s=0,c=C;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,S,s,o.end,c,i,T,E),s=t.length,c=o.end),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,T,E),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(D,E);O=sA(D,t,n,0,t.length,0,C-S,e,e)}else O=m(D,t,n,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 Wk(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 Hk){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Pk.lookAhead))&&(a=r[o]+s.length+c)}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=[Pk.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Pk.lookAhead,i];o=o?[e].concat(o):[e]}return new Hk(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 Hk(s[e.topID],_.reverse(),v.reverse(),y)}var aA=new WeakMap;function oA(e,t){if(!e.isAnonymous||t instanceof Wk||t.type!=e)return 1;let n=aA.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Hk)){n=1;break}n+=oA(e,r)}aA.set(t,n)}return n}function sA(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=oA(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=oA(e,t[s]);for(s++;s<i;s++){let n=oA(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(sA(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 cA=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Qk?this.setBuffer(e.context.buffer,e.index,t):e instanceof Jk&&this.map.set(e.tree,t)}get(e){return e instanceof Qk?this.getBuffer(e.context.buffer,e.index):e instanceof Jk?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},lA=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}},uA=class{startParse(e,t,n){return typeof e==`string`&&(e=new dA(e)),n=n?n.length?n.map(e=>new Nk(e.from,e.to)):[new Nk(0,0)]:[new Nk(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}}},dA=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)}};function mne(e){return(t,n,r,i)=>new gne(t,e,n,r,i)}var fA=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function pA(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var hne=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},mA=new Pk({perNode:!0}),gne=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new Hk(e.type,e.children,e.positions,e.length,e.propValues.concat([[mA,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Pk.mounted.id]=new Fk(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new yne(this.fragments),t=null,n=null,r=new nA(new Jk(this.baseTree,this.ranges[0].from,0,null),Vk.IncludeAnonymous|Vk.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=_ne(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(vne(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new hne(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=_A(this.ranges,i.overlay||(r.from<r.to?[new Nk(r.from,r.to)]:[]));e.length&&pA(e),(e.length||!i.overlay)&&this.inner.push(new fA(i.parser,e.length?i.parser.startParse(this.input,vA(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new Nk(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new Nk(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=_A(this.ranges,t.ranges);e.length&&(pA(e),this.inner.splice(t.index,0,new fA(t.parser,t.parser.startParse(this.input,vA(t.mounts,e),e),t.ranges.map(e=>new Nk(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function _ne(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function hA(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function vne(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];hA(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),hA(o,s[f+3],r,p,m,a),new Hk(i,p,m,u)}i.children[a]=l(0,s.length,Lk.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new Jk(n,r+e.from,t,e._tree))}}var gA=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Vk.IncludeAnonymous|Vk.IgnoreMounts|Vk.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,Vk.IncludeAnonymous|Vk.IgnoreOverlays|Vk.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Hk)t=t.children[0];else break}return!1}},yne=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(mA)??t.to,this.inner=new gA(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(mA)??e.to,this.inner=new gA(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(Pk.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function _A(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new Nk(e.from,o),e.to>s&&n.splice(a+1,0,new Nk(s,e.to))):e.to>s?n[a--]=new Nk(s,e.to):n.splice(a--,1))}}return r}function bne(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new Nk(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function vA(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=bne(t,i.overlay.map(e=>new Nk(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new lA(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new lA(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var xne=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 yA(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){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-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 Sne(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.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}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 yA(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()}},yA=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Sne=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}},bA=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 xA(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 SA=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},CA=new SA,wA=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=CA,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=CA,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}},TA=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;OA(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};TA.prototype.contextual=TA.prototype.fallback=TA.prototype.extend=!1;var EA=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?xA(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(OA(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))}};EA.prototype.contextual=TA.prototype.fallback=TA.prototype.extend=!1;var DA=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function OA(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||AA(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 kA(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function AA(e,t,n,r){let i=kA(n,r,t);return i<0||kA(n,r,e)<i}var jA=typeof process<`u`&&/\bparse\b/.test({}.LOG),MA=null;function NA(e,t,n){let r=e.cursor(Vk.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 PA=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?NA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?NA(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;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 Hk){if(a==e){if(a<this.safeFrom)return null;let e=a+i.length;if(e<=this.safeTo){let t=i.prop(Pk.lookAhead);if(!t||e+t<this.fragment.to)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}}},FA=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new SA)}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 SA,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 SA,{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=HA(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(HA(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(HA(o,s+1),t,n,r))}return r}},IA=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 wA(t,r),this.tokens=new FA(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[xne.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new PA(n,e.nodeSet):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&&UA(r);if(e)return jA&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw jA&&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 jA&&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}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=jA?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(Pk.contextHash)||0)==n))return e.useNode(o,r),jA&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof Hk)||o.children.length==0||o.positions[0]>0)break;let s=o.children[0];if(s instanceof Hk&&o.positions[0]==0)o=s;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),jA&&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),jA&&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 LA(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=jA?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),jA&&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()&&(jA&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)jA&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))jA&&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),jA&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),LA(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),Hk.build({buffer:bA.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=(MA||=new WeakMap).get(e);return t||MA.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function LA(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 RA=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},zA=e=>e,BA=class{constructor(e){this.start=e.start,this.shift=e.shift||zA,this.reduce=e.reduce||zA,this.reuse=e.reuse||zA,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},VA=class e extends uA{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=Pk[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 Rk(t.map((t,i)=>Lk.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=jk;let a=xA(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(WA),this.states=xA(e.states,Uint32Array),this.data=xA(e.stateData),this.goto=xA(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new TA(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 IA(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=HA(n,i+2)];else if(n[i+1]==2)return HA(n,i+2);else break}if(a==t||a==0)return HA(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=HA(this.data,n+2);else break}r=t(HA(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=HA(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]=WA(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 RA(e,n,r)}static deserialize(t){return new e(t)}};function HA(e,t){return e[t]|e[t+1]<<16}function UA(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 WA(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var GA=0,KA=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=GA++}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 JA(e);return e=>e.modified.indexOf(t)>-1?e:JA.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},qA=0,JA=class e{constructor(e){this.name=e,this.instances=[],this.id=qA++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&YA(n,e.modified));if(r)return r;let i=[],a=new KA(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=XA(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 YA(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function XA(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 ZA(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 $A(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return QA.add(t)}var QA=new Pk({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 $A(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),$A=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}};$A.empty=new $A([],2,null);function ej(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 tj(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function nj(e,t,n,r=0,i=e.length){let a=new ij(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}function rj(e,t,n,r,i,a=0,o=e.length){let s=a;function c(t,n){if(!(t<=s)){for(let a=e.slice(s,t),o=0;;){let e=a.indexOf(`
|
|
59
|
-
`,o),t=e<0?a.length:e;if(t>o&&r(a.slice(o,t),n),e<0)break;i(),o=e+1}s=t}}nj(t,n,(e,t,n)=>{c(e,``),c(t,n)},a,o),c(o,``)}var ij=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=aj(e)||$A.empty,u=tj(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(Pk.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 aj(e){let t=e.type.prop(QA);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var U=KA.define,oj=U(),sj=U(),cj=U(sj),lj=U(sj),uj=U(),dj=U(uj),fj=U(uj),pj=U(),mj=U(pj),hj=U(),gj=U(),_j=U(),vj=U(_j),yj=U(),W={comment:oj,lineComment:U(oj),blockComment:U(oj),docComment:U(oj),name:sj,variableName:U(sj),typeName:cj,tagName:U(cj),propertyName:lj,attributeName:U(lj),className:U(sj),labelName:U(sj),namespace:U(sj),macroName:U(sj),literal:uj,string:dj,docString:U(dj),character:U(dj),attributeValue:U(dj),number:fj,integer:U(fj),float:U(fj),bool:U(uj),regexp:U(uj),escape:U(uj),color:U(uj),url:U(uj),keyword:hj,self:U(hj),null:U(hj),atom:U(hj),unit:U(hj),modifier:U(hj),operatorKeyword:U(hj),controlKeyword:U(hj),definitionKeyword:U(hj),moduleKeyword:U(hj),operator:gj,derefOperator:U(gj),arithmeticOperator:U(gj),logicOperator:U(gj),bitwiseOperator:U(gj),compareOperator:U(gj),updateOperator:U(gj),definitionOperator:U(gj),typeOperator:U(gj),controlOperator:U(gj),punctuation:_j,separator:U(_j),bracket:vj,angleBracket:U(vj),squareBracket:U(vj),paren:U(vj),brace:U(vj),content:pj,heading:mj,heading1:U(mj),heading2:U(mj),heading3:U(mj),heading4:U(mj),heading5:U(mj),heading6:U(mj),contentSeparator:U(pj),list:U(pj),quote:U(pj),emphasis:U(pj),strong:U(pj),link:U(pj),monospace:U(pj),strikethrough:U(pj),inserted:U(),deleted:U(),changed:U(),invalid:U(),meta:yj,documentMeta:U(yj),annotation:U(yj),processingInstruction:U(yj),definition:KA.defineModifier(`definition`),constant:KA.defineModifier(`constant`),function:KA.defineModifier(`function`),standard:KA.defineModifier(`standard`),local:KA.defineModifier(`local`),special:KA.defineModifier(`special`)};for(let e in W){let t=W[e];t instanceof KA&&(t.name=e)}var bj=ej([{tag:W.link,class:`tok-link`},{tag:W.heading,class:`tok-heading`},{tag:W.emphasis,class:`tok-emphasis`},{tag:W.strong,class:`tok-strong`},{tag:W.keyword,class:`tok-keyword`},{tag:W.atom,class:`tok-atom`},{tag:W.bool,class:`tok-bool`},{tag:W.url,class:`tok-url`},{tag:W.labelName,class:`tok-labelName`},{tag:W.inserted,class:`tok-inserted`},{tag:W.deleted,class:`tok-deleted`},{tag:W.literal,class:`tok-literal`},{tag:W.string,class:`tok-string`},{tag:W.number,class:`tok-number`},{tag:[W.regexp,W.escape,W.special(W.string)],class:`tok-string2`},{tag:W.variableName,class:`tok-variableName`},{tag:W.local(W.variableName),class:`tok-variableName tok-local`},{tag:W.definition(W.variableName),class:`tok-variableName tok-definition`},{tag:W.special(W.variableName),class:`tok-variableName2`},{tag:W.definition(W.propertyName),class:`tok-propertyName tok-definition`},{tag:W.typeName,class:`tok-typeName`},{tag:W.namespace,class:`tok-namespace`},{tag:W.className,class:`tok-className`},{tag:W.macroName,class:`tok-macroName`},{tag:W.propertyName,class:`tok-propertyName`},{tag:W.operator,class:`tok-operator`},{tag:W.comment,class:`tok-comment`},{tag:W.meta,class:`tok-meta`},{tag:W.invalid,class:`tok-invalid`},{tag:W.punctuation,class:`tok-punctuation`}]),xj=ZA({String:W.string,Number:W.number,"True False":W.bool,PropertyName:W.propertyName,Null:W.null,", :":W.separator,"[ ]":W.squareBracket,"{ }":W.brace}),Sj=VA.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[xj],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Cj=[],wj=[];(()=>{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?wj:Cj).push(n+=e[t])})();function Tj(e){if(e<768)return!1;for(let t=0,n=Cj.length;;){let r=t+n>>1;if(e<Cj[r])n=r;else if(e>=wj[r])t=r+1;else return!0;if(t==n)return!1}}function Ej(e){return e>=127462&&e<=127487}var Dj=8205;function Oj(e,t,n=!0,r=!0){return(n?kj:Aj)(e,t,r)}function kj(e,t,n){if(t==e.length)return t;t&&Mj(e.charCodeAt(t))&&Nj(e.charCodeAt(t-1))&&t--;let r=jj(e,t);for(t+=Pj(r);t<e.length;){let i=jj(e,t);if(r==Dj||i==Dj||n&&Tj(i))t+=Pj(i),r=i;else if(Ej(i)){let n=0,r=t-2;for(;r>=0&&Ej(jj(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Aj(e,t,n){for(;t>1;){let r=kj(e,t-2,n);if(r<t)return r;t--}return 0}function jj(e,t){let n=e.charCodeAt(t);if(!Nj(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Mj(r)?(n-55296<<10)+(r-56320)+65536:n}function Mj(e){return e>=56320&&e<57344}function Nj(e){return e>=55296&&e<56320}function Pj(e){return e<65536?1:2}var Fj=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]=Uj(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),Lj.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]=Uj(this,e,t);let n=[];return this.decompose(e,t,n,0),Lj.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 Bj(this),i=new Bj(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 Bj(this,e)}iterRange(e,t=this.length){return new Vj(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 Hj(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 Ij(t):Lj.from(Ij.split(t,[]))}},Ij=class e extends Fj{constructor(e,t=Cne(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 wne(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(zj(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Rj(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]=Uj(this,t,n);let i=Rj(this.text,Rj(r.text,zj(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Lj.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
60
|
-
`){[e,t]=Uj(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}},Lj=class e extends Fj{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]=Uj(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=`
|
|
61
|
-
`){[e,t]=Uj(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 Ij(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 Ij&&c&&(n=u[u.length-1])instanceof Ij&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Ij(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)}};Fj.empty=new Ij([``],0);function Cne(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Rj(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 zj(e,t,n){return Rj(e,[``],t,n)}var Bj=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 Ij?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 Ij?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=`
|
|
62
|
-
`,this;e--}else if(r instanceof Ij){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 Ij?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)}},Vj=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Bj(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!=``}},Hj=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`&&(Fj.prototype[Symbol.iterator]=function(){return this.iter()},Bj.prototype[Symbol.iterator]=Vj.prototype[Symbol.iterator]=Hj.prototype[Symbol.iterator]=function(){return this});var wne=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 Uj(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Wj(e,t,n=!0,r=!0){return Oj(e,t,n,r)}function Tne(e){return e>=56320&&e<57344}function Ene(e){return e>=55296&&e<56320}function Gj(e,t){let n=e.charCodeAt(t);if(!Ene(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Tne(r)?(n-55296<<10)+(r-56320)+65536:n}function Kj(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function qj(e){return e<65536?1:2}var Jj=/\r\n?|\n/,Yj=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(Yj||={}),Xj=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){eM(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:nM(this,e)}mapDesc(e,t=!1){return e.empty?this:tM(this,e,t)}mapPos(e,t=-1,n=Yj.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!=Yj.Simple&&c>=e&&(n==Yj.TrackDel&&r<e&&c>e||n==Yj.TrackBefore&&r<e||n==Yj.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)}},Zj=class e extends Xj{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 eM(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return tM(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(Fj.empty);r.push(a?t.slice(i,i+a):Fj.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:nM(this,e,!0)}map(e,t=!1){return e.empty?this:tM(this,e,t,!0)}iterChanges(e,t=!1){eM(this,e,t)}get desc(){return Xj.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new rM(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);Qj(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;Qj(n,e,t),t>0&&$j(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);Qj(n,e,-1),Qj(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:Xj.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&&Qj(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`?Fj.of(l.split(r||Jj)):l:Fj.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&Qj(i,e-o,-1),Qj(i,s-e,d),$j(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(Fj.empty);r[e]=Fj.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 Qj(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 $j(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(Fj.empty);e.push(n)}}function eM(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=Fj.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 tM(e,t,n,r=!1){let i=[],a=r?[]:null,o=new rM(e),s=new rM(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);Qj(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(Qj(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(Qj(i,0,o.ins),a&&$j(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;Qj(i,t,e<o.i?o.ins:0),a&&e<o.i&&$j(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?Zj.createSet(i,a):Xj.create(i);else throw Error(`Mismatched change set lengths`)}function nM(e,t,n=!1){let r=[],i=n?[]:null,a=new rM(e),o=new rM(t);for(let e=!1;;)if(a.done&&o.done)return i?Zj.createSet(r,i):Xj.create(r);else if(a.ins==0)Qj(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)Qj(r,0,o.ins,e),i&&$j(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;Qj(r,t,n,e),i&&n&&$j(i,r,o.text)}else o.ins==-1?(Qj(r,a.off?0:a.len,t,e),i&&$j(i,r,a.textBit(t))):(Qj(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&$j(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 rM=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?Fj.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Fj.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)}},iM=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 G.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return G.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 G.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},G=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=>iM.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 iM.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?iM.create(t,e,a|32,n):iM.create(e,t,a,n)}static undirectionalRange(e,t){return iM.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 aM(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var oM=0,K=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=oM++,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:sM),!!t.static,t.enables)}of(e){return new cM([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new cM(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new cM(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function sM(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var cM=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=oM++}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)||uM(e,c)){let r=t(e);if(a?!lM(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=CM(o,c);if(this.dependencies.every(t=>t instanceof K?o.facet(t)===e.facet(t):t instanceof pM?o.field(t,!1)==e.field(t,!1):!0)||(a?lM(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 lM(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 uM(e,t){let n=!1;for(let r of t)SM(e,r)&1&&(n=!0);return n}function dM(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=CM(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)SM(e,t);return e.values[o]=s(e),1},update(e,n){if(!uM(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=uM(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&sM(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 fM=K.define({static:!0}),pM=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(oM++,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(fM).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(fM),i=n.facet(fM),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,fM.of({field:this,create:e})]}get extension(){return this}},mM={lowest:4,low:3,default:2,high:1,highest:0};function hM(e){return t=>new _M(t,e)}var gM={highest:hM(mM.highest),high:hM(mM.high),default:hM(mM.default),low:hM(mM.low),lowest:hM(mM.lowest)},_M=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},vM=class e{of(e){return new yM(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},yM=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},bM=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 xM(t,n,o))e instanceof pM?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,sM(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=>dM(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function xM(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 yM&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof yM){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 _M)a(e.inner,e.prec);else if(e instanceof pM)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof cM)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,mM.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,mM.default),r.reduce((e,t)=>e.concat(t))}function SM(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 CM(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var wM=K.define(),TM=K.define({combine:e=>e.some(e=>e),static:!0}),EM=K.define({combine:e=>e.length?e[0]:void 0,static:!0}),DM=K.define(),OM=K.define(),kM=K.define(),AM=K.define({combine:e=>e.length?e[0]:!1}),jM=class{constructor(e,t){this.type=e,this.value=t}static define(){return new MM}},MM=class{of(e){return new jM(this,e)}},NM=class{constructor(e){this.map=e}of(e){return new q(this,e)}},q=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 NM(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}};q.reconfigure=q.define(),q.appendConfig=q.define();var PM=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&&aM(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]==`.`))}};PM.time=jM.define(),PM.userEvent=jM.define(),PM.addToHistory=jM.define(),PM.remote=jM.define();function FM(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 IM(e,t,n){let r,i,a;return n?(r=t.changes,i=Zj.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:q.mapEffects(e.effects,r).concat(q.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function LM(e,t,n){let r=t.selection,i=HM(t.annotations);return t.userEvent&&(i=i.concat(PM.userEvent.of(t.userEvent))),{changes:t.changes instanceof Zj?t.changes:Zj.of(t.changes||[],n,e.facet(EM)),selection:r&&(r instanceof G?r:G.single(r.anchor,r.head)),effects:HM(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function RM(e,t,n){let r=LM(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=IM(r,LM(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=PM.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return BM(n?zM(i):i)}function zM(e){let t=e.startState,n=!0;for(let r of t.facet(DM)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:FM(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Zj.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=PM.create(t,r,e.selection&&e.selection.map(i),q.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(OM);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof PM?i:Array.isArray(i)&&i.length==1&&i[0]instanceof PM?i[0]:RM(t,HM(i),!1)}return e}function BM(e){let t=e.startState,n=t.facet(kM),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=IM(r,LM(t,a,e.changes.newLength),!0))}return r==e?e:PM.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var VM=[];function HM(e){return e==null?VM:Array.isArray(e)?e:[e]}var UM=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(UM||={}),WM=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,GM;try{GM=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function KM(e){if(GM)return GM.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||WM.test(n)))return!0}return!1}function qM(e){return t=>{if(!/\S/.test(t))return UM.Space;if(KM(t))return UM.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return UM.Word;return UM.Other}}var JM=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++)SM(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 SM(this,n),CM(this,n)}update(...e){return RM(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(vM.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(q.reconfigure)?(n=null,r=e.value):e.is(q.appendConfig)&&(n=null,r=HM(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=bM.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(TM)?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:G.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=HM(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=q.mapEffects(a,c).concat(q.mapEffects(HM(o.effects),l))}return{changes:r,selection:G.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof Zj?t:Zj.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return Fj.of(t.split(this.facet(e.lineSeparator)||Jj))}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:(SM(this,t),CM(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 pM&&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:G.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=bM.resolve(t.extensions||[],new Map),r=t.doc instanceof Fj?t.doc:Fj.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Jj)),i=t.selection?t.selection instanceof G?t.selection:G.single(t.selection.anchor,t.selection.head):G.single(0);return aM(i,r.length),n.staticFacet(TM)||(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)||`
|
|
63
|
-
`}get readOnly(){return this.facet(AM)}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(wM))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 qM(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=Wj(t,a,!1);if(i(t.slice(e,a))!=UM.Word)break;a=e}for(;o<r;){let e=Wj(t,o);if(i(t.slice(o,e))!=UM.Word)break;o=e}return a==o?null:G.range(a+n,o+n)}};JM.allowMultipleSelections=TM,JM.tabSize=K.define({combine:e=>e.length?e[0]:4}),JM.lineSeparator=EM,JM.readOnly=AM,JM.phrases=K.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])}}),JM.languageData=wM,JM.changeFilter=DM,JM.transactionFilter=OM,JM.transactionExtender=kM,vM.reconfigure=q.define();function YM(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 XM=class{eq(e){return this==e}range(e,t=e){return QM.create(e,t,this)}};XM.prototype.startSide=XM.prototype.endSide=0,XM.prototype.point=!1,XM.prototype.mapMode=Yj.TrackDel;function ZM(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var QM=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 $M(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var eN=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return nN(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}}},tN=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($M)),this.isEmpty)return n.length?e.of(n):this;let s=new oN(this,null,-1).goto(0),c=0,l=[],u=new iN;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(QM.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 iN,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?[nN(r)+nN(n).length,nN(nN(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 sN.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return sN.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=aN(a,o,n),c=new lN(a,s,i),l=new lN(o,s,i);n.iterGaps((e,t,n)=>uN(c,e,l,t,n,r)),n.empty&&n.length==0&&uN(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=aN(i,a),s=new lN(i,o,0).goto(n),c=new lN(a,o,0).goto(n);for(;;){if(s.to!=c.to||!dN(s.active,c.active)||s.point&&(!c.point||!ZM(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 lN(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 iN;for(let r of e instanceof QM?[e]:t?rN(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=nN(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}};tN.empty=new tN([],[],null,-1);function nN(e){return e[e.length-1]}function rN(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if($M(t,r)>0)return e.slice().sort($M);t=r}return e}tN.empty.nextLayer=tN.empty;var iN=class e{finishChunk(e){this.chunks.push(new eN(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(tN.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=tN.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function aN(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 oN=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}},sN=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 oN(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--)cN(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--)cN(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(),cN(this.heap,0)}}};function cN(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 lN=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=sN.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){fN(this.active,e),fN(this.activeTo,e),fN(this.activeRank,e),this.minActive=mN(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++;pN(this.active,t,n),pN(this.activeTo,t,r),pN(this.activeRank,t,i),e&&pN(e,t,this.cursor.from),this.minActive=mN(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&&fN(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 uN(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&&ZM(e.point,n.point)&&dN(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&&!dN(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 dN(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!ZM(e[n],t[n]))return!1;return!0}function fN(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function pN(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function mN(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 hN(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=Wj(e,i));return r}function gN(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=Wj(e,r)}return r===!0?-1:e.length}for(var _N=`ͼ`,vN=typeof Symbol>`u`?`__ͼ`:Symbol.for(_N),yN=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),bN=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},xN=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(`
|
|
64
|
-
`)}static newName(){let e=bN[vN]||1;return bN[vN]=e+1,_N+e.toString(36)}static mount(e,t,n){let r=e[yN],i=n&&n.nonce;r?i&&r.setNonce(i):r=new CN(e,i),r.mount(Array.isArray(t)?t:[t],e)}},SN=new Map,CN=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=SN.get(n);if(t)return e[yN]=t;this.sheet=new r.CSSStyleSheet,SN.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[yN]=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()+`
|
|
65
|
-
`;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)}},wN={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:`'`},TN={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},EN=typeof navigator<`u`&&/Mac/.test(navigator.platform),DN=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ON=0;ON<10;ON++)wN[48+ON]=wN[96+ON]=String(ON);for(var ON=1;ON<=24;ON++)wN[ON+111]=`F`+ON;for(var ON=65;ON<=90;ON++)wN[ON]=String.fromCharCode(ON+32),TN[ON]=String.fromCharCode(ON);for(var kN in wN)TN.hasOwnProperty(kN)||(TN[kN]=wN[kN]);function AN(e){var t=!(EN&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||DN&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?TN:wN)[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 jN(){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++)MN(e,arguments[t]);return e}function MN(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++)MN(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var NN=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},PN=typeof document<`u`?document:{documentElement:{style:{}}},FN=/Edge\/(\d+)/.exec(NN.userAgent),IN=/MSIE \d/.test(NN.userAgent),LN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(NN.userAgent),RN=!!(IN||LN||FN),zN=!RN&&/gecko\/(\d+)/i.test(NN.userAgent),BN=!RN&&/Chrome\/(\d+)/.exec(NN.userAgent),VN=`webkitFontSmoothing`in PN.documentElement.style,HN=!RN&&/Apple Computer/.test(NN.vendor),UN=HN&&(/Mobile\/\w+/.test(NN.userAgent)||NN.maxTouchPoints>2),J={mac:UN||/Mac/.test(NN.platform),windows:/Win/.test(NN.platform),linux:/Linux|X11/.test(NN.platform),ie:RN,ie_version:IN?PN.documentMode||6:LN?+LN[1]:FN?+FN[1]:0,gecko:zN,gecko_version:zN?+(/Firefox\/(\d+)/.exec(NN.userAgent)||[0,0])[1]:0,chrome:!!BN,chrome_version:BN?+BN[1]:0,ios:UN,android:/Android\b/.test(NN.userAgent),webkit:VN,webkit_version:VN?+(/\bAppleWebKit\/(\d+)/.exec(NN.userAgent)||[0,0])[1]:0,safari:HN,safari_version:HN?+(/\bVersion\/(\d+(\.\d+)?)/.exec(NN.userAgent)||[0,0])[1]:0,tabSize:PN.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function WN(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 GN=Object.create(null);function KN(e,t,n){if(e==t)return!0;e||=GN,t||=GN;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 qN(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 JN(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 YN(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 XN=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){}},ZN=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(ZN||={}),Y=class extends XM{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 QN(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 eP(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}=tP(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new eP(e,n,r,t,e.widget||null,!0)}static line(e){return new $N(e)}static set(e,t=!1){return tN.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Y.none=tN.empty;var QN=class e extends Y{constructor(e){let{start:t,end:n}=tP(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?WN(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||GN}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&KN(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};QN.prototype.point=!1;var $N=class e extends Y{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&KN(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)}};$N.prototype.mapMode=Yj.TrackBefore,$N.prototype.point=!0;var eP=class e extends Y{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Yj.TrackBefore:Yj.TrackAfter:Yj.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?ZN.WidgetBefore:ZN.WidgetAfter:ZN.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&nP(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)}};eP.prototype.point=!0;function tP(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function nP(e,t){return e==t||!!(e&&t&&e.compare(t))}function rP(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 iP=class e extends XM{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&&KN(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||GN,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return tN.of(e,t)}};iP.prototype.startSide=iP.prototype.endSide=-1;var aP=e=>e.nodeType==1,oP=e=>e.nodeType==3;function sP(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function cP(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function lP(e,t){if(!t.anchorNode)return!1;try{return cP(e,t.anchorNode)}catch{return!1}}function uP(e){return oP(e)?CP(e,0,e.nodeValue.length).getClientRects():aP(e)?e.getClientRects():[]}function dP(e,t,n,r){return n?mP(e,t,n,r,-1)||mP(e,t,n,r,1):!1}function fP(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function pP(e){return aP(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function mP(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:hP(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!aP(n))return!1;t=fP(e)+(i<0?0:1),e=n}else if(aP(e)){if(e=e.childNodes[t+(i<0?-1:0)],aP(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?hP(e):0}else return!1}}function hP(e){return oP(e)?e.nodeValue.length:e.childNodes.length}function gP(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 Dne(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 _P(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 One(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(aP(u)){let e,f=u==c.body,p=1,m=1;if(f)e=Dne(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:m}=_P(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*m}}let h=0,g=0;if(i==`nearest`)t.top<e.top+o?(g=t.top-(e.top+o),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(g=t.bottom-e.bottom+o,n<0&&t.top-g<e.top&&(g=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;g=(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(r==`nearest`?t.left<e.left+a?(h=t.left-(e.left+a),n>0&&t.right>e.right+h&&(h=t.right-e.right+a)):t.right>e.right-a&&(h=t.right-e.right+a,n<0&&t.left<e.left+h&&(h=t.left-(e.left+a))):h=(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,h||g){if(f)l.scrollBy(h,g);else{let e=0,n=0;if(g){let e=u.scrollTop;u.scrollTop+=g/m,n=(u.scrollTop-e)*m}if(h){let t=u.scrollLeft;u.scrollLeft+=h/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-h)<1&&(r=`nearest`),n&&Math.abs(n-g)<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 vP(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(aP(a))!i&&a.scrollHeight>a.clientHeight&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var kne=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?hP(t):0),n,Math.min(e.focusOffset,n?hP(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function yP(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)aP(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function bP(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 xP=null;J.safari&&J.safari_version>=26&&(xP=!1);function SP(e){if(e.setActive)return e.setActive();if(xP)return e.focus(xP);let t=yP(e);e.focus(xP==null?{get preventScroll(){return xP={preventScroll:!0},!0}}:void 0),xP||(xP=!1,bP(t))}var Ane;function CP(e,t,n=t){let r=Ane||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function wP(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 jne(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Mne(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,hP(n));;)if(r){if(!aP(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=hP(n))}else if(n==e)return!0;else r=fP(n),n=n.parentNode}function TP(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 EP(e,t){for(let n=e,r=t;;)if(oP(n)&&r>0)return{node:n,offset:r};else if(aP(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=hP(n)}else if(n.parentNode&&!pP(n))r=fP(n),n=n.parentNode;else return null}function DP(e,t){for(let n=e,r=t;;)if(oP(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(aP(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!pP(n))r=fP(n)+1,n=n.parentNode;else return null}var OP=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,fP(t),n)}static after(t,n){return new e(t.parentNode,fP(t)+1,n)}},kP=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(kP||={}),AP=kP.LTR,jP=kP.RTL;function MP(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var Nne=MP(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Pne=MP(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),NP=Object.create(null),PP=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);NP[t]=n,NP[n]=-t}function FP(e){return e<=247?Nne[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Pne[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Fne=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,IP=class{get dir(){return this.level%2?jP:AP}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 LP(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||!LP(r.inner,i.inner))return!1}return!0}var RP=[];function Ine(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=FP(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),RP[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=RP[e];if(i==128)e<s-1&&t==RP[e+1]&&t&24?i=RP[e]=t:RP[e]=256;else if(i==64){let i=e+1;for(;i<s&&RP[i]==64;)i++;let a=e&&t==8||i<n&&RP[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)RP[t]=a;e=i-1}else i==8&&r==1&&(RP[e]=1);t=i,i&7&&(r=i)}}}function Lne(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=NP[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(PP[e+1]==-r){let n=PP[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(RP[t]=RP[PP[e]]=r),s=e;break}}else if(PP.length==189)break;else PP[s++]=t,PP[s++]=n,PP[s++]=c}else if((o=RP[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=PP[t+2];if(n&2)break;if(e)PP[t+2]|=2;else{if(n&4)break;PP[t+2]|=4}}}}}function Rne(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=RP[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(RP[o]==256)o++;else break;let l=a==1,u=l==((o<t?RP[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),RP[--t]=u;c=o}else a=o,c++}}}function zP(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=RP[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(RP[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new IP(c,m.from,f)),BP(e,m.direction==AP==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?RP[p]!=s:RP[p]==s))break;else p++;d?zP(e,c,p,r+1,i,d,o):c<p&&o.push(new IP(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=RP[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(RP[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new IP(m.to,c,f)),BP(e,m.direction==AP==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?RP[p-1]!=s:RP[p-1]==s))break;else p--;d?zP(e,p,c,r+1,i,d,o):p<c&&o.push(new IP(p,c,f)),c=p}}function BP(e,t,n,r,i,a,o){let s=t%2?2:1;Ine(e,i,a,r,s),Lne(e,i,a,r,s),Rne(i,a,r,s),zP(e,i,a,t,n,r,o)}function zne(e,t,n){if(!e)return[new IP(0,0,+(t==jP))];if(t==AP&&!n.length&&!Fne.test(e))return VP(e.length);if(n.length)for(;e.length>RP.length;)RP[RP.length]=256;let r=[],i=t==AP?0:1;return BP(e,i,i,n,0,e.length,r),r}function VP(e){return[new IP(0,e,0)]}var HP=``;function Bne(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=IP.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=Wj(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),HP=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?G.cursor(e.to,1):G.cursor(e.from,-1);if(u.level+ +!i<s.level)return G.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return G.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function Vne(e,t,n){for(let r=t;r<n;r++){let t=FP(e.charCodeAt(r));if(t==1)return AP;if(t==2||t==4)return jP}return AP}var UP=K.define(),WP=K.define(),GP=K.define(),KP=K.define(),qP=K.define(),JP=K.define(),YP=K.define(),XP=K.define(),ZP=K.define(),QP=K.define({combine:e=>e.some(e=>e)}),$P=K.define({combine:e=>e.some(e=>e)}),eF=K.define(),tF=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(G.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},nF=q.define({map:(e,t)=>e.map(t)}),rF=q.define();function iF(e,t,n){let r=e.facet(KP);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 aF=K.define({combine:e=>!e.length||e[0]}),oF=0,sF=K.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})}}),cF=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(sF.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(sF.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(oF++,t,r,i,e=>{let t=[];return o&&t.push(fF.of(t=>{let n=t.plugin(e);return n?o(n):Y.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},lF=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){iF(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(iF(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){iF(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},uF=K.define(),dF=K.define(),fF=K.define(),pF=K.define(),mF=K.define(),hF=K.define(),gF=K.define();function _F(e,t){let n=e.state.facet(gF);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return tN.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 n=r[e].spec.bidiIsolate,i;if(n??=Vne(t.text,o,s),a>0&&c.length&&(i=c[c.length-1]).to==o&&i.direction==n)i.to=s,c=i.inner;else{let e={from:o,to:s,direction:n,inner:[]};c.push(e),c=e.inner}}}}),i}var vF=K.define();function yF(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(vF)){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 bF=K.define(),xF=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}},SF=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Zj.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 xF(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}},CF=[],wF=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 CF}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&&qN(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=fP(this.dom),r=this.length?e>0:t>0;return new OP(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 DF)return e;return null}static get(e){return e.cmTile}},TF=class extends wF{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=EF(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=EF(r);this.length=a}};function EF(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var DF=class extends TF{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=wF.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 OF)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}}},OF=class e extends TF{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}},kF=class e extends TF{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&&jF(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):AF(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 OP(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 OP(e.dom,0);e==n.tile&&(a=!0)}}return new OP(this.dom,0)}};function AF(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=uP(t);return n[n.length-1]||null}function jF(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var MF=class e extends TF{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}},NF=class e extends wF{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?J.chrome||J.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=CP(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return J.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:gP(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}},PF=class e extends wF{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 gP(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 gP(n,!r)}}get overrideDOMText(){if(!this.length)return Fj.empty;let{root:e}=this;if(!e)return Fj.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)}},FF=class extends wF{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 Fj.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:gP(r,t>0==n)}},IF=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}},LF=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},RF=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 NF(a.dom,a.text+e);t.parent=i}else i.append(r||NF.of(e,this.cache.find(NF)?.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)?JF(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 MF&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(JF(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&wF.get(n.dom)&&(e=JF(n.dom));let t=MF.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=wF.get(e.text);i&&this.cache.reused.set(i,2);let a=new NF(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||=GF;let n=kF.start(e,t||this.cache.find(kF)?.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 MF&&a.mark.eq(i))n=a,t--;else{let e=MF.of(i,this.cache.find(MF,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||!UF(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(J.ios&&UF(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(XF,0,32)||new PF(XF.toDOM(),0,XF,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 LF(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 OF&&n.wrapper.eq(t.wrapper))e=n;else{let n=OF.of(t.wrapper,this.cache.find(OF,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(FF,void 0,1);return n&&(n.flags=t),n||new FF(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},zF=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}},BF=[PF,kF,NF,MF,FF,OF,DF];for(let e=0;e<BF.length;e++)BF[e].bucket=e;var VF=class{constructor(e){this.view=e,this.buckets=BF.map(()=>[]),this.index=BF.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 PF(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}},HF=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 VF(e),this.text=new zF(e.state.doc),this.builder=new RF(this.cache,new DF(e,e.contentDOM),tN.iter(n)),this.cache.reused.set(t,2),this.old=new IF(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=qF(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?PF.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 FF)this.cache.add(e);else if(e instanceof MF)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 MF&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof MF&&(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=tN.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof eP){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?YF.block:YF.inline),c=WF(a),l=this.cache.findWidget(i,t-e,c)||PF.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=KF(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=wF.get(r);if(r==this.view.contentDOM)break;e instanceof MF?t.push(e):e?.isLine()?n=e:e instanceof OF||(r.nodeName==`DIV`&&!n?n=new kF(r,GF):n||t.push(MF.of(new QN({tagName:r.nodeName.toLowerCase(),attributes:YN(r)}),r)))}return n?{line:n,marks:t}:null}};function UF(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 WF(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 GF={class:`cm-line`};function KF(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&WN(n,e),r&&(e.class+=` `+r)),e}function qF(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 MF&&t.push(r.mark)}return t}function JF(e){let t=wF.get(e);return t&&t.setDOM(e.cloneNode()),e}var YF=class extends XN{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}};YF.inline=new YF(`span`),YF.block=new YF(`div`);var XF=new class extends XN{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},ZF=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Y.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 DF(e,e.contentDOM),this.updateInner([new xF(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:!cI(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?tI(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new xF(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,(J.ie||J.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=iI(i,this.decorations,e.changes);o.length&&(t=xF.extendWithRanges(t,o));let s=oI(a,this.blockWrappers,e.changes);return s.length&&(t=xF.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 HF(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&wF.get(t.text)&&r.cache.reused.set(wF.get(t.text),2),this.tile=r.run(e,t),QF(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=J.chrome||J.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 lI&&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(rF)&&(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(aF)||n.tabIndex>-1)&&lP(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)),J.gecko&&s.empty&&!this.hasComposition&&$F(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new OP(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!dP(c.node,c.offset,u.anchorNode,u.anchorOffset)||!dP(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{J.android&&J.chrome&&n.contains(u.focusNode)&&sI(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=sP(this.view.root);if(e){if(s.empty){if(J.gecko){let e=nI(c.node,c.offset);if(e&&e!=3){let t=(e==1?EP:DP)(c.node,c.offset);t&&(c=new OP(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 OP(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new OP(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&dP(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=sP(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=hP(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&&!wF.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 lI?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=Wj(e.text,t);if(n==t)return null;let r=CP(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==kP.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 OF)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?uP(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`?kP.RTL:kP.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=uP(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=uP(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(Y.replace({widget:new lI(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return Y.set(e)}updateDeco(){let e=1,t=this.view.state.facet(fF).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(mF).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(tN.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(pF).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(eF))try{if(t(this.view,e.range,e))return!0}catch(e){iF(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=yF(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(One(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==kP.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=yP(e.dom);e.dom.scrollIntoView({block:`nearest`}),bP(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){QF(this.tile)}};function QF(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)QF(n,t)}}function $F(e){return aP(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 eI(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=EP(n.focusNode,n.focusOffset),i=DP(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=wF.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=wF.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 tI(e,t,n){let r=eI(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 xF(c.mapPos(a),c.mapPos(o),a,o),text:i}}function nI(e,t){return aP(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var rI=class{constructor(){this.changes=[]}compareRange(e,t){rP(e,t,this.changes)}comparePoint(e,t){rP(e,t,this.changes)}boundChange(e){rP(e,e,this.changes)}};function iI(e,t,n){let r=new rI;return tN.compare(e,t,n,r),r.changes}var aI=class{constructor(){this.changes=[]}compareRange(e,t){rP(e,t,this.changes)}comparePoint(){}boundChange(e){rP(e,e,this.changes)}};function oI(e,t,n){let r=new aI;return tN.compare(e,t,n,r),r.changes}function sI(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(aP(n)&&n.contentEditable==`false`)return!0;return!1}function cI(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var lI=class extends XN{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 uI(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return G.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=Wj(i.text,a,!1):s=Wj(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=Wj(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=Wj(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return G.undirectionalRange(o+i.from,s+i.from)}function dI(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+gN(o,a,e.state.tabSize)}function fI(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==ZN.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function pI(e,t,n,r){let i=fI(e,t.head,t.assoc||-1),a=!r||i.type!=ZN.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.posAtCoords({x:n==(r==kP.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return G.cursor(o,n?-1:1)}return G.cursor(n?i.to:i.from,n?-1:1)}function mI(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=Bne(i,a,o,s,n),l=HP;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
66
|
-
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?G.cursor(i.from,-1):G.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function hI(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==UM.Space&&(i=t),i==t}}function gI(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return G.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=xI(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return G.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 G.cursor(i.pos,i.assoc,void 0,o)}}function _I(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 vI(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=_I(e,i.from,0);t!=i.from&&(a=G.cursor(t,-1))}else{let t=_I(e,i.from,-1),n=_I(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?G.undirectionalRange(i.from,i.to):G.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?G.create(n,t.mainIndex):t}function yI(e,t,n){let r=_I(e.state.facet(hF).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:G.cursor(r,r<n.from?1:-1)}var bI=class{constructor(e,t){this.pos=e,this.assoc=t}};function xI(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 bI(0,1);if(c>e.viewState.docHeight)return new bI(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==ZN.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==ZN.Text){let t=dI(e,i,l,o,s);return new bI(t,t==l.from?1:-1)}}if(l.type!=ZN.Text)return c<(l.top+l.bottom)/2?new bI(l.from,1):new bI(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 SI(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var SI=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[IP.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[IP.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==kP.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)==kP.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=Wj(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 CP(e.dom,i,a).getClientRects()});return r.after?new bI(n[r.i+1],-1):new bI(n[r.i],1)}scanTile(e,t){if(!e.length)return new bI(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:(aP(n.dom)?n.dom:CP(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 bI(n[r.i+1],-1):new bI(a,1)}},CI=``,wI=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(JM.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=CI}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=wF.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=wF.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:pP(r))||pP(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!EI(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=wF.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 oP(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():aP(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)(oP(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(TI(e,n.node,n.offset)?t:0))}};function TI(e,t,n){for(;;){if(!t||n<hP(t))return!1;if(t==e)return!0;n=fP(t)+1,t=t.parentNode}}function EI(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=wF.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 DI=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},OI=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=kI(e.docView.tile,t,n,0))){let t=i||a?[]:PI(e),n=new wI(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=FI(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!cP(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!cP(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((J.ios||J.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(G.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=G.create([G.cursor(n,r)])}else this.newSel=G.single(r,n)}}};function kI(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 kI(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 AI(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||J.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,CI),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:Fj.of(t.text.slice(a.from-e,u).split(CI))}:(d=NI(l,t.text,s-e,c))&&(J.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:Fj.of(t.text.slice(d.from,d.toB).split(CI))})}else r&&(!e.hasFocus&&i.facet(aF)||II(r,a))&&(r=null);if(!n&&!r)return!1;if((J.mac||J.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=G.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Fj.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)}:J.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
67
|
-
`&&e.lineWrapping&&(r&&=G.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:Fj.of([` `])}),n)return jI(e,n,r,o);if(r&&!II(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=vI(i.facet(hF).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function jI(e,t,n,r=-1){if(J.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(J.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&&wP(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)&&wP(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&wP(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=MI(e,t,n);return e.state.facet(JP).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function MI(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=_I(i.facet(hF).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:G.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&&eI(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?G.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 NI(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 PI(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 DI(n,r)),(i!=n||a!=r)&&t.push(new DI(i,a))),t}function FI(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?G.create([G.cursor(r+t,-1)]):G.single(n+t,r+t)}function II(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var LI=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,J.safari&&e.contentDOM.addEventListener(`input`,()=>null),J.gecko&&bL(e.contentDOM.ownerDocument)}handleEvent(e){ZI(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=BI(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&&UI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),J.android&&J.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(J.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(VI.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||HI.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&J.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&RI(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,wP(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:J.safari&&!J.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 RI(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function zI(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){iF(n.state,e)}}}function BI(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(zI(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(zI(t.value,r))}}for(let e in QI)n(e).handlers.push(QI[e]);for(let e in $I)n(e).observers.push($I[e]);return t}var VI=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],HI=`dthko`,UI=[16,17,18,20,91,92,224,225],WI=6;function GI(e){return Math.max(0,e)*.7+8}function KI(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var qI=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=vP(e.contentDOM),this.atoms=e.state.facet(hF).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(JM.allowMultipleSelections)&&JI(e,t),this.dragging=XI(e,t)&&lL(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&&KI(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=yF(this.view);e.clientX-s.left<=r+WI?t=-GI(r-e.clientX):e.clientX+s.right>=a-WI&&(t=GI(e.clientX-a)),e.clientY-s.top<=i+WI?n=-GI(i-e.clientY):e.clientY+s.bottom>=o-WI&&(n=GI(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=vI(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 JI(e,t){let n=e.state.facet(UP);return n.length?n[0](t):J.mac?t.metaKey:t.ctrlKey}function YI(e,t){let n=e.state.facet(WP);return n.length?n[0](t):J.mac?!t.altKey:!t.ctrlKey}function XI(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=sP(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 ZI(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=wF.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var QI=Object.create(null),$I=Object.create(null),eL=J.ie&&J.ie_version<15||J.ios&&J.webkit_version<604;function tL(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(),rL(e,n.value)},50)}function nL(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function rL(e,t){t=nL(e.state,XP,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(hL!=null&&n.selection.ranges.every(e=>e.empty)&&hL==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:G.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:G.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}$I.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,J.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},$I.wheel=$I.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},QI.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),$I.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`)},$I.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},$I.touchend=(e,t)=>{e.inputState.touchActive=!1},QI.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(GP))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=uL(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new qI(e,t,n,r)),r&&e.observer.ignore(()=>{SP(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 iL(e,t,n,r){if(r==1)return G.cursor(t,n);if(r==2)return uI(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++,G.undirectionalRange(a,o)}}var aL=J.ie&&J.ie_version<=11,oL=null,sL=0,cL=0;function lL(e){if(!aL)return e.detail;let t=oL,n=cL;return oL=e,cL=Date.now(),sL=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(sL+1)%3:1}function uL(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=lL(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=iL(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=iL(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?G.range(i,a,l.assoc):G.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=dL(i,s.pos))?c:o?i.addRange(l):G.create([l])}}}function dL(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 G.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}QI.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=G.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,nL(e.state,ZP,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},QI.dragend=e=>(e.inputState.draggedContent=null,!1);function fL(e,t,n,r){if(n=nL(e.state,XP,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&YI(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}QI.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&&fL(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 fL(e,t,n,!0),!0}return!1},QI.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=eL?null:t.clipboardData;return n?(rL(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(tL(e),!1)};function pL(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 mL(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:nL(e,ZP,t.join(e.lineBreak)),ranges:n,linewise:r}}var hL=null;QI.copy=QI.cut=(e,t)=>{if(!lP(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=mL(e.state);if(!n&&!i)return!1;hL=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=eL?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(pL(e,n),!1)};var gL=jM.define();function _L(e,t){let n=[];for(let r of e.facet(YP)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:gL.of(!0)}):null}function vL(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=_L(e.state,t);n?e.dispatch(n):e.update([])}},10)}$I.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),vL(e)},$I.blur=e=>{e.observer.clearSelectionRange(),vL(e)},$I.compositionstart=$I.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}},$I.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,J.chrome&&J.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},$I.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},QI.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 jI(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(J.chrome&&J.android&&(n=VI.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 J.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),J.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>$I.compositionend(e,t),20),!1};var yL=new Set;function bL(e){yL.has(e)||(yL.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var xL=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],SL=!1;function CL(){SL=!1}var wL=class{constructor(e){this.lineWrapping=e,this.doc=Fj.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 xL.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=xL.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}},TL=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},EL=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`?ZN.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 eP?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)}},DL=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(DL||={}),OL=.001,kL=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)>OL&&(SL=!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,DL.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,DL.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,DL.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=RL.build(n.setDoc(a),e,l,u);i=AL(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new NL(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 FL(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function AL(e,t){return e==t?e:(e.constructor!=t.constructor&&(SL=!0),t)}kL.prototype.size=1;var jL=Y.replace({}),ML=class extends kL{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new EL(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 EL(r,0,n,this.spaceAbove,jL):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,DL.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})`}},NL=class e extends ML{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 EL(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 PL&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof PL?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):kL.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:``})`}},PL=class e extends kL{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 EL(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 EL(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==DL.ByHeight)return this.blockAt(e,n,r,i);if(t==DL.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new EL(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 EL(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 EL(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 kL.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)>=OL&&(s=-2);let c=new NL(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=kL.of(r);return(s<0||Math.abs(c.height-this.height)>=OL||Math.abs(s-this.heightMetrics(t,n).perLine)>=OL)&&(SL=!0),AL(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},FL=class extends kL{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==DL.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==DL.ByPosNoHeight?DL.ByPosNoHeight:DL.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,DL.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&&IL(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),IL(i,e)}return kL.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?kL.of(this.break?[e,null,t]:[e,t]):(this.left=AL(this.left,e),this.right=AL(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 IL(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof PL&&(r=e[t+1])instanceof PL&&e.splice(t-1,3,new PL(n.length+1+r.length))}var LL=5,RL=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 NL?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new NL(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 ML(a,r,n)):(a||i||r>=LL)&&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 NL(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new PL(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 NL)return e;let t=new NL(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 NL)&&!this.isCovered?this.nodes.push(new NL(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 NL&&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 tN.spans(n,r,i,a,0),a.finish(r)}};function zL(e,t,n){let r=new BL;return tN.compare(e,t,n,r,0),r.changes}var BL=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&rP(e,t,this.changes,5)}};function VL(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(aP(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 HL(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 UL(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var WL=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 Y.replace({widget:new GL(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},GL=class extends XN{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}},KL=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=QL,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=kP.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(dF).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new wL(n),this.stateDeco=$L(t),this.heightMap=kL.empty().applyChanges(this.stateDeco,Fj.empty,this.heightOracle.setDoc(t.doc),[new xF(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=Y.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 qL(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?QL:new eR(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(tR(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=$L(this.state);let r=e.changedRanges,i=xF.extendWithRanges(r,zL(n,this.stateDeco,e?e.changes:Zj.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);CL(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||SL)&&(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($P)&&(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`?kP.RTL:kP.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}=_P(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=vP(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=TP(this.scrollParent||e.win);let m=(this.printing?UL:VL)(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&&!HL(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)),CL();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?kL.empty().applyChanges(this.stateDeco,Fj.empty,this.heightOracle,[new xF(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new TL(n.from,i))}SL&&(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 qL(r.lineAt(a-n*1e3,DL.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,DL.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,DL.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 qL(r.lineAt(o-500,DL.ByHeight,i,0,0).from,r.lineAt(o+n+500,DL.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 qL(this.heightMap.lineAt(n,DL.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,DL.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,DL.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,DL.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 WL(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!=kP.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=ZL(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(G.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new WL(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=ZN.Text)return;let i=JL(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=XL(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=YL(i,n),l=YL(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=XL(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=YL(i,f),l=YL(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=XL(r,n)-XL(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){WL.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Y.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=[];tN.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)||tR(this.heightMap.lineAt(e,DL.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)||tR(this.heightMap.lineAt(this.scaler.fromDOM(e),DL.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+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return tR(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}},qL=class{constructor(e,t){this.from=e,this.to=t}};function JL(e,t,n){let r=[],i=e,a=0;return tN.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 YL({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 XL(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 ZL(e,t){for(let n of e)if(t(n))return n}var QL={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function $L(e){let t=e.facet(fF).filter(e=>typeof e!=`function`),n=e.facet(mF).filter(e=>typeof e!=`function`);return n.length&&t.push(tN.join(n)),t}var eR=class e{constructor(e,t,n){let r=0,i=0,a=0;this.viewports=n.map(({from:n,to:i})=>{let a=t.lineAt(n,DL.ByPos,e,0,0).top,o=t.lineAt(i,DL.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}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 tR(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new EL(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>tR(e,t)):e._content)}var nR=K.define({combine:e=>e.join(` `)}),rR=K.define({combine:e=>e.indexOf(!0)>-1}),iR=xN.newName(),aR=xN.newName(),oR=xN.newName(),sR={"&light":`.`+aR,"&dark":`.`+oR};function cR(e,t,n){return new xN(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 lR=cR(`.`+iR,{"&":{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`}},sR),uR={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},dR=J.ie&&J.ie_version<=11,fR=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new kne,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);(J.ie&&J.ie_version<=11||J.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&&J.android&&e.constructor.EDIT_CONTEXT!==!1&&!(J.chrome&&J.chrome_version<126)&&(this.editContext=new gR(e),e.state.facet(aF)&&(e.contentDOM.editContext=this.editContext.editContext)),dR&&(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(!1),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(aF)?n.root.activeElement!=this.dom:!lP(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):(J.ie&&J.ie_version<=11||J.android&&J.chrome)&&!n.state.selection.main.empty&&r.focusNode&&dP(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=sP(e.root);if(!t)return!1;let n=J.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&hR(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=lP(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mne(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(aP(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,uR),dR&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),dR&&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&&wP(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&&lP(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 OI(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=AI(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=pR(t,e.previousSibling||e.target.previousSibling,-1),r=pR(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(aF)!=e.state.facet(aF)&&(e.view.contentDOM.editContext=e.state.facet(aF)?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 pR(e,t,n){for(;t;){let r=wF.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 mR(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 dP(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function hR(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return mR(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?mR(e,n):null}var gR=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=NI(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=G.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));II(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Fj.of(n.text.slice(l.from,l.toB).split(`
|
|
68
|
-
`))};if((J.mac||J.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Fj.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);jI(e,u,G.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(Y.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:rF.of(Y.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=sP(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])}},X=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||jne(e.parent)||document,this.viewState=new KL(this,e.state||JM.create(e)),e.scrollTo&&e.scrollTo.is(nF)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(sF).map(e=>new lF(e));for(let e of this.plugins)e.update(this);this.observer=new fR(this),this.inputState=new LI(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ZF(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 PM?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(gL))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=_L(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(JM.phrases)!=this.state.facet(JM.phrases))return this.setState(a);i=SF.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 tF(t.empty?t:G.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(nF)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=yR.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(bF)!=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(nR)!=i.state.facet(nR)&&(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(qP))try{e(i)}catch(e){iF(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!AI(this,u)&&l.force&&wP(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 KL(this,e),this.plugins=e.facet(sF).map(e=>new lF(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new ZF(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(sF),n=e.state.facet(sF);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new lF(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){iF(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(TP(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 iF(this.state,e),vR}}),u=SF.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]!=vR)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){iF(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)&&!(J.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(qP))e(t)}get themeClasses(){return iR+` `+(this.state.facet(rR)?oR:aR)+` `+this.state.facet(nR)}updateAttrs(){let e=bR(this,uF,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(aF)?`true`:`false`,class:`cm-content`,style:`${J.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),bR(this,dF,t);let n=this.observer.ignore(()=>{let n=JN(this.contentDOM,this.contentAttrs,t),r=JN(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(bF);let t=this.state.facet(e.cspNonce);xN.mount(this.root,this.styleModules.concat(lR).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 yI(this,e,mI(this,e,t,n))}moveByGroup(e,t){return yI(this,e,mI(this,e,t,t=>hI(this,e.head,t)))}visualLineSide(e,t){return t?G.cursor(e.to,1):G.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return pI(this,e,t,n)}moveVertically(e,t,n){return yI(this,e,gI(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=xI(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),xI(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[IP.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==kP.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(QP)||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>_R)return VP(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||LP(r.isolates,n=_F(this,e))))return r.order;n||=_F(this,e);let r=zne(e.text,t,n);return this.bidiCache.push(new yR(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||J.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{SP(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 nF.of(new tF(typeof e==`number`?G.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 nF.of(new tF(G.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 cF.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return cF.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=xN.newName(),r=[nR.of(n),bF.of(cR(`.${n}`,e))];return t&&t.dark&&r.push(rR.of(!0)),r}static baseTheme(e){return gM.lowest(bF.of(cR(`.`+iR,e,sR)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&wF.get(t)||wF.get(e))?.root?.view||null}};X.styleModule=bF,X.inputHandler=JP,X.clipboardInputFilter=XP,X.clipboardOutputFilter=ZP,X.scrollHandler=eF,X.focusChangeEffect=YP,X.perLineTextDirection=QP,X.exceptionSink=KP,X.updateListener=qP,X.editable=aF,X.mouseSelectionStyle=GP,X.dragMovesSelection=WP,X.clickAddsSelectionRange=UP,X.decorations=fF,X.blockWrappers=pF,X.outerDecorations=mF,X.atomicRanges=hF,X.bidiIsolatedRanges=gF,X.cursorScrollMargin=K.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}}}),X.scrollMargins=vF,X.darkTheme=rR,X.cspNonce=K.define({combine:e=>e.length?e[0]:``}),X.contentAttributes=dF,X.editorAttributes=uF,X.lineWrapping=X.contentAttributes.of({class:`cm-lineWrapping`}),X.announce=q.define();var _R=4096,vR={},yR=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:kP.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 bR(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&&WN(a,n)}return n}var xR=J.mac?`mac`:J.windows?`win`:J.linux?`linux`:`key`;function SR(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 CR(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 wR=gM.default(X.domEventHandlers({keydown(e,t){return NR(DR(t.state),e,t,`editor`)}})),TR=K.define({enables:wR}),ER=new WeakMap;function DR(e){let t=e.facet(TR),n=ER.get(t);return n||ER.set(t,n=jR(t.reduce((e,t)=>e.concat(t),[]))),n}function OR(e,t,n){return NR(DR(e.state),t,e,n)}var kR=null,AR=4e3;function jR(e,t=xR){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=>SR(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=kR={view:t,prefix:n,scope:e};return setTimeout(()=>{kR==r&&(kR=null)},AR),!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,MR))}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 MR=null;function NR(e,t,n,r){MR=t;let i=AN(t),a=qj(Gj(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;kR&&kR.view==n&&kR.scope==r&&(o=kR.prefix+` `,UI.indexOf(t.keyCode)<0&&(c=!0,kR=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+CR(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(J.windows&&t.ctrlKey&&t.altKey)&&!(J.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=wN[t.keyCode])&&p!=i?(d(f[o+CR(p,t,!0)])||t.shiftKey&&(m=TN[t.keyCode])!=i&&m!=p&&d(f[o+CR(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+CR(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),MR=null,s}var PR=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=FR(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return LR(t,n,r)}};function FR(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==kP.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function IR(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 LR(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==kP.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=FR(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=fI(e,r,1),m=fI(e,i,-1),h=p.type==ZN.Text?p:null,g=m.type==ZN.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=IR(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=IR(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==ZN.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new PR(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==kP.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 RR(e,t){return e.constructor==t.constructor&&e.eq(t)}var zR=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(BR)!=e.state.facet(BR)&&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(BR);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)=>!RR(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,J.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},BR=K.define();function VR(e){return[cF.define(t=>new zR(t,e)),BR.of(e)]}var HR=!J.ios,UR=K.define({combine(e){return YM(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function WR(e={}){return[UR.of(e),KR,JR,XR,$P.of(!0)]}function GR(e){return e.startState.facet(UR)!=e.state.facet(UR)}var KR=VR({above:!0,markers(e){let{state:t}=e,n=t.facet(UR),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&J.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:G.cursor(i.head,i.assoc);for(let i of PR.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=GR(e);return n&&qR(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){qR(t.state,e)},class:`cm-cursorLayer`});function qR(e,t){t.style.animationDuration=e.facet(UR).cursorBlinkRate+`ms`}var JR=VR({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(HR||i!=n))for(let n of PR.forRange(e,`cm-selectionBackground`,i))t.push(n);if(J.ios&&!n.empty&&e.state.facet(UR).iosSelectionHandles){for(let r of PR.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,G.cursor(n.from,1)))t.push(r);for(let r of PR.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,G.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||GR(e)},class:`cm-selectionLayer`}),YR=J.gecko&&J.gecko_version==153?`#ffffff01`:`transparent`,XR=gM.highest(X.theme({".cm-line":{...HR?{"& ::selection, &::selection":{backgroundColor:`${YR} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...HR?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}})),ZR=q.define({map(e,t){return e==null?null:t.mapPos(e)}}),QR=pM.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(ZR)?t.value:e,e)}}),$R=cF.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(QR);n==null?this.cursor!=null&&((t=this.cursor)==null||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(`div`)),this.cursor.className=`cm-dropCursor`),(e.startState.field(QR)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(QR),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+`px`,this.cursor.style.top=e.top/n+`px`,this.cursor.style.height=e.height/n+`px`):this.cursor.style.left=`-100000px`}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(QR)!=e&&this.view.dispatch({effects:ZR.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function ez(){return[QR,$R]}function tz(e,t,n,r,i){t.lastIndex=0;for(let a=e.iterRange(n,r),o=n,s;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;s=t.exec(a.value);)i(o+s.index,s)}function nz(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:a}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),a=Math.min(e.state.doc.lineAt(a).to,a+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=a:r.push({from:i,to:a});return r}var rz=class{constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:a=1e3}=e;if(!t.global)throw RangeError(`The regular expression given to MatchDecorator should have its 'g' flag set`);if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if(typeof n==`function`)this.addMatch=(e,t,r,i)=>{let a=n(e,t,r);a&&i(r,r+e[0].length,a)};else if(n)this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n);else throw RangeError(`Either 'decorate' or 'decoration' should be provided to MatchDecorator`);this.boundary=i,this.maxLength=a}createDeco(e){let t=new iN,n=t.add.bind(t);for(let{from:t,to:r}of nz(e,this.maxLength))tz(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,a,o)=>{o>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),r=Math.max(o,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let a=Math.max(i.from,n),o=Math.min(i.to,r);if(o>=a){let n=e.state.doc.lineAt(a),r=n.to<o?e.state.doc.lineAt(o):n,s=Math.max(i.from,n.from),c=Math.min(i.to,r.to);if(this.boundary){for(;a>n.from;a--)if(this.boundary.test(n.text[a-1-n.from])){s=a;break}for(;o<r.to;o++)if(this.boundary.test(r.text[o-r.from])){c=o;break}}let l=[],u,d=(e,t,n)=>l.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=s-n.from;(u=this.regexp.exec(n.text))&&u.index<c-n.from;)this.addMatch(u,e,u.index+n.from,d);else tz(e.state.doc,this.regexp,s,c,(t,n)=>this.addMatch(n,e,t,d));t=t.update({filterFrom:s,filterTo:c,filter:(e,t)=>e<s||t>c,add:l})}}return t}},iz=/x/.unicode==null?`g`:`gu`,az=RegExp(`[\0-\b
|
|
69
|
-
--\u2028\u2029-]`,iz),oz={0:`null`,7:`bell`,8:`backspace`,10:`newline`,11:`vertical tab`,13:`carriage return`,27:`escape`,8203:`zero width space`,8204:`zero width non-joiner`,8205:`zero width joiner`,8206:`left-to-right mark`,8207:`right-to-left mark`,8232:`line separator`,8237:`left-to-right override`,8238:`right-to-left override`,8294:`left-to-right isolate`,8295:`right-to-left isolate`,8297:`pop directional isolate`,8233:`paragraph separator`,65279:`zero width no-break space`,65532:`object replacement`},sz=null;function cz(){if(sz==null&&typeof document<`u`&&document.body){let e=document.body.style;sz=(e.tabSize??e.MozTabSize)!=null}return sz||!1}var lz=K.define({combine(e){let t=YM(e,{render:null,specialChars:az,addSpecialChars:null});return(t.replaceTabs=!cz())&&(t.specialChars=RegExp(` |`+t.specialChars.source,iz)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+`|`+t.addSpecialChars.source,iz)),t}});function uz(e={}){return[lz.of(e),fz()]}var dz=null;function fz(){return dz||=cF.fromClass(class{constructor(e){this.view=e,this.decorations=Y.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(lz)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new rz({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,a=Gj(t[0],0);if(a==9){let e=i.lineAt(r),t=n.state.tabSize,a=hN(e.text,t,r-e.from);return Y.replace({widget:new gz((t-a%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=Y.replace({widget:new hz(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(lz);e.startState.facet(lz)==t?this.decorations=this.decorator.updateDeco(e,this.decorations):(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view))}},{decorations:e=>e.decorations})}var pz=`•`;function mz(e){return e>=32?pz:e==10?``:String.fromCharCode(9216+e)}var hz=class extends XN{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=mz(this.code),n=e.state.phrase(`Control character`)+` `+(oz[this.code]||`0x`+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement(`span`);return i.textContent=t,i.title=n,i.setAttribute(`aria-label`,n),i.className=`cm-specialChar`,i}ignoreEvent(){return!1}},gz=class extends XN{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement(`span`);return e.textContent=` `,e.className=`cm-tab`,e.style.width=this.width+`px`,e}ignoreEvent(){return!1}};function _z(){return yz}var vz=Y.line({class:`cm-activeLine`}),yz=cF.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(vz.range(i.from)),t=i.from)}return Y.set(n)}},{decorations:e=>e.decorations}),bz=class extends XN{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?uP(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=gP(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 xz(e){let t=cF.fromClass(class{constructor(t){this.view=t,this.placeholder=e?Y.set([Y.widget({widget:new bz(e),side:1}).range(0)]):Y.none}get decorations(){return this.view.state.doc.length?Y.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,X.contentAttributes.of({"aria-placeholder":e})]:t}var Sz=2e3;function Cz(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),a=[];if(t.off>Sz||n.off>Sz||t.col<0||n.col<0){let o=Math.min(t.off,n.off),s=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=s&&a.push(G.range(n.from+o,n.to+s))}}else{let o=Math.min(t.col,n.col),s=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=gN(n.text,o,e.tabSize,!0);if(r<0)a.push(G.cursor(n.to));else{let t=gN(n.text,s,e.tabSize);a.push(G.range(n.from+r,n.from+t))}}}return a}function wz(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Tz(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,a=i>Sz?-1:i==r.length?wz(e,t.clientX):hN(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:a,off:i}}function Ez(e,t){let n=Tz(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,a){let o=Tz(e,t);if(!o)return r;let s=Cz(e.state,n,o);return s.length?a?G.create(s.concat(r.ranges)):G.create(s):r}}:null}function Dz(e){let t=e?.eventFilter||(e=>e.altKey&&e.button==0);return X.mouseSelectionStyle.of((e,n)=>t(n)?Ez(e,n):null)}var Oz={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},kz={style:`cursor: crosshair`};function Az(e={}){let[t,n]=Oz[e.key||`Alt`],r=cF.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){(e.keyCode==t||!n(e))&&this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,X.contentAttributes.of(e=>e.plugin(r)?.isDown?kz:null)]}var jz=`-10000px`,Mz=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 Nz(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 Pz(e){let{left:t,right:n}=Nz(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Fz=K.define({combine:e=>({position:J.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||Pz})}),Iz=new WeakMap,Lz=cF.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(Fz);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 Mz(e,Vz,(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(Fz);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=jz,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(J.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=Nz(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=yF(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(Fz).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=jz;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Iz.get(c)??d.bottom-d.top,g=c.offset||Bz,_=this.view.textDirection==kP.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=jz;continue}Iz.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`,Rz(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,Rz(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=jz}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Rz(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var zz=X.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`}}}),Bz={x:0,y:0},Vz=K.define({enables:[Lz,zz]}),Hz=K.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),Uz=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement(`div`),this.dom.classList.add(`cm-tooltip-hover`),this.manager=new Mz(e,Hz,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add(`cm-tooltip-section`),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)==null||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp(`offset`)}get getCoords(){return this.passProp(`getCoords`)}get overlap(){return this.passProp(`overlap`)}get resize(){return this.passProp(`resize`)}},Wz=Vz.compute([Hz],e=>{let t=e.facet(Hz);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:Uz.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Gz=K.define(),Kz=class{constructor(e,t,n,r,i,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener(`mouseleave`,this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener(`mousemove`,this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),o=a&&a.dir==kP.RTL?-1:1;i=t.x<n.left?-o:o}this.activateHover(e,r,i)}activateHover(e,t,n,r){let i=this.source(e,t,n),a=t=>{if(t&&(!Array.isArray(t)||t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&`then`in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,a(e))},t=>iF(e.state,t,`hover tooltip`))}else a(i)}get tooltip(){let e=this.view.plugin(Lz),t=e?e.manager.tooltips.findIndex(e=>e.create==Uz.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:n}=this;if(t.length&&!this.locked.has(t)&&n&&!Jz(n.dom,e)||this.pending){let{pos:n}=t[0]||this.pending,r=t[0]?.end??n;(n==r?this.view.posAtCoords(this.lastMove)!=n:!Yz(this.view,n,r,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener(`mouseleave`,t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener(`mouseleave`,t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener(`mouseleave`,this.mouseleave),this.view.dom.removeEventListener(`mousemove`,this.mousemove)}},qz=4;function Jz(e,t){let{left:n,right:r,top:i,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(`.cm-tooltip-arrow`)){let e=o.getBoundingClientRect();i=Math.min(e.top,i),a=Math.max(e.bottom,a)}return t.clientX>=n-qz&&t.clientX<=r+qz&&t.clientY>=i-qz&&t.clientY<=a+qz}function Yz(e,t,n,r,i,a){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let c=e.posAtCoords({x:r,y:i},!1);return c>=t&&c<=n}function Xz(e,t={}){let n=q.define(),r=new WeakMap,i=pM.define({create(){return[]},update(e,a){let o=r.get(e);if(e.length&&(t.hideOnChange&&(a.docChanged||a.selection)||o&&o(a)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(a,e)))),a.docChanged&&e.length){let t=[];for(let n of e){let e=a.changes.mapPos(n.pos,-1,Yj.TrackDel);if(e!=null){let r=Object.assign(Object.create(null),n);r.pos=e,r.end!=null&&(r.end=a.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of a.effects)t.is(n)&&(e=t.value,o=void 0),(t.is($z)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&r.set(e,o),e},provide:e=>Hz.from(e)}),a=cF.define(a=>new Kz(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,a,Gz.of(a),Wz]}}function Zz(e,t,n,r={}){let i=e.state.facet(Gz).map(t=>e.plugin(t)).filter(e=>!!e);if(r.tooltip&&r.tooltip.active){let e=i.find(e=>e.field==r.tooltip.active);e&&(i=[e])}for(let a of i)a.activateHover(e,t,n,r.until??(()=>!1))}function Qz(e,t){let n=e.plugin(Lz);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var $z=q.define(),eB=K.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function tB(e,t){let n=e.plugin(nB),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var nB=cF.fromClass(class{constructor(e){this.input=e.state.facet(aB),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(eB);this.top=new rB(e,!0,t.topContainer),this.bottom=new rB(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(eB);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new rB(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new rB(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(aB);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=>X.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),rB=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=iB(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=iB(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 iB(e){let t=e.nextSibling;return e.remove(),t}var aB=K.define({enables:nB});function oB(e,t){let n,r=new Promise(e=>n=e),i=e=>dB(e,t,n);e.state.field(cB,!1)?e.dispatch({effects:lB.of(i)}):e.dispatch({effects:q.appendConfig.of(cB.init(()=>[i]))});let a=uB.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(cB).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function sB(e,t){let n=e.state.field(cB,!1)||[];for(let r of n){let n=tB(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var cB=pM.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(lB)?e=[n.value].concat(e):n.is(uB)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>aB.computeN([e],t=>t.field(e))}),lB=q.define(),uB=q.define();function dB(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=jN(`form`),t.input){let e=jN(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(jN(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(jN(`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(),o(null)):e.keyCode==13&&(e.preventDefault(),o(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),o(t)})}let a=jN(`div`,r,jN(`button`,{onclick:()=>o(null),"aria-label":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);function o(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{if(t.focus){let e;e=typeof t.focus==`string`?r.querySelector(t.focus):r.querySelector(`input`)||r.querySelector(`button`),e&&`select`in e?e.select():e&&`focus`in e&&e.focus()}}}}var fB=class extends XM{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};fB.prototype.elementClass=``,fB.prototype.toDOM=void 0,fB.prototype.mapMode=Yj.TrackBefore,fB.prototype.startSide=fB.prototype.endSide=-1,fB.prototype.point=!0;var pB=K.define(),mB=K.define(),hB={class:``,renderEmptyElements:!1,elementStyle:``,markers:()=>tN.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:`before`},gB=K.define();function _B(e){return[yB(),gB.of({...hB,...e})]}var vB=K.define({combine:e=>e.some(e=>e)});function yB(e){let t=[bB];return e&&e.fixed===!1&&t.push(vB.of(!0)),t}var bB=cF.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(gB).map(t=>new wB(e,t)),this.fixed=!e.state.facet(vB);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(vB)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=tN.iter(this.view.state.facet(pB),this.view.viewport.from),r=[],i=this.gutters.map(e=>new CB(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==ZN.Text&&t){SB(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==ZN.Text){SB(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(gB),n=e.state.facet(gB),r=e.docChanged||e.heightChanged||e.viewportChanged||!tN.eq(e.startState.facet(pB),e.state.facet(pB),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new wB(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>X.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==kP.LTR?{left:r,right:i}:{right:r,left:i}})});function xB(e){return Array.isArray(e)?e:[e]}function SB(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var CB=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=tN.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new TB(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];SB(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;(r.length!=0||a.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(mB)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},wB=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement(`div`),this.dom.className=`cm-gutter`+(this.config.class?` `+this.config.class:``);for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=xB(t.markers(e)),t.initialSpacer&&(this.spacer=new TB(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=`visibility: hidden; pointer-events: none`)}update(e){let t=this.markers;if(this.markers=xB(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!tN.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},TB=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),EB(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function EB(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var DB=K.define(),OB=K.define(),kB=K.define({combine(e){return YM(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),AB=class extends fB{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function jB(e,t){return e.state.facet(kB).formatNumber(t,e.state)}var MB=gB.compute([kB],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(DB)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new AB(jB(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(OB)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(kB)!=e.state.facet(kB),initialSpacer(e){return new AB(jB(e,PB(e.state.doc.lines)))},updateSpacer(e,t){let n=jB(t.view,PB(t.view.state.doc.lines));return n==e.number?e:new AB(n)},domEventHandlers:e.facet(kB).domEventHandlers,side:`before`}));function NB(e={}){return[kB.of(e),yB(),MB]}function PB(e){let t=9;for(;t<e;)t=t*10+9;return t}var FB=new class extends fB{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},IB=pB.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(FB.range(i)))}return tN.of(t)});function LB(){return IB}var RB=new Pk;function zB(e){return K.define({combine:e?t=>t.concat(e):void 0})}var BB=new Pk,VB=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,JM.prototype.hasOwnProperty(`tree`)||Object.defineProperty(JM.prototype,"tree",{get(){return WB(this)}}),this.parser=t,this.extension=[QB.of(this),JM.languageData.of((e,t,n)=>{let r=HB(e,t,n),i=r.type.prop(RB);if(!i)return[];let a=e.facet(i),o=r.type.prop(BB);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 HB(e,t,n).type.prop(RB)==this.data}findRegions(e){let t=e.facet(QB);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(RB)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Pk.mounted);if(i){if(i.tree.prop(RB)==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 Hk&&r(i,e.positions[n]+t)}};return r(WB(e),0),n}get allowsNesting(){return!0}};VB.setState=q.define();function HB(e,t,n){let r=e.facet(QB),i=WB(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Vk.ExcludeBuffers|Vk.EnterBracketed))e.type.isTop&&(i=e);return i}var UB=class e extends VB{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=zB(t.languageData);return new e(n,t.parser.configure({props:[RB.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 WB(e){let t=e.field(VB.state,!1);return t?t.tree:Hk.empty}var GB=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)}},KB=null,qB=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,[],Hk.empty,0,r,[],null)}startParse(){return this.parser.startParse(new GB(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Hk.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(lA.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(lA.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=KB;KB=this;try{return e()}finally{KB=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=JB(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=lA.applyChanges(r,e),i=Hk.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=JB(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 uA{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=KB;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 Hk(Lk.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 KB}};function JB(e,t,n){return lA.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var YB=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=qB.create(t.facet(QB).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};VB.state=pM.define({create:YB.init,update(e,t){for(let e of t.effects)if(e.is(VB.setState))return e.value;return t.startState.facet(QB)==t.state.facet(QB)?e.apply(t):YB.init(t.state)}});var XB=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(XB=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var ZB=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,Hne=cF.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(VB.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(VB.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=XB(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(VB.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!ZB?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>ZB&&ZB()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:VB.setState.of(new YB(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=>iF(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),QB=K.define({combine(e){return e.length?e[0]:null},enables:e=>[VB.state,Hne,X.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),$B=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Une=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},Wne=K.define(),eV=K.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 tV(e){let t=e.facet(eV);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function nV(e,t){let n=``,r=e.tabSize,i=e.facet(eV)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function rV(e,t){e instanceof JM&&(e=new iV(e));for(let n of e.state.facet(Wne)){let r=n(e,t);if(r!==void 0)return r}let n=WB(e.state);return n.length>=t?Gne(e,n,t):null}var iV=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=tV(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 hN(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}},aV=new Pk;function Gne(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 oV(r,e,n)}function oV(e,t,n){for(let r=e;r;r=r.next){let e=qne(r.node);if(e)return e(Yne.create(t,n,r))}return 0}function Kne(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function qne(e){let t=e.type.prop(aV);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Pk.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>cV(e,!0,1,void 0,n&&!Kne(e)?t.from:void 0)}return e.parent==null?Jne:null}function Jne(){return 0}var Yne=class e extends iV{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(Xne(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return oV(this.context.next,this.base,this.pos)}};function Xne(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Zne(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 sV({closing:e,align:t=!0,units:n=1}){return r=>cV(r,t,n,e)}function cV(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?Zne(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Qne=e=>e.baseIndent;function lV({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var $ne=200;function ere(){return JM.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+$ne)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=rV(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=nV(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 uV=K.define(),dV=new Pk;function fV(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function tre(e,t,n){let r=WB(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(dV);if(s&&(i.to<r.length-50||r.length==e.doc.length||!nre(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function nre(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function pV(e,t,n){for(let r of e.facet(uV)){let i=r(e,t,n);if(i)return i}return tre(e,t,n)}function mV(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var hV=q.define({map:mV}),gV=q.define({map:mV});function _V(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var vV=pM.define({create(){return Y.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=yV(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(hV)&&!rre(e,r.value.from,r.value.to)?n.push(r.value):r.is(gV)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(CV),i=n.map(e=>(r?Y.replace({widget:new cre(r(t.state,e))}):EV).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=yV(e,t.selection.main.head)),e},provide:e=>X.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(EV.range(r,i))}return Y.set(t,!0)}});function yV(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function bV(e,t,n){var r;let i=null;return(r=e.field(vV,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function rre(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function xV(e,t){return e.field(vV,!1)?t:t.concat(q.appendConfig.of(wV()))}var ire=e=>{for(let t of _V(e)){let n=pV(e.state,t.from,t.to);if(n)return e.dispatch({effects:xV(e.state,[hV.of(n),SV(e,n)])}),!0}return!1},are=e=>{if(!e.state.field(vV,!1))return!1;let t=[];for(let n of _V(e)){let r=bV(e.state,n.from,n.to);r&&t.push(gV.of(r),SV(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function SV(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return X.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var ore=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:ire},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:are},{key:`Ctrl-Alt-[`,run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=pV(t,i.from,i.to);a&&n.push(hV.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:xV(e.state,n)}),!!n.length}},{key:`Ctrl-Alt-]`,run:e=>{let t=e.state.field(vV,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(gV.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],sre={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},CV=K.define({combine(e){return YM(e,sre)}});function wV(e){let t=[vV,dre];return e&&t.push(CV.of(e)),t}function TV(e,t){let{state:n}=e,r=n.facet(CV),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=bV(e.state,n.from,n.to);r&&e.dispatch({effects:gV.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var EV=Y.replace({widget:new class extends XN{toDOM(e){return TV(e,null)}}}),cre=class extends XN{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return TV(e,this.value)}},lre={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},DV=class extends fB{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement(`span`);return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?`Fold line`:`Unfold line`),t}};function ure(e={}){let t={...lre,...e},n=new DV(t,!0),r=new DV(t,!1),i=cF.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(QB)!=e.state.facet(QB)||e.startState.field(vV,!1)!=e.state.field(vV,!1)||WB(e.startState)!=WB(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new iN;for(let i of e.viewportLineBlocks){let a=bV(e.state,i.from,i.to)?r:pV(e.state,i.from,i.to)?n:null;a&&t.add(i.from,i.from,a)}return t.finish()}}),{domEventHandlers:a}=t;return[i,_B({class:`cm-foldGutter`,markers(e){return e.plugin(i)?.markers||tN.empty},initialSpacer(){return new DV(t,!1)},domEventHandlers:{...a,click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let r=bV(e.state,t.from,t.to);if(r)return e.dispatch({effects:gV.of(r)}),!0;let i=pV(e.state,t.from,t.to);return i?(e.dispatch({effects:hV.of(i)}),!0):!1}}}),wV()]}var dre=X.baseTheme({".cm-foldPlaceholder":{backgroundColor:`#eee`,border:`1px solid #ddd`,color:`#888`,borderRadius:`.2em`,margin:`0 1px`,padding:`0 1px`,cursor:`pointer`},".cm-foldGutter span":{padding:`0 1px`,cursor:`pointer`}}),OV=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=xN.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 VB?e=>e.prop(RB)==a.data:a?e=>e==a:void 0,this.style=ej(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new xN(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},kV=K.define(),AV=K.define({combine(e){return e.length?[e[0]]:null}});function jV(e){let t=e.facet(kV);return t.length?t:e.facet(AV)}function MV(e,t){let n=[pre],r;return e instanceof OV&&(e.module&&n.push(X.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(AV.of(e)):r?n.push(kV.computeN([X.darkTheme],t=>t.facet(X.darkTheme)==(r==`dark`)?[e]:[])):n.push(kV.of(e)),n}var fre=class{constructor(e){this.markCache=Object.create(null),this.tree=WB(e.state),this.decorations=this.buildDeco(e,jV(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=WB(e.state),n=jV(e.state),r=n!=jV(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 Y.none;let n=new iN;for(let{from:r,to:i}of e.visibleRanges)nj(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=Y.mark({class:r})))},r,i);return n.finish()}},pre=gM.high(cF.fromClass(fre,{decorations:e=>e.decorations})),mre=OV.define([{tag:W.meta,color:`#404740`},{tag:W.link,textDecoration:`underline`},{tag:W.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:W.emphasis,fontStyle:`italic`},{tag:W.strong,fontWeight:`bold`},{tag:W.strikethrough,textDecoration:`line-through`},{tag:W.keyword,color:`#708`},{tag:[W.atom,W.bool,W.url,W.contentSeparator,W.labelName],color:`#219`},{tag:[W.literal,W.inserted],color:`#164`},{tag:[W.string,W.deleted],color:`#a11`},{tag:[W.regexp,W.escape,W.special(W.string)],color:`#e40`},{tag:W.definition(W.variableName),color:`#00f`},{tag:W.local(W.variableName),color:`#30a`},{tag:[W.typeName,W.namespace],color:`#085`},{tag:W.className,color:`#167`},{tag:[W.special(W.variableName),W.macroName],color:`#256`},{tag:W.definition(W.propertyName),color:`#00c`},{tag:W.comment,color:`#940`},{tag:W.invalid,color:`#f00`}]),hre=X.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),NV=1e4,PV=`()[]{}`,FV=K.define({combine(e){return YM(e,{afterCursor:!0,brackets:PV,maxScanDistance:NV,renderMatch:vre})}}),gre=Y.mark({class:`cm-matchingBracket`}),_re=Y.mark({class:`cm-nonmatchingBracket`});function vre(e){let t=[],n=e.matched?gre:_re;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 IV(e){let t=[],n=e.facet(FV);for(let r of e.selection.ranges){if(!r.empty)continue;let i=BV(e,r.head,-1,n)||r.head>0&&BV(e,r.head-1,1,n)||n.afterCursor&&(BV(e,r.head,1,n)||r.head<e.doc.length&&BV(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return Y.set(t,!0)}var yre=[cF.fromClass(class{constructor(e){this.paused=!1,this.decorations=IV(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=IV(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),hre];function bre(e={}){return[FV.of(e),yre]}var LV=new Pk;function RV(e,t,n){let r=e.prop(t<0?Pk.openedBy:Pk.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 zV(e){let t=e.type.prop(LV);return t?t(e.node):e}function BV(e,t,n,r={}){let i=r.maxScanDistance||NV,a=r.brackets||PV,o=WB(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=RV(r.type,n,a);if(i&&r.from<r.to){let o=zV(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return xre(e,t,n,r,o,i,a)}}return Sre(e,t,n,o,s.type,i,a)}function xre(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=zV(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(RV(u.type,n,o))l++;else if(RV(u.type,-n,o)){if(l==0){let e=zV(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 Sre(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 Cre=Object.create(null),VV=[Lk.none],HV=[],UV=Object.create(null),wre=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`]])wre[e]=Tre(Cre,t);function WV(e,t){HV.indexOf(e)>-1||(HV.push(e),console.warn(t))}function Tre(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||W[n];r?typeof r==`function`?t.length?t=t.map(r):WV(n,`Modifier ${n} used at start of tag`):t.length?WV(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:WV(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=UV[i];if(a)return a.id;let o=UV[i]=Lk.define({id:VV.length,name:r,props:[ZA({[r]:n})]});return VV.push(o),o.id}kP.RTL,kP.LTR;var GV=UB.define({name:`json`,parser:Sj.configure({props:[aV.add({Object:lV({except:/^\s*\}/}),Array:lV({except:/^\s*\]/})}),dV.add({"Object Array":fV})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function KV(){return new $B(GV)}function qV(){return qV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qV.apply(null,arguments)}function Ere(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Dre=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=YV(e.state,n.from);return r.line?Ore(e):r.block?Are(e):!1};function JV(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 Ore=JV(Nre,0),kre=JV(ZV,0),Are=JV((e,t)=>ZV(e,t,Mre(t)),0);function YV(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var XV=50;function jre(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-XV,r),o=e.sliceDoc(i,i+XV),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+XV),d=e.sliceDoc(i-XV,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 Mre(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 ZV(e,t,n=t.selection.ranges){let r=n.map(e=>YV(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>jre(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 Nre(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=YV(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 QV=jM.define(),Pre=jM.define(),Fre=K.define(),$V=K.define({combine(e){return YM(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)})}}),eH=pM.define({create(){return uH.empty},update(e,t){let n=t.state.facet($V),r=t.annotation(QV);if(r){let i=iH.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?aH(o,o.length,n.minDepth,i):cH(o,t.startState.selection),new uH(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Pre);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(PM.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=iH.fromTransaction(t),o=t.annotation(PM.time),s=t.annotation(PM.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 uH(e.done.map(iH.fromJSON),e.undone.map(iH.fromJSON))}});function Ire(e={}){return[eH,$V.of(e),X.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?nH:e.inputType==`historyRedo`?rH:null;return n?(e.preventDefault(),n(t)):!1}})]}function tH(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(eH,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var nH=tH(0,!1),rH=tH(1,!1),Lre=tH(0,!0),Rre=tH(1,!0),iH=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&&Zj.fromJSON(t.changes),[],t.mapped&&Xj.fromJSON(t.mapped),t.startSelection&&G.fromJSON(t.startSelection),t.selectionsAfter.map(G.fromJSON))}static fromTransaction(t,n){let r=sH;for(let e of t.startState.facet(Fre)){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,sH)}static selection(t){return new e(void 0,sH,void 0,void 0,t)}};function aH(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 zre(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 Bre(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function oH(e,t){return e.length?t.length?e.concat(t):e:t}var sH=[],Vre=200;function cH(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Vre));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),aH(e,e.length-1,1e9,n.setSelAfter(r)))}return[iH.selection([t])]}function Hre(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 lH(e,t){if(!e.length)return e;let n=e.length,r=sH;for(;n;){let i=Ure(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?[iH.selection(r)]:sH}function Ure(e,t,n){let r=oH(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):sH,n);if(!e.changes)return iH.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new iH(i,q.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Wre=/^(input\.type|delete)($|\.)/,uH=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||Wre.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,zre(s.changes,t.changes))||r==`input.type.compose`)?aH(o,o.length-1,i.minDepth,new iH(t.changes.compose(s.changes),oH(q.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,sH)):aH(o,o.length,i.minDepth,t),new e(o,sH,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:sH;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Bre(a[a.length-1],t)?this:new e(cH(this.done,t),this.undone,n,r)}addMapping(t){return new e(lH(this.done,t),lH(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:QV.of({side:e,rest:Hre(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?sH:r.slice(0,r.length-1);return i.mapped&&(n=lH(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:QV.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};uH.empty=new uH(sH,sH);var Gre=[{key:`Mod-z`,run:nH,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:rH,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:rH,preventDefault:!0},{key:`Mod-u`,run:Lre,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Rre,preventDefault:!0}];function dH(e,t){return G.create(e.ranges.map(t),e.mainIndex)}function fH(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function pH({state:e,dispatch:t},n){let r=dH(e.selection,n);return!r.eq(e.selection,!0)&&(t(fH(e,r)),!0)}function mH(e,t){return G.cursor(t?e.to:e.from)}function hH(e,t){return pH(e,n=>n.empty?e.moveByChar(n,t):mH(n,t))}function gH(e){return e.textDirectionAt(e.state.selection.main.head)==kP.LTR}var _H=e=>hH(e,!gH(e)),vH=e=>hH(e,gH(e));function yH(e,t){return pH(e,n=>n.empty?e.moveByGroup(n,t):mH(n,t))}var Kre=e=>yH(e,!gH(e)),qre=e=>yH(e,gH(e));typeof Intl<`u`&&Intl.Segmenter;function Jre(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 bH(e,t,n){let r=WB(e).resolveInner(t.head),i=n?Pk.closedBy:Pk.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Jre(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?BV(e,r.from,1):BV(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,G.cursor(s,n?-1:1)}var Yre=e=>pH(e,t=>bH(e.state,t,!gH(e))),Xre=e=>pH(e,t=>bH(e.state,t,gH(e)));function xH(e,t){return pH(e,n=>{if(!n.empty)return mH(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var SH=e=>xH(e,!1),CH=e=>xH(e,!0);function wH(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(X.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 TH(e,t){let n=wH(e),{state:r}=e,i=dH(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):mH(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=X.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(fH(r,i),{effects:a}),!0}var EH=e=>TH(e,!1),DH=e=>TH(e,!0);function OH(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=G.cursor(r.from+n))}return i}var kH=e=>pH(e,t=>OH(e,t,!0)),AH=e=>pH(e,t=>OH(e,t,!1)),jH=e=>pH(e,t=>OH(e,t,!gH(e))),MH=e=>pH(e,t=>OH(e,t,gH(e))),NH=e=>pH(e,t=>e.moveToLineBoundary(t,!1,!1)),PH=e=>pH(e,t=>e.moveToLineBoundary(t,!0,!1));function FH(e,t,n){let r=!1,i=dH(e.selection,t=>{let i=BV(e,t.head,-1)||BV(e,t.head,1)||t.head>0&&BV(e,t.head-1,1)||t.head<e.doc.length&&BV(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?G.range(t.anchor,a):G.cursor(a)});return r?(t(fH(e,i)),!0):!1}var IH=({state:e,dispatch:t})=>FH(e,t,!1);function LH(e,t,n){let r=dH(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=G.range(e.head,e.anchor));let r=n(e);return G.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(fH(e.state,r)),!0)}function RH(e,t){return LH(e,t,n=>e.moveByChar(n,t))}var zH=e=>RH(e,!gH(e)),BH=e=>RH(e,gH(e));function VH(e,t){return LH(e,t,n=>e.moveByGroup(n,t))}var HH=e=>VH(e,!gH(e)),UH=e=>VH(e,gH(e)),WH=e=>{let t=!gH(e);return LH(e,t,n=>bH(e.state,n,t))},GH=e=>{let t=gH(e);return LH(e,t,n=>bH(e.state,n,t))};function KH(e,t){return LH(e,t,n=>e.moveVertically(n,t))}var qH=e=>KH(e,!1),JH=e=>KH(e,!0);function YH(e,t){return LH(e,t,n=>e.moveVertically(n,t,wH(e).height))}var XH=e=>YH(e,!1),ZH=e=>YH(e,!0),QH=e=>LH(e,!0,t=>OH(e,t,!0)),$H=e=>LH(e,!1,t=>OH(e,t,!1)),eU=e=>{let t=!gH(e);return LH(e,t,n=>OH(e,n,t))},tU=e=>{let t=gH(e);return LH(e,t,n=>OH(e,n,t))},nU=e=>LH(e,!1,t=>G.cursor(e.lineBlockAt(t.head).from)),rU=e=>LH(e,!0,t=>G.cursor(e.lineBlockAt(t.head).to)),iU=({state:e,dispatch:t})=>(t(fH(e,{anchor:0})),!0),aU=({state:e,dispatch:t})=>(t(fH(e,{anchor:e.doc.length})),!0),oU=({state:e,dispatch:t})=>(t(fH(e,{anchor:e.selection.main.anchor,head:0})),!0),sU=({state:e,dispatch:t})=>(t(fH(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),cU=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),lU=({state:e,dispatch:t})=>{let n=OU(e).map(({from:t,to:n})=>G.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:G.create(n),userEvent:`select`})),!0},uU=({state:e,dispatch:t})=>{let n=dH(e.selection,t=>{let n=WB(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 G.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(fH(e,n)),!0)};function dU(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(fH(n,G.create(i,i.length-1))),!0)}var fU=e=>dU(e,!1),pU=e=>dU(e,!0),mU=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=G.create([n.main]):n.main.empty||(r=G.create([G.cursor(n.main.head)])),r?(t(fH(e,r)),!0):!1};function hU(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=gU(e,o,!1)):o>i&&(n=`delete.forward`,o=gU(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=gU(e,i,!1),a=gU(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:G.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?X.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function gU(e,t,n){if(e instanceof X)for(let r of e.state.facet(X.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var _U=(e,t,n)=>hU(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=hN(s,a.tabSize)%tV(a)||tV(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Wj(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=Wj(o.text,c-o.from,!1,!1)+o.from);return c}),vU=e=>_U(e,!1,!0),yU=e=>_U(e,!0,!1),bU=(e,t)=>hU(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=Wj(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}),xU=e=>bU(e,!1),SU=e=>bU(e,!0),CU=e=>hU(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),wU=e=>hU(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),TU=e=>hU(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),EU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Fj.of([``,``])},range:G.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},DU=({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:Wj(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Wj(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:G.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function OU(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 kU(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of OU(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(G.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(G.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:G.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var AU=({state:e,dispatch:t})=>kU(e,t,!1),jU=({state:e,dispatch:t})=>kU(e,t,!0);function MU(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of OU(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 NU=({state:e,dispatch:t})=>MU(e,t,!1),PU=({state:e,dispatch:t})=>MU(e,t,!0),FU=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(OU(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=dH(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 IU(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=WB(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(Pk.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 LU=zU(!1),RU=zU(!0);function zU(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&&IU(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new iV(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=rV(s,r);for(c??=hN(/^\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=[``,nV(t,c)];return o&&l.push(nV(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Fj.of(l)},range:G.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function BU(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:G.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var VU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new iV(e,{overrideIndentation:e=>n[e]??-1}),i=BU(e,(t,i,a)=>{let o=rV(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=nV(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},HU=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(BU(e,(t,n)=>{n.push({from:t.from,insert:e.facet(eV)})}),{userEvent:`input.indent`})),!0),UU=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(BU(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=hN(r,e.tabSize),a=0,o=nV(e,Math.max(0,i-tV(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),WU=e=>(e.setTabFocusMode(),!0),GU=[{key:`Ctrl-b`,run:_H,shift:zH,preventDefault:!0},{key:`Ctrl-f`,run:vH,shift:BH},{key:`Ctrl-p`,run:SH,shift:qH},{key:`Ctrl-n`,run:CH,shift:JH},{key:`Ctrl-a`,run:NH,shift:nU},{key:`Ctrl-e`,run:PH,shift:rU},{key:`Ctrl-d`,run:yU},{key:`Ctrl-h`,run:vU},{key:`Ctrl-k`,run:CU},{key:`Ctrl-Alt-h`,run:xU},{key:`Ctrl-o`,run:EU},{key:`Ctrl-t`,run:DU},{key:`Ctrl-v`,run:DH}],KU=[{key:`ArrowLeft`,run:_H,shift:zH,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Kre,shift:HH,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:jH,shift:eU,preventDefault:!0},{key:`ArrowRight`,run:vH,shift:BH,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qre,shift:UH,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:MH,shift:tU,preventDefault:!0},{key:`ArrowUp`,run:SH,shift:qH,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:iU,shift:oU},{mac:`Ctrl-ArrowUp`,run:EH,shift:XH},{key:`ArrowDown`,run:CH,shift:JH,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:aU,shift:sU},{mac:`Ctrl-ArrowDown`,run:DH,shift:ZH},{key:`PageUp`,run:EH,shift:XH},{key:`PageDown`,run:DH,shift:ZH},{key:`Home`,run:AH,shift:$H,preventDefault:!0},{key:`Mod-Home`,run:iU,shift:oU},{key:`End`,run:kH,shift:QH,preventDefault:!0},{key:`Mod-End`,run:aU,shift:sU},{key:`Enter`,run:LU,shift:LU},{key:`Mod-a`,run:cU},{key:`Backspace`,run:vU,shift:vU,preventDefault:!0},{key:`Delete`,run:yU,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:xU,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:SU,preventDefault:!0},{mac:`Mod-Backspace`,run:wU,preventDefault:!0},{mac:`Mod-Delete`,run:TU,preventDefault:!0}].concat(GU.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),qU=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Yre,shift:WH},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Xre,shift:GH},{key:`Alt-ArrowUp`,run:AU},{key:`Shift-Alt-ArrowUp`,run:NU},{key:`Alt-ArrowDown`,run:jU},{key:`Shift-Alt-ArrowDown`,run:PU},{key:`Mod-Alt-ArrowUp`,run:fU},{key:`Mod-Alt-ArrowDown`,run:pU},{key:`Escape`,run:mU},{key:`Mod-Enter`,run:RU},{key:`Alt-l`,mac:`Ctrl-l`,run:lU},{key:`Mod-i`,run:uU,preventDefault:!0},{key:`Mod-[`,run:UU},{key:`Mod-]`,run:HU},{key:`Mod-Alt-\\`,run:VU},{key:`Shift-Mod-k`,run:FU},{key:`Shift-Mod-\\`,run:IH},{key:`Mod-/`,run:Dre},{key:`Alt-A`,mac:`Ctrl-A`,run:kre},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:WU}].concat(KU),JU={key:`Tab`,run:HU,shift:UU},YU=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,XU=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(YU(e)):YU,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 Gj(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=Kj(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=qj(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`&&(XU.prototype[Symbol.iterator]=function(){return this});var ZU={from:-1,to:-1,match:/.*/.exec(``),precise:!0},QU=`gm`+(/x/.unicode==null?``:`u`),$U=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=ZU,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new nW(e,t,n,r,i);this.re=new RegExp(t,QU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=iW(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=iW(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}}},eW=new WeakMap,tW=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=eW.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return eW.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)),eW.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},nW=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=ZU,this.matchPos=iW(e,r),this.re=new RegExp(t,QU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=tW.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=iW(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=tW.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&($U.prototype[Symbol.iterator]=nW.prototype[Symbol.iterator]=function(){return this});function rW(e){try{return new RegExp(e,QU),!0}catch{return!1}}function iW(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 aW=e=>{let t=sB(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}=oB(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=G.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,X.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},oW={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},sW=K.define({combine(e){return YM(e,oW,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function cW(e){let t=[mW,pW];return e&&t.push(sW.of(e)),t}var lW=Y.mark({class:`cm-selectionMatch`}),uW=Y.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function dW(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=UM.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=UM.Word)}function fW(e,t,n,r){return e(t.sliceDoc(n,n+1))==UM.Word&&e(t.sliceDoc(r-1,r))==UM.Word}var pW=cF.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(sW),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Y.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return Y.none;let e=n.wordAt(i.head);if(!e)return Y.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 Y.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(dW(o,n,i.from,i.to)&&fW(o,n,i.from,i.to)))return Y.none}else if(a=n.sliceDoc(i.from,i.to),!a)return Y.none}let s=[];for(let r of e.visibleRanges){let e=new XU(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||dW(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(uW.range(r,a)):(r>=i.to||a<=i.from)&&s.push(lW.range(r,a)),s.length>t.maxMatches))return Y.none}}return Y.set(s)}},{decorations:e=>e.decorations}),mW=X.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),hW=({state:e,dispatch:t})=>{let{selection:n}=e,r=G.create(n.ranges.map(t=>e.wordAt(t.head)||G.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function gW(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 XU(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new XU(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 _W=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return hW({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=gW(e,r);return i?(t(e.update({selection:e.selection.addRange(G.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},vW=K.define({combine(e){return YM(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new QW(e),scrollToMatch:e=>X.scrollIntoView(e)})}}),yW=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||rW(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`?`
|
|
70
|
-
`: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 AW(this):new wW(this)}getCursor(e,t=0,n){let r=e.doc?e:JM.create({doc:e});return n??=r.doc.length,this.regexp?EW(this,r,t,n):SW(this,r,t,n)}},bW=class{constructor(e){this.spec=e}};function xW(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 SW(e,t,n,r){let i;return e.wholeWord&&(i=CW(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=xW(e.test,t,i)),new XU(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function CW(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(DW(i,n-a))!=UM.Word||t(OW(i,n-a))!=UM.Word)&&(t(OW(i,r-a))!=UM.Word||t(DW(i,r-a))!=UM.Word))}var wW=class extends bW{constructor(e){super(e)}nextMatch(e,t,n){let r=SW(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=SW(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=SW(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=SW(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=SW(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 TW(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function EW(e,t,n,r){let i;return e.wholeWord&&(i=kW(t.charCategorizer(t.selection.main.head))),e.test&&(i=TW(e.test,t,i)),new $U(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function DW(e,t){return e.slice(Wj(e,t,!1),t)}function OW(e,t){return e.slice(t,Wj(e,t))}function kW(e){return(t,n,r)=>!r[0].length||(e(DW(r.input,r.index))!=UM.Word||e(OW(r.input,r.index))!=UM.Word)&&(e(OW(r.input,r.index+r[0].length))!=UM.Word||e(DW(r.input,r.index+r[0].length))!=UM.Word)}var AW=class extends bW{nextMatch(e,t,n){let r=EW(this.spec,e,n,e.doc.length).next();return r.done&&(r=EW(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=EW(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=EW(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=EW(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)}},jW=q.define(),MW=q.define(),NW=pM.define({create(e){return new PW(KW(e).create(),null)},update(e,t){for(let n of t.effects)n.is(jW)?e=new PW(n.value.create(),e.panel):n.is(MW)&&(e=new PW(e.query,n.value?GW:null));return e},provide:e=>aB.from(e,e=>e.panel)}),PW=class{constructor(e,t){this.query=e,this.panel=t}},FW=Y.mark({class:`cm-searchMatch`}),IW=Y.mark({class:`cm-searchMatch cm-searchMatch-selected`}),LW=cF.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(NW))}update(e){let t=e.state.field(NW);(t!=e.startState.field(NW)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Y.none;let{view:n}=this,r=new iN;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?IW:FW)})}return r.finish()}},{decorations:e=>e.decorations});function RW(e){return t=>{let n=t.state.field(NW,!1);return n&&n.query.spec.valid?e(t,n):YW(t)}}var zW=RW((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=G.single(r.from,r.to),a=e.state.facet(vW);return e.dispatch({selection:i,effects:[nG(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),JW(e),!0}),BW=RW((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=G.single(i.from,i.to),o=e.state.facet(vW);return e.dispatch({selection:a,effects:[nG(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),JW(e),!0}),VW=RW((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:G.create(n.map(e=>G.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),HW=({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 XU(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(G.range(t.value.from,t.value.to))}return t(e.update({selection:G.create(a,o),userEvent:`select.search.matches`})),!0},UW=RW((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(X.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=G.single(o.from,o.to).map(d),u.push(nG(e,o)),u.push(n.facet(vW).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),WW=RW((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:X.announce.of(r),userEvent:`input.replace.all`}),!0});function GW(e){return e.state.facet(vW).createPanel(e)}function KW(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(vW);return new yW({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 qW(e){let t=tB(e,GW);return t&&t.dom.querySelector(`[main-field]`)}function JW(e){let t=qW(e);t&&t==e.root.activeElement&&t.select()}var YW=e=>{let t=e.state.field(NW,!1);if(t&&t.panel){let n=qW(e);if(n&&n!=e.root.activeElement){let r=KW(e.state,t.query.spec);r.valid&&e.dispatch({effects:jW.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[MW.of(!0),t?jW.of(KW(e.state,t.query.spec)):q.appendConfig.of(iG)]});return!0},XW=e=>{let t=e.state.field(NW,!1);if(!t||!t.panel)return!1;let n=tB(e,GW);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:MW.of(!1)}),!0},ZW=[{key:`Mod-f`,run:YW,scope:`editor search-panel`},{key:`F3`,run:zW,shift:BW,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:zW,shift:BW,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:XW,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:HW},{key:`Mod-Alt-g`,run:aW},{key:`Mod-d`,run:_W,preventDefault:!0}],QW=class{constructor(e){this.view=e;let t=this.query=e.state.field(NW).query.spec;this.commit=this.commit.bind(this),this.searchField=jN(`input`,{value:t.search,placeholder:$W(e,`Find`),"aria-label":$W(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=jN(`input`,{value:t.replace,placeholder:$W(e,`Replace`),"aria-label":$W(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=jN(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=jN(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=jN(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return jN(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=jN(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>zW(e),[$W(e,`next`)]),n(`prev`,()=>BW(e),[$W(e,`previous`)]),n(`select`,()=>VW(e),[$W(e,`all`)]),jN(`label`,null,[this.caseField,$W(e,`match case`)]),jN(`label`,null,[this.reField,$W(e,`regexp`)]),jN(`label`,null,[this.wordField,$W(e,`by word`)]),...e.state.readOnly?[]:[jN(`br`),this.replaceField,n(`replace`,()=>UW(e),[$W(e,`replace`)]),n(`replaceAll`,()=>WW(e),[$W(e,`replace all`)])],jN(`button`,{name:`close`,onclick:()=>XW(e),"aria-label":$W(e,`close`),type:`button`},[`×`])])}commit(){let e=new yW({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:jW.of(e)}))}keydown(e){OR(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?BW:zW)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),UW(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(jW)&&!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(vW).top}};function $W(e,t){return e.state.phrase(t)}var eG=30,tG=/[\s\.,:;?!]/;function nG(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-eG),o=Math.min(i,n+eG),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<eG;e++)if(!tG.test(s[e+1])&&tG.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-eG;e--)if(!tG.test(s[e-1])&&tG.test(s[e])){s=s.slice(0,e);break}}return X.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var rG=X.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`}}),iG=[NW,gM.low(LW),rG],aG=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=WB(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(fG(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 oG(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 sG(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=oG(t)+oG(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function cG(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:sG(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function lG(e,t){return n=>{for(let t=WB(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 uG=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function dG(e){return e.selection.main.from}function fG(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 pG=jM.define();function mG(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:G.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var hG=new WeakMap;function gG(e){if(!Array.isArray(e))return e;let t=hG.get(e);return t||hG.set(e,t=cG(e)),t}var _G=q.define(),vG=q.define(),yG=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=Gj(e,t),r=qj(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(Gj(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=Gj(e,0),i=qj(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=Gj(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=qj(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=Gj(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=Kj(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+=qj(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?qj(Gj(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)}},bG=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)}},xG=K.define({combine(e){return YM(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:CG,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=>SG(e(n),t(n)),optionClass:(e,t)=>n=>SG(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function SG(e,t){return e?t?e+` `+t:e:t}function CG(e,t,n,r,i,a){let o=e.textDirection==kP.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 wG=q.define();function TG(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 EG(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 DG=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(xG);this.optionContent=TG(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=EG(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:wG.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(xG).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:vG.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=EG(r.length,i,e.state.facet(xG).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=EG(t.options.length,t.selected,this.view.state.facet(xG).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=>iF(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&&kG(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(xG).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 OG(e,t){return n=>new DG(n,e,t)}function kG(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 AG(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function jG(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(xG);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 uG(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new bG(n):new yG(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 uG(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):AG(e.completion)>AG(c)&&(s[s.length-1]=e),c=e.completion}return s}var MG=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,LG(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=jG(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(xG).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,LG(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:KG,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)}},NG=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(RG,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(xG),i=(r.override||n.languageDataAt(`autocomplete`,dG(n)).map(gG)).map(e=>(this.active.find(t=>t.source==e)||new BG(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(UG));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!PG(i,this.active)||o?a=MG.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 BG(e.source,0):e));for(let e of t.effects)e.is(wG)&&(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?FG:IG}};function PG(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 FG={"aria-autocomplete":`list`},IG={};function LG(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var RG=[];function zG(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(pG);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 BG=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=zG(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(_G))i=new e(i.source,1,n.value);else if(n.is(vG))i=new e(i.source,0);else if(n.is(UG))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(dG(e.state))}},VG=class e extends BG{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=dG(t.state);if(o>a||!r||n&2&&(dG(t.startState)==this.from||o<this.limit))return new BG(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return HG(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 aG(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??dG(t.state)):new BG(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 BG(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function HG(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):fG(e,!0).test(i)}var UG=q.define({map(e,t){return e.map(e=>e.map(t))}}),WG=pM.define({create(){return NG.start()},update(e,t){return e.update(t)},provide:e=>[Vz.from(e,e=>e.tooltip),X.contentAttributes.from(e,e=>e.attrs)]});function GG(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(WG).active.find(e=>e.source==t.source);return r instanceof VG&&(typeof n==`string`?e.dispatch({...mG(e.state,n,r.from,r.to),annotations:pG.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var KG=OG(WG,GG);function qG(e,t=`option`){return n=>{let r=n.state.field(WG,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(xG).interactionDelay)return!1;let i=1,a;t==`page`&&(a=Qz(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:wG.of(s)}),!0}}var JG=e=>{let t=e.state.field(WG,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(xG).interactionDelay?!1:GG(e,t.open.options[t.open.selected])},YG=e=>e.state.field(WG,!1)?(e.dispatch({effects:_G.of(!0)}),!0):!1,XG=e=>{let t=e.state.field(WG,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:vG.of(null)}),!0)},ZG=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},QG=50,$G=1e3,eK=cF.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(WG).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(WG),n=e.state.facet(xG);if(!e.selectionSet&&!e.docChanged&&e.startState.field(WG)==t)return;let r=e.transactions.some(e=>{let t=zG(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>QG&&Date.now()-n.time>$G){for(let e of n.context.abortListeners)try{e()}catch(e){iF(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(_G)))&&(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(WG);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(xG).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new aG(t,dG(t),e.explicit,this.view),r=new ZG(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:vG.of(null)}),iF(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(xG).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(xG),n=this.view.state.field(WG);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=dG(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new VG(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 BG(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:UG.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(WG,!1);if(t&&t.tooltip&&this.view.state.facet(xG).closeOnBlur){let n=t.open&&Qz(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:vG.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:_G.of(!1)}),20),this.composing=0}}}),tK=typeof navigator==`object`&&/Win/.test(navigator.platform),nK=gM.highest(X.domEventHandlers({keydown(e,t){let n=t.state.field(WG,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(tK&&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&&GG(t,r),!1}})),rK=X.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`}}}),iK=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},aK=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Yj.TrackDel),r=t.mapPos(this.to,1,Yj.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},oK=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(eV);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new aK(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new iK(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},sK=Y.widget({widget:new class extends XN{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),cK=Y.mark({class:`cm-snippetField`}),lK=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=Y.set(e.map(e=>(e.from==e.to?sK:cK).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},uK=q.define({map(e,t){return e&&e.map(t)}}),dK=q.define(),fK=pM.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(uK))return n.value;if(n.is(dK)&&e)return new lK(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>X.decorations.from(e,e=>e?e.deco:Y.none)});function pK(e,t){return G.create(e.filter(e=>e.field==t).map(e=>G.range(e.from,e.to)))}function mK(e){let t=oK.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:Fj.of(a)},scrollIntoView:!0,annotations:n?[pG.of(n),PM.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=pK(o,0)),o.some(e=>e.field>0)){let t=new lK(o,0),n=c.effects=[uK.of(t)];e.state.field(fK,!1)===void 0&&n.push(q.appendConfig.of([fK,vK,bK,rK]))}e.dispatch(e.state.update(c))}}function hK(e){return({state:t,dispatch:n})=>{let r=t.field(fK,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:pK(r.ranges,i),effects:uK.of(a?null:new lK(r.ranges,i)),scrollIntoView:!0})),!0}}var gK=[{key:`Tab`,run:hK(1),shift:hK(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(fK,!1)?(t(e.update({effects:uK.of(null)})),!0):!1}],_K=K.define({combine(e){return e.length?e[0]:gK}}),vK=gM.highest(TR.compute([_K],e=>e.facet(_K)));function yK(e,t){return{...t,apply:mK(e)}}var bK=X.domEventHandlers({mousedown(e,t){let n=t.state.field(fK,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:pK(n.ranges,i.field),effects:uK.of(n.ranges.some(e=>e.field>i.field)?new lK(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),xK={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},SK=q.define({map(e,t){return t.mapPos(e,-1,Yj.TrackAfter)??void 0}}),CK=new class extends XM{};CK.startSide=1,CK.endSide=-1;var wK=pM.define({create(){return tN.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(SK)&&(e=e.update({add:[CK.range(n.value,n.value+1)]}));return e}});function TK(){return[AK,wK]}var EK=`()[]{}<>«»»«[]{}`;function DK(e){for(let t=0;t<16;t+=2)if(EK.charCodeAt(t)==e)return EK.charAt(t+1);return Kj(e<128?e:e+1)}function OK(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||xK}var kK=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),AK=X.inputHandler.of((e,t,n,r)=>{if((kK?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&qj(Gj(r,0))==1||t!=i.from||n!=i.to)return!1;let a=MK(e.state,r);return a?(e.dispatch(a),!0):!1}),jK=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=OK(e,e.selection.main.head).brackets||xK.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=FK(e.doc,t.head);for(let i of n)if(i==r&&PK(e.doc,t.head)==DK(Gj(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:G.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function MK(e,t){let n=OK(e,e.selection.main.head),r=n.brackets||xK.brackets;for(let i of r){let a=DK(Gj(i,0));if(t==i)return a==i?RK(e,i,r.indexOf(i+i+i)>-1,n):IK(e,i,a,n.before||xK.before);if(t==a&&NK(e,e.selection.main.from))return LK(e,i,a)}return null}function NK(e,t){let n=!1;return e.field(wK).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function PK(e,t){let n=e.sliceString(t,t+2);return n.slice(0,qj(Gj(n,0)))}function FK(e,t){let n=e.sliceString(t-2,t);return qj(Gj(n,0))==n.length?n:n.slice(1)}function IK(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:SK.of(a.to+t.length),range:G.range(a.anchor+t.length,a.head+t.length)};let o=PK(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:SK.of(a.head+t.length),range:G.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function LK(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&PK(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:G.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function RK(e,t,n,r){let i=r.stringPrefixes||xK.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:SK.of(r.to+t.length),range:G.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=PK(e.doc,o),c;if(s==t){if(zK(e,o))return{changes:{insert:t+t,from:o},effects:SK.of(o+t.length),range:G.cursor(o+t.length)};if(NK(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:G.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=VK(e,o-2*t.length,i))>-1&&zK(e,c))return{changes:{insert:t+t+t+t,from:o},effects:SK.of(o+t.length),range:G.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=UM.Word&&VK(e,o,i)>-1&&!BK(e,o,t,i))return{changes:{insert:t+t,from:o},effects:SK.of(o+t.length),range:G.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function zK(e,t){let n=WB(e).resolveInner(t+1);return n.parent&&n.from==t}function BK(e,t,n,r){let i=WB(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 VK(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=UM.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))!=UM.Word)return n}return-1}function HK(e={}){return[nK,WG,xG.of(e),eK,WK,rK]}var UK=[{key:`Ctrl-Space`,run:YG},{mac:"Alt-`",run:YG},{mac:`Alt-i`,run:YG},{key:`Escape`,run:XG},{key:`ArrowDown`,run:qG(!0)},{key:`ArrowUp`,run:qG(!1)},{key:`PageDown`,run:qG(!0,`page`)},{key:`PageUp`,run:qG(!1,`page`)},{key:`Enter`,run:JG}],WK=gM.highest(TR.computeN([xG],e=>e.facet(xG).defaultKeymap?[UK]:[])),GK=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},KK=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(oq).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new iN,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=_q(s);if(i)o.add(n,n,Y.widget({widget:new uq(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,Y.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,qK(f))}};function qK(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new GK(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new GK(r.from,n,r.diagnostic)}}),r}function JK(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(oq).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(XK))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function YK(e,t){return e.field($K,!1)?t:t.concat(q.appendConfig.of(yq))}var XK=q.define(),ZK=q.define(),QK=q.define(),$K=pM.define({create(){return new KK(Y.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=qK(n,e.selected.diagnostic,i)||qK(n,null,i)}!n.size&&i&&t.state.facet(oq).autoPanel&&(i=null),e=new KK(n,i,r)}for(let n of t.effects)if(n.is(XK)){let r=t.state.facet(oq).autoPanel?n.value.length?fq.open:null:e.panel;e=KK.init(n.value,r,t.state)}else n.is(ZK)?e=new KK(e.diagnostics,n.value?fq.open:null,e.selected):n.is(QK)&&(e=new KK(e.diagnostics,e.panel,n.value));return e},provide:e=>[aB.from(e,e=>e.panel),X.decorations.from(e,e=>e.diagnostics)]}),eq=Y.mark({class:`cm-lintRange cm-lintRange-active`});function tq(e,t,n){let{diagnostics:r}=e.state.field($K),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(oq).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:nq(e,i)}}}:null}function nq(e,t){return jN(`ul`,{class:`cm-tooltip-lint`},t.map(t=>lq(e,t,!1)))}var rq=e=>{let t=e.state.field($K,!1);(!t||!t.panel)&&e.dispatch({effects:YK(e.state,[ZK.of(!0)])});let n=tB(e,fq.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},iq=e=>{let t=e.state.field($K,!1);return!t||!t.panel?!1:(e.dispatch({effects:ZK.of(!1)}),!0)},aq=[{key:`Mod-Shift-m`,run:rq,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field($K,!1);if(!t)return!1;let n=e.state.selection.main,r=qK(t.diagnostics,null,n.to+1);return!r&&(r=qK(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Zz(e,r.from,1,{tooltip:vq,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],oq=K.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...YM(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:sq,tooltipFilter:sq,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function sq(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function cq(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function lq(e,t,n){let r=n?cq(t.actions):[];return jN(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},jN(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=qK(e.state.field($K).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),jN(`u`,s.slice(c,c+1)),s.slice(c+1)];return jN(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&jN(`div`,{class:`cm-diagnosticSource`},t.source))}var uq=class extends XN{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return jN(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},dq=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=lq(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},fq=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)iq(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=cq(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=qK(this.view.state.field($K).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=jN(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=jN(`div`,{class:`cm-panel-lint`},this.list,jN(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>iq(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field($K).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field($K),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new dq(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new dq(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=qK(this.view.state.field($K).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:QK.of(t)})}static open(t){return new e(t)}};function pq(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function mq(e){return pq(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var hq=X.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:mq(`#f11`)},".cm-lintRange-warning":{backgroundImage:mq(`orange`)},".cm-lintRange-info":{backgroundImage:mq(`#999`)},".cm-lintRange-hint":{backgroundImage:mq(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function gq(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function _q(e){let t=`hint`,n=1;for(let r of e){let e=gq(r.severity);e>n&&(n=e,t=r.severity)}return t}var vq=Xz(tq,{hideOn:JK}),yq=[$K,X.decorations.compute([$K],e=>{let{selected:t,panel:n}=e.field($K);return!t||!n||t.from==t.to?Y.none:Y.set([eq.range(t.from,t.to)])}),vq,hq],bq=function(e){e===void 0&&(e={});var t=e.crosshairCursor,n=t!==void 0&&t,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(jK)),e.defaultKeymap!==!1&&(r=r.concat(qU)),e.searchKeymap!==!1&&(r=r.concat(ZW)),e.historyKeymap!==!1&&(r=r.concat(Gre)),e.foldKeymap!==!1&&(r=r.concat(ore)),e.completionKeymap!==!1&&(r=r.concat(UK)),e.lintKeymap!==!1&&(r=r.concat(aq));var i=[];return e.lineNumbers!==!1&&i.push(NB()),e.highlightActiveLineGutter!==!1&&i.push(LB()),e.highlightSpecialChars!==!1&&i.push(uz()),e.history!==!1&&i.push(Ire()),e.foldGutter!==!1&&i.push(ure()),e.drawSelection!==!1&&i.push(WR()),e.dropCursor!==!1&&i.push(ez()),e.allowMultipleSelections!==!1&&i.push(JM.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(ere()),e.syntaxHighlighting!==!1&&i.push(MV(mre,{fallback:!0})),e.bracketMatching!==!1&&i.push(bre()),e.closeBrackets!==!1&&i.push(TK()),e.autocompletion!==!1&&i.push(HK()),e.rectangularSelection!==!1&&i.push(Dz()),n!==!1&&i.push(Az()),e.highlightActiveLine!==!1&&i.push(_z()),e.highlightSelectionMatches!==!1&&i.push(cW()),e.tabSize&&typeof e.tabSize==`number`&&i.push(eV.of(` `.repeat(e.tabSize))),i.concat([TR.of(r.flat())]).filter(Boolean)},xq=`#e5c07b`,Sq=`#e06c75`,Cq=`#56b6c2`,wq=`#ffffff`,Tq=`#abb2bf`,Eq=`#7d8799`,Dq=`#61afef`,Oq=`#98c379`,kq=`#d19a66`,Aq=`#c678dd`,jq=`#21252b`,Mq=`#2c313a`,Nq=`#282c34`,Pq=`#353a42`,Fq=`#3E4451`,Iq=`#528bff`,Lq=[X.theme({"&":{color:Tq,backgroundColor:Nq},".cm-content":{caretColor:Iq},".cm-cursor, .cm-dropCursor":{borderLeftColor:Iq},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Fq},".cm-panels":{backgroundColor:jq,color:Tq},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:Nq,color:Eq,border:`none`},".cm-activeLineGutter":{backgroundColor:Mq},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:Pq},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Pq,borderBottomColor:Pq},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Mq,color:Tq}}},{dark:!0}),MV(OV.define([{tag:W.keyword,color:Aq},{tag:[W.name,W.deleted,W.character,W.propertyName,W.macroName],color:Sq},{tag:[W.function(W.variableName),W.labelName],color:Dq},{tag:[W.color,W.constant(W.name),W.standard(W.name)],color:kq},{tag:[W.definition(W.name),W.separator],color:Tq},{tag:[W.typeName,W.className,W.number,W.changed,W.annotation,W.modifier,W.self,W.namespace],color:xq},{tag:[W.operator,W.operatorKeyword,W.url,W.escape,W.regexp,W.link,W.special(W.string)],color:Cq},{tag:[W.meta,W.comment],color:Eq},{tag:W.strong,fontWeight:`bold`},{tag:W.emphasis,fontStyle:`italic`},{tag:W.strikethrough,textDecoration:`line-through`},{tag:W.link,color:Eq,textDecoration:`underline`},{tag:W.heading,fontWeight:`bold`,color:Sq},{tag:[W.atom,W.bool,W.special(W.variableName)],color:kq},{tag:[W.processingInstruction,W.string,W.inserted],color:Oq},{tag:W.invalid,color:wq}]))],Rq=X.theme({"&":{backgroundColor:`#fff`}},{dark:!1}),zq=function(e){e===void 0&&(e={});var t=e,n=t.indentWithTab,r=n===void 0||n,i=t.editable,a=i===void 0||i,o=t.readOnly,s=o!==void 0&&o,c=t.theme,l=c===void 0?`light`:c,u=t.placeholder,d=u===void 0?``:u,f=t.basicSetup,p=f===void 0||f,m=[];switch(r&&m.unshift(TR.of([JU])),p&&(typeof p==`boolean`?m.unshift(bq()):m.unshift(bq(p))),d&&m.unshift(xz(d)),l){case`light`:m.push(Rq);break;case`dark`:m.push(Lq);break;case`none`:break;default:m.push(l)}return a===!1&&m.push(X.editable.of(!1)),s&&m.push(JM.readOnly.of(!0)),[...m]},Bq=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),Vq=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},Hq=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},Uq=null,Wq=()=>typeof window>`u`?new Hq:(Uq||=new Hq,Uq),Gq=X.theme({"& .cm-scroller":{height:`100% !important`}}),Kq=null,qq=null;function Jq(e,t,n,r,i,a){if(!e&&!t&&!n&&!r&&!i&&!a)return null;var o=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a});return o===Kq||(Kq=o,qq=X.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a}})),qq}var Yq=jM.define(),Xq=200,Zq=[];function Qq(e){var t=e.value,n=e.selection,r=e.onChange,i=e.onStatistics,a=e.onCreateEditor,o=e.onUpdate,s=e.extensions,c=s===void 0?Zq:s,l=e.autoFocus,u=e.theme,d=u===void 0?`light`:u,f=e.height,p=f===void 0?null:f,m=e.minHeight,h=m===void 0?null:m,g=e.maxHeight,_=g===void 0?null:g,v=e.width,y=v===void 0?null:v,b=e.minWidth,x=b===void 0?null:b,S=e.maxWidth,C=S===void 0?null:S,w=e.placeholder,T=w===void 0?``:w,E=e.editable,D=E===void 0||E,O=e.readOnly,k=O!==void 0&&O,A=e.indentWithTab,j=A===void 0||A,M=e.basicSetup,N=M===void 0||M,P=e.root,ee=e.initialState,F=(0,B.useState)(),I=F[0],te=F[1],ne=(0,B.useState)(),re=ne[0],ie=ne[1],ae=(0,B.useState)(),oe=ae[0],se=ae[1],ce=(0,B.useState)(()=>({current:null}))[0],le=(0,B.useState)(()=>({current:null}))[0],ue=Jq(p,h,_,y,x,C),de=X.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(Yq))&&(ce.current?ce.current.reset():(ce.current=new Vq(()=>{if(le.current){var e=le.current;le.current=null,e()}ce.current=null},Xq),Wq().add(ce.current)),r(e.state.doc.toString(),e)),i&&i(Bq(e))}),fe=zq({theme:d,editable:D,readOnly:k,placeholder:T,indentWithTab:j,basicSetup:N}),pe=[de,...ue?[ue]:[],Gq,...fe];return o&&typeof o==`function`&&pe.push(X.updateListener.of(o)),pe=pe.concat(c),(0,B.useLayoutEffect)(()=>{if(I&&!oe){var e={doc:t,selection:n,extensions:pe},r=ee?JM.fromJSON(ee.json,e,ee.fields):JM.create(e);if(se(r),!re){var i=new X({state:r,parent:I,root:P});ie(i),a&&a(i,r)}}return()=>{re&&(se(void 0),ie(void 0))}},[I,oe]),(0,B.useEffect)(()=>{e.container&&te(e.container)},[e.container]),(0,B.useEffect)(()=>()=>{re&&(re.destroy(),ie(void 0)),ce.current&&=(ce.current.cancel(),null)},[re]),(0,B.useEffect)(()=>{l&&re&&re.focus()},[l,re]),(0,B.useEffect)(()=>{re&&re.dispatch({effects:q.reconfigure.of(pe)})},[d,c,p,h,_,y,x,C,T,D,k,j,N,r,o]),(0,B.useEffect)(()=>{if(t!==void 0){var e=re?re.state.doc.toString():``;if(re&&t!==e){var n=ce.current&&!ce.current.isDone,r=()=>{re&&t!==re.state.doc.toString()&&re.dispatch({changes:{from:0,to:re.state.doc.toString().length,insert:t||``},annotations:[Yq.of(!0)]})};n?le.current=r:r()}}},[t,re]),{state:oe,setState:se,view:re,setView:ie,container:I,setContainer:te}}var $q=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],eJ=(0,B.forwardRef)((e,t)=>{var n=e.className,r=e.value,i=r===void 0?``:r,a=e.selection,o=e.extensions,s=o===void 0?[]:o,c=e.onChange,l=e.onStatistics,u=e.onCreateEditor,d=e.onUpdate,f=e.autoFocus,p=e.theme,m=p===void 0?`light`:p,h=e.height,g=e.minHeight,_=e.maxHeight,v=e.width,y=e.minWidth,b=e.maxWidth,x=e.basicSetup,S=e.placeholder,C=e.indentWithTab,w=e.editable,T=e.readOnly,E=e.root,D=e.initialState,O=Ere(e,$q),k=(0,B.useRef)(null),A=Qq({root:E,value:i,autoFocus:f,theme:m,height:h,minHeight:g,maxHeight:_,width:v,minWidth:y,maxWidth:b,basicSetup:x,placeholder:S,indentWithTab:C,editable:w,readOnly:T,selection:a,onChange:c,onStatistics:l,onCreateEditor:u,onUpdate:d,extensions:s,initialState:D}),j=A.state,M=A.view,N=A.container,P=A.setContainer;(0,B.useImperativeHandle)(t,()=>({editor:k.current,state:j,view:M}),[k,N,j,M]);var ee=(0,B.useCallback)(e=>{k.current=e,P(e)},[P]);if(typeof i!=`string`)throw Error(`value must be typeof string but got `+typeof i);var F=typeof m==`string`?`cm-theme-`+m:`cm-theme`;return(0,z.jsx)(`div`,qV({ref:ee,className:``+F+(n?` `+n:``)},O))});eJ.displayName=`CodeMirror`;var tJ=/^(\d{4})-(\d{2})-(\d{2})$/,nJ=/^(\d{4}-\d{2}-\d{2})([T ])(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-](\d{2}):(\d{2}))?$/,rJ=[31,28,31,30,31,30,31,31,30,31,30,31],iJ=e=>e%4==0&&e%100!=0||e%400==0;function aJ(e){if(typeof e!=`string`)return!1;let t=tJ.exec(e);if(!t)return!1;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return r<1||r>12||i<1?!1:i<=(r===2&&iJ(n)?29:rJ[r-1])}function oJ(e){if(typeof e!=`string`)return null;let t=nJ.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u]=t;return!aJ(n)||Number(i)>23||Number(a)>59||o!==void 0&&Number(o)>59||l!==void 0&&(Number(l)>23||Number(u)>59)?null:{date:n,sep:r,hour:i,minute:a,second:o??null,fraction:s??null,offset:c??null}}var sJ=e=>oJ(e)!==null;function cJ(e){let t=e.second===null?``:`:${e.second}${e.fraction===null?``:`.${e.fraction}`}`;return`${e.date}${e.sep}${e.hour}:${e.minute}${t}${e.offset??``}`}function lJ(e){if(aJ(e))return Date.parse(`${e}T00:00:00Z`);let t=oJ(e);if(!t)return null;let n=(t.fraction??``).padEnd(3,`0`).slice(0,3);return Date.parse(`${t.date}T${t.hour}:${t.minute}:${t.second??`00`}.${n}${t.offset??`Z`}`)}function uJ({className:e,size:t=`default`,...n}){return(0,z.jsx)(xte,{"data-slot":`switch`,"data-size":t,className:T(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80`,e),...n,children:(0,z.jsx)(Cte,{"data-slot":`switch-thumb`,className:T(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`)})})}function dJ({className:e,...t}){return(0,z.jsx)(`textarea`,{"data-slot":`textarea`,className:T(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var fJ=/^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/,pJ=e=>String(e).padStart(2,`0`);function mJ(e){let t=oJ(e);if(!t||t.fraction!==null&&t.fraction.length>3)return null;let n=t.second===null?``:`:${t.second}${t.fraction===null?``:`.${t.fraction}`}`,r=t.fraction===null?t.second===null?60:1:.001;return{value:`${t.date}T${t.hour}:${t.minute}${n}`,step:r}}function hJ(e,t,n){let[r,i,a]=e.split(`-`).map(Number),o=-new Date(r,i-1,a,Number(t),Number(n)).getTimezoneOffset(),s=Math.abs(o);return`${o<0?`-`:`+`}${pJ(Math.floor(s/60))}:${pJ(s%60)}`}function gJ(e,t,n=hJ){let r=fJ.exec(e);if(!r)return null;let[,i,a,o,s,c]=r,l=t===null?null:oJ(t);if(!l)return cJ({date:i,sep:`T`,hour:a,minute:o,second:null,fraction:null,offset:n(i,a,o)});let u=l.fraction?.length??0,d=(c??``).replace(/0+$/,``).length;return cJ({date:i,sep:l.sep,hour:a,minute:o,second:l.second===null?null:s??`00`,fraction:l.fraction===null?null:(c??``).padEnd(u,`0`).slice(0,Math.max(u,d)),offset:l.offset})}var _J=e=>{let t=/^([+-])(\d{2}):(\d{2})$/.exec(e??``);return t?(t[1]===`-`?-1:1)*(Number(t[2])*60+Number(t[3])):0};function vJ(e,t){if(typeof e!=`string`)return;let n=lJ(e);if(n===null)return;let r=new Date(n+_J(t)*6e4).toISOString(),i=oJ(e),a=i?.second==null?``:i.fraction===null?r.slice(16,19):r.slice(16,23);return`${r.slice(0,16)}${a}`}function yJ(e,t){return t===`date`?aJ(e)?null:`not a date`:t===`datetime`?sJ(e)?null:`not a datetime`:t===`list`?Array.isArray(e)?null:`not a list`:t===`map`?typeof e==`object`&&e&&!Array.isArray(e)?null:`not a map`:null}function bJ(e,t){return t===`date`||t===`datetime`?yJ(e,t)===null?lJ(e):null:typeof e==`number`?e:typeof e==`bigint`?Number(e):null}var xJ=e=>typeof e==`number`?e:lJ(e);function SJ(e,t,n,r){let i=bJ(e,t);return i===null?null:n!==void 0&&i<xJ(n)?`below min ${n}`:r!==void 0&&i>xJ(r)?`above max ${r}`:null}var CJ=e=>e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`,wJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),TJ=e=>Array.isArray(e)?`[${e.length}]`:wJ(e)?`{${Object.keys(e).length}}`:``,EJ=/^(import\s|export\s+(const|let|var|function|class|default|async|\{|\*))/,DJ=/^\s*([-*_]\s*){3,}$|^\s*\|?\s*:?-{3,}/;function OJ(e){let t=[],n=[],r=()=>{n.length>0&&t.push(n.join(` `)),n=[]},i=!1;for(let t of e.split(`
|
|
71
|
-
`)){if(/^\s*(```|~~~)/.test(t)){i=!i,r();continue}if(i||EJ.test(t)||DJ.test(t))continue;let e=/^\s*(#{1,6}\s|\|)/.test(t),a=/^\s*([-*+]|\d+[.)])\s/.test(t);(e||a)&&r();let o=t.replace(/^\s*(#{1,6}\s+|>\s?|[-*+]\s+(\[[ xX]\]\s+)?|\d+[.)]\s+)/,``).replace(/<\/?[A-Za-z][^>]*>/g,``).replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/(\*\*|__|~~)(.+?)\1/g,`$2`).replace(/\*([^*\s][^*]*)\*/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\s*\|\s*/g,` `).trim();o===``?r():n.push(o),e&&r()}return r(),t.join(` · `)}var kJ=3,AJ=2;function jJ(e,t,n){if(e==null)return{kind:`null`};if(typeof e==`boolean`)return{kind:`bool`,value:e};if(typeof e==`number`)return{kind:`number`,text:String(e)};if(typeof e==`string`)return t===`INTEGER`&&/^-?\d+$/.test(e)?{kind:`number`,text:e}:n===`markdown`?{kind:`text`,text:OJ(e)}:{kind:`text`,text:e.replaceAll(`
|
|
72
|
-
`,` ⏎ `)};if(Array.isArray(e))return e.every(CJ)?{kind:`chips`,items:e.slice(0,kJ).map(String),more:Math.max(0,e.length-kJ)}:{kind:`nested`,label:TJ(e),preview:e.map(TJ).join(`, `)};if(wJ(e)){let t=Object.entries(e);return t.length>0&&t.every(([,e])=>CJ(e))?{kind:`map`,entries:t.slice(0,AJ).map(([e,t])=>[e,String(t)]),more:Math.max(0,t.length-AJ)}:{kind:`nested`,label:TJ(e),preview:t.map(([e,t])=>CJ(t)?e:`${e}${TJ(t)}`).join(`, `)}}return{kind:`text`,text:String(e)}}var MJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),NJ=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function PJ(e){return CJ(e)?!0:Array.isArray(e)?NJ(e):MJ(e)&&Object.values(e).every(PJ)}function FJ(e,t,n,r){return n?`ref`:r===`date`&&(e==null||aJ(e))?`date`:r===`datetime`&&(e==null||typeof e==`string`&&mJ(e)!==null)?`datetime`:e==null?r===`map`?`map`:`unset`:typeof e==`boolean`?`switch`:typeof e==`number`?`number`:typeof e==`string`?t===`INTEGER`&&/^-?\d+$/.test(e)?`bigint`:r===`markdown`?`markdown`:e.includes(`
|
|
73
|
-
`)||e.length>80?`textarea`:`text`:NJ(e)?`chips`:MJ(e)&&PJ(e)?`map`:`json`}function IJ(e){switch(e){case`BOOLEAN`:return!1;case`INTEGER`:case`REAL`:return 0;case`JSON`:return{};case`TEXT`:return``}}function LJ(e){return JSON.stringify(e??null,(e,t)=>MJ(t)?Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]])):t)}function RJ(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].filter(n=>LJ(e[n])!==LJ(t[n]))}function zJ(e,t){let n=RJ(e,t);return{values:Object.fromEntries(n.map(e=>[e,t[e]??null])),base:Object.fromEntries(n.map(t=>[t,e[t]??null]))}}function BJ(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(Array.isArray(e)){let t=[...e];return t[r]=BJ(t[r],i,n),t}let a=MJ(e)?e:{};return{...a,[r]:BJ(a[r],i,n)}}function VJ(e,t,n,r){return e==null?null:yJ(e,t)??SJ(e,t,n,r)}function HJ({label:e,value:t,onChange:n,placeholder:r=kn(),removeLabel:i=e=>Jn({item:e}),accept:a=()=>!0,unique:o=!1,invalid:s=!1}){let[c,l]=(0,B.useState)(``),u=()=>{let e=c.trim();if(e===``)return l(``);a(e)&&(o&&t.includes(e)||n([...t,e]),l(``))};return(0,z.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-1 rounded-md border ${s?`border-warn`:``} bg-background px-1.5 py-1 transition-[color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,children:[t.map((e,r)=>(0,z.jsxs)(`span`,{className:kk,children:[e,(0,z.jsx)(`button`,{type:`button`,"aria-label":i(e),className:`ml-1 opacity-60 hover:opacity-100 max-md:grid max-md:size-7 max-md:place-items-center`,onClick:()=>n(t.filter((e,t)=>t!==r)),children:(0,z.jsx)(ik,{className:`size-3`})})]},`${r}-${e}`)),(0,z.jsx)(`input`,{"aria-label":e,className:`min-w-32 flex-1 bg-transparent px-1 text-base outline-none placeholder:text-muted-foreground md:text-sm`,placeholder:r,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),u()):e.key===`Backspace`&&!e.repeat&&c===``&&t.length>0&&n(t.slice(0,-1))},onBlur:u}),c.trim()!==``&&(0,z.jsx)(`button`,{type:`button`,"aria-label":Nn({field:e}),className:`rounded-md px-2 text-[13px] text-muted-foreground md:hidden`,onMouseDown:e=>e.preventDefault(),onClick:u,children:On()})]})}function UJ(e,t,n){let r=t?.find(t=>t.name===e.table)?.key;return e.target===void 0||e.target===r?{key:n}:{filter:[{col:e.target,op:`eq`,value:n}]}}function WJ({reference:e,value:t,className:n,children:r}){let{data:i}=ey();return(0,z.jsx)(Yh,{to:`/t/$table`,params:{table:e.table},search:UJ(e,i?.tables,t),"aria-label":`open ${e.table} ${t}`,className:n??`text-tomato underline-offset-2 hover:underline`,onClick:e=>e.stopPropagation(),children:r??t})}var GJ=()=>Fh({from:`__root__`,select:e=>e.app!==void 0}),KJ=(0,B.createContext)(!1),qJ=()=>(0,B.useContext)(KJ),JJ,YJ=()=>JJ;function XJ(e,t=document.baseURI){return new URL(`-/apps/${encodeURIComponent(e)}/`,t).toString()}function ZJ(e,t){let n=new URL(`.`,t).pathname,r=new URL(e).pathname;if(!r.startsWith(n))return;let i=/^-\/apps\/([^/]+)\/?$/.exec(r.slice(n.length))?.[1];if(i!==void 0)try{return decodeURIComponent(i)}catch{return}}var QJ=`modulepreload`,$J=function(e,t){return new URL(e,t).href},eY={},tY=function(e){return e.pathname.endsWith(`.css`)},nY=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},rY=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=$J(t,n);let r=s(t),i=tY(r);return nY(eY,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`:QJ,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)})},iY=e=>e.join(`.`),aY=(0,B.lazy)(()=>rY(()=>import(`./MarkdownField-DGK9weUB.js`),__vite__mapDeps([0,1,2]),import.meta.url));function oY({path:e,value:t,problem:n,onChange:r,onValidity:i,readOnly:a}){let[o,s]=(0,B.useState)(()=>JSON.stringify(t,null,2)),[c,l]=(0,B.useState)(null),u=h(),d=(0,B.useRef)(JSON.stringify(t)),f=(0,B.useRef)(i);f.current=i;let p=iY(e);return(0,B.useEffect)(()=>{JSON.stringify(t)!==d.current&&(d.current=JSON.stringify(t),s(JSON.stringify(t,null,2)),l(null),f.current?.(p,!0))},[t,p]),(0,B.useEffect)(()=>()=>f.current?.(p,!0),[p]),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(eJ,{"aria-label":p,value:o,extensions:[KV(),X.lineWrapping],theme:u,editable:!a,basicSetup:{lineNumbers:!1,foldGutter:!1},className:`overflow-hidden rounded-md border text-[12px] ${dY(n)}`,onChange:e=>{s(e);try{let t=JSON.parse(e);d.current=JSON.stringify(t),r(t),l(null),i?.(p,!0)}catch(e){l(e instanceof Error?e.message:String(e)),i?.(p,!1)}}}),c&&(0,z.jsx)(`p`,{className:`mt-1 text-[11px] text-err`,children:c})]})}var sY=e=>e===!0?`1`:e===!1?`0`:e==null?``:String(e);function cY({path:e,value:t,allowed:n,onChange:r,readOnly:i}){let a=sY(t),o=a!==``&&!n.some(e=>sY(e)===a);return(0,z.jsxs)(`select`,{"aria-label":iY(e),"aria-invalid":o||void 0,disabled:i,className:`${Dk} w-full ${o?`border-warn text-warn`:``}`,value:a,onChange:e=>{let t=e.target.value;if(t===``)return r(null);let i=n.find(e=>sY(e)===t);i!==void 0&&r(i)},children:[(0,z.jsx)(`option`,{value:``,children:`—`}),o&&(0,z.jsx)(`option`,{value:a,children:`${a} (not in values)`}),n.map((e,t)=>(0,z.jsx)(`option`,{value:sY(e),children:String(e)},`${t}:${sY(e)}`))]})}function lY({path:e,value:t,type:n,reference:r,onChange:i}){let a=qJ(),o=r?.table??``,s=r?.key,{data:c}=U_({queryKey:[`refKeys`,o],queryFn:()=>Nv.rows(o,{limit:500,offset:0,filters:[]}),enabled:o!==``}),l=`ref-${iY(e)}`,u=t==null?``:String(t);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,z.jsx)(ak,{"aria-label":iY(e),list:l,value:u,onChange:e=>{let t=e.target.value;if(t===``)return i(null);let r=Number(t);i(n===`INTEGER`&&mY.test(t)&&Number.isSafeInteger(r)?r:t)}}),r&&u!==``&&!a&&(0,z.jsx)(WJ,{reference:r,value:u,className:`shrink-0 text-muted-foreground hover:text-foreground max-md:grid max-md:size-9 max-md:place-items-center max-md:text-foreground`,children:(0,z.jsx)(HD,{className:`size-4`})})]}),(0,z.jsx)(`datalist`,{id:l,children:s!==void 0&&[...new Set(c?.rows.flatMap(e=>e[s]==null?[]:[String(e[s])]))].map(e=>(0,z.jsx)(`option`,{value:e},e))})]})}function uY(e){let{path:t,value:n,problem:r,onChange:i}=e,a=Object.entries(n??{}),[o,s]=(0,B.useState)(null);return(0,z.jsxs)(`div`,{className:`rounded-lg border bg-panel px-2.5 pt-2.5 pb-1 ${dY(r)}`,children:[a.map(([r,a])=>(0,z.jsxs)(`div`,{className:`mb-2.5 grid grid-cols-[minmax(34px,auto)_1fr_auto] items-start gap-1.5`,children:[(0,z.jsx)(`span`,{className:`pt-1.5 font-mono text-[11px] text-syn-key max-md:text-[12.5px]`,children:r}),(0,z.jsx)(vY,{...e,path:[...t,r],value:a,type:void 0,format:void 0,min:void 0,max:void 0,reference:void 0,label:void 0,onChange:e=>i({...n,[r]:e})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Jn({item:iY([...t,r])}),className:`pt-1.5 text-muted-foreground max-md:grid max-md:size-8 max-md:place-items-center max-md:pt-0`,onClick:()=>{let{[r]:e,...t}=n;i(t)},children:(0,z.jsx)(ik,{className:`size-3.5`})})]},r)),o===null?(0,z.jsx)(`button`,{type:`button`,className:`pb-2 text-[11.5px] text-muted-foreground max-md:py-2 max-md:text-[13px]`,onClick:()=>s(``),children:Hn()}):(0,z.jsx)(ak,{autoFocus:!0,"aria-label":Gn({field:iY(t)}),className:`mb-2 h-7`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o.trim()!==``&&(i({...n,[o.trim()]:``}),s(null)),e.key===`Escape`&&s(null)}})]})}var dY=e=>e?`border-warn`:``;function fY({path:e,value:t,min:n,max:r,problem:i,onChange:a}){return(0,z.jsx)(ak,{type:`date`,"aria-label":iY(e),className:`${Ok} font-mono ${dY(i)}`,value:typeof t==`string`?t:``,min:typeof n==`string`?n:void 0,max:typeof r==`string`?r:void 0,onChange:e=>a(e.target.value===``?null:e.target.value)})}function pY({path:e,value:t,min:n,max:r,problem:i,onChange:a}){let o=typeof t==`string`?t:``,s=o===``?null:mJ(o),c=oJ(o)?.offset??null,l=o===``?hJ(new Date().toISOString().slice(0,10),`12`,`00`):c,u=(0,B.useRef)(o);return o!==``&&(u.current=o),(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 max-md:flex-wrap`,children:[(0,z.jsx)(ak,{type:`datetime-local`,"aria-label":iY(e),className:`w-60 font-mono max-md:w-full ${dY(i)}`,step:s?.step??60,value:s?.value??``,min:vJ(n,l),max:vJ(r,l),onChange:e=>{if(e.target.value===``)return a(null);let t=gJ(e.target.value,u.current===``?null:u.current);t!==null&&a(t)}}),c&&(0,z.jsx)(`span`,{className:`font-mono text-[12px] text-muted-foreground`,children:c})]})}var mY=/^-?\d+$/,hY=/^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;function gY(e){let{path:t,value:n,type:r,format:i,reference:a,problem:o,onChange:s}=e,c=i===`date`||i===`datetime`,[l,u]=(0,B.useState)(()=>FJ(n,r,a!==void 0,i)),[d,f]=(0,B.useState)(n==null?``:String(n)),p=n==null?``:String(n),m=(e,t)=>{l===`unset`&&(u(t??FJ(e,r,!1,i)),f(e==null?``:String(e))),s(e)},h=e=>(0,z.jsx)(`button`,{type:`button`,"aria-label":In({field:iY(t),kind:e}),className:`shrink-0 rounded border px-1.5 py-0.5 font-mono text-[11.5px] text-muted-foreground hover:text-foreground max-md:grid max-md:min-h-8 max-md:min-w-8 max-md:place-items-center`,onClick:()=>u(e===`text`?`text`:FJ(n,r,!1,i)),children:e===`text`?(0,z.jsx)(ek,{className:`size-3.5`}):i===`date`?(0,z.jsx)(Xte,{className:`size-3.5`}):(0,z.jsx)($te,{className:`size-3.5`})});if(e.allowed&&r!==`JSON`)return(0,z.jsx)(cY,{...e,allowed:e.allowed});switch(l){case`switch`:return(0,z.jsx)(uJ,{"aria-label":iY(t),checked:n===!0,onCheckedChange:m});case`number`:case`bigint`:return(0,z.jsx)(ak,{"aria-label":iY(t),inputMode:r===`REAL`?`decimal`:`numeric`,className:`${Ok} font-mono ${dY(o)}`,value:d,onChange:e=>{let t=e.target.value;f(t);let n=t.trim();if(r===`INTEGER`){if(!mY.test(n))return;let e=Number(n);s(Number.isSafeInteger(e)?e:n)}else hY.test(n)&&Number.isFinite(Number(n))&&s(Number(n))}});case`date`:case`datetime`:return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[l===`date`?(0,z.jsx)(fY,{...e}):(0,z.jsx)(pY,{...e}),h(`text`)]});case`text`:{let e=(0,z.jsx)(ak,{"aria-label":iY(t),className:dY(o),value:p,onChange:e=>m(c&&e.target.value===``?null:e.target.value)});if(!c)return e;let a=FJ(n,r,!1,i)===i;return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e,a&&h(`picker`)]})}case`textarea`:return(0,z.jsx)(dJ,{"aria-label":iY(t),className:dY(o),rows:4,value:p,onChange:e=>m(e.target.value)});case`markdown`:return(0,z.jsx)(B.Suspense,{fallback:(0,z.jsx)(dJ,{"aria-label":iY(t),rows:4,value:p,readOnly:!0}),children:(0,z.jsx)(aY,{...e})});case`ref`:return(0,z.jsx)(lY,{...e});case`chips`:return(0,z.jsx)(HJ,{label:iY(t),value:n??[],onChange:s,invalid:o});case`map`:return(0,z.jsx)(uY,{...e});case`json`:return(0,z.jsx)(oY,{...e});case`unset`:if(r===`JSON`){let e=[{name:`map`,text:`{ } map`,next:{},chosen:`map`},{name:`list`,text:`[ ] list`,next:[],chosen:`chips`},{name:`JSON`,text:`JSON`,next:[],chosen:`json`}],n=i===`list`?e.filter(e=>e.name!==`map`):e;return(0,z.jsx)(`div`,{className:`flex gap-1.5`,children:n.map(e=>(0,z.jsx)(`button`,{type:`button`,"aria-label":In({field:iY(t),kind:e.name}),className:`rounded border px-1.5 py-0.5 font-mono text-[11.5px] text-muted-foreground hover:text-foreground`,onClick:()=>m(e.next,e.chosen),children:e.text},e.name))})}return(0,z.jsx)(`button`,{type:`button`,"aria-label":iY(t),className:`text-[12px] text-muted-foreground hover:text-foreground`,onClick:()=>m(IJ(r??`TEXT`)),children:Yn()})}}var _Y=e=>e==null||(Array.isArray(e)?e.length===0:typeof e==`object`&&Object.keys(e).length===0);function vY(e){let{label:t,value:n,type:r,readOnly:i,onChange:a}=e,o=VJ(n,e.format,e.min,e.max),[s]=(0,B.useState)(()=>r===`JSON`&&n==null&&e.format!==`map`),[c,l]=(0,B.useState)(0);return(0,z.jsxs)(`div`,{"data-problem":o??void 0,children:[t!==void 0&&(0,z.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[t,s&&!i&&n!=null&&(0,z.jsxs)(`button`,{type:`button`,"aria-label":Vn({field:iY(e.path)}),className:`inline-flex shrink-0 items-center gap-1 rounded px-1 text-[12px] font-semibold text-muted-foreground max-md:text-[13px] font-medium hover:text-foreground`,onClick:()=>{(_Y(n)||window.confirm(Rn()))&&(a(null),l(e=>e+1))},children:[(0,z.jsx)(MO,{className:`size-3`}),Ln()]})]}),(0,z.jsx)(gY,{...e,problem:o!==null},c),o&&(0,z.jsx)(`p`,{className:`mt-1 text-[11px] text-warn`,children:o})]})}function yY({table:e,open:t,onOpenChange:n,initial:r={},initialKey:i=``}){let a=Nh(),{connected:o}=ny(),s=iy(),[c,l]=(0,B.useState)(i),[u,d]=(0,B.useState)(r),[f,p]=(0,B.useState)(0),m=W_({mutationFn:()=>{let t=Object.fromEntries(Object.entries(u).filter(([,e])=>e!=null&&e!==``));return Nv.create(e.name,c,t)},onMutate:()=>s({type:`saved`,table:e.name,key:c,at:Date.now()}),onError:()=>s({type:`cancelled`,table:e.name,key:c}),onSuccess:()=>{n(!1),l(i),d(r),p(e=>e+1),a({to:`/t/$table`,params:{table:e.name},search:e=>({...e,key:c})})}}),h=Ak(m.error);return(0,z.jsx)(gk,{open:t,onOpenChange:n,children:(0,z.jsxs)(yk,{pinned:!0,className:`sm:max-w-2xl`,children:[(0,z.jsx)(bk,{pinned:!0,children:(0,z.jsx)(Ck,{children:Mt({table:e.name})})}),(0,z.jsxs)(xk,{children:[(0,z.jsxs)(`label`,{className:Ek,children:[(e.mode===`files`?Yt:Qt)({key:e.key}),(0,z.jsx)(ak,{"aria-label":sn(),value:c,onChange:e=>l(e.target.value),className:`mt-1 font-mono`})]}),h?.field===`key`&&(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:h.message}),Object.entries(e.columns).filter(([t])=>t!==e.key&&!(e.captures??[]).some(e=>e.column===t)).map(([t,n])=>(0,z.jsx)(`div`,{children:(0,z.jsx)(vY,{path:[t],label:(0,z.jsxs)(`div`,{className:T(`flex-1`,Ek,e.required.includes(t)&&u[t]==null&&`text-warn`),children:[t,e.required.includes(t)&&(0,z.jsx)(`span`,{"aria-label":Qa(),children:` *`})]}),value:u[t]??null,type:n,format:Object.hasOwn(e.formats,t)?e.formats[t]:void 0,mdx:e.files?.endsWith(`.mdx`),allowed:Object.hasOwn(e.values,t)?e.values[t]:void 0,min:Object.hasOwn(e.min,t)?e.min[t]:void 0,max:Object.hasOwn(e.max,t)?e.max[t]:void 0,reference:e.references.find(e=>e.column===t),onChange:e=>d({...u,[t]:e})})},`${f}:${t}`)),h&&h.field!==`key`&&(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:h.message})]}),(0,z.jsxs)(Sk,{pinned:!0,children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>n(!1),children:ht()}),(0,z.jsx)(V,{disabled:c===``||m.isPending||!o,title:o?void 0:yt(),onClick:()=>m.mutate(),children:An()})]})]})})}function bY({title:e}){return(0,z.jsx)(`div`,{className:`p-6 text-muted-foreground`,children:Rl({title:e})})}var xY=63,SY=64,CY=1,wY=2,TY=3,EY=4,DY=5,OY=6,kY=7,AY=65,jY=66,MY=8,NY=9,PY=10,FY=11,IY=12,LY=13,RY=19,zY=20,BY=29,VY=33,HY=34,UY=47,WY=0,GY=1,KY=2,qY=3,JY=4,YY=class{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}};YY.top=new YY(null,-1,WY);function XY(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(QY(t)||t==-1)return n}}function ZY(e){return e==32||e==9}function QY(e){return e==10||e==13}function $Y(e){return ZY(e)||QY(e)}function eX(e){return e<0||$Y(e)}var tX=new BA({start:YY.top,reduce(e,t){return e.type==qY&&(t==zY||t==HY)?e.parent:e},shift(e,t,n,r){if(t==TY)return new YY(e,XY(r,r.pos),GY);if(t==AY||t==DY)return new YY(e,XY(r,r.pos),KY);if(t==xY)return e.parent;if(t==RY||t==VY)return new YY(e,0,qY);if(t==LY&&e.type==JY)return e.parent;if(t==UY){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new YY(e,e.depth+ +t[0],JY)}return e},hash(e){return e.hash}});function nX(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&eX(e.peek(n+3))}var rX=new DA((e,t)=>{if(e.next==-1&&t.canShift(SY))return e.acceptToken(SY);let n=e.peek(-1);if((QY(n)||n<0)&&t.context.type!=qY){if(nX(e,45)){if(t.canShift(xY))e.acceptToken(xY);else return e.acceptToken(CY,3)}if(nX(e,46)){if(t.canShift(xY))e.acceptToken(xY);else return e.acceptToken(wY,3)}let n=0;for(;e.next==32;)n++,e.advance();(n<t.context.depth||n==t.context.depth&&t.context.type==GY&&(e.next!=45||!eX(e.peek(1))))&&e.next!=-1&&!QY(e.next)&&e.next!=35&&e.acceptToken(xY,-n)}},{contextual:!0}),iX=new DA((e,t)=>{if(t.context.type==qY)e.next==63&&(e.advance(),eX(e.next)&&e.acceptToken(kY));else if(e.next==45)e.advance(),eX(e.next)&&e.acceptToken(t.context.type==GY&&t.context.depth==XY(e,e.pos-1)?EY:TY);else if(e.next==63)e.advance(),eX(e.next)&&e.acceptToken(t.context.type==KY&&t.context.depth==XY(e,e.pos-1)?OY:DY);else{let n=e.pos;for(;;)if(ZY(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)cX(e);else if(e.next==38)lX(e);else if(e.next==42){lX(e);break}else if(e.next==39||e.next==34){if(uX(e,!0))break;return}else if(e.next==91||e.next==123){if(!dX(e))return;break}else{hX(e,!0,!1,0);break}for(;ZY(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(BY))return;eX(e.peek(1))&&e.acceptTokenTo(t.context.type==KY&&t.context.depth==XY(e,n)?jY:AY,n)}}},{contextual:!0});function aX(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function oX(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function sX(e,t){return e.next==37?(e.advance(),oX(e.next)&&e.advance(),oX(e.next)&&e.advance(),!0):aX(e.next)||t&&e.next==44?(e.advance(),!0):!1}function cX(e){if(e.advance(),e.next==60){for(e.advance();;)if(!sX(e,!0)){e.next==62&&e.advance();break}}else for(;sX(e,!1););}function lX(e){for(e.advance();!eX(e.next)&&pX(e.next)!=`f`;)e.advance()}function uX(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==n){if(a==39){if(e.next==39)e.advance();else break}else break}else if(a==92&&n==34)e.next>=0&&e.advance();else if(QY(a)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function dX(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!uX(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else if(e.next<0||e.pos>n||QY(e.next))return!1;else e.advance()}var fX=`iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif`;function pX(e){return e<33?`u`:e>125?`s`:fX[e-33]}function mX(e,t){let n=pX(e);return n!=`u`&&!(t&&n==`f`)}function hX(e,t,n,r){if(pX(e.next)==`s`||(e.next==63||e.next==58||e.next==45)&&mX(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let a=e.next,o=0,s=r+1;for(;$Y(a);){if(QY(a)){if(t)return!1;s=0}else s++;a=e.peek(++o)}if(!(a>=0&&(a==58?mX(e.peek(o+1),n):a==35?e.peek(o-1)!=32:mX(a,n)))||!n&&s<=r||s==0&&!n&&(nX(e,45,o)||nX(e,46,o)))break;if(t&&pX(a)==`f`)return!1;for(let t=o;t>=0;t--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}var gX=new DA((e,t)=>{if(e.next==33)cX(e),e.acceptToken(IY);else if(e.next==38||e.next==42){let t=e.next==38?PY:FY;lX(e),e.acceptToken(t)}else e.next==39||e.next==34?(uX(e,!1),e.acceptToken(NY)):hX(e,!1,t.context.type==qY,t.context.depth)&&e.acceptToken(MY)}),_X=new DA((e,t)=>{let n=t.context.type==JY?t.context.depth:-1,r=e.pos;scan:for(;;){let i=0,a=e.next;for(;a==32;)a=e.peek(++i);if(!i&&(nX(e,45,i)||nX(e,46,i))||!QY(a)&&(n<0&&(n=Math.max(t.context.depth+1,i)),i<n))break;for(;;){if(e.next<0)break scan;let t=QY(e.next);if(e.advance(),t)continue scan;r=e.pos}}e.acceptTokenTo(LY,r)}),vX=ZA({DirectiveName:W.keyword,DirectiveContent:W.attributeValue,"DirectiveEnd DocEnd":W.meta,QuotedLiteral:W.string,BlockLiteralHeader:W.special(W.string),BlockLiteralContent:W.content,Literal:W.content,"Key/Literal Key/QuotedLiteral":W.definition(W.propertyName),"Anchor Alias":W.labelName,Tag:W.typeName,Comment:W.lineComment,": , -":W.separator,"?":W.punctuation,"[ ]":W.squareBracket,"{ }":W.brace}),yX=VA.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:`⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document`,maxTerm:74,context:tX,nodeProps:[[`isolate`,-3,8,9,14,``],[`openedBy`,18,`[`,32,`{`],[`closedBy`,19,`]`,33,`}`]],propSources:[vX],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[rX,iX,gX,_X,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),bX=UB.define({name:`yaml`,parser:yX.configure({props:[aV.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name==`BlockLiteralContent`&&t.from<t.to)return e.baseIndentFor(t);if(t.name==`BlockLiteral`)return e.baseIndentFor(t)+e.unit;if(t.name==`BlockSequence`||t.name==`BlockMapping`)return e.column(t.firstChild.from,1);if(t.name==`QuotedLiteral`)return null;if(t.name==`Literal`){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)return null}}return null},FlowMapping:sV({closing:`}`}),FlowSequence:sV({closing:`]`})}),dV.add({"FlowMapping FlowSequence":fV,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:`#`},indentOnInput:/^\s*[\]\}]$/}});function xX(){return new $B(bX)}W.meta;function SX({className:e,orientation:t=`horizontal`,...n}){return(0,z.jsx)(Ate,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:T(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var CX=O(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function wX({className:e,variant:t=`default`,...n}){return(0,z.jsx)(Mte,{"data-slot":`tabs-list`,"data-variant":t,className:T(CX({variant:t}),e),...n})}function TX({className:e,...t}){return(0,z.jsx)(Pte,{"data-slot":`tabs-trigger`,className:T(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function EX({className:e,...t}){return(0,z.jsx)(Ite,{"data-slot":`tabs-content`,className:T(`flex-1 outline-none`,e),...t})}var DX={min:320,max:()=>Math.max(320,Math.floor(window.innerWidth*.7))},OX={min:180,max:()=>Math.max(180,Math.min(480,Math.floor(window.innerWidth*.4)))},kX=(e,t)=>Math.min(t.max(),Math.max(t.min,Math.round(e)));function AX(e,t,n){try{let r=localStorage.getItem(e);return r!==null&&Number.isFinite(Number(r))?kX(Number(r),n):t}catch{return t}}function jX(e,t,n=DX){let[r,i]=(0,B.useState)(()=>AX(e,t,n));return[r,r=>{let a=r===null?t:kX(r,n);i(a);try{r===null?localStorage.removeItem(e):localStorage.setItem(e,String(a))}catch{}}]}var MX=16;function NX({width:e,label:t,onResize:n,edge:r=`left`,bounds:i=DX}){let a=r===`left`?-1:1;return(0,z.jsx)(`div`,{role:`separator`,"aria-label":t,"aria-orientation":`vertical`,"aria-valuenow":e,"aria-valuemin":i.min,"aria-valuemax":i.max(),tabIndex:0,onPointerDown:t=>{if(t.button!==0)return;t.preventDefault();let r=t.currentTarget;r.setPointerCapture?.(t.pointerId),document.body.setAttribute(`data-resizing`,``);let i=t.clientX,o=t=>n(e+a*(t.clientX-i)),s=!1,c=()=>{if(s)return;s=!0,document.removeEventListener(`pointermove`,o),document.removeEventListener(`pointerup`,c),document.removeEventListener(`pointercancel`,c),r.removeEventListener(`lostpointercapture`,c),document.body.removeAttribute(`data-resizing`);let e=e=>e.stopPropagation();window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),0)};document.addEventListener(`pointermove`,o),document.addEventListener(`pointerup`,c),document.addEventListener(`pointercancel`,c),r.addEventListener(`lostpointercapture`,c)},onDoubleClick:()=>n(null),onKeyDown:t=>{let r=t.key===`ArrowLeft`?-a*MX:t.key===`ArrowRight`?a*MX:0;r!==0&&(t.preventDefault(),n(e+r))},className:T(`absolute inset-y-0 z-10 w-1 cursor-col-resize outline-none hover:bg-primary/40 focus-visible:bg-primary/40`,r===`left`?`-left-0.5`:`-right-0.5`)})}var PX=`(width < 48rem)`,FX=e=>{let t=matchMedia(PX);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},IX=()=>(0,B.useSyncExternalStore)(FX,()=>matchMedia(PX).matches),LX=e=>{let t=window.visualViewport;return t?.addEventListener(`resize`,e),t?.addEventListener(`scroll`,e),()=>{t?.removeEventListener(`resize`,e),t?.removeEventListener(`scroll`,e)}};function RX(e){let t=(0,B.useSyncExternalStore)(LX,()=>window.visualViewport?.height);return e?t:void 0}function zX(e,t){let n=Math.max(0,Math.round((t-Date.parse(e))/1e3));if(n<60)return Yr();let r=new Intl.RelativeTimeFormat(E(),{numeric:`always`}),i=Math.round(n/60);if(i<60)return r.format(-i,`minute`);let a=Math.round(i/60);if(a<24)return r.format(-a,`hour`);let o=Math.round(a/24);return o<30?r.format(-o,`day`):e.slice(0,10)}var BX=e=>e==null?ni():typeof e==`string`?e:JSON.stringify(e),VX=(e,t,n)=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0});function HX(e,t,n){let r={};for(let t of Object.keys(e))VX(r,t,null);for(let[e,n]of Object.entries(t))VX(r,e,n);return VX(r,n,e[n]),r}function UX(e){let t=e?.at(-1);if(!e||!t||t.state!==`ok`)return null;let n=e.reduce((e,t)=>e+(t.state===`ok`?t.entries.filter(e=>e.kind===`commit`).length:0),0);return t.next===null?String(n):`${n}+`}function WX(e,t,n){return G_({queryKey:[`history`,e,t],queryFn:({pageParam:n})=>Nv.history(e,t,n),initialPageParam:void 0,getNextPageParam:e=>e.state===`ok`?e.next??void 0:void 0,enabled:n})}var GX=e=>e.slice(0,7),KX=e=>e.sha??`wip`;function qX({title:e,children:t}){return(0,z.jsxs)(`div`,{className:`px-2 py-10 text-center text-[13px] text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`mb-1.5 text-[15px] font-semibold text-foreground`,children:e}),t]})}function JX({children:e}){return(0,z.jsx)(`span`,{className:`rounded border px-1.5 font-mono text-[11px] text-muted-foreground`,children:e})}function YX({table:e,recordKey:t,rev:n}){let{data:r,error:i}=U_({queryKey:[`history`,e,t,`diff`,n],queryFn:()=>Nv.historyDiff(e,t,n)});return i?(0,z.jsx)(`p`,{className:`text-[12px] text-err`,children:i.message}):r?(0,z.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-panel py-2 font-mono text-[12px] leading-relaxed`,children:r.text.split(`
|
|
74
|
-
`).map((e,t)=>(0,z.jsx)(`span`,{className:T(`block px-3 whitespace-pre`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-ok/15 text-ok`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-err-soft text-err`),children:e},t))}):(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:bt()})}function XX({entry:e,...t}){let[n,r]=(0,B.useState)(`fields`),i=e.record,a=i!==null&&RJ(t.current,HX(t.current,i,t.keyColumn)).length>0,o=n===`yaml`||e.changes.length===0;return(0,z.jsxs)(`div`,{className:`rounded-b-lg border border-t-0 p-3`,children:[(0,z.jsxs)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:[e.changes.length>0?(0,z.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-md border text-[12px]`,children:[`fields`,`yaml`].map(e=>(0,z.jsx)(`button`,{type:`button`,"aria-pressed":n===e,onClick:()=>r(e),className:T(`px-2.5 py-0.5`,n===e&&`bg-foreground text-background`),children:e===`fields`?Jr():li()},e))}):(0,z.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:e.unreadable?si():ti()}),e.kind===`commit`&&e.sha&&i!==null&&t.canRestore&&(0,z.jsx)(V,{variant:`outline`,size:`sm`,className:`ml-auto`,disabled:!a,title:a?ii():ai(),onClick:()=>t.onRestore(i,e.sha),children:ri()})]}),o?(0,z.jsx)(YX,{table:t.table,recordKey:t.recordKey,rev:KX(e)}):e.changes.map(e=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[7rem_1fr] gap-2 border-b border-dashed py-2 last:border-b-0`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[12px] break-all text-muted-foreground`,children:e.path}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1 font-mono text-[12px]`,children:[e.from!==null&&(0,z.jsx)(`span`,{className:`rounded bg-err-soft px-2 py-0.5 break-all text-err line-through`,children:BX(e.from)}),(0,z.jsx)(`span`,{className:`rounded bg-ok/15 px-2 py-0.5 break-all text-ok`,children:BX(e.to)})]})]},e.path))]})}function ZX(e){let{query:t}=e,[n,r]=(0,B.useState)(null);if(t.error)return(0,z.jsx)(`p`,{className:`text-[13px] text-err`,children:t.error.message});let i=t.data?.pages[0];if(!t.data||!i)return(0,z.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:bt()});if(i.state===`nogit`)return(0,z.jsx)(qX,{title:$r(),children:ei()});if(i.state===`untracked`)return(0,z.jsx)(qX,{title:Zr(),children:Qr()});if(i.state===`error`)return(0,z.jsx)(`p`,{className:`text-[13px] text-err`,children:i.message});let a=t.data.pages.flatMap(e=>e.state===`ok`?e.entries:[]),o=Date.now();return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`ol`,{className:`relative m-0 list-none p-0 before:absolute before:top-3.5 before:bottom-3.5 before:left-[11px] before:w-0.5 before:bg-border`,children:a.map(t=>{let i=KX(t),a=n===i;return(0,z.jsxs)(`li`,{className:`relative mb-1.5 pl-8`,children:[(0,z.jsx)(`span`,{className:T(`absolute top-3.5 left-1 size-4 rounded-full border-2 border-muted-foreground bg-background`,t.kind===`wip`&&`border-dashed border-warn`,t.head&&`border-tomato`,a&&`border-primary bg-primary`)}),(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>r(a?null:i),className:T(`block w-full rounded-lg border border-transparent px-3 py-2 text-left hover:bg-panel`,a&&`rounded-b-none border-border bg-panel`),children:[(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[14px] font-semibold`,children:[t.kind===`wip`?ci():t.subject,t.kind===`wip`&&(0,z.jsx)(`span`,{className:`rounded bg-warn-soft px-1.5 text-[11px] text-warn`,children:oi()}),t.head&&(0,z.jsx)(`span`,{className:`rounded bg-chip px-1.5 text-[11px] text-chip-foreground`,children:`HEAD`})]}),(0,z.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[12px] text-muted-foreground`,children:[t.sha&&(0,z.jsx)(`span`,{className:`font-mono text-foreground`,children:GX(t.sha)}),t.author&&(0,z.jsx)(`span`,{children:t.author}),(0,z.jsx)(`span`,{children:zX(t.date,o)})]}),t.renamedFrom?(0,z.jsxs)(`span`,{className:`mt-1 block font-mono text-[12px] text-muted-foreground`,children:[t.renamedFrom,` → `,t.path]}):(0,z.jsxs)(`span`,{className:`mt-1.5 flex flex-wrap gap-1`,children:[t.event===`created`&&(0,z.jsx)(JX,{children:Kr()}),t.event===`deleted`&&(0,z.jsx)(JX,{children:qr()}),t.changes.map(e=>(0,z.jsx)(JX,{children:e.path},e.path))]})]}),a&&(0,z.jsx)(XX,{...e,entry:t})]},i)})}),t.hasNextPage&&(0,z.jsx)(`button`,{type:`button`,disabled:t.isFetchingNextPage,onClick:()=>void t.fetchNextPage(),className:`mt-2 ml-8 text-[12px] text-muted-foreground`,children:Xr()})]})}function QX({table:e,recordKey:t}){let n=ry(e,t);if(!n)return null;let r=n.state===`pending`?Xa():n.state===`applied`?Ya({file:n.file}):n.state===`failed`?Ga({reason:n.reason}):Ka(),i=n.state===`applied`?`text-ok`:n.state===`failed`?`text-err`:`text-muted-foreground`;return(0,z.jsx)(`span`,{role:`status`,className:`text-[11px] ${i}`,children:r})}var $X=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends $X{};function eZ(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function tZ(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function nZ(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function rZ(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function iZ(e,t){return nZ(e,t,``)}function aZ(e,t){return rZ(e,t,``)}function oZ(e,t){return t.slice(0,sZ(e,t))}function sZ(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function cZ(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function lZ(e,t){if(t)return dZ(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function uZ(e,t){if(t)return dZ(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function dZ(e,t){if(!t)return[uZ(e),lZ(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=cZ(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var fZ=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,pZ=RegExp(`[${fZ}]+|\\s+|[^${fZ}]`,`ug`),mZ=new class extends $X{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=cZ(e,r)}else n=e.match(pZ)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&gZ(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&gZ(n,i,r,null,t.intlSegmenter),e}};function hZ(e,t,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?vZ(e,t,n):mZ.diff(e,t,n)}function gZ(e,t,n,r,i){if(t&&n){let[a,o]=dZ(t.value,i),[s,c]=dZ(n.value,i);if(e){let r=eZ(a,s);e.value=rZ(e.value,s,r),t.value=iZ(t.value,r),n.value=iZ(n.value,r)}if(r){let e=tZ(o,c);r.value=nZ(r.value,c,e),t.value=aZ(t.value,e),n.value=aZ(n.value,e)}}else if(n){if(e){let e=uZ(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=uZ(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=uZ(r.value,i),[a,o]=dZ(t.value,i),s=eZ(n,a);t.value=iZ(t.value,s);let c=tZ(iZ(n,s),o);t.value=aZ(t.value,c),r.value=nZ(r.value,n,c),e.value=rZ(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=uZ(r.value,i),n=oZ(lZ(t.value,i),e);t.value=aZ(t.value,n)}else if(e){let n=oZ(lZ(e.value,i),uZ(t.value,i));t.value=iZ(t.value,n)}}var _Z=new class extends $X{tokenize(e){let t=RegExp(`(\\r?\\n)|[${fZ}]+|[^\\S\\n\\r]+|[^${fZ}]`,`ug`);return e.match(t)||[]}};function vZ(e,t,n){return _Z.diff(e,t,n)}var yZ=new class extends $X{constructor(){super(...arguments),this.tokenize=xZ}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
75
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
76
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
77
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
78
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function bZ(e,t,n){return yZ.diff(e,t,n)}function xZ(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
79
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function SZ(e){return e==`.`||e==`!`||e==`?`}new class extends $X{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(SZ(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends $X{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends $X{constructor(){super(...arguments),this.tokenize=xZ}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(CZ(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function CZ(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=CZ(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=CZ(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends $X{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var wZ=2,TZ=new Intl.Segmenter(void 0,{granularity:`word`}),EZ=e=>typeof e==`string`&&(e.includes(`
|
|
80
|
-
`)||e.length>120),DZ=e=>e.replace(/\n$/,``).split(`
|
|
81
|
-
`),OZ=(e,t)=>({kind:e,segments:[{text:t,mark:!1}]});function kZ(e,t){let n=hZ(e,t,{intlSegmenter:TZ});return[{kind:`del`,segments:n.filter(e=>!e.added).map(e=>({text:e.value,mark:e.removed}))},{kind:`add`,segments:n.filter(e=>!e.removed).map(e=>({text:e.value,mark:e.added}))}]}function AZ(e,t){let n=bZ(e,t),r=[];for(let e=0;e<n.length;e++){let t=n[e],i=DZ(t.value),a=n[e+1];if(t.removed&&a?.added){let t=DZ(a.value),n=Math.min(i.length,t.length),o=Array.from({length:n},(e,n)=>kZ(i[n],t[n]));r.push(...o.map(([e])=>e),...i.slice(n).map(e=>OZ(`del`,e))),r.push(...o.map(([,e])=>e),...t.slice(n).map(e=>OZ(`add`,e))),e++}else r.push(...i.map(e=>OZ(t.added?`add`:t.removed?`del`:`same`,e)))}return r}function jZ(e){let t=e.map(()=>!1);e.forEach((n,r)=>{if(n.kind!==`same`)for(let n=Math.max(0,r-wZ);n<=Math.min(e.length-1,r+wZ);n++)t[n]=!0});let n=[];return e.forEach((e,r)=>{let i=t[r]?`lines`:`skip`,a=n.at(-1);a?.kind===i?a.lines.push(e):n.push({kind:i,lines:[e]})}),n}var MZ={same:` `,add:`+`,del:`-`};function NZ({line:e}){return e.segments.map((t,n)=>t.mark?(0,z.jsx)(`mark`,{className:T(`rounded-sm text-inherit`,e.kind===`add`?`bg-ok/30`:`bg-err/25`),children:t.text},n):t.text)}function PZ({line:e}){return(0,z.jsxs)(`div`,{className:T(`flex gap-2 px-2.5`,e.kind===`add`&&`bg-ok/15`,e.kind===`del`&&`bg-err-soft`,e.kind===`same`&&`text-muted-foreground`),children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:T(`shrink-0 select-none`,e.kind===`add`?`text-ok`:e.kind===`del`&&`text-err`),children:MZ[e.kind]}),(0,z.jsxs)(`span`,{className:`min-w-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:[(0,z.jsx)(NZ,{line:e}),e.segments.every(e=>e.text===``)&&`\xA0`]})]})}function FZ({hunk:e}){let[t,n]=(0,B.useState)(!1);return t?e.lines.map((e,t)=>(0,z.jsx)(PZ,{line:e},t)):(0,z.jsx)(`button`,{type:`button`,onClick:()=>n(!0),className:`block w-full bg-panel px-2.5 py-0.5 text-left font-sans text-[13px] text-muted-foreground hover:text-foreground`,children:wa({count:e.lines.length})})}function IZ({field:e,before:t,after:n,legend:r}){let i=(0,B.useMemo)(()=>jZ(AZ(t,n)),[t,n]);return(0,z.jsxs)(`div`,{role:`group`,"aria-label":e,className:`flex min-w-0 flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 text-[13px]`,children:[(0,z.jsx)(`span`,{className:`font-mono text-syn-key`,children:e}),(0,z.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-mono text-err`,children:MZ.del}),` `,(0,z.jsx)(`span`,{className:`[&>*]:text-inherit`,children:r[0]})]}),(0,z.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-mono text-ok`,children:MZ.add}),` `,(0,z.jsx)(`span`,{className:`[&>*]:text-inherit`,children:r[1]})]})]}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-md border font-mono text-[13px] leading-relaxed`,children:i.map((e,t)=>e.kind===`skip`?(0,z.jsx)(FZ,{hunk:e},t):e.lines.map((e,n)=>(0,z.jsx)(PZ,{line:e},`${t}:${n}`)))})]})}var LZ=e=>typeof e==`string`?e:e==null?``:JSON.stringify(e),RZ=e=>!e.dim&&e.a!==e.b&&(EZ(e.a)||EZ(e.b));function zZ(e,t){let n=t(e.a),r=t(e.b);if(e.dim||typeof e.a!=`string`||typeof e.b!=`string`||e.a===e.b)return{a:n,b:r};let[i,a]=kZ(n,r);return{a:(0,z.jsx)(NZ,{line:i}),b:(0,z.jsx)(NZ,{line:a})}}function BZ({labels:e,rows:t,note:n,className:r}){return IX()?(0,z.jsxs)(`div`,{"data-testid":`field-diff`,className:T(`flex flex-col gap-2 font-mono text-[13px]`,r),children:[n&&(0,z.jsx)(`p`,{className:`font-sans text-muted-foreground`,children:n}),t.map(t=>(0,z.jsxs)(`div`,{role:`group`,"aria-label":t.field,className:T(`overflow-hidden rounded-md border`,t.dim&&`opacity-50`),children:[(0,z.jsx)(`div`,{className:`bg-panel px-2.5 py-1.5 font-semibold text-syn-key`,children:t.field}),[[e[0],t.a],[e[1],t.b]].map(([e,n],r)=>(0,z.jsxs)(`div`,{className:`flex gap-2 border-t px-2.5 py-1.5 break-all`,children:[(0,z.jsx)(`span`,{className:`w-24 shrink-0 font-sans text-[12px] text-muted-foreground`,children:e}),(0,z.jsx)(`span`,{className:T(t.dim&&`line-clamp-2`),children:n})]},r))]},t.field))]}):(0,z.jsxs)(`div`,{"data-testid":`field-diff`,className:T(`grid grid-cols-[auto_1fr_1fr] gap-x-3 gap-y-1 font-mono text-[12px]`,r),children:[(0,z.jsx)(`span`,{}),(0,z.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:e[0]}),(0,z.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:e[1]}),n&&(0,z.jsx)(`span`,{className:`col-span-3 text-muted-foreground`,children:n}),t.map(e=>(0,z.jsxs)(`div`,{className:T(`contents`,e.dim&&`opacity-50`),children:[(0,z.jsx)(`span`,{className:`text-syn-key`,children:e.field}),(0,z.jsx)(`span`,{className:T(`[overflow-wrap:anywhere]`,e.dim&&`line-clamp-2`),children:e.a}),(0,z.jsx)(`span`,{className:T(`[overflow-wrap:anywhere]`,e.dim&&`line-clamp-2`),children:e.b})]},e.field))]})}function VZ({labels:e,rows:t,format:n,note:r,className:i}){let a=t.filter(e=>!RZ(e)),o=t.filter(RZ);return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(a.length>0||r)&&(0,z.jsx)(BZ,{labels:e,note:r,className:i,rows:a.map(e=>({field:e.field,...zZ(e,n),dim:e.dim}))}),o.map(t=>(0,z.jsx)(IZ,{field:t.field,legend:e,before:LZ(t.a),after:LZ(t.b)},t.field))]})}function HZ({stale:e,current:t,draft:n,onReload:r,onOverwrite:i,onClose:a}){let o=(0,B.useRef)(null);return(0,z.jsx)(gk,{open:!0,onOpenChange:e=>!e&&a(),children:(0,z.jsxs)(yk,{onOpenAutoFocus:e=>{e.preventDefault(),o.current?.focus()},children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{children:so()}),(0,z.jsx)(wk,{children:io()})]}),(0,z.jsx)(VZ,{labels:[oo(),ao()],format:e=>JSON.stringify(e??null),rows:e.map(e=>({field:e,a:t[e],b:n[e]}))}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{ref:o,variant:`outline`,onClick:r,children:Za()}),(0,z.jsx)(V,{onClick:i,children:Ha()})]})]})})}var UZ=(e,t)=>Object.hasOwn(e.columns,t)?e.columns[t]:void 0,WZ=(e,t)=>Object.hasOwn(e.formats,t)?e.formats[t]:void 0,GZ=e=>e.files?.endsWith(`.mdx`)??!1,KZ=(e,t)=>Object.hasOwn(e.values,t)?e.values[t]:void 0,qZ=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,JZ=`absolute inset-y-0 right-0 z-20 border-l bg-background shadow-xl max-md:fixed max-md:inset-0 max-md:z-40 max-md:h-dvh max-md:border-l-0 max-md:shadow-none max-md:animate-[y-slide-up_160ms_ease-out]`,YZ=`max-md:flex-1 max-md:text-[14px]`;function XZ(e,t=!0){let n=(0,B.useRef)(void 0);(0,B.useEffect)(()=>{t&&(n.current=window.event)},[t]),(0,B.useEffect)(()=>{if(!t)return;let r=t=>{if(t===n.current)return;let r=t.composedPath();r.length!==0&&r[0]instanceof Element&&(r.some(e=>e instanceof Element&&e.matches(`aside[data-record-drawer], [role="dialog"], [role="alertdialog"], [data-radix-popper-content-wrapper], [data-sonner-toaster], [role="row"][data-key]`))||e())},i=t=>{t.key===`Escape`&&!document.querySelector(`[role="dialog"], [role="alertdialog"], [data-radix-popper-content-wrapper]`)&&e()};return document.addEventListener(`click`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`click`,r),document.removeEventListener(`keydown`,i)}})}function ZZ({table:e,recordKey:t,headerActions:n,onClose:r}){let i=h(),a=Cg(),o=Nh(),s=iy(),{connected:c}=ny(),l=c&&!zv(),{data:u,error:d}=U_({queryKey:[`record`,e.name,t],queryFn:()=>Nv.record(e.name,t)}),[f,p]=(0,B.useState)(null),[m,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(new Set),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(null),[E,D]=(0,B.useState)(`form`),[O,k]=(0,B.useState)(null),A=WX(e.name,t,E===`history`&&!zv()),[j,M]=(0,B.useState)(0),N=f!==null&&m!==null&&RJ(f,m).length>0,[P,ee]=jX(`yamlite-drawer-width`,360),F=IX(),I=RX(F),te=F?I?{height:I}:void 0:{width:P};(0,B.useEffect)(()=>{u&&!N&&(m&&RJ(m,u.row).length===0?p(u.row):ne(u.row))},[u,N]);function ne(e){p(e),g(e),v(new Set),w(null),M(e=>e+1),k(null)}function re(t,n){f&&(g(HX(f,t,e.key)),v(new Set),M(e=>e+1),k(n.slice(0,7)),D(`form`))}let ie=W_({mutationFn:({values:n,base:r})=>Nv.update(e.name,t,n,r),onMutate:()=>s({type:`saved`,table:e.name,key:t,at:Date.now()}),onSuccess:(n,r)=>{let i={...f,...r.values};p(i),g(i),k(null),a.setQueryData([`record`,e.name,t],e=>e&&{...e,row:i}),a.invalidateQueries({queryKey:[`record`,e.name,t]})},onError:n=>{s({type:`cancelled`,table:e.name,key:t}),n instanceof gv&&n.status===409&&Array.isArray(n.body.stale)&&b({fields:n.body.stale,current:n.body.current})}}),ae=W_({mutationFn:()=>Nv.remove(e.name,t),onMutate:()=>s({type:`saved`,table:e.name,key:t,at:Date.now()}),onError:()=>s({type:`cancelled`,table:e.name,key:t}),onSuccess:()=>{r?r():o({to:`/t/$table`,params:{table:e.name},search:{}})}}),oe=()=>{!f||!m||!N||_.size>0||!c||ie.isPending||ie.mutate(zJ(f,m))},se=()=>r?r():void o({to:`/t/$table`,params:{table:e.name},search:e=>({...e,key:void 0})});if(XZ(se,!N),(0,B.useEffect)(()=>{let e=e=>{e.key===`s`&&(e.metaKey||e.ctrlKey)&&!zv()&&(e.preventDefault(),oe())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)}),d)return(0,z.jsx)(`aside`,{"data-record-drawer":!0,"aria-label":Ba(),className:T(JZ,`p-4 text-err`),style:te,children:d.message});if(!m||!f||!u)return(0,z.jsx)(`aside`,{"data-record-drawer":!0,"aria-label":Ba(),className:JZ,style:te});let ce=Object.keys(e.columns).filter(t=>t!==e.key),le=Object.keys(m).filter(t=>t!==e.key&&!ce.includes(t)),ue=new Set(RJ(f,m)),de=ue.size,fe=UX(A.data?.pages);return(0,z.jsxs)(`aside`,{"data-record-drawer":!0,"aria-label":Ba(),className:T(JZ,`flex flex-col`),style:te,children:[!F&&(0,z.jsx)(NX,{width:P,label:$a(),onResize:ee}),(0,z.jsxs)(SX,{value:E,onValueChange:e=>{D(e),v(e=>new Set([...e].filter(e=>e!==`$json`))),w(null)},className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b px-4 py-3 max-md:gap-1 max-md:px-2 max-md:pt-[calc(0.5rem+env(safe-area-inset-top))] max-md:pb-2`,children:[F&&(0,z.jsx)(`button`,{type:`button`,"aria-label":_t(),onClick:se,className:`grid size-10 place-items-center`,children:(0,z.jsx)(RD,{className:`size-5`})}),(0,z.jsx)(`span`,{className:`min-w-[6rem] flex-1 truncate font-mono font-bold`,children:t}),n,(0,z.jsxs)(wX,{className:`ml-auto h-7 max-md:order-last max-md:ml-0 max-md:h-9 max-md:w-full`,children:[(0,z.jsx)(TX,{value:`form`,className:YZ,children:lo()}),(0,z.jsx)(TX,{value:`json`,className:YZ,children:`JSON`}),(0,z.jsx)(TX,{value:`yaml`,className:YZ,children:co()}),!zv()&&(0,z.jsxs)(TX,{value:`history`,className:YZ,children:[uo(),fe!==null&&(0,z.jsx)(`span`,{className:`ml-1 font-mono text-[10px] text-muted-foreground`,children:fe})]})]}),!F&&(0,z.jsx)(`button`,{type:`button`,"aria-label":_t(),onClick:se,className:`text-muted-foreground`,children:(0,z.jsx)(ik,{className:`size-4`})})]}),(0,z.jsx)(`div`,{className:`truncate px-4 pt-3 font-mono text-[11px] text-muted-foreground max-md:text-[12px]`,children:u.file}),(0,z.jsxs)(EX,{value:`form`,className:`min-h-0 flex-1 overflow-auto px-4 py-3`,onFocus:e=>F&&e.target.matches(`input, textarea, [contenteditable]`)&&e.target.scrollIntoView?.({block:`center`}),children:[!c&&(0,z.jsx)(`p`,{className:`mb-2 text-[11.5px] text-err`,children:Ia()}),(0,z.jsx)(`fieldset`,{disabled:!l,className:`m-0 min-w-0 border-0 p-0`,children:[...ce,...le].map(t=>{let n=e.references.find(e=>e.column===t),r=(e.captures??[]).some(e=>e.column===t),i=(0,z.jsx)(vY,{readOnly:!l||r,path:[t],label:(0,z.jsxs)(`div`,{className:`flex flex-1 justify-between ${Ek}`,children:[(0,z.jsxs)(`span`,{className:e.required.includes(t)&&m[t]==null?`text-warn`:void 0,children:[t,e.required.includes(t)&&(0,z.jsx)(`span`,{"aria-label":Qa(),children:` *`})]}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] font-medium max-md:text-[11.5px]`,children:n?`→ ${n.table}`:WZ(e,t)??UZ(e,t)??Va()})]}),value:m[t],type:UZ(e,t),format:WZ(e,t),mdx:GZ(e),allowed:KZ(e,t),min:qZ(e.min,t),max:qZ(e.max,t),reference:n,onChange:e=>g({...m,[t]:e}),onValidity:(e,t)=>v(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},`${t}:${j}`);return(0,z.jsx)(`div`,{className:T(`mb-3.5`,O&&ue.has(t)&&`-mx-2 rounded-md bg-warn-soft px-2 py-1`),children:r?(0,z.jsx)(`fieldset`,{disabled:!0,className:`m-0 min-w-0 border-0 p-0`,children:i}):i},t)})})]}),(0,z.jsxs)(EX,{value:`json`,className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:[(0,z.jsx)(eJ,{"aria-label":Ra(),value:JSON.stringify(m,null,2),extensions:[KV(),X.lineWrapping],theme:i,editable:l,onChange:t=>{try{let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(za());g({...n,[e.key]:m[e.key]}),v(e=>new Set([...e].filter(e=>e!==`$json`))),w(null)}catch(e){v(e=>new Set([...e,`$json`])),w(e instanceof Error?e.message:String(e))}}}),C&&(0,z.jsx)(`p`,{className:`mt-1 text-[11px] text-err`,children:C})]}),(0,z.jsxs)(EX,{value:`yaml`,className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:[u.yamlError&&(0,z.jsx)(`p`,{className:`mb-2 text-[11.5px] text-err`,children:u.yamlError}),(0,z.jsx)(eJ,{"aria-label":La(),value:u.yaml??`# not written to a file yet`,extensions:[xX(),X.lineWrapping],editable:!1,theme:i})]}),!zv()&&(0,z.jsx)(EX,{value:`history`,className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,z.jsx)(ZX,{table:e.name,recordKey:t,query:A,current:f,keyColumn:e.key,canRestore:l,onRestore:re})})]}),!zv()&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-4 py-2.5 max-md:flex-wrap max-md:pb-[calc(0.625rem+env(safe-area-inset-bottom))]`,children:[(0,z.jsxs)(`span`,{className:`mr-auto flex min-w-0 flex-col text-[11px] text-muted-foreground max-md:basis-full max-md:text-[12px]`,children:[de>0?O?no({from:O,count:de}):Da({count:de}):(0,z.jsx)(QX,{table:e.name,recordKey:t}),ie.isError&&!(ie.error instanceof gv&&ie.error.status===409)&&(0,z.jsx)(`span`,{className:`text-err`,children:ie.error.message})]}),(0,z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":Oa(),disabled:!c,onClick:()=>S(!0),children:(0,z.jsx)(XO,{className:`size-4`})}),(0,z.jsx)(V,{variant:`outline`,size:F?`lg`:`sm`,disabled:!N,onClick:()=>ne(f),children:Fa()}),(0,z.jsx)(V,{size:F?`lg`:`sm`,className:`max-md:flex-1`,disabled:!N||_.size>0||ie.isPending||!c,title:c?void 0:yt(),onClick:oe,children:F?St():ro()})]}),y&&(0,z.jsx)(HZ,{stale:y.fields,current:y.current,draft:m,onClose:()=>b(null),onReload:()=>{ne(y.current),b(null)},onOverwrite:()=>{let e=zJ(f,m);for(let t of y.fields)e.base[t]=y.current[t]??null;b(null),ie.mutate(e)}}),x&&(0,z.jsx)(gk,{open:!0,onOpenChange:e=>{e||(S(!1),ae.reset())},children:(0,z.jsxs)(yk,{children:[(0,z.jsx)(bk,{children:(0,z.jsx)(Ck,{children:Pa({key:t})})}),(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:ja({file:u.file})}),ae.error&&(0,z.jsx)(`p`,{className:`text-[12px] text-err`,children:ae.error.message}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>{S(!1),ae.reset()},children:ht()}),(0,z.jsx)(V,{variant:`destructive`,disabled:ae.isPending,onClick:()=>ae.mutate(),children:vt()})]})]})})]})}function QZ({table:e,recordKey:t,open:n,onOpenChange:r}){let i=Nh(),a=iy(),[o,s]=(0,B.useState)(t),c=W_({mutationFn:()=>Nv.rename(e.name,t,o),onMutate:()=>a({type:`saved`,table:e.name,key:o,at:Date.now()}),onError:()=>a({type:`cancelled`,table:e.name,key:o}),onSuccess:()=>{r(!1),i({to:`/t/$table`,params:{table:e.name},search:e=>({...e,key:o})})}}),l=Ak(c.error);return(0,z.jsx)(gk,{open:n,onOpenChange:r,children:(0,z.jsxs)(yk,{children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{children:hn()}),(0,z.jsx)(wk,{children:e.mode===`files`?pn():mn()})]}),(0,z.jsx)(ak,{"aria-label":sn(),value:o,onChange:e=>s(e.target.value),className:`font-mono`}),l&&(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:l.message}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>r(!1),children:ht()}),(0,z.jsx)(V,{disabled:o===``||o===t||c.isPending,onClick:()=>c.mutate(),children:fn()})]})]})})}var $Z=1,eQ=.9,tQ=.8,nQ=.17,rQ=.1,iQ=.999,aQ=.9999,oQ=.99,sQ=/[\\\/_+.#"@\[\(\{&]/,cQ=/[\\\/_+.#"@\[\(\{&]/g,lQ=/[\s-]/,uQ=/[\s-]/g;function dQ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?$Z:oQ;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=dQ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=$Z:sQ.test(e.charAt(l-1))?(d*=tQ,p=e.slice(i,l-1).match(cQ),p&&i>0&&(d*=iQ**+p.length)):lQ.test(e.charAt(l-1))?(d*=eQ,m=e.slice(i,l-1).match(uQ),m&&i>0&&(d*=iQ**+m.length)):(d*=nQ,i>0&&(d*=iQ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=aQ)),(d<rQ&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=dQ(e,t,n,r,l+1,a+2,o),f*rQ>d&&(d=f*rQ)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function fQ(e){return e.toLowerCase().replace(uQ,` `)}function pQ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,dQ(e,t,fQ(e),fQ(t),0,0,{})}var mQ=`[cmdk-group=""]`,hQ=`[cmdk-group-items=""]`,gQ=`[cmdk-group-heading=""]`,_Q=`[cmdk-item=""]`,vQ=`${_Q}:not([aria-disabled="true"])`,yQ=`cmdk-item-select`,bQ=`data-value`,xQ=(e,t,n)=>pQ(e,t,n),SQ=B.createContext(void 0),CQ=()=>B.useContext(SQ),wQ=B.createContext(void 0),TQ=()=>B.useContext(wQ),EQ=B.createContext(void 0),DQ=B.forwardRef((e,t)=>{let n=VQ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=VQ(()=>new Set),i=VQ(()=>new Map),a=VQ(()=>new Map),o=VQ(()=>new Set),s=zQ(e),{label:c,children:l,value:u,onValueChange:d,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,b=y(),x=y(),S=y(),C=B.useRef(null),w=WQ();BQ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),BQ(()=>{w(6,j)},[]);let T=B.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=B.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??xQ;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(hQ);t?t.appendChild(e.parentElement===t?e:e.closest(`${hQ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${hQ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${mQ}[${bQ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(bQ);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(mQ)?.querySelector(gQ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${_Q}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(vQ)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(bQ))}function ee(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(bQ))}function F(e){let t=M()?.closest(mQ),n;for(;t&&!n;)t=e>0?LQ(t,mQ):RQ(t,mQ),n=t?.querySelector(vQ);n?T.setState(`value`,n.getAttribute(bQ)):ee(e)}let I=()=>P(N().length-1),te=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):ee(1)},ne=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?F(-1):ee(-1)};return B.createElement(f.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:_&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(yQ);t.dispatchEvent(e)}}}}},B.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:qQ},c),KQ(e,e=>B.createElement(wQ.Provider,{value:T},B.createElement(SQ.Provider,{value:E},e))))}),OQ=B.forwardRef((e,t)=>{let n=y(),r=B.useRef(null),i=B.useContext(EQ),a=CQ(),o=zQ(e),s=o.current?.forceMount??i?.forceMount;BQ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=UQ(n,r,[e.value,e.children,r],e.keywords),l=TQ(),u=HQ(e=>e.value&&e.value===c.current),d=HQ(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);B.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(yQ,m),()=>t.removeEventListener(yQ,m)},[d,e.onSelect,e.disabled]);function m(){var e,t;h(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function h(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:g,value:_,onSelect:v,forceMount:b,keywords:x,...S}=e;return B.createElement(f.div,{ref:p(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!g,"aria-selected":!!u,"data-disabled":!!g,"data-selected":!!u,onPointerMove:g||a.getDisablePointerSelection()?void 0:h,onClick:g?void 0:m},e.children)}),kQ=B.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=y(),s=B.useRef(null),c=B.useRef(null),l=y(),u=CQ(),d=HQ(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));BQ(()=>u.group(o),[]),UQ(o,s,[e.value,e.heading,c]);let m=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(f.div,{ref:p(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&B.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),KQ(e,e=>B.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},B.createElement(EQ.Provider,{value:m},e))))}),AQ=B.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=B.useRef(null),a=HQ(e=>!e.search);return!n&&!a?null:B.createElement(f.div,{ref:p(i,t),...r,"cmdk-separator":``,role:`separator`})}),jQ=B.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=TQ(),o=HQ(e=>e.search),s=HQ(e=>e.selectedItemId),c=CQ();return B.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),B.createElement(f.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),MQ=B.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=B.useRef(null),o=B.useRef(null),s=HQ(e=>e.selectedItemId),c=CQ();return B.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),B.createElement(f.div,{ref:p(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},KQ(e,e=>B.createElement(`div`,{ref:p(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),NQ=B.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return B.createElement(Cx,{open:n,onOpenChange:r},B.createElement(Dx,{container:o},B.createElement(kx,{"cmdk-overlay":``,className:i}),B.createElement(Nx,{"aria-label":e.label,"cmdk-dialog":``,className:a},B.createElement(DQ,{ref:t,...s}))))}),PQ=B.forwardRef((e,t)=>HQ(e=>e.filtered.count===0)?B.createElement(f.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),FQ=B.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return B.createElement(f.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},KQ(e,e=>B.createElement(`div`,{"aria-hidden":!0},e)))}),IQ=Object.assign(DQ,{List:MQ,Item:OQ,Input:jQ,Group:kQ,Separator:AQ,Dialog:NQ,Empty:PQ,Loading:FQ});function LQ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function RQ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function zQ(e){let t=B.useRef(e);return BQ(()=>{t.current=e}),t}var BQ=typeof window>`u`?B.useEffect:B.useLayoutEffect;function VQ(e){let t=B.useRef();return t.current===void 0&&(t.current=e()),t}function HQ(e){let t=TQ(),n=()=>e(t.snapshot());return B.useSyncExternalStore(t.subscribe,n,n)}function UQ(e,t,n,r=[]){let i=B.useRef(),a=CQ();return BQ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(bQ,s),i.current=s}),i}var WQ=()=>{let[e,t]=B.useState(),n=VQ(()=>new Map);return BQ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function GQ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function KQ({asChild:e,children:t},n){return e&&B.isValidElement(t)?B.cloneElement(GQ(t),{ref:t.ref},n(t.props.children)):n(t)}var qQ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},JQ=e=>`"${e.replaceAll(`"`,`""`)}"`,YQ=class extends Error{status;extra;constructor(e,t,n={}){super(t),this.status=e,this.extra=n}},XQ=20,ZQ=200;function QQ(e){let t=e.get(`q`)?.trim()??``;if([...t].length<2)throw new YQ(400,`q needs at least 2 characters`);let n=e.get(`per`);if(n===null)return{needle:t,per:XQ};let r=Number(n);if(!Number.isInteger(r))throw new YQ(400,`not an integer: ${n}`);return{needle:t,per:Math.min(ZQ,Math.max(1,r))}}var $Q=[`title`,`name`,`label`];function e$(e){let t=t=>[...e.columns].find(([n,r])=>n!==e.key&&r===`TEXT`&&n.toLowerCase()===t)?.[0];for(let e of $Q){let n=t(e);if(n)return n}return null}var t$=e=>`'${e.replaceAll(`'`,`''`)}'`,n$=e=>`CAST(${JQ(e)} AS TEXT)`,r$=e=>`instr(lower(${n$(e)}), needle.v) > 0`;function i$(e){let t=[e.key,...[...e.columns.keys()].filter(t=>t!==e.key)].filter(t=>e.columns.get(t)!==`BOOLEAN`);if(t.length===0)return null;let n=e=>`CASE ${t.map(t=>`WHEN ${r$(t)} THEN ${e(t)}`).join(` `)} END`,r=e$(e);return`SELECT ${t$(e.name)} AS tbl, ${n$(e.key)} AS k, ${r?n$(r):`NULL`} AS lbl, ${n(t$)} AS col, ${n(n$)} AS val FROM main.${JQ(e.name)}, needle WHERE ${t.map(r$).join(` OR `)}`}function a$(e,t,n){let r=e.map(i$).filter(e=>e!==null);return r.length===0?null:{sql:`WITH needle(v) AS (SELECT lower(?)),
|
|
82
|
-
hits AS (${r.join(` UNION ALL `)}),
|
|
83
|
-
ranked AS (
|
|
84
|
-
SELECT hits.*,
|
|
85
|
-
CASE WHEN lower(k) = needle.v THEN 0
|
|
86
|
-
WHEN substr(lower(k), 1, length(needle.v)) = needle.v THEN 1
|
|
87
|
-
WHEN instr(lower(k), needle.v) > 0 THEN 2
|
|
88
|
-
ELSE 3 END AS grade,
|
|
89
|
-
count(*) OVER (PARTITION BY tbl) AS total
|
|
90
|
-
FROM hits, needle
|
|
91
|
-
)
|
|
92
|
-
SELECT tbl, k, lbl, col, val, grade, total FROM (
|
|
93
|
-
SELECT ranked.*, row_number() OVER (PARTITION BY tbl ORDER BY grade, k) AS n FROM ranked
|
|
94
|
-
) WHERE n <= ? ORDER BY grade, tbl, k`,params:[t,n]}}function o$(e){return{table:String(e.tbl),key:String(e.k),label:e.lbl===null||e.lbl===void 0?null:String(e.lbl),column:String(e.col),value:String(e.val??``),rank:Number(e.grade),total:Number(e.total)}}var s$=30,c$=e=>[...e.trim()].length>=2,l$=e=>e.replace(/^[ \t]*(?:#{1,6}|[-*+]|>)[ \t]+/gm,``).replace(/\s+/g,` `);function u$(e,t,n=s$){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r<0){let t=e.slice(0,n*2);return{before:``,match:``,after:l$(t)+(e.length>t.length?`…`:``)}}let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n);return{before:(a>0?`…`:``)+l$(e.slice(a,r)),match:l$(e.slice(r,i)),after:l$(e.slice(i,o))+(o<e.length?`…`:``)}}function d$(e,t){let n=new Map(e.map(e=>[e,xQ(e.value,t)]));return[...e].sort((e,t)=>e.rank-t.rank||(n.get(t)??0)-(n.get(e)??0)||e.table.localeCompare(t.table)||e.key.localeCompare(t.key))}function f$(e,t){let n=new Map;for(let r of d$(e,t)){let e=n.get(r.table)??{table:r.table,total:r.total,hits:[]};e.hits.push(r),n.set(r.table,e)}return[...n.values()]}function p$(e,t){let n=e.trim();return U_({queryKey:[`search`,n,t],queryFn:()=>Nv.search(n,t),enabled:c$(n),placeholderData:qg})}var m$=`rounded-[3px] bg-tomato-soft text-inherit`;function h$({value:e,needle:t,around:n}){let r=u$(e,t,n);return(0,z.jsxs)(`span`,{children:[r.before,r.match&&(0,z.jsx)(`mark`,{className:m$,children:r.match}),r.after]})}function g$({text:e,needle:t}){return(0,z.jsx)(h$,{value:e,needle:t,around:1/0})}function _$(e,t){let[n,r]=(0,B.useState)(e);return(0,B.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var v$=$h()({beforeLoad:({context:e,matches:t})=>{if(e.app===void 0)return;let n=t.at(-1);if(n?.routeId!==`/app/$page`||n.params.page!==e.app)throw Hf({to:`/app/$page`,params:{page:e.app},replace:!0})}}),y$=Qh({getParentRoute:()=>v$,path:`/t/$table`,validateSearch:e=>({key:typeof e.key==`string`?e.key:void 0,sort:typeof e.sort==`string`?e.sort:void 0,q:typeof e.q==`string`?e.q:void 0,filter:Array.isArray(e.filter)?e.filter:void 0})}),b$=Qh({getParentRoute:()=>v$,path:`/sql`}),x$=Qh({getParentRoute:()=>v$,path:`/sync`}),S$=Qh({getParentRoute:()=>v$,path:`/erd`}),C$=Qh({getParentRoute:()=>v$,path:`/p/$page`}),w$=Qh({getParentRoute:()=>v$,path:`/app/$page`,beforeLoad:({context:e,params:t})=>{if(e.app===void 0)throw Hf({to:`/p/$page`,params:{page:t.page},replace:!0})}}),T$=Qh({getParentRoute:()=>v$,path:`/search`,validateSearch:e=>({q:typeof e.q==`string`?e.q:void 0})}),E$=20;function D$(){let{q:e}=T$.useSearch(),t=Nh(),[n,r]=(0,B.useState)(e??``);(0,B.useEffect)(()=>r(t=>t.trim()===(e??``)?t:e??``),[e]);let i=_$(n.trim(),200);(0,B.useEffect)(()=>{i!==(e??``)&&t({to:`/search`,search:{q:i||void 0},replace:!0})},[i,e,t]);let a=(e??``).trim(),o=c$(a),{data:s,isPending:c,error:l}=p$(a,E$),u=o&&s?f$(s.hits,a):[],d;if(!o)d=(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:yl()});else if(l)d=(0,z.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:l.message});else if(c)d=(0,z.jsx)(`div`,{"aria-busy":`true`,className:`h-24 animate-pulse rounded-md bg-panel-2`});else if(u.length===0)d=(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:vl()});else{let e=u.reduce((e,t)=>e+t.total,0);d=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`text-[15px] text-muted-foreground`,children:`${Sl({count:e})} · ${kl({count:u.length})}`}),u.map(e=>(0,z.jsxs)(`section`,{"aria-label":e.table,className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2.5 px-1`,children:[(0,z.jsx)(GO,{className:`size-[18px] text-muted-foreground`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`text-[19px] font-semibold`,children:e.table}),(0,z.jsx)(`span`,{className:`rounded-full border px-2.5 text-[13px] text-muted-foreground`,children:Sl({count:e.total})}),e.total>e.hits.length&&(0,z.jsx)(Yh,{to:`/t/$table`,params:{table:e.table},search:{q:a},className:`ml-auto text-[15px] font-medium text-tomato hover:underline`,children:El({count:e.total})})]}),(0,z.jsx)(`ul`,{className:`divide-y overflow-hidden rounded-xl border`,children:e.hits.map(t=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(Yh,{to:`/t/$table`,params:{table:e.table},search:{key:t.key},className:`group grid grid-cols-[1fr_auto] items-center gap-x-4 gap-y-0.5 px-4 py-3 outline-none hover:bg-panel focus-visible:bg-panel`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2.5`,children:[(0,z.jsx)(`span`,{className:`truncate text-[17px] font-semibold`,children:(0,z.jsx)(g$,{text:t.label??t.key,needle:a})}),t.label!==null&&(0,z.jsx)(`span`,{className:`shrink-0 font-mono text-[13px] text-muted-foreground`,children:(0,z.jsx)(g$,{text:t.key,needle:a})})]}),(0,z.jsx)(QD,{className:`row-span-2 size-[18px] text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t.value!==t.key&&t.value!==t.label&&(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`shrink-0 rounded-md bg-chip px-1.5 font-mono text-xs text-chip-foreground`,children:t.column}),(0,z.jsx)(`span`,{className:`truncate text-[15px] text-muted-foreground`,children:(0,z.jsx)(h$,{value:t.value,needle:a})})]})]})},t.key))})]},e.table))]})}return(0,z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-5 overflow-auto px-4 py-6 md:px-8`,children:[(0,z.jsx)(`h1`,{className:`sr-only`,children:Al()}),(0,z.jsxs)(`label`,{className:`flex items-center gap-3 rounded-xl border bg-panel px-4 focus-within:ring-2 focus-within:ring-ring`,children:[(0,z.jsx)(IO,{className:`size-[22px] shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,z.jsx)(`input`,{type:`search`,"aria-label":Al(),placeholder:Cl(),value:n,onChange:e=>r(e.target.value),autoFocus:!0,className:`h-14 w-full bg-transparent text-[19px] outline-none placeholder:text-muted-foreground`})]}),d]})}var O$=e=>{let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},k$=()=>document.documentElement.dataset.theme,A$=({...e})=>{let t=(0,B.useSyncExternalStore)(O$,k$);return(0,z.jsx)(gee,{theme:t,className:`toaster group`,icons:{success:(0,z.jsx)(Qte,{className:`size-4`}),info:(0,z.jsx)(rne,{className:`size-4`}),warning:(0,z.jsx)(QO,{className:`size-4`}),error:(0,z.jsx)(xO,{className:`size-4`}),loading:(0,z.jsx)(sne,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`,pointerEvents:`auto`},...e})},j$=`yamlite-ai`,M$={};function N$(){try{return JSON.parse(localStorage.getItem(j$)??`{}`)}catch{return{}}}function P$(e){try{localStorage.setItem(j$,JSON.stringify(e))}catch{}}function F$(){let e=ey();return zv()?null:e.data?.ai?.providers??null}function I$(){let e=ey(),t=zv()?null:e.data?.ai;return t?{viewerKeys:t.viewerKeys,settingsUrl:t.settingsUrl,unavailable:t.unavailable??!1}:null}function L$(e){return M$[e]??N$().keys?.[e]??``}function R$(e){return!!N$().keys?.[e]}function z$(e,{viewerKeys:t}={viewerKeys:!0}){let n=N$(),r=e.find(e=>e.id===n.provider)??e.find(e=>e.hasKey)??e[0];if(!r)return null;let i=r.id===n.provider&&n.model?n.model:void 0,a=i&&(!r.fixedModels||r.models.includes(i))?i:r.models[0],o=t?L$(r.id):``;return o||r.hasKey?{provider:r.id,model:a,apiKey:o}:null}function B$(e,t){let n={...N$().keys};delete n[e.provider],delete M$[e.provider],e.apiKey&&(t?n[e.provider]=e.apiKey:M$[e.provider]=e.apiKey),P$({provider:e.provider,model:e.model,keys:n})}var V$={get:()=>Sv(`GET`,`/api/ai/instructions`),save:e=>Sv(`PUT`,`/api/ai/instructions`,e)},H$={items:[],busy:!1,closed:!1};function U$(e,t){let n=e.items;switch(t.type){case`user`:return{...e,items:[...n,{kind:`user`,text:t.text}]};case`text`:{let r=n.at(-1);return r?.kind===`agent`?{...e,items:[...n.slice(0,-1),{...r,text:r.text+t.text}]}:{...e,items:[...n,{kind:`agent`,text:t.text}]}}case`source`:{let r=n.at(-1),i={url:t.url,...t.title?{title:t.title}:{}};return r?.kind!==`agent`&&r?.kind!==`tool`?{...e,items:[...n,{kind:`agent`,text:``,sources:[i]}]}:r.sources?.some(e=>e.url===t.url)?e:{...e,items:[...n.slice(0,-1),{...r,sources:[...r.sources??[],i]}]}}case`tool`:{let r=n.findIndex(e=>e.kind===`tool`&&e.id===t.id);if(r<0){let r={kind:`tool`,id:t.id,title:t.title??t.id,status:t.status??null,...t.input===void 0?{}:{input:t.input}};return{...e,items:[...n,r]}}let i={...n[r],...t.title?{title:t.title}:{},...t.status===void 0?{}:{status:t.status??null},...t.input===void 0?{}:{input:t.input}};return{...e,items:n.map((e,t)=>t===r?i:e)}}case`proposal`:{let r=n.findIndex(e=>e.kind===`proposal`&&e.proposal.id===t.proposal.id),i={kind:`proposal`,proposal:t.proposal};return{...e,items:r<0?[...n,i]:n.map((e,t)=>t===r?i:e)}}case`busy`:return{...e,busy:t.busy};case`error`:return{...e,items:[...n,{kind:`error`,message:t.code===`auth`?ce():t.message,...t.code?{code:t.code}:{}}]};case`closed`:return{...e,busy:!1,closed:!0}}}var W$=encodeURIComponent,G$=e=>`/api/agent/conversations/${W$(e)}`,K$={conversations:()=>Sv(`GET`,`/api/agent/conversations`),start:e=>Sv(`POST`,`/api/agent/conversations`,{provider:e.provider,model:e.model,...e.apiKey?{apiKey:e.apiKey}:{}}),prompt:(e,t)=>Sv(`POST`,`${G$(e)}/prompt`,{text:t}),cancel:e=>Sv(`POST`,`${G$(e)}/cancel`),proposals:()=>Sv(`GET`,`/api/agent/proposals`),apply:e=>Sv(`POST`,`/api/agent/proposals/${W$(e)}/apply`),discard:e=>Sv(`POST`,`/api/agent/proposals/${W$(e)}/discard`)};function q$(e,t){let n=new Map;for(let r of e)if(r.status===`pending`)for(let e of r.rows)e.table===t&&n.set(e.key,{op:e.op,before:e.before,after:e.after,changed:e.changed});return n}var J$=2,Y$=[`agent-proposals`],X$=[`agent-conversations`],Z$=new class{make;state=H$;id=null;source=null;listeners=new Set;constructor(e=e=>hv().eventSource(e)){this.make=e}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}async start(e){let{id:t}=await K$.start(e);this.open(t)}open(e){$v.invalidateQueries({queryKey:X$}),this.source?.close(),this.id=e,this.set(H$);let t=this.make(`${G$(e)}/events`);this.source=t;let n=!1;t.addEventListener(`open`,()=>{this.source===t&&(n&&this.set(H$),n=!0)}),t.addEventListener(`agent`,e=>{if(this.source!==t||!(e instanceof MessageEvent)||typeof e.data!=`string`)return;let n;try{n=JSON.parse(e.data)}catch{return}n.type===`proposal`&&$v.invalidateQueries({queryKey:Y$}),this.set(U$(this.state,n)),n.type===`closed`&&this.disconnect(t)}),t.addEventListener(`error`,()=>{if(this.source===t&&t.readyState===J$&&(this.disconnect(t),!this.state.closed)){let e=U$(this.state,{type:`error`,message:de()});this.set(U$(e,{type:`closed`}))}})}async send(e){this.id&&await K$.prompt(this.id,e)}async stop(){this.id&&await K$.cancel(this.id)}async reset(){$v.invalidateQueries({queryKey:X$}),this.source?.close(),this.source=null,this.id=null,this.set(H$)}disconnect(e){e.close(),this.source===e&&(this.source=null)}set(e){this.state=e;for(let e of this.listeners)e()}},Q$=()=>(0,B.useSyncExternalStore)(e=>Z$.subscribe(e),()=>Z$.state);function $$(){let e=F$()!==null;return U_({queryKey:Y$,queryFn:K$.proposals,enabled:e}).data?.proposals??[]}function e1(e){let t=U_({queryKey:X$,queryFn:K$.conversations,enabled:e,staleTime:0});return{conversations:t.data?.conversations??[],loading:t.isPending}}var t1=()=>$v.invalidateQueries({queryKey:Y$}),n1=!1,r1=new Set,i1=e=>{n1=e;for(let e of r1)e()},a1={open:()=>i1(!0),close:()=>i1(!1),toggle:()=>i1(!n1)},o1=()=>(0,B.useSyncExternalStore)(e=>(r1.add(e),()=>r1.delete(e)),()=>n1);function s1(){}function c1(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var l1=/[$_\p{ID_Start}]/u,u1=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,d1=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,f1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m1={};function h1(e){return e?l1.test(String.fromCodePoint(e)):!1}function g1(e,t){let n=(t||m1).jsx?d1:u1;return e?n.test(String.fromCodePoint(e)):!1}function _1(e,t){return((t||m1).jsx?p1:f1).test(e)}var v1=/[ \t\n\f\r]/g;function y1(e){return typeof e==`object`?e.type===`text`&&b1(e.value):b1(e)}function b1(e){return e.replace(v1,``)===``}var x1=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};x1.prototype.normal={},x1.prototype.property={},x1.prototype.space=void 0;function S1(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new x1(n,r,t)}function C1(e){return e.toLowerCase()}var w1=class{constructor(e,t){this.attribute=t,this.property=e}};w1.prototype.attribute=``,w1.prototype.booleanish=!1,w1.prototype.boolean=!1,w1.prototype.commaOrSpaceSeparated=!1,w1.prototype.commaSeparated=!1,w1.prototype.defined=!1,w1.prototype.mustUseProperty=!1,w1.prototype.number=!1,w1.prototype.overloadedBoolean=!1,w1.prototype.property=``,w1.prototype.spaceSeparated=!1,w1.prototype.space=void 0;var T1=e({boolean:()=>Z,booleanish:()=>D1,commaOrSpaceSeparated:()=>j1,commaSeparated:()=>A1,number:()=>Q,overloadedBoolean:()=>O1,spaceSeparated:()=>k1}),E1=0,Z=M1(),D1=M1(),O1=M1(),Q=M1(),k1=M1(),A1=M1(),j1=M1();function M1(){return 2**++E1}var N1=Object.keys(T1),P1=class extends w1{constructor(e,t,n,r){let i=-1;if(super(e,t),F1(this,`space`,r),typeof n==`number`)for(;++i<N1.length;){let e=N1[i];F1(this,N1[i],(n&T1[e])===T1[e])}}};P1.prototype.defined=!0;function F1(e,t,n){n&&(e[t]=n)}function I1(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new P1(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[C1(r)]=r,n[C1(a.attribute)]=r}return new x1(t,n,e.space)}var L1=I1({properties:{ariaActiveDescendant:null,ariaAtomic:D1,ariaAutoComplete:null,ariaBusy:D1,ariaChecked:D1,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:k1,ariaCurrent:null,ariaDescribedBy:k1,ariaDetails:null,ariaDisabled:D1,ariaDropEffect:k1,ariaErrorMessage:null,ariaExpanded:D1,ariaFlowTo:k1,ariaGrabbed:D1,ariaHasPopup:null,ariaHidden:D1,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:k1,ariaLevel:Q,ariaLive:null,ariaModal:D1,ariaMultiLine:D1,ariaMultiSelectable:D1,ariaOrientation:null,ariaOwns:k1,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:D1,ariaReadOnly:D1,ariaRelevant:null,ariaRequired:D1,ariaRoleDescription:k1,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:D1,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function R1(e,t){return t in e?e[t]:t}function z1(e,t){return R1(e,t.toLowerCase())}var B1=I1({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:A1,acceptCharset:k1,accessKey:k1,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alpha:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:k1,autoFocus:Z,autoPlay:Z,blocking:k1,capture:null,charSet:null,checked:Z,cite:null,className:k1,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:D1,controls:Z,controlsList:k1,coords:Q|A1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:O1,draggable:D1,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:k1,height:Q,hidden:O1,high:Q,href:null,hrefLang:null,htmlFor:k1,httpEquiv:k1,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:k1,itemRef:k1,itemScope:Z,itemType:k1,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:Q,pattern:null,ping:k1,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:k1,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:k1,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootCustomElementRegistry:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shadowRootSerializable:Z,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:D1,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:D1,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:k1,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:D1,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Z,disablePictureInPicture:Z,disableRemotePlayback:Z,exportParts:A1,part:k1,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:z1}),V1=I1({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,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`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,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`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,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`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:j1,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:k1,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:A1,g2:A1,glyphName:A1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:j1,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:k1,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:j1,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:j1,rev:j1,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:j1,requiredFeatures:j1,requiredFonts:j1,requiredFormats:j1,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:j1,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:j1,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:j1,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:R1}),H1=I1({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),U1=I1({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:z1}),W1=I1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),G1={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},K1=/[A-Z]/g,q1=/-[a-z]/g,J1=/^data[-\w.:]+$/i;function Y1(e,t){let n=C1(t),r=t,i=w1;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&J1.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(q1,Z1);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!q1.test(e)){let n=e.replace(K1,X1);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=P1}return new i(r,t)}function X1(e){return`-`+e.toLowerCase()}function Z1(e){return e.charAt(1).toUpperCase()}var Q1=S1([L1,B1,H1,U1,W1],`html`),$1=S1([L1,V1,H1,U1,W1],`svg`);function e0(e){return e.join(` `).trim()}var t0=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
95
|
-
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),n0=n(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(t0());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),r0=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),i0=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n0()),i=r0();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),a0=s0(`end`),o0=s0(`start`);function s0(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function c0(e){let t=o0(e),n=a0(e);if(t&&n)return{start:t,end:n}}function l0(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?d0(e.position):`start`in e||`end`in e?d0(e):`line`in e||`column`in e?u0(e):``}function u0(e){return f0(e&&e.line)+`:`+f0(e&&e.column)}function d0(e){return u0(e&&e.start)+`-`+u0(e&&e.end)}function f0(e){return e&&typeof e==`number`?e:1}var p0=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=l0(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};p0.prototype.file=``,p0.prototype.name=``,p0.prototype.reason=``,p0.prototype.message=``,p0.prototype.stack=``,p0.prototype.column=void 0,p0.prototype.line=void 0,p0.prototype.ancestors=void 0,p0.prototype.cause=void 0,p0.prototype.fatal=void 0,p0.prototype.place=void 0,p0.prototype.ruleId=void 0,p0.prototype.source=void 0;var m0=t(i0(),1),h0={}.hasOwnProperty,g0=new Map,_0=/[A-Z]/g,v0=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),y0=new Set([`td`,`th`]),b0=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function x0(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=M0(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=j0(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?$1:Q1,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=S0(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function S0(e,t,n){if(t.type===`element`)return C0(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return w0(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return E0(e,t,n);if(t.type===`mdxjsEsm`)return T0(e,t);if(t.type===`root`)return D0(e,t,n);if(t.type===`text`)return O0(e,t)}function C0(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=$1,e.schema=i),e.ancestors.push(t);let a=R0(e,t.tagName,!1),o=N0(e,t),s=F0(e,t);return v0.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!y1(e)})),k0(e,o,a,t),A0(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function w0(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}z0(e,t.position)}function T0(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);z0(e,t.position)}function E0(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=$1,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:R0(e,t.name,!0),o=P0(e,t),s=F0(e,t);return k0(e,o,a,t),A0(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function D0(e,t,n){let r={};return A0(r,F0(e,t)),e.create(t,e.Fragment,r,n)}function O0(e,t){return t.value}function k0(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function A0(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function j0(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function M0(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=o0(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function N0(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&h0.call(t.properties,i)){let a=I0(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&y0.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function P0(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else z0(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else z0(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function F0(e,t){let n=[],r=-1,i=e.passKeys?new Map:g0;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=S0(e,a,o);s!==void 0&&n.push(s)}return n}function I0(e,t,n){let r=Y1(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?c1(n):e0(n)),r.property===`style`){let t=typeof n==`object`?n:L0(e,String(n));return e.stylePropertyNameCase===`css`&&(t=B0(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?G1[r.property]||r.property:r.attribute,n]}}function L0(e,t){try{return(0,m0.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new p0("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=b0+`#cannot-parse-style-attribute`,r}}function R0(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=_1(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=_1(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return h0.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);z0(e)}function z0(e,t){let n=new p0("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=b0+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function B0(e){let t={},n;for(n in e)h0.call(e,n)&&(t[V0(n)]=e[n]);return t}function V0(e){let t=e.replace(_0,H0);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function H0(e){return`-`+e.toLowerCase()}var U0={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},W0={};function G0(e,t){let n=t||W0;return K0(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function K0(e,t,n){if(J0(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return q0(e.children,t,n)}return Array.isArray(e)?q0(e,t,n):``}function q0(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=K0(e[i],t,n);return r.join(``)}function J0(e){return!!(e&&typeof e==`object`)}var Y0=document.createElement(`i`);function X0(e){let t=`&`+e+`;`;Y0.innerHTML=t;let n=Y0.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Z0(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Q0(e,t){return e.length>0?(Z0(e,e.length,0,t),e):t}var $0={}.hasOwnProperty;function e2(e){let t={},n=-1;for(;++n<e.length;)t2(t,e[n]);return t}function t2(e,t){let n;for(n in t){let r=($0.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){$0.call(r,a)||(r[a]=[]);let e=i[a];n2(r[a],Array.isArray(e)?e:e?[e]:[])}}}function n2(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Z0(e,0,0,r)}function r2(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function i2(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var a2=g2(/[A-Za-z]/),o2=g2(/[\dA-Za-z]/),s2=g2(/[#-'*+\--9=?A-Z^-~]/);function c2(e){return e!==null&&(e<32||e===127)}var l2=g2(/\d/),u2=g2(/[\dA-Fa-f]/),d2=g2(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function f2(e){return e!==null&&(e<0||e===32)}function p2(e){return e===-2||e===-1||e===32}var m2=g2(/\p{P}|\p{S}/u),h2=g2(/\s/);function g2(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function _2(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&o2(e.charCodeAt(n+1))&&o2(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function v2(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return p2(r)?(e.enter(n),s(r)):t(r)}function s(r){return p2(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function y2(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&p2(t)?(e.enter(r),c(t)):l(t)}function c(t){return p2(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var b2={tokenize:x2};function x2(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),v2(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var S2=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){C2(this,e,t,n,!1)}addBefore(e,t,n){C2(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function C2(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var w2={tokenize:E2},T2={tokenize:D2};function E2(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new S2;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(T2,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(T2,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return $(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new S2;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function D2(e,t,n){return v2(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function O2(e){if(e===null||f2(e)||h2(e))return 1;if(m2(e))return 2}function k2(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var A2={name:`attention`,resolveAll:j2,tokenize:M2};function j2(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};N2(o,-a),N2(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Q0(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Q0(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Q0(r,k2(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Q0(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Q0(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),Z0(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function M2(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=O2(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=O2(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function N2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var P2={name:`autolink`,tokenize:F2};function F2(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return a2(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||o2(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||o2(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||c2(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):s2(t)?(e.consume(t),l):n(t)}function u(e){return o2(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||o2(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var I2={partial:!0,tokenize:L2};function L2(e,t,n){return r;function r(t){return p2(t)?v2(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var R2={continuation:{tokenize:B2},exit:V2,name:`blockQuote`,tokenize:z2};function z2(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return p2(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function B2(e,t,n){let r=this;return i;function i(t){return p2(t)?v2(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(R2,t,n)(r)}}function V2(e){e.exit(`blockQuote`)}var H2={name:`characterEscape`,tokenize:U2};function U2(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return d2(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var W2={name:`characterReference`,tokenize:G2};function G2(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=o2,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=u2,u):(e.enter(`characterReferenceValue`),a=7,o=l2,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===o2&&!X0(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var K2={partial:!0,tokenize:q2};function q2(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var J2={concrete:!0,name:`codeFenced`,tokenize:Y2};function Y2(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),p2(t)?v2(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(K2,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):p2(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),v2(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&p2(t)?v2(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(K2,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),p2(t)?v2(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),p2(t)?v2(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var X2={name:`codeIndented`,tokenize:Q2},Z2={partial:!0,tokenize:$2};function Q2(e,t,n){return r;function r(t){return e.enter(`codeIndented`),y2(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):$(t)?e.attempt(Z2,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||$(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function $2(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):$(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):y2(e,t,a,`linePrefix`,4,4)(o)}function a(e){return $(e)?i(e):n(e)}}var e4={name:`codeText`,previous:n4,resolve:t4,tokenize:r4};function t4(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function n4(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function r4(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||$(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var i4=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&a4(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),a4(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),a4(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);a4(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);a4(this.left,t.reverse())}}}};function a4(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function o4(e){let t={},n=-1,r,i,a,o,s,c,l,u=new i4(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,s4(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Z0(e,0,1/0,u.slice(0)),!l}function s4(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var c4={resolve:u4,tokenize:d4},l4={partial:!0,tokenize:f4};function u4(e){return o4(e),e}function d4(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):$(t)?e.check(l4,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function f4(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),v2(e,a,`linePrefix`)}function a(i){if(i===null||$(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function p4(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||c2(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||$(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||f2(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||c2(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function m4(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):$(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!p2(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function h4(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),v2(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function g4(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):p2(i)?v2(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var _4={name:`definition`,tokenize:y4},v4={partial:!0,tokenize:b4};function y4(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return m4.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=i2(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return f2(t)?g4(e,l)(t):l(t)}function l(t){return p4(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(v4,d,d)(t)}function d(t){return p2(t)?v2(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function b4(e,t,n){return r;function r(t){return f2(t)?g4(e,i)(t):n(t)}function i(t){return h4(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return p2(t)?v2(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var x4={name:`hardBreakEscape`,tokenize:S4};function S4(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var C4={name:`headingAtx`,resolve:w4,tokenize:T4};function w4(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};Z0(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function T4(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||f2(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):p2(n)?v2(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||f2(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var E4=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),D4=[`pre`,`script`,`style`,`textarea`],O4={concrete:!0,name:`htmlFlow`,resolveTo:A4,tokenize:j4},k4={partial:!0,tokenize:M4};function A4(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function j4(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):a2(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):a2(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return a2(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||f2(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&D4.includes(l)?(i=1,r.interrupt?t(s):O(s)):E4.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||o2(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return p2(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||a2(t)?(e.consume(t),b):p2(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||o2(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):p2(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):p2(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||f2(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||p2(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):p2(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),ee):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(k4,te,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(K2,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),F):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return D4.includes(n)?(e.consume(t),I):O(t)}return a2(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),F):O(t)}function I(t){return t===null||$(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function M4(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(I2,t,n)}}var N4={name:`htmlText`,tokenize:P4};function P4(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):a2(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):a2(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):$(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):$(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):$(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return a2(t)?(e.consume(t),S):n(t)}function S(t){return t===45||o2(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,N(t)):p2(t)?(e.consume(t),C):M(t)}function w(t){return t===45||o2(t)?(e.consume(t),w):t===47||t===62||f2(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||a2(t)?(e.consume(t),E):$(t)?(o=T,N(t)):p2(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||o2(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,N(t)):p2(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):$(t)?(o=O,N(t)):p2(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):$(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||f2(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||f2(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return p2(t)?v2(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var F4={name:`labelEnd`,resolveAll:z4,resolveTo:B4,tokenize:V4},I4={tokenize:H4},L4={tokenize:U4},R4={tokenize:W4};function z4(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Z0(e,0,e.length,n),e}function B4(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Q0(o,e.slice(i+1,i+r+3)),o=Q0(o,[[`enter`,l,t]]),o=Q0(o,k2(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Q0(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Q0(o,e.slice(a+1)),o=Q0(o,[[`exit`,s,t]]),Z0(e,i,e.length,o),e}function V4(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(i2(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(I4,u,o?u:d)(t):t===91?e.attempt(L4,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(R4,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function H4(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return f2(t)?g4(e,a)(t):a(t)}function a(t){return t===41?u(t):p4(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return f2(t)?g4(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?h4(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return f2(t)?g4(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function U4(e,t,n){let r=this;return i;function i(t){return m4.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(i2(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function W4(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var G4={name:`labelStartImage`,resolveAll:F4.resolveAll,tokenize:K4};function K4(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var q4={name:`labelStartLink`,resolveAll:F4.resolveAll,tokenize:J4};function J4(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Y4={name:`lineEnding`,tokenize:X4};function X4(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),v2(e,t,`linePrefix`)}}var Z4={name:`thematicBreak`,tokenize:Q4};function Q4(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),p2(t)?v2(e,s,`whitespace`)(t):s(t))}}var $4={continuation:{tokenize:r3},exit:a3,name:`list`,tokenize:n3},e3={partial:!0,tokenize:o3},t3={partial:!0,tokenize:i3};function n3(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:l2(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Z4,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return l2(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(I2,r.interrupt?n:u,e.attempt(e3,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return p2(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function r3(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(I2,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,v2(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!p2(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(t3,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,v2(e,e.attempt($4,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function i3(e,t,n){let r=this;return v2(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function a3(e){e.exit(this.containerState.type)}function o3(e,t,n){let r=this;return v2(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!p2(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var s3={name:`setextUnderline`,resolveTo:c3,tokenize:l3};function c3(e,t){let n=new S2,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function l3(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),p2(t)?v2(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var u3={tokenize:d3};function d3(e){let t=this,n=e.attempt(I2,r,e.attempt(this.parser.constructs.flowInitial,i,v2(e,e.attempt(this.parser.constructs.flow,i,e.attempt(c4,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var f3={resolveAll:g3()},p3=h3(`string`),m3=h3(`text`);function h3(e){return{resolveAll:g3(e===`text`?_3:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function g3(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function _3(e,t){let n=new S2,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var v3=e({attentionMarkers:()=>E3,contentInitial:()=>b3,disable:()=>D3,document:()=>y3,flow:()=>S3,flowInitial:()=>x3,insideSpan:()=>T3,string:()=>C3,text:()=>w3}),y3={42:$4,43:$4,45:$4,48:$4,49:$4,50:$4,51:$4,52:$4,53:$4,54:$4,55:$4,56:$4,57:$4,62:R2},b3={91:_4},x3={[-2]:X2,[-1]:X2,32:X2},S3={35:C4,42:Z4,45:[s3,Z4],60:O4,61:s3,95:Z4,96:J2,126:J2},C3={38:W2,92:H2},w3={[-5]:Y4,[-4]:Y4,[-3]:Y4,33:G4,38:W2,42:A2,60:[P2,N4],91:q4,92:[x4,H2],93:F4,95:A2,96:e4},T3={null:[A2,f3]},E3={null:[42,95]},D3={null:[]};function O3(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Q0(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=k2(a,l.events,l),l.events):[]}function f(e,t){return A3(p(e),t)}function p(e){return k3(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){$(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Z0(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function k3(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function A3(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
96
|
-
`;break;case-3:o=`\r
|
|
97
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function j3(e){let t={constructs:e2([v3,...(e||{}).extensions||[]]),content:n(b2),defined:[],document:n(w2),flow:n(u3),lazy:{},string:n(p3),text:n(m3)};return t;function n(e){return n;function n(n){return O3(t,e,n)}}}function M3(e){for(;!o4(e););return e}var N3=/[\0\t\n\r]/g;function P3(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){N3.lastIndex=c;let n=N3.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var F3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I3(e){return e.replace(F3,L3)}function L3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return r2(n.slice(t?2:1),t?16:10)}return X0(n)||e}var R3={}.hasOwnProperty;function z3(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),B3(n)(M3(j3(n).document().write(P3()(e,t,!0))))}function B3(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(ve),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(me),blockQuote:o(ue),characterEscape:E,characterReference:E,codeFenced:o(de),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(de,s),codeText:o(fe,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(pe),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(L),hardBreakEscape:o(he),hardBreakTrailing:o(he),htmlFlow:o(ge,s),htmlFlowData:E,htmlText:o(ge,s),htmlTextData:E,image:o(_e),label:s,link:o(ve),listItem:o(be),listItemValue:p,listOrdered:o(ye,f),listUnordered:o(ye),paragraph:o(xe),reference:re,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(me),strong:o(Se),thematicBreak:o(we)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(P),label:F,labelText:ee,lineEnding:O,link:l(N),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ie,resourceDestinationString:I,resourceTitleString:te,resource:ne,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};H3(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),R3.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||W3).call(o,void 0,e[0])}for(r.position={start:V3(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:V3(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:V3(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+l0({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||W3).call(this,e,r[0])),n.position.end=V3(e.end)}function d(){return G0(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=i2(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:V3(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=V3(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=V3(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=I3(t),n.identifier=i2(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=i2(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=r2(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=X0(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=V3(e.end)}function ce(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[],position:void 0}}function de(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function fe(){return{type:`inlineCode`,value:``,position:void 0}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function L(){return{type:`emphasis`,children:[],position:void 0}}function me(){return{type:`heading`,depth:0,children:[],position:void 0}}function he(){return{type:`break`,position:void 0}}function ge(){return{type:`html`,value:``,position:void 0}}function _e(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function ve(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function xe(){return{type:`paragraph`,children:[],position:void 0}}function Se(){return{type:`strong`,children:[],position:void 0}}function Ce(){return{type:`text`,value:``,position:void 0}}function we(){return{type:`thematicBreak`,position:void 0}}}function V3(e){return{line:e.line,column:e.column,offset:e.offset}}function H3(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?H3(e,r):U3(e,r)}}function U3(e,t){let n;for(n in t)if(R3.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function W3(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+l0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+l0({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+l0({start:t.start,end:t.end})+`) is still open`)}function G3(e){let t=this;t.parser=n;function n(n){return z3(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function K3(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function q3(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
98
|
-
`}]}function J3(e,t){let n=t.value?t.value+`
|
|
99
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Y3(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X3(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z3(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=_2(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Q3(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $3(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function e6(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function t6(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return e6(e,t);let i={src:_2(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function n6(e,t){let n={src:_2(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function r6(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function i6(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return e6(e,t);let i={href:_2(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function a6(e,t){let n={href:_2(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function o6(e,t,n){let r=e.all(t),i=n?s6(n):c6(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
100
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
101
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function s6(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=c6(n[r])}return t}function c6(e){return e.spread??e.children.length>1}function l6(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function u6(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d6(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function f6(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function p6(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=o0(t.children[1]),o=a0(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function m6(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function h6(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var g6=9,_6=32;function v6(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(y6(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(y6(t.slice(i),i>0,!1)),a.join(``)}function y6(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===g6||t===_6;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===g6||t===_6;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function b6(e,t){let n={type:`text`,value:v6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function x6(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var S6={blockquote:K3,break:q3,code:J3,delete:Y3,emphasis:X3,footnoteReference:Z3,heading:Q3,html:$3,imageReference:t6,image:n6,inlineCode:r6,linkReference:i6,link:a6,listItem:o6,list:l6,paragraph:u6,root:d6,strong:f6,table:p6,tableCell:h6,tableRow:m6,text:b6,thematicBreak:x6,toml:C6,yaml:C6,definition:C6,footnoteDefinition:C6};function C6(){}var{defineProperty:w6}=Object,T6=typeof self==`object`?self:globalThis,E6=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new T6[e](t)},D6=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?w6(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof T6[e]==`function`?E6(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(E6(a,o),i)};return r},O6=e=>D6(new Map,e)(0),k6=``,{toString:A6}={},{keys:j6,is:M6}=Object,N6=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=A6.call(e).slice(8,-1);switch(n){case`Array`:return[1,k6];case`Object`:return[2,k6];case`Date`:return[3,k6];case`RegExp`:return[4,k6];case`Map`:return[5,k6];case`Set`:return[6,k6];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},P6=([e,t])=>e===0&&(t===`function`||t===`symbol`),F6=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=N6(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&M6(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of j6(o))(e||!P6(N6(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?k6:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(P6(N6(n))||P6(N6(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!P6(N6(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},I6=(e,{json:t,lossy:n}={})=>{let r=[];return F6(!(t||n),!!t,new Map,r)(e),r},L6=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?O6(I6(e,t)):structuredClone(e):(e,t)=>O6(I6(e,t));function R6(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function z6(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function B6(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||R6,r=e.options.footnoteBackLabel||z6,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=_2(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...L6(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
102
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
103
|
-
`}]}}var V6=(function(e){if(e==null)return K6;if(typeof e==`function`)return G6(e);if(typeof e==`object`)return Array.isArray(e)?H6(e):U6(e);if(typeof e==`string`)return W6(e);throw Error(`Expected function, string, or object as test`)});function H6(e){let t=[],n=-1;for(;++n<e.length;)t[n]=V6(e[n]);return G6(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function U6(e){let t=e;return G6(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function W6(e){return G6(t);function t(t){return t&&t.type===e}}function G6(e){return t;function t(t,n,r){return!!(q6(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function K6(){return!0}function q6(e){return typeof e==`object`&&!!e&&`type`in e}function J6(e){return e}var Y6=[];function X6(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=V6(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+J6(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Y6,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Z6(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Z6(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Y6:[e]}function Q6(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),X6(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var $6={}.hasOwnProperty,e8={};function t8(e,t){let n=t||e8,r=new Map,i=new Map,a={all:s,applyData:r8,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...S6,...n.handlers},one:o,options:n,patch:n8,wrap:a8};return Q6(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if($6.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=L6(n);return r.children=a.all(e),r}return L6(e)}return(a.options.unknownHandler||i8)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=o8(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=o8(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function n8(e,t){e.position&&(t.position=c0(e))}function r8(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,L6(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function i8(e,t){let n=t.data||{},r=`value`in t&&!($6.call(n,`hProperties`)||$6.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a8(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
104
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
105
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
106
|
-
`}),n}function o8(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function s8(e,t){let n=t8(e,t),r=n.one(e,void 0),i=B6(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
107
|
-
`},i)),a}function c8(e,t){return e&&`run`in e?async function(n,r){let i=s8(n,{file:r,...t});await e.run(i,r)}:function(n,r){return s8(n,{file:r,...e||t})}}function l8(e){if(e)throw e}var u8=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function d8(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function f8(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?p8(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function p8(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var m8={basename:h8,dirname:Zre,extname:Qre,join:$re,sep:`/`};function h8(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);g8(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Zre(e){if(g8(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Qre(e){g8(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function $re(...e){let t=-1,n;for(;++t<e.length;)g8(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:eie(n)}function eie(e){g8(e);let t=e.codePointAt(0)===47,n=tie(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function tie(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function g8(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var nie={cwd:rie};function rie(){return`/`}function _8(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function iie(e){if(typeof e==`string`)e=new URL(e);else if(!_8(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return aie(e)}function aie(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var v8=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],y8=class{constructor(e){let t;t=e?_8(e)?{path:e}:typeof e==`string`||oie(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:nie.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<v8.length;){let e=v8[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)v8.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?m8.basename(this.path):void 0}set basename(e){x8(e,`basename`),b8(e,`basename`),this.path=m8.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?m8.dirname(this.path):void 0}set dirname(e){S8(this.basename,`dirname`),this.path=m8.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?m8.extname(this.path):void 0}set extname(e){if(b8(e,`extname`),S8(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=m8.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){_8(e)&&(e=iie(e)),x8(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?m8.basename(this.path,this.extname):void 0}set stem(e){x8(e,`stem`),b8(e,`stem`),this.path=m8.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new p0(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function b8(e,t){if(e&&e.includes(m8.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+m8.sep+"`")}function x8(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function S8(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function oie(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sie=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),C8=t(u8(),1),cie={}.hasOwnProperty,lie=new class e extends sie{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=f8()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,C8.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(E8(`data`,this.frozen),this.namespace[e]=t,this):cie.call(this.namespace,e)&&this.namespace[e]||void 0:e?(E8(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=k8(e),n=this.parser||this.Parser;return w8(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),w8(`process`,this.parser||this.Parser),T8(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=k8(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);die(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),w8(`processSync`,this.parser||this.Parser),T8(`processSync`,this.compiler||this.Compiler),this.process(e,r),O8(`processSync`,`process`,t),n;function r(e,r){t=!0,l8(e),n=r}}run(e,t,n){D8(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=k8(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),O8(`runSync`,`run`,n),r;function i(e,t){l8(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=k8(t),r=this.compiler||this.Compiler;return T8(`stringify`,r),D8(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(E8(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,C8.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];d8(o)&&d8(r)&&(r=(0,C8.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function w8(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function T8(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function E8(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function D8(e){if(!d8(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function O8(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function k8(e){return uie(e)?e:new y8(e)}function uie(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function die(e){return typeof e==`string`||fie(e)}function fie(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var A8=[],j8={allowDangerousHtml:!0},pie=/^(https?|ircs?|mailto|xmpp)$/i,mie=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function M8(e){let t=hie(e),n=gie(e);return _ie(t.runSync(t.parse(n),n),e)}function hie(e){let t=e.rehypePlugins||A8,n=e.remarkPlugins||A8,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...j8}:j8;return lie().use(G3).use(n).use(c8,r).use(t)}function gie(e){let t=e.children||``,n=new y8;return typeof t==`string`?n.value=t:``+t,n}function _ie(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||vie;for(let e of mie)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Q6(e,l),x0(e,{Fragment:z.Fragment,components:i,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in U0)if(Object.hasOwn(U0,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=U0[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function vie(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||pie.test(e.slice(0,t))?e:``}function N8(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function yie(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function bie(e,t,n){let r=V6((n||{}).ignore||[]),i=xie(t),a=-1;for(;++a<i.length;)X6(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function xie(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Sie(e[0]),Cie(e[1])])}return t}function Sie(e){return typeof e==`string`?new RegExp(yie(e),`g`):e}function Cie(e){return typeof e==`function`?e:function(){return e}}var P8=`phrasing`,F8=[`autolink`,`link`,`image`,`label`];function wie(){return{transforms:[jie],enter:{literalAutolink:Eie,literalAutolinkEmail:I8,literalAutolinkHttp:I8,literalAutolinkWww:I8},exit:{literalAutolink:Aie,literalAutolinkEmail:kie,literalAutolinkHttp:Die,literalAutolinkWww:Oie}}}function Tie(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:P8,notInConstruct:F8},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:P8,notInConstruct:F8},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:P8,notInConstruct:F8}]}}function Eie(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function I8(e){this.config.enter.autolinkProtocol.call(this,e)}function Die(e){this.config.exit.autolinkProtocol.call(this,e)}function Oie(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function kie(e){this.config.exit.autolinkEmail.call(this,e)}function Aie(e){this.exit(e)}function jie(e){bie(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Mie],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Nie]],{ignore:[`link`,`linkReference`]})}function Mie(e,t,n,r,i){let a=``;if(!L8(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Pie(n)))return!1;let o=Fie(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Nie(e,t,n,r){return!L8(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Pie(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Fie(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=N8(e,`(`),a=N8(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function L8(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||h2(n)||m2(n))&&(!t||n!==47)}R8.peek=Wie;function Iie(){this.buffer()}function Lie(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Rie(){this.buffer()}function zie(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Bie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=i2(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vie(e){this.exit(e)}function Hie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=i2(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Uie(e){this.exit(e)}function Wie(){return`[`}function R8(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Gie(){return{enter:{gfmFootnoteCallString:Iie,gfmFootnoteCall:Lie,gfmFootnoteDefinitionLabelString:Rie,gfmFootnoteDefinition:zie},exit:{gfmFootnoteCallString:Bie,gfmFootnoteCall:Vie,gfmFootnoteDefinitionLabelString:Hie,gfmFootnoteDefinition:Uie}}}function Kie(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:R8},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
108
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?z8:qie))),s(),o}}function qie(e,t,n){return t===0?e:z8(e,t,n)}function z8(e,t,n){return(n?``:` `)+e}var Jie=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];B8.attention=$ie,B8.peek=eae;function Yie(){return{canContainEols:[`delete`],enter:{strikethrough:Zie},exit:{strikethrough:Qie}}}function Xie(){return{handlers:{delete:B8},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Jie}]}}function Zie(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Qie(e){this.exit(e)}function B8(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function $ie(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function eae(){return`~`}function tae(e){return e.length}function nae(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||tae,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=rae(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=V8(r[d]);else{let e=V8(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
109
|
-
`)}function rae(e){return e==null?``:String(e)}function V8(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var iae=V6([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function aae(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),oae);return i(),o}function oae(e,t,n){return`>`+(n?``:` `)+e}function sae(e,t){return H8(e,t.inConstruct,!0)&&!H8(e,t.notInConstruct,!1)}function H8(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function U8(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
|
|
110
|
-
`&&!e.before&&!e.after&&sae(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
|
|
111
|
-
`}function cae(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function lae(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function uae(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dae(e,t,n,r){let i=uae(n),a=e.value||``;if(lae(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,fae);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(cae(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
|
|
112
|
-
`,encode:["`"],...o.current()})),t()}return u+=o.move(`
|
|
113
|
-
`),a&&(u+=o.move(a+`
|
|
114
|
-
`)),u+=o.move(s),c(),u}function fae(e,t,n){return(n?``:` `)+e}function W8(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function pae(e,t,n,r){let i=W8(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
115
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function mae(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}G8.attention=hae,G8.peek=gae;function G8(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function hae(e,t){return{construct:`emphasis`,markers:mae(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function gae(e,t,n){return n.options.emphasis||`*`}function _ae(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function vae(e,t){let n=!1;return Q6(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&G0(e)&&(t.options.setext||n))}function yae(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(vae(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
116
|
-
`,after:`
|
|
117
|
-
`});return r(),t(),o+`
|
|
118
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
119
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
120
|
-
`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=_ae(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}K8.peek=bae;function K8(e){return e.value||``}function bae(){return`<`}q8.peek=xae;function q8(e,t,n,r){let i=W8(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function xae(){return`!`}J8.peek=Sae;function J8(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Sae(){return`!`}Y8.peek=Cae;function Y8(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Cae(){return"`"}function X8(e,t){let n=G0(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}Z8.peek=wae;function Z8(e,t,n,r){let i=W8(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(X8(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function wae(e,t,n){return X8(e,n)?`<`:`[`}Q8.peek=Tae;function Q8(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Tae(){return`[`}function $8(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Eae(e){let t=$8(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Dae(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function e5(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Oae(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Dae(n):$8(n),s=e.ordered?o===`.`?`)`:`.`:Eae(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),e5(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function kae(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Aae(e,t,n,r){let i=kae(n),a=n.bulletCurrent||$8(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function jae(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Mae(e,t,n,r){if(!e.children.some(function(e){return iae(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function Nae(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}t5.attention=Pae,t5.peek=Fae;function t5(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function Pae(e,t){return{construct:`strong`,markers:Nae(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function Fae(e,t,n){return n.options.strong||`*`}function Iae(e,t,n,r){return n.safe(e.value,r)}function Lae(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Rae(e,t,n){let r=(e5(n)+(n.options.ruleSpaces?` `:``)).repeat(Lae(n));return n.options.ruleSpaces?r.slice(0,-1):r}var n5={blockquote:aae,break:U8,code:dae,definition:pae,emphasis:G8,hardBreak:U8,heading:yae,html:K8,image:q8,imageReference:J8,inlineCode:Y8,link:Z8,linkReference:Q8,list:Oae,listItem:Aae,paragraph:jae,root:Mae,strong:t5,text:Iae,thematicBreak:Rae};function zae(){return{enter:{table:Bae,tableData:i5,tableHeader:i5,tableRow:Hae},exit:{codeText:Uae,table:Vae,tableData:r5,tableHeader:r5,tableRow:r5}}}function Bae(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Vae(e){this.exit(e),this.data.inTable=void 0}function Hae(e){this.enter({type:`tableRow`,children:[]},e)}function r5(e){this.exit(e)}function i5(e){this.enter({type:`tableCell`,children:[]},e)}function Uae(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Wae));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Wae(e,t){return t===`|`?t:e}function Gae(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
121
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
122
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return nae(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=n5.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Kae(){return{exit:{taskListCheckValueChecked:a5,taskListCheckValueUnchecked:a5,paragraph:Jae}}}function qae(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Yae}}}function a5(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Jae(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Yae(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=n5.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Xae(){return[wie(),Gie(),Yie(),zae(),Kae()]}function Zae(e){return{extensions:[Tie(),Kie(e),Xie(),Gae(e),qae()]}}var Qae={tokenize:ioe,partial:!0},o5={tokenize:aoe,partial:!0},s5={tokenize:ooe,partial:!0},c5={tokenize:soe,partial:!0},$ae={tokenize:coe,partial:!0},l5={name:`wwwAutolink`,tokenize:noe,previous:m5},u5={name:`protocolAutolink`,tokenize:roe,previous:h5},d5={name:`emailAutolink`,tokenize:toe,previous:g5},f5={};function eoe(){return{text:f5}}for(var p5=48;p5<123;)f5[p5]=d5,p5++,p5===58?p5=65:p5===91&&(p5=97);f5[43]=d5,f5[45]=d5,f5[46]=d5,f5[95]=d5,f5[72]=[d5,u5],f5[104]=[d5,u5],f5[87]=[d5,l5],f5[119]=[d5,l5];function toe(e,t,n){let r=this,i,a;return o;function o(t){return!_5(t)||!g5.call(r,r.previous)||v5(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return _5(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check($ae,u,l)(t):t===45||t===95||o2(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&a2(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function noe(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!m5.call(r,r.previous)||v5(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Qae,e.attempt(o5,e.attempt(s5,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function roe(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&h5.call(r,r.previous)&&!v5(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(a2(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||c2(t)||f2(t)||h2(t)||m2(t)?n(t):e.attempt(o5,e.attempt(s5,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function ioe(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function aoe(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(c5,c,s)(t):t===null||f2(t)||h2(t)||t!==45&&m2(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ooe(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(c5,t,a)(o):o===null||f2(o)||h2(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function soe(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||f2(o)||h2(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||f2(e)||h2(e)?t(e):r(e)}function a(e){return a2(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):a2(t)?(e.consume(t),o):n(t)}}function coe(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return o2(e)?n(e):t(e)}}function m5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||f2(e)}function h5(e){return!a2(e)}function g5(e){return!(e===47||_5(e))}function _5(e){return e===43||e===45||e===46||e===95||o2(e)}function v5(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var loe={tokenize:_oe,partial:!0};function uoe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:moe,continuation:{tokenize:hoe},exit:goe}},text:{91:{name:`gfmFootnoteCall`,tokenize:poe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:doe,resolveTo:foe}}}}function doe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=i2(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function foe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function poe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||f2(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(i2(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return f2(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function moe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||f2(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=i2(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return f2(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),v2(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function hoe(e,t,n){return e.check(I2,t,e.attempt(loe,t,n))}function goe(e){e.exit(`gfmFootnoteDefinition`)}function _oe(e,t,n){let r=this;return v2(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function voe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Z0(o,o.length,0,k2(s,e.slice(r+1,n),t)),Z0(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Z0(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=O2(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=O2(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var yoe=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){boe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function boe(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function xoe(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Soe(){return{flow:{null:{name:`table`,tokenize:Coe,resolveAll:woe}}}}function Coe(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):p2(t)?v2(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||f2(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,p2(t)?v2(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return p2(t)?v2(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return p2(t)?v2(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$(n)?(e.exit(`tableRow`),t(n)):p2(n)?v2(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||f2(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function woe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new yoe;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(b5(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=y5(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=y5(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=y5(f,t,o,i,n,d)):(o[0]=o[1],d=y5(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&b5(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=xoe(t.events,n))}return e}function y5(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},x5(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=x5(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=x5(t.events,n[2]),a=x5(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},x5(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function b5(e,t,n,r,i){let a=[],o=x5(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function x5(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Toe={name:`tasklistCheck`,tokenize:Doe};function Eoe(){return{text:{91:Toe}}}function Doe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return f2(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $(r)?t(r):p2(r)?e.check({tokenize:Ooe},t,n)(r):n(r)}}function Ooe(e,t,n){return v2(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function koe(e){return e2([eoe(),uoe(),voe(e),Soe(),Eoe()])}var Aoe={};function S5(e){let t=this,n=e||Aoe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(koe(n)),a.push(Xae()),o.push(Zae(n))}function C5({...e}){return(0,z.jsx)(AT,{"data-slot":`dropdown-menu`,...e})}function w5({...e}){return(0,z.jsx)(MT,{"data-slot":`dropdown-menu-trigger`,...e})}function T5({className:e,sideOffset:t=4,...n}){return(0,z.jsx)(NT,{children:(0,z.jsx)(FT,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:T(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function E5({className:e,inset:t,variant:n=`default`,...r}){return(0,z.jsx)(IT,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:T(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function joe({className:e,children:t,checked:n,...r}){return(0,z.jsxs)(LT,{"data-slot":`dropdown-menu-checkbox-item`,className:T(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,z.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,z.jsx)(RT,{children:(0,z.jsx)(qD,{className:`size-4`})})}),t]})}var D5={hour:`2-digit`,minute:`2-digit`},Moe=e=>new Date(e).toLocaleTimeString(E(),D5),O5=e=>new Date(e).toLocaleTimeString(E());function Noe(e,t=new Date){let n=new Date(e);return n.toDateString()===t.toDateString()?Moe(e):n.toLocaleString(E(),{month:`numeric`,day:`numeric`,...D5})}function Poe(e,t){if(!e)return`—`;let n=Math.max(0,Math.round((t-Date.parse(e))/1e3)),r=new Intl.RelativeTimeFormat(E(),{numeric:`always`});return n<60?r.format(-n,`second`):r.format(-Math.round(n/60),`minute`)}var k5=[`git`],A5={state:()=>Sv(`GET`,`/api/git`).then(e=>e.git),review:e=>Sv(`POST`,`/api/git/review`,e),openPr:()=>Sv(`GET`,`/api/git/pr`).then(e=>e.url),draft:e=>Sv(`POST`,`/api/git/review/draft`,e),diff:e=>Sv(`GET`,`/api/git/diff?path=${encodeURIComponent(e)}`),revert:e=>Sv(`POST`,`/api/git/revert`,e),defaultChanges:()=>Sv(`GET`,`/api/git/default`).then(e=>e.files),restoreDefault:e=>Sv(`POST`,`/api/git/restore-default`,{files:e})};async function Foe(e){for(let{table:t,key:n,before:r,after:i}of e)if(r===null)await Nv.remove(t,n);else if(i===null)await Nv.create(t,n,r);else{let e=Object.fromEntries(Object.keys(i).filter(e=>!(e in r)).map(e=>[e,null]));await Nv.update(t,n,{...e,...r},i)}}function j5(){let e=!zv();return U_({queryKey:k5,queryFn:A5.state,enabled:e,refetchOnWindowFocus:!0}).data??null}function M5(e){let t=new Map;for(let n of e)t.set(n.table,[...t.get(n.table)??[],n]);return[...t.entries()].sort(([e],[t])=>e===null?1:t===null?-1:e.localeCompare(t)).map(([e,t])=>({table:e,changes:t}))}var N5=[`ai-instructions`];function P5({open:e,onOpenChange:t}){let n=Cg(),r=U_({queryKey:N5,queryFn:V$.get,enabled:e,staleTime:1/0,refetchOnWindowFocus:!1}),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1);(0,B.useEffect)(()=>{r.data&&!c&&(a(r.data.instructions??``),s(r.data.pullRequests??``),l(!0))},[r.data,c]);let u=W_({mutationFn:()=>V$.save({instructions:i,pullRequests:o,base:r.data?.base??``}),onSuccess:e=>{n.setQueryData(N5,e),n.invalidateQueries({queryKey:k5}),cv.success(et()),t(!1)}}),d=e=>{t(e),e||(u.reset(),n.removeQueries({queryKey:N5}))},f=u.error instanceof gv&&u.error.status===409?Ye():u.error instanceof Error?u.error.message:r.error instanceof Error?r.error.message:null;return(0,z.jsx)(gk,{open:e,onOpenChange:d,children:(0,z.jsxs)(yk,{className:`sm:max-w-2xl`,children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{className:`text-[18px]`,children:tt()}),(0,z.jsx)(wk,{className:`text-[14px]`,children:Xe()})]}),(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-[15px]`,children:[(0,z.jsx)(`span`,{className:`font-semibold`,children:qe()}),(0,z.jsx)(dJ,{value:i,placeholder:Je(),onChange:e=>a(e.target.value),disabled:!r.data,className:`min-h-28 text-[15px]`})]}),(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-[15px]`,children:[(0,z.jsx)(`span`,{className:`font-semibold`,children:Qe()}),(0,z.jsx)(dJ,{value:o,placeholder:$e(),onChange:e=>s(e.target.value),disabled:!r.data,className:`min-h-20 text-[15px]`})]}),f&&(0,z.jsx)(`p`,{role:`alert`,className:`text-[13px] text-err`,children:f}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>d(!1),children:ht()}),(0,z.jsx)(V,{disabled:!r.data||u.isPending,onClick:()=>u.mutate(),children:St()})]})]})})}var F5=`w-full rounded-md border bg-panel px-2.5 py-1.5 text-[15px]`;function Ioe({viewerKeys:e,providers:t,initial:n,onSave:r}){let[i,a]=(0,B.useState)(n?.provider??t[0]?.id??``),o=t.find(e=>e.id===i)??t[0],[s,c]=(0,B.useState)(n?.provider===o.id?n.model:o.models[0]),l=t=>e?L$(t):``,u=t=>e&&R$(t),[d,f]=(0,B.useState)(()=>n?.provider===o.id?n.apiKey:l(o.id)),[p,m]=(0,B.useState)(()=>u(o.id)),h=s.trim(),g=h!==``&&(!e||d.trim()!==``||o.hasKey);return(0,z.jsxs)(`form`,{"aria-label":Me(),className:`flex flex-col gap-3 border-b p-3.5 text-[15px]`,onSubmit:t=>{t.preventDefault(),g&&r({provider:o.id,model:h,apiKey:e?d.trim():``},e&&p)},children:[(0,z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[we(),(0,z.jsx)(`select`,{className:F5,value:o.id,onChange:e=>{let n=t.find(t=>t.id===e.target.value);a(n.id),c(n.models[0]),f(l(n.id)),m(u(n.id))},children:t.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),o.fixedModels?(0,z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[he(),(0,z.jsx)(`select`,{className:F5,value:s,onChange:e=>c(e.target.value),children:o.models.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}):(0,z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[he(),(0,z.jsx)(`input`,{className:F5,list:`ai-models-${o.id}`,autoComplete:`off`,spellCheck:!1,value:s,onChange:e=>c(e.target.value)}),(0,z.jsx)(`datalist`,{id:`ai-models-${o.id}`,children:o.models.map(e=>(0,z.jsx)(`option`,{value:e},e))}),h!==``&&!o.models.includes(h)&&(0,z.jsx)(`span`,{className:`text-[14px] text-muted-foreground`,children:ge()})]}),e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[ae(),(0,z.jsx)(`input`,{className:F5,type:`password`,autoComplete:`off`,spellCheck:!1,value:d,placeholder:o.hasKey?se():``,onChange:e=>f(e.target.value)})]}),(0,z.jsx)(`p`,{className:`text-[14px] text-muted-foreground`,children:oe()}),(0,z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),Ee()]})]}),(0,z.jsx)(V,{type:`submit`,disabled:!g,className:`self-end`,children:Ae()})]})}var I5=e=>typeof e==`object`&&!!e&&!Array.isArray(e),L5=e=>typeof e!=`object`||!e,R5=e=>Array.isArray(e)?`[${e.map(R5).join(`,`)}]`:I5(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${R5(e[t])}`).join(`,`)}}`:JSON.stringify(e)??`null`,z5=(e,t)=>e===``?t:`${e} › ${t}`,B5=[`id`,`key`,`name`],Loe=/(^|_)(id|key|code|uuid|slug|name)$/i,Roe=/^[\w.\-:/]{1,64}$/;function zoe(e){return typeof e==`string`?e.length<=64&&!/\s/.test(e):typeof e==`number`||typeof e==`boolean`}function Boe(e,t){let n=[...e,...t];if(n.length===0)return null;let r=r=>n.every(e=>Object.hasOwn(e,r)&&zoe(e[r]))&&new Set(n.map(e=>typeof e[r])).size===1&&[e,t].every(e=>new Set(e.map(e=>e[r])).size===e.length),i=n=>{if(e.length===0||t.length===0)return 1;let r=new Set(t.map(e=>e[n]));return e.filter(e=>r.has(e[n])).length},a=B5.find(e=>r(e)&&i(e)>0);if(a)return a;let o=Math.ceil(Math.min(e.length,t.length)/2),s=Object.keys(n[0]).filter(e=>!B5.includes(e)&&r(e)&&i(e)>=Math.max(o,1)),c=e=>n.every(t=>typeof t[e]!=`string`||Roe.test(t[e]));return s.find(e=>Loe.test(e))??s.find(e=>c(e)&&n.every(t=>typeof t[e]==`string`||Number.isInteger(t[e])))??null}function Voe(e,t){let n=Array.from({length:e.length+1},()=>Array.from({length:t.length+1},()=>0));for(let r=e.length-1;r>=0;r--)for(let i=t.length-1;i>=0;i--)n[r][i]=e[r]===t[i]?n[r+1][i+1]+1:Math.max(n[r+1][i],n[r][i+1]);let r=[],i=0,a=0;for(;i<e.length&&a<t.length;)e[i]===t[a]?r.push([i++,a++]):n[i+1][a]>=n[i][a+1]?i++:a++;return r}function Hoe(e,t,n,r){if(e.every(I5)&&t.every(I5)){let i=Boe(e,t);if(i!==null){let a=e=>new Map(e.map(e=>[String(e[i]),e])),o=a(e),s=a(t);for(let[e,t]of o){let i=s.get(e),a=z5(n,e);i===void 0?r.push({path:a,kind:`removed`,before:t}):V5(t,i,a,r)}for(let[e,t]of s)o.has(e)||r.push({path:z5(n,e),kind:`added`,after:t});return}}if(e.length===t.length){e.forEach((e,i)=>V5(e,t[i],z5(n,`[${i}]`),r));return}let i=e.map(R5),a=t.map(R5),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o++;let s=i.length,c=a.length;for(;s>o&&c>o&&i[s-1]===a[c-1];)s--,c--;if((s-o)*(c-o)>4e6){r.push({path:n,kind:`changed`,before:e,after:t});return}let l=Voe(i.slice(o,s),a.slice(o,c)),u=new Set(l.map(([e])=>e+o)),d=new Set(l.map(([,e])=>e+o));for(let t=o;t<s;t++)u.has(t)||r.push({path:z5(n,`[${t}]`),kind:`removed`,before:e[t]});for(let e=o;e<c;e++)d.has(e)||r.push({path:z5(n,`[${e}]`),kind:`added`,after:t[e]})}function V5(e,t,n,r){if(I5(e)&&I5(t)){for(let i of Object.keys(e))Object.hasOwn(t,i)?V5(e[i],t[i],z5(n,i),r):r.push({path:z5(n,i),kind:`removed`,before:e[i]});for(let i of Object.keys(t))Object.hasOwn(e,i)||r.push({path:z5(n,i),kind:`added`,after:t[i]})}else Array.isArray(e)&&Array.isArray(t)&&!(e.every(L5)&&t.every(L5))?Hoe(e,t,n,r):R5(e)!==R5(t)&&r.push({path:n,kind:`changed`,before:e,after:t})}function Uoe(e,t){let n=[];return V5(e,t,``,n),n}var H5=e=>typeof e==`object`&&!!e,Woe=e=>e==null?`—`:typeof e==`string`?e:JSON.stringify(e),Goe={insert:ca,update:la,delete:sa},Koe={applied:Bi,discarded:Xi,stale:fa,failed:Zi},qoe={added:Gi,removed:qi,changed:Ki},Joe=200,U5=50;function W5({value:e}){let t=JSON.stringify(e)??`null`,[n,r]=(0,B.useState)(!1),i=t.length>Joe;return(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:T(`font-mono text-[14px] [overflow-wrap:anywhere]`,i&&!n&&`line-clamp-6`),children:t}),i&&(0,z.jsx)(`button`,{type:`button`,className:`text-[14px] text-muted-foreground underline`,onClick:()=>r(!n),children:n?Ji():da()})]})}function Yoe({field:e,before:t,after:n}){let r=(0,B.useMemo)(()=>Uoe({[e]:t},{[e]:n}),[e,t,n]),i=r.slice(0,U5);return r.length===0?(0,z.jsxs)(`p`,{className:`text-[14px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-mono`,children:e}),` `,(0,z.jsx)(`span`,{children:ua()})]}):(0,z.jsxs)(`ul`,{"aria-label":e,className:`flex flex-col gap-2`,children:[i.map(e=>(0,z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 rounded-md border bg-panel px-2.5 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[14px]`,children:[(0,z.jsx)(`span`,{className:T(`shrink-0 rounded-full border px-2`,e.kind===`removed`?`border-err text-err`:e.kind===`added`?`border-ok text-ok`:`text-muted-foreground`),children:qoe[e.kind]()}),(0,z.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.path})]}),e.kind!==`added`&&(0,z.jsx)(W5,{value:e.before}),e.kind===`changed`&&(0,z.jsx)(`span`,{className:`text-[14px] text-muted-foreground`,children:`→`}),e.kind!==`removed`&&(0,z.jsx)(W5,{value:e.after})]},`${e.kind}:${e.path}`)),r.length>U5&&(0,z.jsx)(`li`,{className:`text-[14px] text-muted-foreground`,children:ra({count:r.length-U5})})]})}function Xoe({row:e}){let t=e.op===`update`?e.changed:Object.keys(e.after??e.before??{}),n=t=>e.op===`update`&&H5(e.before?.[t])&&H5(e.after?.[t]),r=t.filter(e=>!n(e));return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-dashed py-2.5 last:border-b-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,z.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e.key}),(0,z.jsx)(`span`,{className:T(`rounded-full border px-2 text-[14px]`,e.op===`delete`?`border-err text-err`:`border-ok text-ok`),children:Goe[e.op]()})]}),e.op!==`delete`&&r.length>0&&(0,z.jsx)(VZ,{labels:[Wi(),zi()],format:Woe,rows:r.map(t=>({field:t,a:e.before?.[t],b:e.after?.[t]}))}),e.op!==`delete`&&t.filter(n).map(t=>(0,z.jsx)(Yoe,{field:t,before:e.before?.[t],after:e.after?.[t]},t))]})}var Zoe={done:lr,failed:ur,skipped:jr};function Qoe(e){switch(e.kind){case`create_branch`:return e.from?sr({name:e.name,from:e.from}):ir({name:e.name});case`switch`:return Lr({branch:e.branch});case`commit`:return tr({message:e.message});case`push`:return Sr({branch:e.branch});case`pull`:return yr({branch:e.branch});case`open_pr`:return mr({title:e.title})}}function $oe({git:e,ran:t}){let n=t||e.results.some(e=>e.status!==`skipped`);return(0,z.jsx)(`ol`,{className:`flex flex-col gap-2 py-2.5`,children:e.steps.map((t,r)=>{let i=e.results[r];return(0,z.jsxs)(`li`,{className:`flex flex-col gap-1 text-[15px]`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`${r+1}.`}),(0,z.jsx)(`span`,{children:Qoe(t)}),n&&i&&(0,z.jsx)(`span`,{className:T(`ml-auto shrink-0 rounded-full border px-2 text-[14px]`,i.status===`done`?`border-ok text-ok`:i.status===`failed`?`border-err text-err`:`text-muted-foreground`),children:Zoe[i.status]()})]}),t.kind===`commit`&&(0,z.jsx)(`ul`,{className:`ml-6 font-mono text-[14px] text-muted-foreground`,children:t.paths.map(e=>(0,z.jsx)(`li`,{children:e},e))}),t.kind===`open_pr`&&t.body&&(0,z.jsx)(`p`,{className:`ml-6 text-[14px] whitespace-pre-wrap text-muted-foreground`,children:t.body}),n&&i?.message&&(0,z.jsx)(`p`,{className:`ml-6 text-[14px] text-err [overflow-wrap:anywhere]`,children:i.message}),n&&i?.url&&(0,z.jsx)(`a`,{className:`ml-6 text-[14px] underline`,href:i.url,target:`_blank`,rel:`noreferrer`,children:i.created?gr():hr()})]},r)})})}function G5({proposal:e}){let t=W_({mutationFn:t=>t===`apply`?K$.apply(e.id):K$.discard(e.id),onSettled:()=>t1(),onError:e=>cv.error(e.message)}),n=[...new Set(e.rows.map(e=>e.table))],r=e.git?e.git.steps.length:e.table?1:e.rows.length;return(0,z.jsxs)(`section`,{"aria-label":ea({title:e.title}),className:`overflow-hidden rounded-lg border`,children:[(0,z.jsxs)(`header`,{className:`flex items-baseline justify-between gap-2 border-b bg-panel px-3 py-2.5`,children:[(0,z.jsx)(`h3`,{className:`text-[16px] font-semibold`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[14px] text-muted-foreground`,children:e.git?Pr({count:r}):e.table?oa({name:e.table.name}):ha({tables:n.join(`, `),count:r})})]}),(0,z.jsx)(`div`,{className:`max-h-[360px] overflow-auto px-3`,children:e.git?(0,z.jsx)($oe,{git:e.git,ran:e.status!==`pending`}):e.table?(0,z.jsx)(`p`,{className:`py-2.5 text-[14px]`,children:(e.table.mode===`list`?xa:va)({name:e.table.name,key:e.table.key})}):e.rows.map(e=>(0,z.jsx)(Xoe,{row:e},`${e.table}/${e.key}`))}),e.warnings.length>0&&(0,z.jsx)(`ul`,{className:`border-t bg-warn-soft px-3 py-2 text-[14px] text-warn`,children:e.warnings.map(e=>(0,z.jsxs)(`li`,{children:[`⚠ `,e]},e))}),e.sql&&(0,z.jsxs)(`details`,{className:`border-t px-3 py-2 text-[14px] text-muted-foreground`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer`,children:`SQL`}),(0,z.jsx)(`pre`,{className:`mt-1.5 font-mono text-[14px] whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:e.sql})]}),(0,z.jsx)(`footer`,{className:`flex items-center justify-end gap-2 border-t px-3 py-2.5`,children:e.status===`pending`?(0,z.jsxs)(z.Fragment,{children:[e.git&&t.isPending&&(0,z.jsx)(`p`,{role:`status`,className:`mr-auto text-[14px] text-muted-foreground`,children:kr()}),(0,z.jsx)(V,{variant:`outline`,disabled:t.isPending,onClick:()=>t.mutate(`discard`),children:Yi()}),(0,z.jsx)(V,{disabled:t.isPending,onClick:()=>t.mutate(`apply`),children:e.git?Or({count:r}):Ui({count:r})})]}):(0,z.jsxs)(`p`,{className:T(`text-[14px]`,e.status===`applied`?`text-ok`:e.status===`discarded`?`text-muted-foreground`:`text-err`),children:[Koe[e.status](),e.stale&&`: ${e.stale.join(`, `)}`,e.error&&`: ${e.error}`]})})]})}var ese=`max-w-none min-w-0 [overflow-wrap:anywhere] [&_a]:underline [&_code]:font-mono [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-1.5 [&_pre]:overflow-auto [&_table]:text-[14px] [&_ul]:list-disc [&_ul]:pl-5`,tse={schema:We,query:Ue,get_records:Be,propose_changes:Ve,propose_sql:Ve,propose_table:He,check:Re,web_search:Ge,code_execution:ze},K5=e=>tse[e]?.()??e;function nse({busy:e,last:t}){let n=t?.kind===`tool`&&t.status===`in_progress`?K5(t.title):null;return(0,z.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`flex items-center gap-2 text-[14px] text-muted-foreground`,children:e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`flex gap-1`,children:[0,1,2].map(e=>(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground motion-safe:animate-pulse`,style:{animationDelay:`${e*200}ms`}},e))}),n?ke({tool:n}):Le()]})})}function rse({item:e}){let t=K5(e.title),n=e.input,r=n?.sql??(e.title===`web_search`?n?.query:void 0);return(0,z.jsxs)(`details`,{className:`min-w-0 rounded-md border bg-panel px-2.5 py-1.5 text-[14px] text-muted-foreground`,children:[(0,z.jsxs)(`summary`,{className:`cursor-pointer`,children:[t,e.status===`in_progress`&&` …`]}),e.input!==void 0&&(0,z.jsx)(`pre`,{className:`mt-1.5 font-mono text-[14px] whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r??JSON.stringify(e.input,null,2)}),e.sources&&(0,z.jsx)(q5,{sources:e.sources})]})}var ise=e=>URL.parse(e)?.hostname||e;function q5({sources:e}){return(0,z.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:e.map(e=>(0,z.jsx)(`li`,{className:`min-w-0 truncate`,children:(0,z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,title:e.url,children:e.title||ise(e.url)})},e.url))})}function ase({sources:e}){return(0,z.jsxs)(`details`,{className:`mt-2 text-[14px] text-muted-foreground`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer`,children:Fe({count:e.length})}),(0,z.jsx)(q5,{sources:e})]})}var J5=()=>Z$.reset().catch(()=>{});function ose({current:e,onPick:t}){let[n,r]=(0,B.useState)(!1),{conversations:i,loading:a}=e1(n);return(0,z.jsxs)(C5,{open:n,onOpenChange:r,children:[(0,z.jsx)(w5,{asChild:!0,children:(0,z.jsxs)(V,{variant:`ghost`,className:`text-[14px]`,children:[(0,z.jsx)(AO,{className:`size-4`}),ue()]})}),(0,z.jsx)(T5,{align:`start`,className:`w-80 max-w-[calc(100vw-2rem)]`,children:i.length===0?(0,z.jsx)(E5,{disabled:!0,className:`text-[14px]`,children:a?bt():ve()}):i.map(n=>(0,z.jsxs)(E5,{"aria-current":n.id===e?`true`:void 0,className:`flex cursor-pointer flex-col items-stretch gap-0.5 py-2 aria-[current]:bg-panel-2`,onSelect:()=>t(n),children:[(0,z.jsx)(`span`,{className:`truncate text-[15px]`,children:n.title||Ke()}),(0,z.jsxs)(`span`,{className:`flex gap-2 text-[14px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{children:Noe(n.updatedAt)}),(0,z.jsx)(`span`,{children:n.model})]})]},n.id))})]})}function Y5({url:e}){return e?(0,z.jsx)(`a`,{href:e,className:`underline`,children:be()}):null}function sse(e){return e instanceof gv&&e.body.code===`no_key`?me():e instanceof Error?e.message:String(e)}function cse(){let e=F$(),t=I$(),n=t?.viewerKeys??!0,r=Q$(),i=IX(),[a,o]=jX(`yamlite-agent-width`,420),[s,c]=(0,B.useState)(()=>e?z$(e,{viewerKeys:n}):null),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(!1),y=(0,B.useRef)(!1),b=(0,B.useRef)(null),x=(0,B.useRef)(null),S=$$(),C=new Set(r.items.flatMap(e=>e.kind===`proposal`?[e.proposal.id]:[])),w=S.filter(e=>!C.has(e.id));if((0,B.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.keyCode===229||document.querySelector(`[role="dialog"], [role="alertdialog"], [data-radix-popper-content-wrapper], aside[data-record-drawer]`))return;let t=e.target instanceof HTMLElement?e.target:null;t&&t!==x.current&&t.closest(`input, textarea, select, [contenteditable]`)||x.current?.value.trim()||a1.close()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,B.useEffect)(()=>{b.current?.scrollTo?.({top:b.current.scrollHeight})},[r.items,r.busy]),!e)return null;let E=r.items.at(-1),D=n&&E?.kind===`error`&&E.code===`auth`,O=!n&&e.length===0,k=!O&&(l||s===null||D),A=async()=>{let e=p.trim();if(!(e===``||r.busy||y.current)){if(!s)u(!0);else{y.current=!0,v(!0),g(null);try{(!Z$.id||r.closed)&&(await Z$.reset(),await Z$.start(s)),await Z$.send(e),m(``)}catch(e){g(sse(e)),e instanceof gv&&e.body.code===`no_key`&&u(!0)}finally{y.current=!1,v(!1)}}}};return(0,z.jsxs)(`aside`,{"aria-label":fi(),className:T(`relative flex min-h-0 flex-col border-l bg-background`,i&&`fixed inset-0 z-40 h-dvh border-l-0`),style:i?void 0:{width:a},children:[!i&&(0,z.jsx)(NX,{width:a,label:`Resize AI panel`,onResize:o}),(0,z.jsxs)(`header`,{className:`flex items-center justify-between gap-2 border-b px-3.5 py-2.5`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[!O&&(0,z.jsxs)(V,{variant:`ghost`,className:`min-w-0 shrink text-[14px]`,"aria-label":Me(),"aria-expanded":k,onClick:()=>u(e=>!e),children:[(0,z.jsx)(une,{className:`size-4`}),(0,z.jsx)(`span`,{className:`truncate`,children:s?`${e.find(e=>e.id===s.provider)?.name??s.provider} · ${s.model}`:Me()})]}),(0,z.jsx)(ose,{current:Z$.id,onPick:e=>{g(null),Z$.open(e.id)}}),(0,z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":Ze(),title:Ze(),onClick:()=>f(!0),children:(0,z.jsx)(PO,{className:`size-4`})}),d&&(0,z.jsx)(P5,{open:!0,onOpenChange:f})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(V,{variant:`ghost`,className:`text-[14px]`,onClick:()=>{g(null),J5()},children:_e()}),(0,z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":gt(),onClick:a1.close,children:(0,z.jsx)(ik,{className:`size-5`})})]})]}),O&&(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-2 border-b p-3.5 text-[15px]`,children:[(0,z.jsx)(`p`,{children:t?.unavailable?ie():ye()}),(0,z.jsx)(Y5,{url:t?.settingsUrl})]}),k&&(0,z.jsx)(Ioe,{viewerKeys:n,providers:e,initial:s,onSave:(e,t)=>{B$(e,t),c(e),u(!1),g(null),J5()}}),(0,z.jsxs)(`div`,{ref:b,className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-3.5 text-[15px] leading-relaxed [&>*]:shrink-0`,children:[w.length>0&&(0,z.jsxs)(`section`,{"aria-label":xe(),className:`flex flex-col gap-3 border-b pb-3`,children:[(0,z.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:xe()}),(0,z.jsx)(`p`,{className:`text-[14px] text-muted-foreground`,children:Se()}),w.map(e=>(0,z.jsx)(G5,{proposal:e},e.id))]}),r.items.length===0&&(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:L()}),r.items.map((e,r)=>e.kind===`user`?(0,z.jsx)(`p`,{className:`max-w-[85%] self-end rounded-xl rounded-br-sm bg-panel-2 px-3 py-2 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.text},r):e.kind===`agent`?(0,z.jsxs)(`div`,{className:ese,children:[(0,z.jsx)(M8,{remarkPlugins:[S5],disallowedElements:[`img`],unwrapDisallowed:!0,components:{a:({node:e,...t})=>(0,z.jsx)(`a`,{...t,target:`_blank`,rel:`noreferrer noopener`})},children:e.text}),e.sources&&(0,z.jsx)(ase,{sources:e.sources})]},r):e.kind===`tool`?(0,z.jsx)(rse,{item:e},e.id):e.kind===`proposal`?(0,z.jsx)(G5,{proposal:e.proposal},e.proposal.id):!n&&e.code===`auth`?(0,z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 rounded-md border border-err px-3 py-2`,children:[(0,z.jsx)(`p`,{className:`text-err`,children:fe()}),(0,z.jsx)(Y5,{url:t?.settingsUrl})]},r):(0,z.jsx)(`p`,{role:`alert`,className:`rounded-md border border-err px-3 py-2 text-err`,children:e.message},r)),(0,z.jsx)(nse,{busy:r.busy,last:r.items.at(-1)}),r.closed&&(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:le()}),h&&(0,z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-err px-3 py-2 text-err`,children:(0,z.jsx)(`p`,{children:h})})]}),(0,z.jsxs)(`form`,{className:`border-t p-3.5`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,z.jsx)(`textarea`,{ref:x,"aria-label":pe(),disabled:O,rows:3,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.keyCode===229||(e.preventDefault(),A())},placeholder:Ce(),className:`w-full resize-none rounded-lg border bg-panel px-3 py-2.5 text-[16px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60`}),(0,z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[14px] text-muted-foreground`,children:Te()}),r.busy?(0,z.jsxs)(V,{type:`button`,variant:`outline`,onClick:()=>void Z$.stop(),children:[(0,z.jsx)(VO,{className:`size-4`}),` `,Ie()]}):(0,z.jsx)(V,{type:`submit`,disabled:O||_||p.trim()===``,children:je()})]})]})]})}var lse={added:Ds,modified:ks,deleted:Os},use={added:`text-ok`,modified:`text-warn`,deleted:`text-err`};function X5({branch:e,open:t,onOpenChange:n}){let r=Cg(),{data:i,error:a}=U_({queryKey:[...k5,`default`],queryFn:A5.defaultChanges,enabled:t}),[o,s]=(0,B.useState)(new Set),[c,l]=(0,B.useState)(null),u=(i??[]).filter(e=>o.has(e.path)),d=u.some(e=>e.unsent),f=JSON.stringify(u.map(e=>e.path)),p=c===f,m=e=>{n(e),e||(h.reset(),s(new Set),l(null))},h=W_({mutationFn:()=>A5.restoreDefault(u.map(e=>e.path)),onSuccess:t=>{cv.success(_o({count:t.files.length,branch:e})),m(!1)},onSettled:()=>{l(null),r.invalidateQueries({queryKey:k5})}}),g=e=>s(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),_=h.error??a;return(0,z.jsx)(gk,{open:t,onOpenChange:m,children:(0,z.jsxs)(yk,{className:`sm:max-w-2xl`,children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{className:`text-[18px]`,children:Ao({branch:e})}),(0,z.jsx)(wk,{className:`text-[14px]`,children:mo({branch:e})})]}),i?i.length===0?(0,z.jsx)(`p`,{className:`text-[14px] text-muted-foreground`,children:bo({branch:e})}):(0,z.jsxs)(`fieldset`,{className:`flex max-h-[45vh] flex-col gap-2 overflow-auto rounded-md border p-3 text-[14px]`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-[13px] text-muted-foreground`,children:Xo({count:u.length})}),M5(i).map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,z.jsx)(`div`,{className:`text-[12.5px] font-semibold text-muted-foreground`,children:e.table??as()}),e.changes.map(e=>(0,z.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 rounded-md px-1 py-1`,children:[(0,z.jsx)(`input`,{type:`checkbox`,"aria-label":es({file:e.path}),checked:o.has(e.path),disabled:h.isPending,onChange:()=>g(e.path)}),(0,z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13.5px]`,children:e.path}),e.unsent&&(0,z.jsx)(`span`,{className:`shrink-0 text-[12.5px] text-warn`,children:Po()}),(0,z.jsx)(`span`,{className:T(`ml-auto shrink-0 text-[12.5px]`,use[e.status]),children:lse[e.status]()})]},e.path))]},e.table??``))]}):!a&&(0,z.jsx)(`p`,{className:`text-[14px] text-muted-foreground`,children:ts()}),_&&(0,z.jsx)(`p`,{role:`alert`,className:`text-[13px] text-err`,children:_.message}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>m(!1),children:ht()}),(0,z.jsxs)(V,{variant:p?`destructive`:`default`,disabled:u.length===0||h.isPending,onClick:()=>d&&!p?l(f):h.mutate(),children:[(0,z.jsx)(AO,{className:`size-4`}),h.isPending?xo():p?Do({count:u.length}):wo({count:u.length})]})]})]})})}var dse={added:Ds,modified:ks,deleted:Os},fse={added:`text-ok`,modified:`text-warn`,deleted:`text-err`},pse=e=>e.records===null?{records:[],files:e.status===`added`?[]:[e.path]}:{records:e.table===null?[]:e.records.filter(e=>e.kind===`deleted`||e.fields.length>0).map(t=>({table:e.table,key:t.key})),files:[]},mse=e=>e==null?`—`:typeof e==`string`?e:JSON.stringify(e);function hse({path:e,many:t}){let{data:n,error:r}=U_({queryKey:[`gitdiff`,e],queryFn:()=>A5.diff(e)});return r?(0,z.jsx)(`p`,{className:`text-[13px] text-err`,children:r.message}):n?(0,z.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.records.map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t&&(0,z.jsx)(`div`,{className:`font-mono text-[13px] font-semibold`,children:e.key}),e.fields.length===0?(0,z.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:Zo()}):(0,z.jsx)(VZ,{labels:[Bo(),rs()],format:mse,rows:e.fields.map(e=>({field:e.field,a:e.from,b:e.to}))})]},e.key))}):(0,z.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:ts()})}function Z5({table:e,record:t,busy:n,onRevert:r}){return t.kind===`added`?(0,z.jsx)(Q5,{label:Go({record:t.key}),confirm:Ho(),remove:!0,busy:n,onConfirm:()=>r({records:[{table:e,key:t.key,delete:!0}],files:[]})}):(0,z.jsx)(`button`,{type:`button`,"aria-label":ds({record:t.key}),title:ds({record:t.key}),disabled:n||t.kind===`modified`&&t.fields.length===0,className:`rounded p-1 text-muted-foreground hover:bg-panel-2 hover:text-foreground disabled:opacity-30`,onClick:()=>r({records:[{table:e,key:t.key}],files:[]}),children:(0,z.jsx)(nk,{className:`size-4`})})}function gse({change:e,busy:t,onRevert:n}){let r=e.status===`added`;return(0,z.jsx)(Q5,{label:r?Go({record:e.path}):ds({record:e.path}),confirm:r?Ho():cs(),remove:r,busy:t,onConfirm:()=>n({records:[],files:[e.path]})})}function Q5({label:e,confirm:t,remove:n=!1,busy:r,onConfirm:i}){let[a,o]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{r||o(!1)},[r]),a?(0,z.jsx)(V,{size:`sm`,variant:`destructive`,className:`h-6 px-2 text-[12.5px]`,autoFocus:!0,disabled:r,onBlur:()=>o(!1),onClick:i,children:t}):(0,z.jsx)(`button`,{type:`button`,"aria-label":e,title:e,disabled:r,className:T(`rounded p-1 text-muted-foreground hover:bg-panel-2 disabled:opacity-50`,n?`hover:text-err`:`hover:text-foreground`),onClick:()=>o(!0),children:n?(0,z.jsx)(XO,{className:`size-4`}):(0,z.jsx)(nk,{className:`size-4`})})}function $5({label:e,kind:t,fields:n,action:r}){return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13.5px]`,children:e}),n&&n.length>0&&(0,z.jsx)(`span`,{className:`min-w-0 truncate text-[12.5px] text-muted-foreground`,children:n.join(`, `)}),(0,z.jsx)(`span`,{className:T(`ml-auto shrink-0 text-[12.5px]`,fse[t]),children:dse[t]()}),(0,z.jsx)(`span`,{className:`flex min-w-7 shrink-0 justify-end`,children:r})]})}function _se({change:e,list:t,checked:n,busy:r,onToggle:i,onRevert:a}){let[o,s]=(0,B.useState)(!1),{table:c,records:l}=e,u=!t&&c!==null&&l?.length===1?l[0]:null;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md px-1 py-1`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`checkbox`,"aria-label":es({file:e.path}),checked:n,onChange:i}),l&&l.length>0?(0,z.jsx)(`button`,{type:`button`,"aria-expanded":o,"aria-label":Es({file:e.path}),className:`rounded p-0.5 text-muted-foreground hover:bg-panel-2`,onClick:()=>s(!o),children:(0,z.jsx)(QD,{className:T(`size-4 transition-transform`,o&&`rotate-90`)})}):(0,z.jsx)(`span`,{className:`w-5 shrink-0`}),u&&c?(0,z.jsx)($5,{label:u.key,kind:u.kind,fields:u.fields,action:(0,z.jsx)(Z5,{table:c,record:u,busy:r,onRevert:a})}):(0,z.jsx)($5,{label:e.path,kind:e.status,action:l===null&&(0,z.jsx)(gse,{change:e,busy:r,onRevert:a})})]}),!u&&c&&l&&l.length>0&&(0,z.jsx)(`div`,{className:`ml-12 flex flex-col gap-1`,children:l.map(e=>(0,z.jsx)($5,{label:e.key,kind:e.kind,fields:e.fields,action:(0,z.jsx)(Z5,{table:c,record:e,busy:r,onRevert:a})},e.key))}),o&&(0,z.jsx)(`div`,{className:`mt-1 ml-12 border-t pt-2`,children:(0,z.jsx)(hse,{path:e.path,many:!u})})]})}function e7({git:e,open:t,onOpenChange:n}){let r=Cg(),{data:i}=ey(),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(new Set),[h,g]=(0,B.useState)(null),_=e.changes.map(e=>e.path).filter(e=>!p.has(e)),v=e.branch===e.defaultBranch,y=()=>void r.invalidateQueries({queryKey:k5}),b=U_({queryKey:[...k5,`pr`,e.branch],queryFn:A5.openPr,enabled:t&&!v,staleTime:3e4}),x=v?null:b.data??null,S=v||b.isSuccess||b.isError,C=(0,B.useRef)(0),w=F$(),T=I$(),D=w?z$(w,{viewerKeys:T?.viewerKeys??!0}):null,O=W_({mutationFn:async e=>({...await A5.draft({paths:_,mode:x?`commit`:`pr`,locale:E(),...D}),at:e}),onSuccess:e=>{e.at===C.current&&(o(e.title),e.body!==void 0&&c(e.body))}}),k=W_({mutationFn:()=>A5.review({title:a.trim(),body:x?``:s,paths:_,...v&&l.trim()?{branch:l.trim()}:{}}),onSettled:y}),A=e=>void Foe(e).then(y).catch(e=>cv.error(e instanceof Error?e.message:String(e))),j=W_({mutationFn:e=>A5.revert(e),onSuccess:({reverted:e,files:t})=>cv.success(bs({count:e.length+t.length}),t.length>0?{}:{action:{label:js(),onClick:()=>A(e)}}),onSettled:()=>{g(null),y()}}),M=k.isPending||j.isPending||O.isPending,N=e.changes.filter(e=>!p.has(e.path)).map(pse),P={records:N.flatMap(e=>e.records),files:N.flatMap(e=>e.files)},ee=P.records.length+P.files.length,F=JSON.stringify(P),I=h===F,te=e=>{m(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},ne=e=>{n(e),e||(k.reset(),j.reset(),O.reset(),C.current++,o(``),c(``),u(``),m(new Set),g(null))},re=e.changes.length===0;(0,B.useEffect)(()=>{re&&!k.data&&n(!1)},[re,k.data,n]);let ie=new Set(i?.tables.filter(e=>e.mode===`list`).map(e=>e.name)),ae=k.data,oe=k.error??j.error??O.error,se=oe instanceof Error?oe.message:ae?.error??null;return(0,z.jsx)(gk,{open:t,onOpenChange:ne,children:(0,z.jsxs)(yk,{className:`sm:max-w-2xl`,onInteractOutside:e=>{e.target instanceof Element&&e.target.closest(`[data-sonner-toaster]`)&&e.preventDefault()},children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{className:`text-[18px]`,children:As()}),(0,z.jsx)(wk,{className:`text-[14px]`,children:v?ns():b.isPending?Fo():x?Io():Lo()}),x&&!ae&&(0,z.jsxs)(`a`,{href:x,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[14px] font-semibold text-tomato hover:underline`,children:[is(),(0,z.jsx)(iO,{className:`size-4`})]})]}),ae?(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 text-[15px]`,children:[!ae.error&&(0,z.jsx)(`p`,{children:Cs()}),ae.url&&(0,z.jsxs)(`a`,{href:ae.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 font-semibold text-tomato hover:underline`,children:[ae.created?is():Vo(),(0,z.jsx)(iO,{className:`size-4`})]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`fieldset`,{className:`flex max-h-[45vh] flex-col gap-2 overflow-auto rounded-md border p-3 text-[14px]`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-[13px] text-muted-foreground`,children:Xo({count:_.length})}),M5(e.changes).map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,z.jsx)(`div`,{className:`text-[12.5px] font-semibold text-muted-foreground`,children:e.table??as()}),e.changes.map(e=>(0,z.jsx)(_se,{change:e,list:e.table!==null&&ie.has(e.table),checked:!p.has(e.path),busy:M,onToggle:()=>te(e.path),onRevert:e=>j.mutate(e)},e.path))]},e.table??``))]}),v&&e.namesBranch&&(0,z.jsx)(ak,{"aria-label":Ro(),placeholder:Ro(),value:l,onChange:e=>u(e.target.value),className:`font-mono text-[15px]`}),(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsx)(ak,{"aria-label":x?zo():ss(),placeholder:x?zo():ss(),value:a,onChange:e=>o(e.target.value),className:`text-[15px]`}),D&&(0,z.jsxs)(V,{variant:`outline`,disabled:_.length===0||M||!v&&b.isPending,onClick:()=>O.mutate(C.current),children:[(0,z.jsx)(zO,{className:`size-4`}),O.isPending?Ko():R()]})]}),D&&(0,z.jsx)(`button`,{type:`button`,className:`self-end text-[13.5px] text-muted-foreground underline-offset-2 hover:underline`,onClick:()=>f(!0),children:qo()}),d&&(0,z.jsx)(P5,{open:!0,onOpenChange:f}),S&&!x&&(0,z.jsx)(dJ,{"aria-label":os(),placeholder:os(),value:s,onChange:e=>c(e.target.value),className:`min-h-20 text-[15px]`})]}),se&&(0,z.jsx)(`p`,{role:`alert`,className:`text-[13px] text-err`,children:se}),(0,z.jsx)(Sk,{children:ae?(0,z.jsx)(V,{onClick:()=>ne(!1),children:gt()}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(V,{variant:I?`destructive`:`outline`,className:`sm:mr-auto`,disabled:ee===0||M,onClick:()=>P.files.length>0&&!I?g(F):j.mutate(P),children:[(0,z.jsx)(nk,{className:`size-4`}),I?_s({count:ee}):ms({count:ee})]}),(0,z.jsx)(V,{variant:`outline`,onClick:()=>ne(!1),children:ht()}),(0,z.jsx)(V,{disabled:a.trim()===``||_.length===0||M||!S,onClick:()=>k.mutate(),children:k.isPending?Ss():xs()})]})})]})})}function vse(){let e=j5(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),a=e?.restoresDefault===!0&&e.defaultBranch!==null;return zv()||!e||e.changes.length===0&&!t&&!a?null:(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5`,children:[a&&(0,z.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-[13px] text-muted-foreground hover:text-foreground`,onClick:()=>i(!0),children:[(0,z.jsx)(AO,{className:`size-3.5`}),Tr({branch:e.defaultBranch??``})]}),e.changes.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:Qn({count:e.changes.length})}),(0,z.jsxs)(`button`,{type:`button`,disabled:e.branch===null,className:`flex items-center gap-1.5 rounded-md bg-tomato px-3 py-1.5 text-[13px] font-semibold text-[var(--y-on-accent)] hover:opacity-90 disabled:opacity-60`,onClick:()=>n(!0),children:[(0,z.jsx)(WD,{className:`size-3.5`}),Ar()]})]}),t&&(0,z.jsx)(e7,{git:e,open:t,onOpenChange:n}),r&&e.defaultBranch&&(0,z.jsx)(X5,{branch:e.defaultBranch,open:r,onOpenChange:i})]})}function yse(){let e=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let t=YJ();if(t&&e.current)return e.current.append(t),()=>t.remove()},[]),(0,z.jsxs)(`footer`,{className:`app-footer flex min-h-[48px] flex-wrap items-center gap-x-3 gap-y-2 border-t bg-panel px-3 py-2 max-md:pb-[calc(8px+env(safe-area-inset-bottom))]`,children:[(0,z.jsx)(`div`,{ref:e,className:`app-footer-host min-w-0 flex-1`}),(0,z.jsx)(vse,{})]})}function bse({className:e,...t}){return(0,z.jsx)(IQ,{"data-slot":`command`,className:T(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function xse({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,value:o,onValueChange:s,...c}){return(0,z.jsxs)(gk,{...c,children:[(0,z.jsxs)(bk,{className:`sr-only`,children:[(0,z.jsx)(Ck,{children:e}),(0,z.jsx)(wk,{children:t})]}),(0,z.jsx)(yk,{className:T(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,z.jsx)(bse,{filter:a,value:o,onValueChange:s,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Sse({className:e,...t}){return(0,z.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,z.jsx)(IO,{className:`size-4 shrink-0 opacity-50`}),(0,z.jsx)(IQ.Input,{"data-slot":`command-input`,className:T(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Cse({className:e,...t}){return(0,z.jsx)(IQ.List,{"data-slot":`command-list`,className:T(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function wse({...e}){return(0,z.jsx)(IQ.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function t7({className:e,...t}){return(0,z.jsx)(IQ.Group,{"data-slot":`command-group`,className:T(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function n7({className:e,...t}){return(0,z.jsx)(IQ.Item,{"data-slot":`command-item`,className:T(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}var r7=!1,i7=new Set;function a7(e){r7=typeof e==`function`?e(r7):e;for(let e of i7)e()}var o7=()=>a7(!0),Tse=e=>(i7.add(e),()=>{i7.delete(e)}),Ese=()=>(0,B.useSyncExternalStore)(Tse,()=>r7),s7=`\0`,Dse=(e,t,n)=>e.startsWith(s7)?1:xQ(e,t,n),Ose=10,kse=10;function Ase(){let e=Ese(),t=Nh(),{data:n}=ey(),r=F$(),[i,a]=(0,B.useState)(``);(0,B.useEffect)(()=>{e||a(``)},[e]);let o=_$(i.trim(),200),s=c$(o),{data:c,isFetching:l}=p$(o,5),u=s&&c?d$(c.hits,o).slice(0,Ose):[],d=s&&c?[...new Map(c.hits.map(e=>[e.table,e.total])).values()].reduce((e,t)=>e+t,0):0,f=s&&(u.length>0||l),p=e=>`${s7}${e.table}${s7}${e.key}`,[m,h]=(0,B.useState)(``),g=u[0]?p(u[0]):null;(0,B.useEffect)(()=>{g&&h(g)},[g]);let _=()=>v(()=>t({to:`/search`,search:{q:o}}));(0,B.useEffect)(()=>{let e=e=>{e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a7(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let v=e=>{a7(!1),e()};return(0,z.jsxs)(xse,{open:e,onOpenChange:a7,filter:Dse,value:m,onValueChange:h,className:`sm:max-w-2xl`,children:[(0,z.jsx)(Sse,{placeholder:dt(),className:`max-md:pr-10`,value:i,onValueChange:a,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&u.length>0&&(e.preventDefault(),_())}}),(0,z.jsxs)(Cse,{className:`max-h-[min(480px,60vh)] max-md:max-h-none`,children:[!f&&(0,z.jsx)(wse,{children:st()}),f&&(0,z.jsxs)(t7,{heading:(0,z.jsxs)(`span`,{className:`flex justify-between`,children:[(0,z.jsx)(`span`,{children:ft()}),d>0&&(0,z.jsx)(`span`,{children:Sl({count:d})})]}),forceMount:!0,children:[u.map(e=>(0,z.jsxs)(n7,{value:p(e),className:`gap-3`,onSelect:()=>v(()=>t({to:`/t/$table`,params:{table:e.table},search:{key:e.key}})),children:[(0,z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border bg-panel text-muted-foreground`,children:(0,z.jsx)(GO,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`truncate text-base font-semibold`,children:(0,z.jsx)(g$,{text:e.label??e.key,needle:o})}),e.label!==null&&(0,z.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:(0,z.jsx)(g$,{text:e.key,needle:o})}),(0,z.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.table})]}),e.value!==e.key&&e.value!==e.label&&(0,z.jsxs)(`span`,{className:`truncate text-sm text-muted-foreground`,children:[`${e.column}: `,(0,z.jsx)(h$,{value:e.value,needle:o,around:kse})]})]})]},`${e.table}${s7}${e.key}`)),u.length===0&&(0,z.jsx)(n7,{value:`${s7}searching`,disabled:!0,children:pt()}),u.length>0&&(0,z.jsxs)(n7,{value:`${s7}all`,className:`font-semibold text-tomato`,onSelect:_,children:[ot({count:d}),(0,z.jsx)(BD,{className:`ml-auto size-4`,"aria-hidden":!0})]})]}),(0,z.jsx)(t7,{heading:Pi(),children:n?.tables.map(e=>(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/t/$table`,params:{table:e.name}})),children:e.name},e.name))}),n&&n.views.length>0&&(0,z.jsx)(t7,{heading:mt(),children:n.views.map(e=>(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/t/$table`,params:{table:e.name}})),children:e.name},e.name))}),n&&n.pages.length>0&&(0,z.jsx)(t7,{heading:_i(),children:n.pages.map(e=>(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/p/$page`,params:{page:e.name}})),children:e.title},e.name))}),(0,z.jsxs)(t7,{heading:Fi(),children:[(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/sql`})),children:ki()}),(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/erd`})),children:pi()}),!zv()&&(0,z.jsx)(n7,{onSelect:()=>v(()=>t({to:`/sync`})),children:Ai()}),r!==null&&(0,z.jsx)(n7,{onSelect:()=>v(a1.open),children:fi()})]})]}),(0,z.jsx)(`div`,{className:`flex gap-4 border-t px-3.5 py-2 text-xs text-muted-foreground max-md:hidden`,children:[[`↑↓`,lt()],[`↵`,ut()],[`⌘↵`,ct()]].map(([e,t])=>(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`kbd`,{className:`mr-1 rounded border px-1 font-mono`,children:e}),t]},e))})]})}function c7(){return(0,B.useSyncExternalStore)(yv.subscribe,yv.expired)?(0,z.jsx)(`div`,{role:`alert`,className:`bg-err-soft px-4 py-2 text-[12px] text-err`,children:zl()}):null}function l7(){let e=ty(),t=Nh(),n=qJ();return(0,B.useEffect)(()=>e.listen(e=>{e.type===`conflict`&&cv.warning(Dt({table:e.table,key:e.key}),{description:e.winner===`file`?wt():Ct(),action:n?void 0:{label:Ot(),onClick:()=>void t({to:`/sync`})},duration:15e3})}),[e,t,n]),null}var jse=[`TEXT`,`INTEGER`,`REAL`,`BOOLEAN`,`JSON`];function u7({open:e,onOpenChange:t,adopt:n}){let r=Cg(),i=Nh(),{connected:a}=ny(),{data:o}=ey(),s=(0,B.useId)(),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(n??``),[f,p]=(0,B.useState)(`files`),[m,h]=(0,B.useState)(`id`),[g,_]=(0,B.useState)([]),v=W_({mutationFn:()=>Nv.createTable({name:u,mode:f,key:m,columns:Object.fromEntries(g.filter(e=>e.name!==``).map(e=>[e.name,e.type])),group:c.trim()===``?void 0:c.trim()}),onSuccess:async()=>{t(!1),await r.invalidateQueries({queryKey:[`meta`]}),i({to:`/t/$table`,params:{table:u}})}}),y=Ak(v.error),b=e=>y?.field===e?(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:y.message}):null;return(0,z.jsx)(gk,{open:e,onOpenChange:t,children:(0,z.jsxs)(yk,{children:[(0,z.jsx)(bk,{children:(0,z.jsx)(Ck,{children:n?Ft({table:n}):cn()})}),(0,z.jsxs)(`label`,{className:`text-[11.5px] font-semibold text-muted-foreground`,children:[on(),(0,z.jsx)(ak,{"aria-label":gn(),value:u,disabled:n!==void 0,onChange:e=>d(e.target.value),className:`mt-1 font-mono`})]}),b(`name`),(0,z.jsxs)(`fieldset`,{className:`flex gap-4 text-[12px]`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`input`,{type:`radio`,checked:f===`files`,onChange:()=>p(`files`)}),` `,tn({name:u||`name`})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`input`,{type:`radio`,checked:f===`list`,onChange:()=>p(`list`)}),` `,an({name:u||`name`})]})]}),(0,z.jsxs)(`label`,{className:`text-[11.5px] font-semibold text-muted-foreground`,children:[Kt(),(0,z.jsx)(ak,{"aria-label":Gt(),value:m,onChange:e=>h(e.target.value),className:`mt-1 font-mono`})]}),b(`key`),(0,z.jsxs)(`label`,{className:`text-[11.5px] font-semibold text-muted-foreground`,children:[Wt(),(0,z.jsx)(ak,{"aria-label":ud(),list:s,value:c,onChange:e=>l(e.target.value),className:`mt-1`})]}),(0,z.jsx)(`datalist`,{id:s,children:uk(o?.tables??[]).map(e=>(0,z.jsx)(`option`,{value:e},e))}),b(`group`),!n&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,z.jsx)(`span`,{className:`text-[11.5px] font-semibold text-muted-foreground`,children:Ht()}),g.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,z.jsx)(ak,{"aria-label":Rt({n:t+1}),value:e.name,onChange:e=>_(g.map((n,r)=>r===t?{...n,name:e.target.value}:n)),className:`font-mono max-md:basis-full`}),(0,z.jsx)(`select`,{"aria-label":Vt({n:t+1}),className:`rounded border bg-background px-2 max-md:h-9 max-md:flex-1`,value:e.type,onChange:e=>_(g.map((n,r)=>r===t?{...n,type:e.target.value}:n)),children:jse.map(e=>(0,z.jsx)(`option`,{children:e},e))}),(0,z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":dn({n:t+1}),onClick:()=>_(g.filter((e,n)=>n!==t)),children:(0,z.jsx)(ik,{className:`size-4`})})]},t)),(0,z.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>_([...g,{name:``,type:`TEXT`}]),children:kt()}),b(`columns`)]}),y&&y.field===null&&(0,z.jsx)(`p`,{className:`text-[11px] text-err`,children:y.message}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>t(!1),children:ht()}),(0,z.jsx)(V,{disabled:u===``||v.isPending||!a,title:a?void 0:yt(),onClick:()=>v.mutate(),children:Ut()})]})]})})}var Mse=Cx,Nse={left:`inset-y-0 left-0 h-dvh w-[82%] max-w-[320px] border-r animate-[y-slide-right_160ms_ease-out]`,bottom:`inset-x-0 bottom-0 max-h-dvh border-t animate-[y-slide-up_160ms_ease-out]`};function Pse({side:e,title:t,className:n,children:r,...i}){return(0,z.jsxs)(Dx,{children:[(0,z.jsx)(kx,{className:`fixed inset-0 z-50 bg-black/40`}),(0,z.jsxs)(Nx,{"aria-describedby":void 0,className:T(`fixed z-50 flex flex-col bg-panel shadow-xl outline-none`,Nse[e],n),...i,children:[(0,z.jsx)(Lx,{className:`sr-only`,children:t}),r]})]})}function Fse(e,t){let[,n,r]=e.split(`/`),i=r?decodeURIComponent(r):``;return n===`t`&&i?i:n===`p`&&i?t.find(e=>e.name===i)?.title??i:n===`sql`?ki():n===`sync`?Ai():n===`erd`?pi():`yamlite`}var Ise={toDb:{symbol:`M`,tone:`warn`,detail:()=>`file → DB`},toFile:{symbol:`M`,tone:`warn`,detail:()=>`DB → file`},deleteDb:{symbol:`−`,tone:`err`,detail:te},deleteFile:{symbol:`−`,tone:`err`,detail:ne}};function Lse(e){let t=[];for(let n of e)if(n.type===`sync`){n.ok||t.push({at:n.at,symbol:`✗`,tone:`err`,text:n.table,detail:n.error??re()});for(let e of n.changes){let{detail:r,...i}=Ise[e.op];t.push({at:n.at,...i,detail:r(),text:`${n.table} / ${e.key}`})}}else n.type===`conflict`?t.push({at:n.at,symbol:`⚠`,tone:`err`,text:`${n.table} / ${n.key}`,detail:I({winner:n.winner})}):n.type===`error`?t.push({at:n.at,symbol:`✗`,tone:`err`,text:n.table??`yamlite`,detail:n.message}):t.push({at:n.at,symbol:`↻`,tone:`muted`,text:`yamlite.yaml`,detail:P()});return t.reverse()}function d7(e,t=new Set){return Object.entries(e).flatMap(([e,n])=>n.map(n=>{let r=n.indexOf(`: `),i=r>0?n.slice(0,r):``;if(i===``||i.includes(` `))return{table:e,key:null,view:null,text:n};let a=n.slice(r+2);return t.has(i)?{table:e,key:null,view:i,text:a}:{table:e,key:i,view:null,text:a}}))}function Rse(e){let t=new Map;for(let n of e)n.key!==null&&t.set(n.key,[...t.get(n.key)??[],n.text]);return t}function zse(e,t){let n=new Map;for(let r of d7(e,t)){let e=r.view??r.table;n.set(e,(n.get(e)??0)+1)}return n}var Bse=!1,f7=()=>Bse;function p7(e,t){return t.value===null?{col:e.column,op:`null`}:{col:e.column,op:e.json?`has`:`eq`,value:t.value}}function Vse(e,t,n){if(e.length!==1)return!1;let[r]=e,i=p7(t,n);return r.col===i.col&&r.op===i.op&&r.value===i.value}var Hse=(e,t)=>(e.captures??[]).some(e=>e.column===t);function Use(e,t){if(Object.hasOwn(e.columns,t))return[t];let[n,...r]=t.split(`.`);return!n||r.length===0||r.some(e=>e===``)?null:Object.hasOwn(e.columns,n)&&e.columns[n]===`JSON`?[n,...r]:null}var Wse=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function m7(e,t,n){let[r,...i]=t;return i.length===0?{...e,[r]:n}:{...e,[r]:m7(Wse(e[r])?e[r]:{},i,n)}}function Gse(e,t){let n={};for(let r of t){if(r.col===e.key||Hse(e,r.col))continue;let t=Use(e,r.col);t!==null&&(r.op===`eq`?n=m7(n,t,r.value):r.op===`has`&&(n=m7(n,t,t.length>1?r.value:[r.value])))}return n}function Kse(e,t){let n=[...e.captures??[]].sort((e,t)=>e.segment-t.segment),r=``;for(let[e,i]of n.entries()){if(i.segment!==e)break;let n=t.find(e=>e.col===i.column&&e.op===`eq`);if(!n)break;r+=`${String(n.value)}/`}return r}function qse({className:e}){return(0,z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 64 64`,"aria-hidden":`true`,className:e,children:[(0,z.jsx)(`rect`,{width:`64`,height:`64`,rx:`15`,fill:`#e5484d`}),(0,z.jsx)(`path`,{d:`M15 19L27 38M39 19L22 50`,stroke:`#fff7ed`,strokeWidth:`7`,strokeLinecap:`round`,fill:`none`}),(0,z.jsx)(`circle`,{cx:`48`,cy:`29`,r:`4.5`,fill:`#1c1b29`}),(0,z.jsx)(`circle`,{cx:`48`,cy:`44`,r:`4.5`,fill:`#fff7ed`})]})}var h7=`flex items-center gap-2 rounded-md px-2.5 py-1.5 mx-1.5 text-[13px] hover:bg-panel-2 max-md:py-2.5 max-md:text-[15px]`,g7={className:T(h7,`bg-tomato text-[var(--y-on-accent)] font-semibold hover:bg-tomato [&>[data-count]]:text-current [&>[data-count]]:opacity-80`)};function _7({count:e,fallback:t}){return e===0?t:(0,z.jsxs)(`span`,{role:`img`,"aria-label":Ri({count:e}),title:Ri({count:e}),className:`flex shrink-0 items-center gap-0.5 rounded-full bg-warn-soft px-1 text-[10.5px] font-semibold text-warn`,children:[(0,z.jsx)(QO,{className:`size-3`}),e]})}function v7({onNewTable:e,onSearch:t}){let{data:n}=ey(),r=F$(),{warnings:i,connected:a}=ny(),o=zv(),{data:s}=U_({queryKey:[`conflicts`],queryFn:Nv.conflicts,enabled:!o}),c=s?.conflicts.length??0,l=new Set(n?.views.map(e=>e.name)),[u,d]=pk(),[f,p]=mk(),m=xg({select:e=>e.matches.find(e=>e.routeId===`/t/$table`)}),h=m?.params?.table,g=m?.search?.filter??[],_=n?.views.find(e=>e.name===h),v=e=>{let t=e.split;return t!==null&&h===e.name?t.items.find(e=>Vse(g,t,e)):void 0},y=_?.table??n?.tables.find(e=>v(e)!==void 0)?.name??null,[b,x]=(0,B.useState)(null);b!==null&&b!==y&&x(null);let S=e=>{let t=d7({[e.name]:i[e.name]??[]},l),r=e=>t.filter(t=>t.view===e).length,a=e.split,o=n?.views.filter(t=>t.table===e.name)??[],s=v(e),c=a!==null&&a.items.length>0||o.length>0,u=c&&(f.has(e.name)||y===e.name&&b!==e.name);return(0,z.jsxs)(B.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center`,children:[(0,z.jsxs)(Yh,{to:`/t/$table`,params:{table:e.name},className:T(h7,`min-w-0 flex-1`),activeProps:s?{}:{className:T(g7.className,`min-w-0 flex-1`)},children:[(0,z.jsx)(_7,{count:r(null),fallback:(0,z.jsx)(GO,{className:`size-3.5 opacity-70`})}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`span`,{"data-count":!0,className:`ml-auto text-[11px] text-muted-foreground tabular-nums max-md:text-[12.5px]`,children:e.count})]}),c&&(0,z.jsx)(`button`,{type:`button`,"aria-label":Ni({table:e.name}),"aria-expanded":u,className:`mr-1.5 rounded-md p-1 text-muted-foreground hover:bg-panel-2 max-md:p-2`,onClick:()=>{y===e.name?u?(f.has(e.name)&&p(e.name),x(e.name)):x(null):p(e.name)},children:(0,z.jsx)(QD,{className:T(`size-3.5 transition-transform`,u&&`rotate-90`)})})]}),u&&a?.items.map(t=>(0,z.jsxs)(Yh,{to:`/t/$table`,params:{table:e.name},search:{filter:[p7(a,t)]},className:T(t===s?g7.className:h7,`min-w-0`),activeProps:{},style:{paddingLeft:`24px`},children:[(0,z.jsx)(one,{className:`size-3.5 shrink-0 opacity-70`}),(0,z.jsx)(`span`,{className:`truncate`,children:t.value===null?Oi():String(t.value)}),(0,z.jsx)(`span`,{"data-count":!0,className:`ml-auto text-[11px] text-muted-foreground tabular-nums max-md:text-[12.5px]`,children:t.count})]},JSON.stringify(t.value))),u&&o.map(e=>(0,z.jsxs)(Yh,{to:`/t/$table`,params:{table:e.name},className:h7,activeProps:g7,style:{paddingLeft:`${10+e.depth*14}px`},children:[(0,z.jsx)(_7,{count:r(e.name),fallback:(0,z.jsx)(lO,{className:`size-3.5 shrink-0 opacity-70`})}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`span`,{"data-count":!0,className:`ml-auto text-[11px] text-muted-foreground tabular-nums max-md:text-[12.5px]`,children:e.count})]},e.name))]},e.name)};return(0,z.jsxs)(`aside`,{className:`flex h-full min-h-0 flex-col border-r bg-panel`,"aria-label":Ei(),children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 pt-3.5 pb-2.5 text-base font-bold tracking-tight`,children:!f7()&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(qse,{className:`size-6`}),`YAMLite`,(0,z.jsx)(Jse,{})]})}),(0,z.jsxs)(`div`,{className:`mx-2.5 mb-2 flex gap-1.5`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 justify-between rounded-md border bg-background px-2 py-1.5 text-[12px] text-muted-foreground max-md:py-2.5 max-md:text-[14px]`,onClick:()=>{t?.(),o7()},children:[(0,z.jsx)(`span`,{children:Ti()}),(0,z.jsx)(`kbd`,{className:`rounded border px-1 font-mono text-[10px] max-md:hidden`,children:`⌘K`})]}),r!==null&&(0,z.jsx)(`button`,{type:`button`,"aria-label":fi(),title:fi(),className:`grid place-items-center rounded-md border bg-background px-2 hover:bg-panel-2 max-md:px-3`,onClick:()=>{if(!t)return a1.toggle();t(),a1.open()},children:(0,z.jsx)(zO,{className:`size-4`})})]}),(0,z.jsx)(`div`,{className:`px-3.5 pt-2.5 pb-1 text-[10.5px] font-semibold tracking-wider text-muted-foreground uppercase max-md:text-[12px]`,children:Pi()}),(0,z.jsxs)(`nav`,{className:`flex flex-col gap-px overflow-auto`,children:[n&&lk(n.tables).map(({group:e,tables:t})=>{if(e===null)return(0,z.jsx)(B.Fragment,{children:t.map(S)},``);let n=!u.has(e);return(0,z.jsxs)(`div`,{role:`group`,"aria-label":e,className:`flex flex-col gap-px`,children:[(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`mx-1.5 mt-1.5 flex items-center gap-1 rounded-md px-1.5 py-1 text-[11.5px] font-semibold text-muted-foreground hover:bg-panel-2 max-md:py-2 max-md:text-[13px]`,onClick:()=>d(e),children:[(0,z.jsx)(QD,{className:T(`size-3 transition-transform`,n&&`rotate-90`)}),(0,z.jsx)(`span`,{className:`truncate`,children:e})]}),n&&t.map(S)]},`g:${e}`)}),!o&&(0,z.jsxs)(`button`,{type:`button`,disabled:!a,title:a?void 0:yt(),className:T(h7,`text-muted-foreground disabled:opacity-50`),onClick:e,children:[(0,z.jsx)(lne,{className:`size-3.5`}),` `,gi()]})]}),n&&n.pages.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`px-3.5 pt-2.5 pb-1 text-[10.5px] font-semibold tracking-wider text-muted-foreground uppercase max-md:text-[12px]`,children:_i()}),(0,z.jsx)(`nav`,{className:`flex flex-col gap-px`,children:n.pages.map(e=>(0,z.jsxs)(Yh,{to:`/p/$page`,params:{page:e.name},className:h7,activeProps:g7,children:[(0,z.jsx)(ane,{className:`size-3.5 opacity-70`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.title})]},e.name))})]}),(0,z.jsx)(`div`,{className:`px-3.5 pt-2.5 pb-1 text-[10.5px] font-semibold tracking-wider text-muted-foreground uppercase max-md:text-[12px]`,children:Fi()}),(0,z.jsxs)(`nav`,{className:`flex flex-col gap-px`,children:[(0,z.jsxs)(Yh,{to:`/sql`,className:h7,activeProps:g7,children:[(0,z.jsx)(dne,{className:`size-3.5 opacity-70`}),` `,ki()]}),(0,z.jsxs)(Yh,{to:`/erd`,className:h7,activeProps:g7,children:[(0,z.jsx)(yO,{className:`size-3.5 opacity-70`}),` `,pi()]}),!o&&(0,z.jsxs)(Yh,{to:`/sync`,className:h7,activeProps:g7,children:[(0,z.jsx)(Yte,{className:`size-3.5 opacity-70`}),` `,Ai(),c>0&&(0,z.jsx)(`span`,{className:`ml-auto rounded-full bg-err-soft px-1.5 text-[10.5px] font-semibold text-err`,children:c})]})]}),!o&&(0,z.jsx)(Yse,{})]})}function Jse(){let{data:e}=ey(),t=e?.root??``,n=t.split(/[\\/]/).filter(Boolean).at(-1)??t;return(0,z.jsxs)(ok,{children:[(0,z.jsx)(sk,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":Ci(),className:`ml-auto flex min-w-0 items-center gap-0.5 rounded px-1 font-mono text-[11px] font-normal text-muted-foreground hover:bg-panel-2 max-md:text-[12.5px]`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:n}),(0,z.jsx)(YD,{className:`size-3 shrink-0`})]})}),(0,z.jsxs)(ck,{align:`end`,className:`w-72 text-[13px]`,children:[(0,z.jsx)(`div`,{className:`font-mono text-[12px] break-all text-muted-foreground`,children:t}),(0,z.jsxs)(`dl`,{className:`mt-2.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:bi()}),(0,z.jsx)(`dd`,{className:`truncate font-mono`,children:e?.configFile}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:xi()}),(0,z.jsx)(`dd`,{className:`truncate font-mono`,children:e?.db}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:Pi()}),(0,z.jsx)(`dd`,{children:e?.tables.length??0}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:Si()}),(0,z.jsx)(`dd`,{className:`truncate font-mono`,children:location.host})]})]})]})}function Yse(){let e=j5(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1);if(!e)return null;let a=e.changes.length;return(0,z.jsxs)(`div`,{className:`mt-auto border-t px-3.5 py-2.5 text-[12px] max-md:pb-[calc(0.625rem+env(safe-area-inset-bottom))] max-md:text-[13.5px]`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,z.jsx)(nne,{className:`size-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`truncate font-mono`,children:e.branch??cr()}),(0,z.jsx)(`span`,{children:`·`}),a>0?(0,z.jsx)(`span`,{className:`shrink-0 font-semibold text-foreground`,children:Qn({count:a})}):(0,z.jsx)(`span`,{className:`shrink-0`,children:dr()})]}),(0,z.jsxs)(`button`,{type:`button`,disabled:a===0||e.branch===null,className:T(`mt-2 flex w-full items-center justify-center gap-1.5 rounded-md py-1.5 text-[13px] max-md:py-2.5 max-md:text-[15px]`,a>0?`bg-tomato font-semibold text-[var(--y-on-accent)] hover:opacity-90`:`border bg-background text-muted-foreground disabled:opacity-60`),onClick:()=>n(!0),children:[(0,z.jsx)(WD,{className:`size-3.5`}),Ar()]}),e.restoresDefault&&e.defaultBranch&&(0,z.jsxs)(`button`,{type:`button`,className:`mt-1.5 flex w-full items-center justify-center gap-1.5 rounded-md border bg-background py-1.5 text-[13px] text-muted-foreground hover:text-foreground max-md:py-2.5 max-md:text-[15px]`,onClick:()=>i(!0),children:[(0,z.jsx)(AO,{className:`size-3.5`}),(0,z.jsx)(`span`,{className:`truncate`,children:Tr({branch:e.defaultBranch})})]}),t&&(0,z.jsx)(e7,{git:e,open:t,onOpenChange:n}),r&&e.defaultBranch&&(0,z.jsx)(X5,{branch:e.defaultBranch,open:r,onOpenChange:i})]})}var y7=`grid size-10 shrink-0 place-items-center rounded-md hover:bg-panel-2`;function Xse({onNewTable:e}){let[t,n]=(0,B.useState)(!1),{data:r}=ey(),i=F$(),a=j5(),[o,s]=(0,B.useState)(!1),c=a?.branch?a.changes.length:0,l=xg({select:e=>e.location.pathname});return(0,z.jsxs)(`div`,{className:`flex items-center gap-1 border-b bg-background px-2 pt-[env(safe-area-inset-top)]`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":mi(),className:y7,onClick:()=>n(!0),children:(0,z.jsx)(cne,{className:`size-5`})}),(0,z.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-[16px] font-semibold`,children:Fse(l,r?.pages??[])}),(0,z.jsx)(`button`,{type:`button`,"aria-label":wi(),className:y7,onClick:o7,children:(0,z.jsx)(IO,{className:`size-5`})}),i!==null&&(0,z.jsx)(`button`,{type:`button`,"aria-label":fi(),className:y7,onClick:a1.open,children:(0,z.jsx)(zO,{className:`size-5`})}),a&&c>0&&(0,z.jsxs)(`button`,{type:`button`,"aria-label":`${Ar()} (${Qn({count:c})})`,className:`${y7} relative`,onClick:()=>s(!0),children:[(0,z.jsx)(WD,{className:`size-5`}),(0,z.jsx)(`span`,{className:`absolute top-1 right-1 min-w-4 rounded-full bg-tomato px-1 text-[10.5px] leading-4 font-semibold text-[var(--y-on-accent)]`,children:c})]}),a&&o&&(0,z.jsx)(e7,{git:a,open:o,onOpenChange:s}),(0,z.jsx)(Mse,{open:t,onOpenChange:n,children:(0,z.jsx)(Pse,{side:`left`,title:mi(),onClick:e=>e.target instanceof Element&&e.target.closest(`a`)&&n(!1),children:(0,z.jsx)(v7,{onSearch:()=>n(!1),onNewTable:()=>{n(!1),e()}})})})]})}function Zse({...e}){return(0,z.jsx)(DE,{"data-slot":`select`,...e})}function Qse({...e}){return(0,z.jsx)(jE,{"data-slot":`select-value`,...e})}function $se({className:e,size:t=`default`,children:n,...r}){return(0,z.jsxs)(kE,{"data-slot":`select-trigger`,"data-size":t,className:T(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,z.jsx)(ME,{asChild:!0,children:(0,z.jsx)(YD,{className:`size-4 opacity-50`})})]})}function ece({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,z.jsx)(FE,{children:(0,z.jsxs)(LE,{"data-slot":`select-content`,className:T(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,z.jsx)(nce,{}),(0,z.jsx)(YE,{className:T(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,z.jsx)(rce,{})]})})}function tce({className:e,children:t,...n}){return(0,z.jsxs)($E,{"data-slot":`select-item`,className:T(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,z.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,z.jsx)(rD,{children:(0,z.jsx)(qD,{className:`size-4`})})}),(0,z.jsx)(tD,{children:t})]})}function nce({className:e,...t}){return(0,z.jsx)(aD,{"data-slot":`select-scroll-up-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,z.jsx)(Zte,{className:`size-4`})})}function rce({className:e,...t}){return(0,z.jsx)(sD,{"data-slot":`select-scroll-down-button`,className:T(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,z.jsx)(YD,{className:`size-4`})})}var ice={en:`English`,ja:`日本語`};function ace(){let e=E();return(0,z.jsxs)(Zse,{value:e,onValueChange:t=>t!==e&&i(t),children:[(0,z.jsxs)($se,{size:`sm`,"aria-label":di(),className:`h-6 gap-1 border-0 px-1.5 text-[11px] shadow-none max-md:size-10 max-md:justify-center max-md:p-0 max-md:[&>[data-slot=select-value]]:hidden max-md:[&>svg:last-child]:hidden`,children:[(0,z.jsx)(ine,{className:`size-3.5 max-md:size-4.5`}),(0,z.jsx)(Qse,{})]}),(0,z.jsx)(ece,{position:`popper`,align:`end`,children:o.map(e=>(0,z.jsx)(tce,{value:e,lang:e,children:ice[e]},e))})]})}var oce={light:Td,dark:wd,system:Ed};function sce(){let{connected:e,lastSyncAt:t,warnings:n}=ny(),{data:r}=ey(),i=Lv(),{data:a}=U_({queryKey:[`conflicts`],queryFn:Nv.conflicts,enabled:i===null}),[o,s]=(0,B.useState)(Date.now()),[c,l]=(0,B.useState)(x);(0,B.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let u=Object.values(n).reduce((e,t)=>e+t.length,0),d=a?.conflicts.length??0,f=c===`system`?hO:c===`light`?UO:_O;return(0,z.jsxs)(`footer`,{className:`flex h-[30px] items-center gap-4 border-t bg-panel px-3 text-[11px] text-muted-foreground max-md:h-[calc(40px+env(safe-area-inset-bottom))] max-md:gap-3 max-md:pb-[env(safe-area-inset-bottom)] max-md:text-[12px]`,children:[i?(0,z.jsx)(`span`,{children:hu({at:i.generatedAt.slice(0,16).replace(`T`,` `)})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5`,"aria-live":`polite`,children:[(0,z.jsx)(`span`,{className:`size-[7px] rounded-full ${e?`bg-ok`:`bg-err`}`}),e?f7()?cu():(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`max-md:hidden`,children:wu({root:r?.root??``})}),(0,z.jsx)(`span`,{className:`md:hidden`,children:cu()})]}):lu()]}),(0,z.jsx)(`span`,{className:`max-md:hidden`,children:fu({ago:Poe(t,o)})}),!f7()&&(0,z.jsx)(`span`,{className:`max-md:hidden`,children:location.host})]}),(0,z.jsxs)(`span`,{className:`ml-auto flex items-center gap-3.5`,children:[u>0&&(i?(0,z.jsx)(`span`,{className:`text-warn`,children:xu({count:u})}):(0,z.jsx)(Yh,{to:`/sync`,className:`text-warn hover:underline`,children:xu({count:u})})),d>0&&(0,z.jsx)(`span`,{className:`text-err`,children:su({count:d})}),(0,z.jsx)(ace,{}),(0,z.jsx)(`button`,{type:`button`,"aria-label":vu({theme:oce[c]()}),className:`rounded p-1 hover:bg-panel-2 max-md:grid max-md:size-10 max-md:place-items-center`,onClick:()=>{let e=v(c);C(e),l(e)},children:(0,z.jsx)(f,{className:`size-3.5 max-md:size-4.5`})})]})]})}function cce(){return GJ()?(0,z.jsx)(KJ.Provider,{value:!0,children:(0,z.jsx)(lce,{})}):(0,z.jsx)(uce,{})}function b7(){let{configError:e}=ny();return e?(0,z.jsx)(`div`,{role:`alert`,className:`bg-warn-soft px-4 py-2 text-[12px] text-warn`,children:Nl({error:e})}):null}function lce(){let e=IX();return(0,z.jsxs)(`div`,{className:`grid h-[var(--y-shell-h,100dvh)] grid-cols-1 grid-rows-[auto_1fr_auto]`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(c7,{}),(0,z.jsx)(b7,{})]}),(0,z.jsx)(`main`,{className:`flex min-h-0 min-w-0`,children:(0,z.jsx)(dg,{})}),(0,z.jsx)(yse,{}),(0,z.jsx)(A$,{position:e?`top-center`:`bottom-right`}),(0,z.jsx)(l7,{})]})}function uce(){let[e,t]=(0,B.useState)(!1),n=IX(),r=F$(),i=o1()&&r!==null,[a,o]=jX(`yamlite-sidebar-width`,220,OX);return(0,z.jsxs)(`div`,{className:`grid h-[var(--y-shell-h,100dvh)] grid-cols-1 grid-rows-[auto_1fr_auto]`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(c7,{}),(0,z.jsx)(b7,{}),n&&(0,z.jsx)(Xse,{onNewTable:()=>t(!0)})]}),(0,z.jsxs)(`div`,{className:`grid min-h-0 grid-cols-1`,style:n?void 0:{gridTemplateColumns:`${a}px 1fr`},children:[!n&&(0,z.jsxs)(`div`,{className:`relative min-h-0`,children:[(0,z.jsx)(v7,{onNewTable:()=>t(!0)}),(0,z.jsx)(NX,{width:a,label:Di(),onResize:o,edge:`right`,bounds:OX})]}),(0,z.jsxs)(`main`,{className:`flex min-h-0 min-w-0`,children:[(0,z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,z.jsx)(dg,{})}),i&&(0,z.jsx)(cse,{})]})]}),(0,z.jsx)(sce,{}),(0,z.jsx)(Ase,{}),e&&(0,z.jsx)(u7,{open:!0,onOpenChange:t}),(0,z.jsx)(A$,{position:n?`top-center`:`bottom-right`}),(0,z.jsx)(l7,{})]})}var dce=36,x7=1,fce=2,S7=3,C7=4,pce=5,mce=6,hce=7,gce=8,_ce=9,vce=10,yce=11,bce=12,xce=13,Sce=14,Cce=15,wce=16,Tce=17,w7=18,Ece=19,T7=20,E7=21,D7=22,Dce=23,Oce=24;function O7(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function kce(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function k7(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 Ace(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 jce(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 A7(e,t){for(;e.next==95||O7(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Mce(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),k7(e,t,!1)}else A7(e)}function j7(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function M7(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 N7(e){for(;!(e.next<0||e.next==10);)e.advance()}function P7(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var F7=` \r
|
|
123
|
-
`;function I7(e,t,n){let r=Object.create(null);r.true=r.false=pce,r.null=r.unknown=mce;for(let t of e.split(` `))t&&(r[t]=T7);for(let e of t.split(` `))e&&(r[e]=E7);for(let e of(n||``).split(` `))e&&(r[e]=Oce);return r}var L7={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:I7(`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 `,`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 `)};function Nce(e,t,n,r){let i={};for(let t in L7)i[t]=(e.hasOwnProperty(t)?e:L7)[t];return t&&(i.words=I7(t,n||``,r)),i}function R7(e){return new DA(t=>{let{next:n}=t;if(t.advance(),P7(n,F7)){for(;P7(t.next,F7);)t.advance();t.acceptToken(dce)}else if(n==36&&e.doubleDollarQuotedStrings){let e=A7(t,``);t.next==36&&(t.advance(),Ace(t,e),t.acceptToken(S7))}else if(n==39||n==34&&e.doubleQuotedStrings)k7(t,n,e.backslashEscapes),t.acceptToken(S7);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)N7(t),t.acceptToken(x7);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))N7(t),t.acceptToken(x7);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(fce)}else if((n==101||n==69)&&t.next==39)t.advance(),k7(t,39,!0),t.acceptToken(S7);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),k7(t,39,e.backslashEscapes),t.acceptToken(S7);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),k7(t,39,e.backslashEscapes),t.acceptToken(S7);break}if(!O7(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!P7(t.peek(1),F7)){let e=t.peek(1);t.advance(2),jce(t,e),t.acceptToken(S7)}else if(P7(n,e.identifierQuotes))k7(t,n==91?93:n,!1),t.acceptToken(Ece);else if(n==40)t.acceptToken(hce);else if(n==41)t.acceptToken(gce);else if(n==123)t.acceptToken(_ce);else if(n==125)t.acceptToken(vce);else if(n==91)t.acceptToken(yce);else if(n==93)t.acceptToken(bce);else if(n==59)t.acceptToken(xce);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),j7(t),t.acceptToken(D7);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(k7(t,n,e.backslashEscapes),t.acceptToken(Dce)):(j7(t,n),t.acceptToken(D7))}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();kce(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(C7)}else if(n==46&&t.next>=48&&t.next<=57)M7(t,!0),t.acceptToken(C7);else if(n==46)t.acceptToken(Sce);else if(n>=48&&n<=57)M7(t,!1),t.acceptToken(C7);else if(P7(n,e.operatorChars)){for(;P7(t.next,e.operatorChars);)t.advance();t.acceptToken(Cce)}else if(P7(n,e.specialVar))t.next==n&&t.advance(),Mce(t),t.acceptToken(Tce);else if(n==58||n==44)t.acceptToken(wce);else if(O7(n)){let r=A7(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?w7:e.words[r.toLowerCase()]??w7)}})}var z7=R7(L7),Pce=VA.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,z7],topRules:{Script:[0,25]},tokenPrec:0});function B7(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function V7(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function H7(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function Fce(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)H7(r)&&n.push(V7(e,r));return n}return[V7(e,t)]}function U7(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=B7(t);if(!H7(r))return n;n.unshift(V7(e,r)),t=B7(r)}}function Ice(e,t){let n=WB(e).resolveInner(t,-1),r=Rce(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:U7(e.doc,B7(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:U7(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var Lce=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function Rce(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&&H7(t.nextSibling))o=V7(e,t.nextSibling);else if(n&&Lce.has(n))break;else a&&H7(t)&&(o=V7(e,t));o&&(r||=Object.create(null),r[o]=Fce(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function zce(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Bce=/^\w*$/,Vce=/^[`'"\[]?\w*[`'"\]]?$/;function W7(e){return e.self&&typeof e.self.label==`string`}var Hce=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(G7(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`?G7(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):W7(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;W7(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 G7(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+K7(n)}}function K7(e){return e===`[`?`]`:e}function Uce(e,t,n,r,i,a){let o=new Hce(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}=Ice(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=K7(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:zce(t,r,u),validFor:Vce}}return{from:n,options:u,validFor:Bce}}}function Wce(e){return e==E7?`type`:e==T7?`keyword`:`variable`}function Gce(e,t,n){return lG([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],cG(Object.keys(e).map(r=>n(t?r.toUpperCase():r,Wce(e[r])))))}var Kce=Pce.configure({props:[aV.add({Statement:lV()}),dV.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}}}),ZA({Keyword:W.keyword,Type:W.typeName,Builtin:W.standard(W.name),Bits:W.number,Bytes:W.string,Bool:W.bool,Null:W.null,Number:W.number,String:W.string,Identifier:W.name,QuotedIdentifier:W.special(W.string),SpecialVar:W.special(W.name),LineComment:W.lineComment,BlockComment:W.blockComment,Operator:W.operator,"Semi Punctuation":W.punctuation,"( )":W.paren,"{ }":W.brace,"[ ]":W.squareBracket})]}),qce=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=Nce(t,t.keywords,t.types,t.builtin),r=UB.define({name:`sql`,parser:Kce.configure({tokenizers:[{from:z7,to:R7(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}});return new e(n,r,t)}};function Jce(e,t){return{label:e,type:t,boost:-1}}function Yce(e,t=!1,n){return Gce(e.dialect.words,t,n||Jce)}function Xce(e){return e.schema?Uce(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||q7):()=>null}function Zce(e){return e.schema?(e.dialect||q7).language.data.of({autocomplete:Xce(e)}):[]}function Qce(e={}){let t=e.dialect||q7;return new $B(t.language,[Zce(e),t.language.data.of({autocomplete:Yce(t,e.upperCaseKeywords,e.keywordCompletion)})])}var q7=qce.define({}),J7=`yamlite-sql-history`,$ce=50;function Y7(){try{let e=JSON.parse(localStorage.getItem(J7)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function ele(e){let t=[e,...Y7().filter(t=>t!==e)].slice(0,$ce);try{localStorage.setItem(J7,JSON.stringify(t))}catch{}return t}function X7(e,t=!0,n=!1){let r=``,i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`-`&&o===`-`){let t=e.indexOf(`
|
|
124
|
-
`,i);i=t<0?e.length:t,r+=` `}else if(a===`/`&&o===`*`){let t=e.indexOf(`*/`,i+2);i=t<0?e.length:t+2,r+=` `}else if(a===`'`||a===`"`||a==="`"||a===`[`){let o=a===`[`?`]`:a,s=i+1;for(;s<e.length;s++)if(e[s]===o){if(o!==`]`&&e[s+1]===o)s++;else break}r+=a===`'`&&!n||!t?`''`:e.slice(i,s+1),i=s+1}else r+=a,i++}return r}var tle=e=>X7(e,!1).split(`;`).filter(e=>e.trim()!==``).length,Z7=e=>/^\s*([A-Za-z]+)/.exec(X7(e))?.[1]?.toUpperCase()??``,nle=new Set([`SELECT`,`EXPLAIN`,`VALUES`]),rle=/\b(?:INSERT|UPDATE|DELETE|REPLACE(?!\s*\())\b/i;function ile(e){let t=Z7(e);return nle.has(t)||t===`WITH`&&!rle.test(X7(e,!1))}function ale(e){let t=Z7(e);return t===`DROP`?Wl():(t===`DELETE`||t===`UPDATE`)&&!/\bWHERE\b/i.test(X7(e))?Gl():null}function ole(e){return typeof e==`object`?e.key:e}function sle(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 Q7(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 $7(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var e9=(e,t)=>Math.abs(e-t)<1.01,cle=(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 lle({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 ule=e=>e===`smooth`||e===`smoothFinishing`;function dle({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!ule(n.phase)&&!e9(t,n.lastTargetOffset)&&!e9(t,r())&&e!==`clampedEcho`}var t9=40;function fle(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<t9;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<t9;)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 ple(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<t9;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var n9,r9=()=>{if(n9!==void 0)return n9;if(typeof navigator>`u`)return n9=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return n9=!0;let e=navigator.maxTouchPoints;return n9=navigator.platform===`MacIntel`&&e!==void 0&&e>0},i9,mle=()=>i9===void 0?i9=r9()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):i9,a9={capture:!0,passive:!0},hle=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,a9),e.addEventListener(`touchend`,n,a9),e.addEventListener(`touchcancel`,n,a9),()=>{e.removeEventListener(`touchstart`,t,a9),e.removeEventListener(`touchend`,n,a9),e.removeEventListener(`touchcancel`,n,a9),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(!r9()||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}},o9=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},s9=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()}}},gle=e=>e,_le=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},vle=(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(o9(n)),!r.ResizeObserver)return()=>{};let a=s9(r),o=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(o9(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(r):r()});return o.observe(n,{box:`border-box`}),()=>{o.unobserve(n),a.cancel()}},c9={passive:!0},yle=typeof window>`u`||`onscrollend`in window,ble=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&yle,o=0,s=a?null:cle(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,c9),a&&r.addEventListener(`scrollend`,u,c9),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},xle=(e,t)=>ble(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Sle=(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`]},Cle=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},l9=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,u9=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function wle(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 Tle=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 hle({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`&&ple(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand()}}),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=()=>{if(e)return e;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let i=t=s9(n);return e=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?i.schedule(t):t()})},r=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 r;(r=n())==null||r.disconnect(),t?.cancel(),e=null,t=null},observe:e=>n()?.observe(e,{box:`border-box`}),unobserve:e=>n()?.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:gle,rangeExtractor:_le,onChange:()=>{},measureElement:Sle,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=>ole(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||wle(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=Q7(()=>(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:dle({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||fle(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()?u9(this.scrollState)&&!e9(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)=>lle({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)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=l9(t,e.index!=null&&e9(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=()=>!(r9()&&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=Q7(()=>[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=Q7(()=>[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=sle(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=Q7(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=Dle(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Q7(()=>{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(!u9(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`&&!u9(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=!u9(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=Q7(()=>[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 $7(t[d9(0,t.length-1,r?e=>n[e*2]:e=>$7(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);i.setProperty(a,`hidden`,`important`);let c={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=c,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===c&&(this._momentumStop=null,c.restore()&&c.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.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.measurementsCache[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!(r9()&&this._iosGesture.dragging())&&e!==null&&!e9(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&&e9(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=u9(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){let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&mle()){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:l9(n,e.index!=null&&e9(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},d9=(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 Ele(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 Dle(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=Ele(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=d9(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 f9=typeof document<`u`?B.useLayoutEffect:B.useEffect;function Ole({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=B.useReducer(e=>e+1,0)[1],a=B.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=B.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,K_.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=B.useState(()=>{let e=new Tle(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),f9(()=>d._didMount(),[]),f9(()=>(s(d),d._willUpdate())),f9(()=>{l(d)}),d}function kle(e){return Ole({observeElementRect:vle,observeElementOffset:xle,scrollToFn:Cle,...e})}var p9=(0,B.createContext)(``);function Ale(e,t){if(t===``)return[{text:e,match:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0;for(let t=n.indexOf(r);t>=0;t=n.indexOf(r,a))t>a&&i.push({text:e.slice(a,t),match:!1}),i.push({text:e.slice(t,t+r.length),match:!0}),a=t+r.length;return a<e.length&&i.push({text:e.slice(a),match:!1}),i}function m9({text:e}){let t=Ale(e,(0,B.useContext)(p9));return t.length===1&&!t[0]?.match?e:t.map((e,t)=>e.match?(0,z.jsx)(`mark`,{className:`rounded-[2px] bg-warn-soft text-foreground`,children:e.text},t):e.text)}function h9({value:e}){return typeof e==`string`?(0,z.jsx)(`span`,{className:`text-syn-str`,children:JSON.stringify(e)}):typeof e==`number`?(0,z.jsx)(`span`,{className:`text-syn-num`,children:e}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:String(e)})}function g9({value:e}){if(CJ(e))return(0,z.jsx)(h9,{value:e});let t=Array.isArray(e)?e.map((e,t)=>[String(t),e]):Object.entries(e);return(0,z.jsx)(`div`,{className:`font-mono text-[12px] leading-[1.7]`,children:t.map(([t,n])=>(0,z.jsxs)(`div`,{children:[!Array.isArray(e)&&(0,z.jsx)(`span`,{className:`text-syn-key`,children:t}),!Array.isArray(e)&&`: `,CJ(n)?(0,z.jsx)(h9,{value:n}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:Array.isArray(n)?`[${n.length}]`:`{${Object.keys(n).length}}`}),(0,z.jsx)(`div`,{className:`ml-[3px] border-l pl-3.5`,children:(0,z.jsx)(g9,{value:n})})]})]},t))})}function _9({title:e,value:t,children:n}){return(0,z.jsxs)(ok,{children:[(0,z.jsx)(sk,{asChild:!0,children:n}),(0,z.jsxs)(ck,{className:`w-[min(20rem,calc(100vw-2rem))]`,align:`start`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`mb-1 flex justify-between text-[11px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`button`,{type:`button`,className:`hover:text-foreground`,onClick:()=>void navigator.clipboard?.writeText(JSON.stringify(t,null,2)),children:ui()})]}),(0,z.jsx)(g9,{value:t})]})]})}var v9=`inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]`;function jle({value:e,type:t,format:n,column:r,rowKey:i}){let a=jJ(e,t,n);switch(a.kind){case`null`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});case`bool`:return(0,z.jsx)(`span`,{role:`img`,"aria-label":a.value?`true`:`false`,className:`inline-flex size-3.5 items-center justify-center rounded-[3px] border-[1.5px] ${a.value?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground`}`,children:a.value&&(0,z.jsx)(qD,{className:`size-2.5`,strokeWidth:4})});case`number`:return(0,z.jsx)(`span`,{className:`font-mono tabular-nums`,children:(0,z.jsx)(m9,{text:a.text})});case`text`:return(0,z.jsx)(`span`,{children:(0,z.jsx)(m9,{text:a.text})});case`chips`:return(0,z.jsxs)(`span`,{children:[a.items.map((e,t)=>(0,z.jsx)(`span`,{className:v9,children:(0,z.jsx)(m9,{text:e})},`${t}-${e}`)),a.more>0&&(0,z.jsxs)(`span`,{className:`inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]`,children:[`+`,a.more]})]});case`map`:return(0,z.jsx)(_9,{title:`${r} · ${i}`,value:e,children:(0,z.jsxs)(`button`,{type:`button`,className:`text-left max-md:min-h-8`,onClick:e=>e.stopPropagation(),children:[a.entries.map(([e,t])=>(0,z.jsxs)(`span`,{className:`mr-1.5`,children:[(0,z.jsx)(`span`,{className:`mr-0.5 text-[11px] text-muted-foreground`,children:e}),(0,z.jsx)(m9,{text:t})]},e)),a.more>0&&(0,z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`+`,a.more]})]})});case`nested`:return(0,z.jsx)(_9,{title:`${r} · ${i}`,value:e,children:(0,z.jsxs)(`button`,{type:`button`,className:`text-left max-md:min-h-8`,onClick:e=>e.stopPropagation(),children:[(0,z.jsx)(`span`,{className:`mr-1.5 rounded border px-1 font-mono text-[10px] text-muted-foreground`,children:a.label}),(0,z.jsx)(`span`,{className:`border-b border-dotted border-muted-foreground`,children:a.preview})]})})}}function y9({label:e,hint:t,className:n,children:r}){return(0,z.jsx)(`span`,{className:`contents`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:(0,z.jsxs)(ok,{children:[(0,z.jsx)(sk,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,"aria-label":e,title:typeof t==`string`?t:void 0,className:T(`shrink-0`,n),children:r})}),(0,z.jsx)(ck,{className:`w-auto max-w-[min(20rem,calc(100vw-2rem))] text-[13px] whitespace-pre-line`,children:t})]})})}function b9({column:e,row:t,rowKey:n}){let r=t[e.name],i=jJ(r,e.type,e.format),{reference:a}=e;return a&&(i.kind===`text`||i.kind===`number`)?(0,z.jsx)(WJ,{reference:a,value:String(r),children:(0,z.jsx)(m9,{text:String(r)})}):a&&i.kind===`chips`?(0,z.jsxs)(`span`,{children:[i.items.map((e,t)=>(0,z.jsx)(WJ,{reference:a,value:e,className:`${v9} hover:underline`,children:(0,z.jsx)(m9,{text:e})},`${t}-${e}`)),i.more>0&&(0,z.jsxs)(`span`,{className:`inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]`,children:[`+`,i.more]})]}):(0,z.jsx)(jle,{value:r,type:e.type,format:e.format,column:e.name,rowKey:n})}var Mle=34,Nle=44,x9=`sticky left-0 z-[1] bg-background shadow-[1px_0_0_var(--border)]`,Ple=16;function Fle({column:e,width:t,onResize:n}){let r=e=>t??e.parentElement?.getBoundingClientRect().width??0;return(0,z.jsx)(`div`,{role:`separator`,"aria-label":Ur({column:e}),"aria-orientation":`vertical`,"aria-valuenow":t,tabIndex:0,onPointerDown:t=>{if(t.button!==0)return;t.preventDefault();let i=t.currentTarget;i.setPointerCapture?.(t.pointerId),document.body.setAttribute(`data-resizing`,``);let a=t.clientX,o=r(i),s=t=>n(e,o+t.clientX-a),c=()=>{document.removeEventListener(`pointermove`,s),document.removeEventListener(`pointerup`,c),document.removeEventListener(`pointercancel`,c),i.removeEventListener(`lostpointercapture`,c),document.body.removeAttribute(`data-resizing`)};document.addEventListener(`pointermove`,s),document.addEventListener(`pointerup`,c),document.addEventListener(`pointercancel`,c),i.addEventListener(`lostpointercapture`,c)},onDoubleClick:()=>n(e,null),onKeyDown:t=>{let i=t.key===`ArrowRight`?Ple:t.key===`ArrowLeft`?-16:0;i!==0&&(t.preventDefault(),n(e,r(t.currentTarget)+i))},className:`absolute inset-y-0 -right-[3px] z-[2] w-1.5 cursor-col-resize touch-none outline-none hover:bg-primary/40 focus-visible:bg-primary/40`})}function S9({columns:e,rows:t,keyCol:n,stickyCol:r=n,rowId:i,selectedKey:a,onSelect:o,onEndReached:s,flagged:c,sort:l,onSort:u,widths:d,onResize:f,pinned:p=!0,onTogglePin:m,preview:h}){let g=(0,B.useRef)(null),_=IX(),v=_?Nle:Mle,y=kle({count:t.length,getScrollElement:()=>g.current,estimateSize:()=>v,overscan:10});(0,B.useEffect)(()=>y.measure(),[v,y]);let b=y.getVirtualItems(),x=b.at(-1)?.index??0;(0,B.useEffect)(()=>{t.length>0&&x>=t.length-20&&s?.()},[x,t.length,s]);let[S,C]=_?[`minmax(120px, 160px)`,`minmax(96px, 1fr)`]:[`minmax(160px, 220px)`,`minmax(110px, 1fr)`],w=e.map(e=>{let t=d?.[e.name];return t===void 0?e.name===n?S:C:`${t}px`}).join(` `),E=p?r:void 0,[D,O]=(l??``).split(`:`);return(0,z.jsx)(`div`,{ref:g,role:`grid`,"aria-rowcount":t.length,className:`min-h-0 flex-1 overflow-auto text-[12.5px] max-md:text-[14px]`,children:(0,z.jsxs)(`div`,{className:`w-max min-w-full`,children:[(0,z.jsx)(`div`,{role:`row`,className:`sticky top-0 z-10 grid border-b bg-background`,style:{gridTemplateColumns:w},children:e.map(e=>(0,z.jsxs)(`div`,{role:`columnheader`,className:T(`group/header relative flex min-w-0 items-center`,e.name===E&&x9),children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1 px-3 py-[7px] text-left text-[11.5px] font-semibold whitespace-nowrap text-muted-foreground max-md:text-[12.5px]`,onClick:()=>u?.(e.name),children:[(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`span`,{className:`shrink-0 rounded bg-panel-2 px-1 font-mono text-[9.5px] font-medium max-md:text-[11px]`,children:e.name===n?Rr():e.note??e.type}),D===e.name&&(O===`desc`?(0,z.jsx)(Jte,{className:`size-3 shrink-0`}):(0,z.jsx)(WD,{className:`size-3 shrink-0`}))]}),e.name===r&&m&&(0,z.jsx)(`button`,{type:`button`,"aria-label":p?Wr():zr(),"aria-pressed":p,title:p?Gr():Br(),className:T(`mr-1 grid size-6 shrink-0 place-items-center rounded text-muted-foreground hover:bg-panel-2 hover:text-foreground focus-visible:opacity-100 max-md:size-8`,p&&`opacity-0 group-hover/header:opacity-100 max-md:opacity-100`),onClick:m,children:p?(0,z.jsx)(TO,{className:`size-3.5`}):(0,z.jsx)(CO,{className:`size-3.5`})}),f&&!_&&(0,z.jsx)(Fle,{column:e.name,width:d?.[e.name],onResize:f})]},e.name))}),(0,z.jsx)(`div`,{style:{height:y.getTotalSize(),position:`relative`},children:b.map(r=>{let s=t[r.index],l=i?i(s):String(s[n]),u=l===a,d=h?.get(l);return(0,z.jsx)(`div`,{role:`row`,"aria-selected":u,"data-key":l,"data-preview":d?.op,className:T(`group absolute inset-x-0 grid cursor-pointer border-b md:hover:bg-panel`,u&&`bg-tomato-soft md:hover:bg-tomato-soft`,d&&`bg-warn-soft md:hover:bg-warn-soft`,d?.op===`delete`&&`line-through opacity-60`,d?.op===`insert`&&`cursor-default`),style:{gridTemplateColumns:w,height:v,transform:`translateY(${r.start}px)`},onClick:()=>d?.op!==`insert`&&o?.(l,s),children:e.map(e=>(0,z.jsxs)(`div`,{role:`gridcell`,className:T(`flex items-center overflow-hidden px-3 whitespace-nowrap`,e.name===n&&`font-mono text-[12px] max-md:text-[13px]`,e.name===E&&x9,e.name===E&&d&&`bg-warn-soft`,e.name===E&&!d&&(u?`bg-tomato-soft`:`md:group-hover:bg-panel`)),children:[e.name===n&&(c?.has(l)?(0,z.jsx)(y9,{label:`has warnings`,hint:c.get(l)?.join(`
|
|
125
|
-
`),className:`mr-1.5 grid min-h-6 min-w-[1em] place-items-center text-warn max-md:-my-2 max-md:-ml-2 max-md:mr-0 max-md:min-h-8 max-md:min-w-8`,children:`⚠`}):(0,z.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5 w-[1em] shrink-0`})),d?.op===`update`&&d.changed.includes(e.name)?(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 truncate`,children:[(0,z.jsx)(`span`,{"data-testid":`preview-old`,className:`text-muted-foreground line-through`,children:(0,z.jsx)(b9,{column:e,row:d.before??s,rowKey:l})}),`→`,(0,z.jsx)(`span`,{className:`font-semibold text-ok`,children:(0,z.jsx)(b9,{column:e,row:d.after??s,rowKey:l})})]}):(0,z.jsx)(`span`,{className:`truncate`,children:(0,z.jsx)(b9,{column:e,row:s,rowKey:l})})]},e.name))},l)})})]})})}var Ile={toFile:`M`,deleteFile:`−`,toDb:`M`,deleteDb:`−`};function Lle(){let e=h(),t=IX(),{data:n}=ey(),r=ty(),[i,a]=(0,B.useState)(Y7),[o,s]=(0,B.useState)(()=>i[0]??`select * from `),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)([]),[f,p]=(0,B.useState)(null),m=(0,B.useRef)(()=>{}),g=()=>{m.current(),d([]);let e=r.listen(e=>{if(e.type!==`sync`)return;let t=e.changes.filter(e=>e.op===`toFile`||e.op===`deleteFile`);t.length>0&&d(n=>[...n,...t.map(t=>({table:e.table,key:t.key,op:t.op}))])}),t=setTimeout(e,1e4);m.current=()=>{clearTimeout(t),e()}};(0,B.useEffect)(()=>()=>m.current(),[]);let _=W_({mutationFn:e=>Nv.sql(e),onMutate:g,onSuccess:(e,t)=>{a(ele(t)),`columns`in e&&(m.current(),d([]))},onError:()=>{m.current(),d([])}}),v=(0,B.useRef)(()=>{});v.current=()=>{if(_.isPending)return;let e=zv()?null:ale(o);e?l(e):_.mutate(o)};let y=(0,B.useMemo)(()=>[Qce({schema:Object.fromEntries((n?.tables??[]).map(e=>[e.name,Object.keys(e.columns)]))}),gM.highest(TR.of([{key:`Mod-Enter`,run:()=>(v.current(),!0)}])),X.lineWrapping],[n]),b=Yv(n),x=_.data;return(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b px-[18px] py-3 max-md:px-3`,children:[(0,z.jsx)(`h1`,{className:`max-md:sr-only text-lg font-semibold tracking-tight`,children:ki()}),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsxs)(C5,{children:[(0,z.jsx)(w5,{asChild:!0,children:(0,z.jsxs)(V,{variant:`outline`,size:`sm`,disabled:i.length===0,children:[(0,z.jsx)(AO,{className:`size-3.5`}),` `,Jl()]})}),(0,z.jsx)(T5,{className:`max-w-[min(480px,calc(100vw-2rem))]`,children:i.map(e=>(0,z.jsx)(E5,{className:`truncate font-mono text-[12px]`,onSelect:()=>s(e),children:e},e))})]}),!t&&(0,z.jsxs)(V,{size:`sm`,onClick:()=>v.current(),disabled:_.isPending,children:[(0,z.jsx)(DO,{className:`size-3.5`}),` `,$l()]})]}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2.5 px-[18px] py-3.5 max-md:px-3`,children:[(0,z.jsx)(eJ,{"aria-label":`SQL`,value:o,onChange:s,extensions:y,theme:e,minHeight:`110px`,className:`overflow-hidden rounded-lg border text-[12.5px]`}),t&&(0,z.jsxs)(V,{size:`lg`,className:`w-full`,onClick:()=>v.current(),disabled:_.isPending,children:[(0,z.jsx)(DO,{className:`size-4`}),` `,Ql()]}),_.isError&&(0,z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-err-soft px-3 py-2 font-mono text-[12px] text-err`,children:_.error.message}),x&&`columns`in x&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:[Zl({count:x.rows.length}),x.truncated?tu():``,` · `,x.ms,` ms`]}),(0,z.jsx)(S9,{columns:x.columns.map(e=>({name:e,type:`TEXT`})),rows:x.rows.map((e,t)=>({...e,__row:t})),keyCol:`__row`,stickyCol:x.columns[0]})]}),x&&!(`columns`in x)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-[11.5px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`text-ok`,children:Ul({count:x.changes})}),(0,z.jsxs)(`span`,{children:[x.ms,` ms`]})]}),!zv()&&x.unmanaged&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md bg-warn-soft px-3 py-2 text-[12px] text-warn`,children:[iu({table:x.unmanaged}),(0,z.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>p(x.unmanaged??null),children:Bl()})]}),u.length>0&&(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 font-mono text-[12px] leading-[1.8]`,children:[(0,z.jsx)(`div`,{className:`font-sans text-[11px] text-muted-foreground`,children:eu()}),u.map((e,t)=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`mr-1.5 font-bold text-warn`,children:Ile[e.op]}),b(e.table,e.key)]},`${t}-${e.table}-${e.key}`))]})]})]}),c&&(0,z.jsx)(gk,{open:!0,onOpenChange:e=>!e&&l(null),children:(0,z.jsxs)(yk,{children:[(0,z.jsxs)(bk,{children:[(0,z.jsx)(Ck,{children:Kl()}),(0,z.jsx)(wk,{children:c})]}),(0,z.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-panel p-2 font-mono text-[12px]`,children:o}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>l(null),children:ht()}),(0,z.jsx)(V,{variant:`destructive`,onClick:()=>{l(null),_.mutate(o)},children:ql()})]})]})}),f&&(0,z.jsx)(u7,{open:!0,adopt:f,onOpenChange:e=>!e&&p(null)})]})}function Rle(e,t,n){let r=e??{},i=t??{},a=new Set(RJ(r,i));return[...new Set([...Object.keys(r),...Object.keys(i)])].filter(e=>e!==n).map(e=>({field:e,winner:r[e],saved:i[e],same:!a.has(e)}))}function C9(e){return e===`file`?jo():e===`db`?Mo():No()}var zle={ok:`text-ok`,warn:`text-warn`,err:`text-err`,muted:`text-muted-foreground`},Ble=e=>e===void 0?`—`:JSON.stringify(e);function w9({entry:e,detail:t,keyCol:n}){return(0,z.jsx)(VZ,{className:`md:text-[11.5px]`,labels:[(0,z.jsx)(`span`,{className:`text-ok`,children:Nu({winner:e.winner??``})}),Eu()],note:t.deleted?Ou():void 0,format:Ble,rows:Rle(t.current,t.saved,n).map(e=>({field:e.field,a:e.winner,b:e.saved,dim:e.same}))})}function Vle({entry:e}){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),a=Cg(),{connected:o}=ny(),s=IX(),{data:c}=ey(),l=c?.tables.find(t=>t.name===e.table)?.key,u=U_({queryKey:[`conflict`,e.id],queryFn:()=>Nv.conflict(e.id),enabled:t||r}),d=e=>{a.invalidateQueries({queryKey:[`conflicts`]}),cv.success(e)},f=W_({mutationFn:t=>Nv.restore(e.id,t),onSuccess:()=>{i(!1),d(Yu({table:e.table,key:e.key??``}))},onError:t=>{cv.error(t.message),t instanceof gv&&t.status===409&&a.invalidateQueries({queryKey:[`conflict`,e.id]})}}),p=W_({mutationFn:()=>Nv.dismiss(e.id),onSuccess:()=>d(Au()),onError:e=>cv.error(e.message)}),m=o?e.restorable?void 0:Ku():yt();return(0,z.jsxs)(`div`,{className:`border-b px-3.5 py-2.5 text-[12px] last:border-b-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left max-md:basis-full max-md:flex-wrap`,onClick:()=>n(!t),children:[t?(0,z.jsx)(YD,{className:`size-3.5`}):(0,z.jsx)(QD,{className:`size-3.5`}),(0,z.jsxs)(`span`,{className:`font-semibold`,children:[e.table,` / `,e.key??e.file]}),(0,z.jsxs)(`span`,{className:`truncate text-[11.5px] text-muted-foreground max-md:basis-full max-md:pl-5 max-md:text-[12.5px] max-md:whitespace-normal`,children:[O5(e.at),` · `,e.winner?ed({winner:e.winner}):zu()]})]}),(0,z.jsx)(V,{size:s?`default`:`sm`,variant:`outline`,disabled:!o||!e.restorable||f.isPending,title:m,onClick:()=>i(!0),children:C9(e.restorable?e.winner:null)}),(0,z.jsx)(V,{size:s?`default`:`sm`,variant:`ghost`,disabled:!o||p.isPending,title:o?void 0:yt(),onClick:()=>p.mutate(),children:ku()})]}),s&&m&&(0,z.jsx)(`p`,{className:`mt-1 text-[12px] text-muted-foreground`,children:m}),t&&u.data&&(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(w9,{entry:e,detail:u.data,keyCol:l})}),r&&(0,z.jsx)(gk,{open:!0,onOpenChange:e=>!e&&i(!1),children:(0,z.jsxs)(yk,{children:[(0,z.jsx)(bk,{children:(0,z.jsx)(Ck,{children:Gu({table:e.table,key:e.key??``})})}),u.data?(0,z.jsx)(w9,{entry:e,detail:u.data,keyCol:l}):(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:u.error?u.error.message:bt()}),(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:Hu()}),(0,z.jsxs)(Sk,{children:[(0,z.jsx)(V,{variant:`outline`,onClick:()=>i(!1),children:ht()}),(0,z.jsx)(V,{disabled:!u.data||f.isPending,onClick:()=>u.data&&f.mutate(u.data.current),children:C9(e.winner)})]})]})})]})}function T9({title:e,count:t,tone:n,children:r}){return(0,z.jsxs)(`div`,{className:`mb-3.5 overflow-hidden rounded-[10px] border`,children:[(0,z.jsxs)(`h3`,{className:`flex items-center gap-2 border-b bg-panel px-3.5 py-2.5 text-[13px] font-semibold`,children:[t!==void 0&&t>0&&(0,z.jsx)(`span`,{className:`rounded-full px-1.5 text-[10.5px] ${n===`err`?`bg-err-soft text-err`:`bg-warn-soft text-warn`}`,children:t}),e]}),r]})}function Hle(){let e=ty(),{activity:t,warnings:n,connected:r,lastSyncAt:i}=ny(),{data:a}=U_({queryKey:[`conflicts`],queryFn:Nv.conflicts});(0,B.useEffect)(()=>e.markConflictsSeen(),[e]);let o=a?.conflicts??[],{data:s}=ey(),c=d7(n,new Set(s?.views.map(e=>e.name))),l=Lse(t);return(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5 border-b px-[18px] py-3 max-md:px-3`,children:[(0,z.jsx)(`h1`,{className:`max-md:sr-only text-lg font-semibold tracking-tight`,children:Ai()}),(0,z.jsxs)(`span`,{className:`text-[12px] text-muted-foreground`,children:[r?Zu():lu(),i&&Iu({at:O5(i)})]})]}),(0,z.jsxs)(`div`,{className:`overflow-auto px-[18px] py-3.5 max-md:px-3`,children:[(0,z.jsx)(T9,{title:Du(),count:o.length,tone:`err`,children:o.length===0?(0,z.jsx)(`p`,{className:`px-3.5 py-2.5 text-[12px] text-muted-foreground`,children:Ru()}):o.map(e=>(0,z.jsx)(Vle,{entry:e},e.id))}),(0,z.jsx)(T9,{title:Xu(),count:c.length,tone:`warn`,children:c.length===0?(0,z.jsx)(`p`,{className:`px-3.5 py-2.5 text-[12px] text-muted-foreground`,children:Bu()}):c.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b px-3.5 py-2 text-[12px] last:border-b-0 max-md:text-[13px]`,children:[(0,z.jsxs)(`span`,{className:`font-semibold`,children:[e.table,e.key&&` / ${e.key}`,e.view&&` / ${e.view}`]}),(0,z.jsx)(`span`,{className:`flex-1 text-muted-foreground max-md:order-last max-md:basis-full`,children:e.text}),e.key&&(0,z.jsx)(Yh,{to:`/t/$table`,params:{table:e.table},search:{key:e.key},className:`text-tomato max-md:py-1.5`,children:Vu()}),e.view&&(0,z.jsx)(Yh,{to:`/t/$table`,params:{table:e.view},className:`text-tomato max-md:py-1.5`,children:Vu()})]},`${t}-${e.text}`))}),(0,z.jsx)(T9,{title:Tu(),children:l.length===0?(0,z.jsx)(`p`,{className:`px-3.5 py-2.5 text-[12px] text-muted-foreground`,children:Lu()}):l.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 border-b px-3.5 py-2 text-[12px] last:border-b-0 max-md:text-[13px]`,children:[(0,z.jsx)(`span`,{className:`w-3 font-mono font-bold ${zle[e.tone]}`,children:e.symbol}),(0,z.jsx)(`span`,{className:`font-semibold`,children:e.text}),(0,z.jsxs)(`span`,{className:`text-muted-foreground`,children:[O5(e.at),` · `,e.detail]})]},`${t}-${e.at}-${e.text}`))})]})]})}var E9=e=>`yamlite-grid:${e}`;function Ule(e){try{let t=JSON.parse(localStorage.getItem(E9(e))??`{}`);return{widths:Object.fromEntries(Object.entries(t.widths??{}).filter(([,e])=>typeof e==`number`&&Number.isFinite(e))),unpinned:t.unpinned===!0}}catch{return{widths:{},unpinned:!1}}}function Wle(e){let[t,n]=(0,B.useState)(()=>Ule(e)),r=t=>{n(t);try{localStorage.setItem(E9(e),JSON.stringify(t))}catch{}};return{...t,setWidth:(e,n)=>{let{[e]:i,...a}=t.widths;r({...t,widths:n===null?a:{...a,[e]:Math.max(60,Math.round(n))}})},togglePin:()=>r({...t,unpinned:!t.unpinned})}}var D9=e=>()=>e,O9=[[`eq`,D9(`=`)],[`ne`,D9(`≠`)],[`lt`,D9(`<`)],[`lte`,D9(`≤`)],[`gt`,D9(`>`)],[`gte`,D9(`≥`)],[`contains`,bn],[`has`,xn],[`null`,Cn],[`notnull`,Sn]],k9=e=>`${e.col} ${O9.find(([t])=>t===e.op)?.[1]()??e.op}${e.value===void 0?``:` ${JSON.stringify(e.value)}`}`;function Gle(e,t){return t===`BOOLEAN`?e===`true`:(t===`INTEGER`||t===`REAL`)&&e.trim()!==``&&!Number.isNaN(Number(e))?t===`INTEGER`&&!Number.isSafeInteger(Number(e))?e:Number(e):e}function Kle({columns:e,filters:t,search:n,onChange:r}){let i=Object.keys(e),[a,o]=(0,B.useState)({col:i[0]??``,op:`eq`,text:``}),[s,c]=(0,B.useState)(n??``),[l,u]=(0,B.useState)(!1);(0,B.useEffect)(()=>c(n??``),[n]),(0,B.useEffect)(()=>{let e=setTimeout(()=>{(n??``)!==s&&r({filters:t,search:s||void 0})},300);return()=>clearTimeout(e)},[s,n,t,r]);let d=()=>{let i=a.op!==`null`&&a.op!==`notnull`,o=i?Gle(a.text,(Object.hasOwn(e,a.col)?e[a.col]:void 0)??`TEXT`):void 0;r({filters:[...t,{col:a.col,op:a.op,...i?{value:o}:{}}],search:n}),u(!1)};return(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b px-[18px] py-2 max-md:px-3`,children:[(0,z.jsxs)(`div`,{className:`relative w-full max-w-[280px] max-md:max-w-none max-md:basis-full`,children:[(0,z.jsx)(IO,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(ak,{type:`search`,"aria-label":Tn(),placeholder:En(),className:`h-7 pl-7 text-[12px] max-md:h-9`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Escape`&&c(``)})]}),t.map((e,i)=>(0,z.jsxs)(`button`,{type:`button`,className:`rounded-full border border-tomato bg-tomato-soft px-2 py-0.5 text-[11.5px] text-tomato max-md:min-h-8 max-md:px-3 max-md:text-[13px]`,onClick:()=>r({filters:t.filter((e,t)=>t!==i),search:n}),children:[k9(e),` ×`]},`${i}-${k9(e)}`)),(0,z.jsxs)(ok,{open:l,onOpenChange:u,children:[(0,z.jsx)(sk,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`rounded-full border border-dashed px-2 py-0.5 text-[11.5px] text-muted-foreground max-md:min-h-8 max-md:px-3 max-md:text-[13px]`,children:vn()})}),(0,z.jsxs)(ck,{className:`flex w-[min(20rem,calc(100vw-2rem))] flex-col gap-2`,children:[(0,z.jsx)(`select`,{"aria-label":yn(),className:`rounded border bg-background px-2 py-1 max-md:py-2`,value:a.col,onChange:e=>o({...a,col:e.target.value}),children:i.map(e=>(0,z.jsx)(`option`,{children:e},e))}),(0,z.jsx)(`select`,{"aria-label":wn(),className:`rounded border bg-background px-2 py-1 max-md:py-2`,value:a.op,onChange:e=>o({...a,op:e.target.value}),children:O9.map(([e,t])=>(0,z.jsx)(`option`,{value:e,children:t()},e))}),a.op!==`null`&&a.op!==`notnull`&&(0,z.jsx)(ak,{"aria-label":Dn(),value:a.text,onChange:e=>o({...a,text:e.target.value}),onKeyDown:e=>e.key===`Enter`&&d()}),(0,z.jsx)(V,{size:`sm`,onClick:d,children:_n()})]})]})]})}var qle=O(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Jle({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?_:`span`;return(0,z.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:T(qle({variant:t}),e),...r})}function A9({title:e,heading:t,actions:n,flush:r=!1,children:i}){return(0,z.jsxs)(`section`,{"data-slot":`section-card`,className:`overflow-hidden rounded-lg border`,children:[(0,z.jsxs)(`header`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b bg-muted px-4 py-1.5`,children:[(0,z.jsx)(`h3`,{className:Tk,children:e}),t,n&&(0,z.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:n})]}),(0,z.jsx)(`div`,{className:T(!r&&`flex flex-col gap-2 px-4 py-3`),children:i})]})}function Yle(e){return{required:[...e.required],values:{...e.values},formats:{...e.formats},min:{...e.min},max:{...e.max},references:Object.fromEntries(e.references.map(e=>[e.column,e.target?`${e.table}.${e.target}`:e.table]))}}var j9=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0;function Xle(e,t){return e!==void 0&&t!==void 0?`${e} – ${t}`:e===void 0?t===void 0?null:`≤ ${t}`:`≥ ${e}`}function Zle(e,t){let n=[];e.required.includes(t)&&n.push(`required`);let r=j9(e.values,t);r&&n.push(`values ${r.length}`);let i=j9(e.formats,t);i&&n.push(i);let a=Xle(j9(e.min,t),j9(e.max,t));a&&n.push(a);let o=j9(e.references,t);return o&&n.push(`→ ${o}`),n}var Qle=/^\w+__\w+: /;function $le(e,t,n){return t.filter(t=>{let r=t;if(n){let e=`${n}: `;if(!t.startsWith(e))return!1;r=t.slice(e.length)}else if(Qle.test(t))return!1;return r.startsWith(`${e} `)||r.startsWith(`references.${e}:`)})}var M9=(e,t)=>e===`INTEGER`||e===`REAL`?`number`:t===`date`||t===`datetime`?t:null,eue=e=>e.columns?{columns:[...e.columns],unique:e.unique}:{expr:e.expr??``,unique:e.unique},N9=e=>`${e.unique?`unique `:``}(${`columns`in e?e.columns.join(`, `):e.expr})`,P9=e=>JSON.stringify([`columns`in e?e.columns:null,`expr`in e?e.expr:null,e.unique]),tue=(e,t)=>F9(e.map(P9),t.map(P9)),F9=(e,t)=>{let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))},I9=(e,t)=>JSON.stringify([e.required.includes(t),j9(e.values,t)??null,j9(e.formats,t)??null,j9(e.min,t)??null,j9(e.max,t)??null,j9(e.references,t)??null]);function nue({indexes:e,known:t,columns:n,onChange:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),f=new Map(t.map(e=>[e.definition,e.inDb])),p=n.filter(e=>!o.includes(e)),m=()=>{a(!1),s([]),l(``),d(!1)};return(0,z.jsxs)(A9,{title:Zc(),actions:!i&&(0,z.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(!0),children:`+ ${Ns()}`}),children:[e.length===0&&!i&&(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:el()}),e.length>0&&(0,z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(t=>{let n=N9(t),i=f.get(n);return(0,z.jsxs)(`li`,{className:`flex items-center gap-3 rounded-md border px-3 py-1.5`,children:[(0,z.jsx)(`span`,{className:`font-mono`,children:n}),i!==void 0&&(0,z.jsx)(`span`,{className:`ml-auto text-[12px] ${i?`text-ok`:`text-warn`}`,children:i?Wc():tl()}),(0,z.jsx)(`button`,{type:`button`,"aria-label":_c({index:n}),className:`px-1 text-[15px] text-muted-foreground hover:text-foreground ${i===void 0?`ml-auto`:``}`,onClick:()=>r(e.filter(e=>N9(e)!==n)),children:`×`})]},n)})}),i&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border px-3 py-2`,children:[o.length>0&&(0,z.jsx)(`ol`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,z.jsxs)(`li`,{className:`inline-flex items-center rounded-full bg-chip py-0.5 pr-1 pl-2.5 text-[13px] text-chip-foreground`,children:[(0,z.jsx)(`span`,{children:e}),(0,z.jsx)(`button`,{type:`button`,"aria-label":mc({column:e}),className:`ml-1 px-1 opacity-60 hover:opacity-100`,onClick:()=>s(o.filter(t=>t!==e)),children:`×`})]},e))}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`select`,{"aria-label":$s(),className:`h-9 rounded-md border bg-background px-2 text-base md:text-sm w-56 max-md:w-full font-mono`,value:c,onChange:e=>l(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:`—`}),p.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}),(0,z.jsx)(V,{type:`button`,variant:`outline`,disabled:c===``,onClick:()=>{s([...o,c]),l(``)},children:Ms()}),(0,z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`checkbox`,"aria-label":Ic(),className:`size-4`,checked:u,onChange:e=>d(e.target.checked)}),(0,z.jsx)(`span`,{children:Ic()})]})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,z.jsx)(V,{type:`button`,variant:`ghost`,onClick:m,children:Us()}),(0,z.jsx)(V,{type:`button`,disabled:o.length===0,onClick:()=>{let t={columns:o,unique:u},n=N9(t);e.some(e=>N9(e)===n)||r([...e,t]),m()},children:Ns()})]})]})]})}var rue={TEXT:[`date`,`datetime`,`markdown`],JSON:[`list`,`map`]},L9=[`markdown`,`list`,`map`],R9=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0;function z9(e,t){let n=t.trim();if(n!==``){if(e===`INTEGER`||e===`REAL`){let e=Number(n);return Number.isFinite(e)?e:void 0}return e===`BOOLEAN`?n===`true`||n!==`false`&&void 0:n}}function B9({title:e,children:t,hints:n=[]}){return(0,z.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,z.jsx)(`h4`,{className:Ek,children:e}),t,(0,z.jsx)(V9,{hints:n})]})}function V9({hints:e}){return e.length===0?null:(0,z.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-[12.5px] text-warn`,children:e.map(e=>(0,z.jsx)(`li`,{children:e},e))})}function iue(e,t){return t.includes(`references.${e}: `)||/ not found in \S+ \(/.test(t)?`references`:t.includes(`${e} missing (`)?`required`:t.includes(` not in values (`)?`values`:`other`}function aue({column:e,type:t,draft:n,tables:r,hints:i,set:a,toggleRequired:o,onBack:s}){let c=R9(n.formats,e),l=R9(n.values,e)??[],u=M9(t,c),d=R9(n.references,e)??``,f=d.indexOf(`.`),p=f<0?d:d.slice(0,f),m=f<0?``:d.slice(f+1),h=t=>i.filter(n=>iue(e,n)===t),g=!L9.includes(c),_=rue[t],v=n=>{let r=[...new Set(n.map(e=>l.find(t=>String(t)===e)??z9(t,e)))];a(`values`,e,r.length===0?void 0:r)},y=n=>{a(`formats`,e,n),L9.includes(n)&&a(`values`,e,void 0),M9(t,n)!==u&&(a(`min`,e,void 0),a(`max`,e,void 0))},b=(t,n)=>{let r=n===``?void 0:u===`number`?Number(n):n;a(t,e,r!==void 0&&typeof r==`number`&&!Number.isFinite(r)?void 0:r)},x=(t,n)=>a(`references`,e,t===``?void 0:n.trim()===``?t:`${t}.${n.trim()}`);return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5 text-[13px]`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,className:`-ml-2`,onClick:s,children:`‹ ${Rs()}`}),(0,z.jsx)(`h3`,{className:`font-mono text-[15px] font-semibold`,children:e})]}),(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:Fc({type:t})})]}),(0,z.jsx)(B9,{title:Ac(),hints:h(`required`),children:(0,z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`checkbox`,"aria-label":Ac(),className:`size-4`,checked:n.required.includes(e),onChange:t=>o(e,t.target.checked)}),(0,z.jsx)(`span`,{children:jc()})]})}),g&&(0,z.jsx)(B9,{title:Lc(),hints:h(`values`),children:(0,z.jsx)(HJ,{label:Lc(),value:l.map(String),onChange:v,placeholder:Rc(),removeLabel:e=>bc({value:e}),accept:e=>z9(t,e)!==void 0,unique:!0})}),_&&(0,z.jsx)(B9,{title:Ys(),children:(0,z.jsxs)(`select`,{"aria-label":Ys(),className:`h-9 rounded-md border bg-background px-2 text-base md:text-sm w-56 max-md:w-full`,value:c??``,onChange:e=>y(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:cc()}),_.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})}),u&&(0,z.jsx)(`div`,{className:`flex flex-wrap gap-3 max-md:flex-col`,children:[`min`,`max`].map(t=>(0,z.jsx)(B9,{title:t===`min`?ac():ic(),children:(0,z.jsx)(ak,{"aria-label":t===`min`?ac():ic(),type:u===`number`?`number`:u===`date`?`date`:`text`,className:`w-56 max-md:w-full`,value:String(R9(n[t],e)??``),onChange:e=>b(t,e.target.value)})},t))}),(0,z.jsx)(V9,{hints:g?h(`other`):[...h(`values`),...h(`other`)]}),(0,z.jsx)(B9,{title:lc(),hints:h(`references`),children:(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`select`,{"aria-label":lc(),className:`${Dk} ${Ok}`,value:p,onChange:e=>x(e.target.value,``),children:[(0,z.jsx)(`option`,{value:``,children:cc()}),r.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}),(0,z.jsx)(ak,{"aria-label":uc(),placeholder:dc(),className:`${Ok} font-mono`,disabled:p===``,value:m,onChange:e=>x(p,e.target.value)})]})})]})}function oue({fields:e,names:t,json:n,onChange:r}){let i=n.filter(t=>!e.includes(t)),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),l=i.includes(s)?s:``,u=e=>Object.hasOwn(t,e)?t[e]:e,d=()=>{o(!1),c(``)},f=n=>{(!Object.hasOwn(t,n)||window.confirm(Ec({view:u(n)})))&&r(e.filter(e=>e!==n))};return(0,z.jsxs)(A9,{title:Yc(),actions:i.length>0&&!a&&(0,z.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>o(!0),children:`+ ${Ps()}`}),children:[e.length>0&&(0,z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,z.jsxs)(`li`,{className:`flex items-center gap-3 rounded-md border px-3 py-1.5`,children:[(0,z.jsx)(`span`,{className:`font-mono`,children:u(e)}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Cc({view:u(e)}),className:`px-1 text-[15px] text-muted-foreground hover:text-foreground ml-auto`,onClick:()=>f(e),children:`×`})]},e))}),i.length===0?(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:sc()}):a?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border px-3 py-2`,children:[(0,z.jsxs)(`select`,{"aria-label":zc(),className:`${Dk} ${Ok} font-mono`,value:l,onChange:e=>c(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:`—`}),i.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}),(0,z.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,z.jsx)(V,{type:`button`,variant:`ghost`,onClick:d,children:Us()}),(0,z.jsx)(V,{type:`button`,disabled:l===``,onClick:()=>{r([...e,l]),d()},children:Ps()})]})]}):e.length===0&&(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:el()})]})}var H9=e=>e instanceof gv&&e.status===409&&`current`in e.body,U9=e=>e instanceof Error?e.message:String(e);function sue(e){let t=Cg(),{data:n}=ey(),r=IX(),i=Object.keys(e.columns),[a,o]=(0,B.useState)(()=>r?null:i.find(t=>!e.fixed.includes(t))??null),[s]=(0,B.useState)(e.base),c=e.views.filter(t=>t.path.length===e.target.path.length+1),[l]=(0,B.useState)(()=>({rules:e.initial,indexes:(e.indexes??[]).map(eue),views:c.map(e=>e.path.at(-1))})),[u,d]=(0,B.useState)(l),f=u.rules,p=e=>d(t=>({...t,rules:e(t.rules)})),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),[b,x]=(0,B.useState)(!1),S=_$(u,300),C=t=>({...e.indexes!==void 0&&!tue(t.indexes,l.indexes)?{indexes:t.indexes}:{},...F9(t.views,l.views)?{}:{views:t.views}}),w=JSON.stringify(u.rules)!==JSON.stringify(l.rules)||Object.keys(C(u)).length>0,T=e=>{(!w||window.confirm(Ks()))&&e()},E=t=>T(()=>e.onOpenView(t)),D=e.views.filter(t=>u.views.includes(t.path[e.target.path.length]));(0,B.useEffect)(()=>{let t=!0;return Nv.previewRules(e.target,S.rules,s,C(S)).then(e=>{t&&(h(e),_(S),y(null))},e=>{t&&(H9(e)?x(!0):y(U9(e)))}),()=>{t=!1}},[S,s,e.target]);let O=()=>{t.invalidateQueries({queryKey:[`schema`]}),t.invalidateQueries({queryKey:[`meta`]}),t.invalidateQueries({queryKey:[`git`]}),t.invalidateQueries({queryKey:[`gitdiff`]})},k=W_({mutationFn:()=>Nv.saveRules(e.target,u.rules,s,C(u)),onSuccess:()=>{O(),e.onDone()},onError:e=>H9(e)?x(!0):y(U9(e))}),A=(e,t,n)=>p(r=>{let i={...r[e]};return n===void 0?delete i[t]:i[t]=n,{...r,[e]:i}}),j=(e,t)=>p(n=>({...n,required:t?[...n.required.filter(t=>t!==e),e]:n.required.filter(t=>t!==e)})),M=()=>{window.confirm(Ks())&&(O(),e.onDone())},N=m?.added??[],P=m?.removed??[],ee=[...(m?.indexes?.added??[]).map(e=>Qs({index:e})),...(m?.indexes?.removed??[]).map(e=>nc({index:e}))],F=a===null?void 0:e.columns[a],I=(0,z.jsxs)(`nav`,{className:`flex flex-col gap-1`,children:[i.map(t=>{let n=e.fixed.includes(t),r=Zle(f,t),i=!n&&I9(f,t)!==I9(l.rules,t),s=a===t;return(0,z.jsxs)(`button`,{type:`button`,disabled:n,"aria-current":s||void 0,onClick:()=>o(t),className:`flex flex-col items-start gap-0.5 rounded-md px-3 py-2 text-left disabled:cursor-default ${s?`bg-accent`:`hover:bg-background disabled:hover:bg-transparent`}`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[13px] ${s?`font-semibold`:``}`,children:t}),(n||r.length>0||i)&&(0,z.jsxs)(`span`,{className:`text-[12px] text-muted-foreground`,children:[n?Js():r.join(` · `),i&&(0,z.jsx)(`span`,{className:`text-tomato`,children:`${r.length>0?` · `:``}${Ws()}`})]})]},t)}),D.map(e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>E(e.name),className:`rounded-md px-3 py-2 text-left font-mono text-[13px] hover:bg-background`,children:`${e.name} ▸`},e.name))]}),te=a!==null&&F!==void 0&&(0,z.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,z.jsx)(aue,{column:a,type:F,draft:f,tables:(n?.tables??[]).map(e=>e.name),hints:$le(a,N,e.viewName),set:A,toggleRequired:j,onBack:r?()=>o(null):void 0},a)}),ne=(0,z.jsxs)(`footer`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-[13px] ${e.footer===void 0?`border-t pt-3`:vk}`,children:[b&&(0,z.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-3 text-warn`,children:[(0,z.jsx)(`span`,{children:Gs()}),(0,z.jsx)(V,{type:`button`,variant:`outline`,onClick:M,children:rc()})]}),m&&(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[N.length>0&&(0,z.jsx)(`p`,{className:`text-warn`,children:Ls({count:N.length})}),P.length>0&&(0,z.jsx)(`p`,{className:`text-ok`,children:kc({count:P.length})}),ee.map(e=>(0,z.jsx)(`p`,{className:`font-mono`,children:e},e)),!m.changed&&(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:oc()}),N.length>0&&(0,z.jsx)(`ul`,{className:`max-h-24 list-disc overflow-y-auto pl-5 text-[12.5px] text-muted-foreground`,children:N.slice(0,5).map(e=>(0,z.jsx)(`li`,{children:e},e))})]}),v!==null&&(0,z.jsx)(`p`,{className:`w-full text-err`,children:v}),(0,z.jsxs)(`div`,{className:`ml-auto flex shrink-0 justify-end gap-2`,children:[(0,z.jsx)(V,{type:`button`,variant:`outline`,onClick:e.onDone,children:Us()}),(0,z.jsx)(V,{type:`button`,disabled:!m?.changed||g!==u||v!==null||b||k.isPending,onClick:()=>k.mutate(),children:Mc()})]})]}),re=e.trail&&e.trail.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),(0,z.jsxs)(`nav`,{"aria-label":Hs(),className:`flex flex-wrap items-center gap-x-1 gap-y-1 font-mono`,children:[e.trail.map(e=>(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":Vs({name:e.label}),className:`rounded-md px-1.5 py-0.5 text-muted-foreground underline-offset-2 hover:bg-background hover:text-foreground hover:underline`,onClick:()=>T(e.onOpen),children:e.label}),(0,z.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`›`})]},e.label)),(0,z.jsx)(`span`,{className:`px-1.5 font-semibold`,title:e.viewName,children:e.here})]})]}),ie=(0,z.jsx)(`div`,{className:`bg-muted p-2`,children:I}),ae=te&&(0,z.jsx)(`div`,{className:`px-4 py-4`,children:te});return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[(0,z.jsx)(A9,{title:Uc(),heading:re,flush:!0,children:r?ae||ie:(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,14rem)_minmax(0,1fr)]`,children:[(0,z.jsx)(`div`,{className:`border-r bg-muted p-2`,children:I}),ae||(0,z.jsx)(`div`,{})]})}),e.indexes!==void 0&&(0,z.jsx)(nue,{indexes:u.indexes,known:e.indexes,columns:i,onChange:e=>d(t=>({...t,indexes:e}))}),(0,z.jsx)(oue,{fields:u.views,names:Object.fromEntries(c.map(e=>[e.path.at(-1),e.name])),json:i.filter(t=>e.columns[t]===`JSON`),onChange:e=>d(t=>({...t,views:e}))}),e.footer===void 0?ne:e.footer&&(0,K_.createPortal)(ne,e.footer)]})}var W9=(e,t)=>e!==void 0&&t!==void 0?`${e} – ${t}`:e===void 0?t===void 0?null:`≤ ${t}`:`≥ ${e}`,G9=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,K9=`border-b px-2 py-1.5 text-left align-top`,q9=`w-full [&_tr:last-child>td]:border-b-0`,J9=()=>(0,z.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:el()}),Y9=e=>({target:{table:e.table,path:e.path},viewName:e.name});function cue({editing:e,meta:t,schema:n,onEdit:r,onDone:i,footer:a}){let o=e.viewName===void 0?void 0:t.views.find(t=>t.name===e.viewName),s=t.tables.find(t=>t.name===e.target.table),c=o??s;if(!c||n.base===void 0)return null;let l=e.target.path.length,u=[{label:e.target.table,onOpen:()=>r({target:{table:e.target.table,path:[]}})},...e.target.path.slice(0,-1).flatMap((n,i)=>{let a=t.views.find(t=>t.table===e.target.table&&t.path.length===i+1&&t.path.every((t,n)=>e.target.path[n]===t));return a?[{label:n,onOpen:()=>r(Y9(a))}]:[]})],d=t.views.filter(t=>t.table===e.target.table&&t.path.length>l&&e.target.path.every((e,n)=>t.path[n]===e));return(0,z.jsx)(sue,{target:e.target,viewName:e.viewName,columns:o?o.columns:n.columns,fixed:o?o.identity:[n.key],initial:Yle(c),base:n.base,indexes:o?void 0:n.indexes,views:d.map(e=>({name:e.name,path:e.path})),trail:l>0?u:void 0,here:e.target.path.at(-1),onOpenView:e=>{let n=t.views.find(t=>t.name===e);n&&r(Y9(n))},onDone:i,footer:a},`${e.target.table}/${e.target.path.join(`.`)}`)}function lue({view:e,editor:t}){return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.5px]`,children:[(0,z.jsx)(A9,{title:hl(),children:(0,z.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:il()}),(0,z.jsx)(`dd`,{className:`font-mono`,children:e.parent}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:Xc()}),(0,z.jsx)(`dd`,{className:`font-mono`,children:e.identity.length>0?e.identity.join(`, `):`—`}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:Gc()}),(0,z.jsx)(`dd`,{children:e.inDb?_l():rl()})]})}),t??(0,z.jsx)(A9,{title:Uc(),children:(0,z.jsx)(`div`,{className:`-mx-2 overflow-x-auto`,children:(0,z.jsx)(`table`,{className:q9,children:(0,z.jsx)(`tbody`,{children:Object.entries(e.columns).map(([t,n])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{className:`${K9} font-mono`,children:t}),(0,z.jsx)(`td`,{className:`${K9} font-mono text-muted-foreground`,children:n}),(0,z.jsx)(`td`,{className:`${K9} text-muted-foreground`,children:e.identity.includes(t)?Xc():[Object.hasOwn(e.declared,t)?Kc():Qc(),...e.required.includes(t)?[sl()]:[],...G9(e.formats,t)?[G9(e.formats,t)]:[],...(()=>{let n=W9(G9(e.min,t),G9(e.max,t));return n?[n]:[]})()].join(` · `)}),(0,z.jsx)(`td`,{className:`${K9} font-mono text-muted-foreground`,children:Object.hasOwn(e.values,t)?e.values[t]?.map(String).join(`, `):``})]},t))})})})})]})}function uue({table:e,view:t,path:n,open:r,onOpenChange:i}){let[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),{data:l}=ey(),u=t?.table??e,{data:d,error:f}=U_({queryKey:[`schema`,u],queryFn:()=>Nv.schema(u),enabled:r&&(!t||a!==null)}),p=t!==void 0&&(a===null||a.viewName!==void 0),m=!zv()&&l!==void 0&&!l.configError&&(t!==void 0||d!==void 0),h=a&&l&&d?(0,z.jsx)(cue,{editing:a,meta:l,schema:d,onEdit:o,onDone:()=>o(null),footer:s}):null;return(0,z.jsx)(gk,{open:r,onOpenChange:i,children:(0,z.jsxs)(yk,{pinned:!0,className:a?`sm:max-w-4xl`:`sm:max-w-2xl`,children:[(0,z.jsxs)(bk,{pinned:!0,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:justify-center`,children:[(0,z.jsx)(Ck,{children:pl({table:e})}),a&&(0,z.jsx)(Jle,{variant:`outline`,className:`border-tomato text-[12px] text-tomato`,children:Jc()})]}),(0,z.jsx)(wk,{children:a?qc():t?gl():ll()}),n&&!(a&&!p)&&(0,z.jsx)(`p`,{className:`font-mono text-[12px] break-all text-muted-foreground md:hidden`,children:n}),m&&!a&&(0,z.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>o(t?Y9(t):{target:{table:e,path:[]}}),children:qs()})]}),(0,z.jsx)(xk,{children:p?(0,z.jsx)(lue,{view:t,editor:h??(a&&f?(0,z.jsx)(`p`,{className:`text-[12px] text-err`,children:f.message}):null)}):(0,z.jsxs)(z.Fragment,{children:[f&&(0,z.jsx)(`p`,{className:`text-[12px] text-err`,children:f.message}),d&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.5px]`,children:[(0,z.jsx)(A9,{title:cl(),children:(0,z.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:al()}),(0,z.jsx)(`dd`,{className:`font-mono`,children:d.mode===`files`?d.files:d.path}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:$c()}),(0,z.jsx)(`dd`,{className:`font-mono`,children:d.key}),(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:Gc()}),(0,z.jsx)(`dd`,{children:d.inDb?ul():rl()})]})}),h??(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(A9,{title:Uc(),children:(0,z.jsx)(`div`,{className:`-mx-2 overflow-x-auto`,children:(0,z.jsx)(`table`,{className:q9,children:(0,z.jsx)(`tbody`,{children:Object.entries(d.columns).map(([e,t])=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{className:`${K9} font-mono`,children:e}),(0,z.jsx)(`td`,{className:`${K9} font-mono text-muted-foreground`,children:t}),(0,z.jsx)(`td`,{className:`${K9} text-muted-foreground`,children:e===d.key?$c():[e in d.declared?Kc():Qc(),...d.required.includes(e)?[sl()]:[],...G9(d.formats,e)?[G9(d.formats,e)]:[],...(()=>{let t=W9(G9(d.min,e),G9(d.max,e));return t?[t]:[]})()].join(` · `)}),(0,z.jsx)(`td`,{className:`${K9} font-mono text-muted-foreground`,children:Object.hasOwn(d.values,e)?d.values[e]?.map(String).join(`, `):``})]},e))})})})}),(0,z.jsx)(A9,{title:ol(),children:d.references.length===0?(0,z.jsx)(J9,{}):d.references.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-mono`,children:[(0,z.jsx)(`span`,{children:e.column}),(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,z.jsx)(`span`,{children:`${e.table}.${e.target}`}),(0,z.jsx)(`span`,{className:`ml-auto font-sans text-[11px] ${e.problems.length>0?`text-warn`:`text-ok`}`,children:e.problems.length>0?Hc({count:e.problems.length}):`OK`})]}),e.problems.length>0&&(0,z.jsx)(`ul`,{className:`mt-1.5 list-disc pl-5 text-[11.5px] text-muted-foreground`,children:e.problems.map(e=>(0,z.jsx)(`li`,{children:e},e))})]},e.column))})]}),!h&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A9,{title:Zc(),children:[d.indexes.length===0&&d.otherIndexes.length===0?(0,z.jsx)(J9,{}):(0,z.jsx)(`div`,{className:`-mx-2 overflow-x-auto`,children:(0,z.jsx)(`table`,{className:q9,children:(0,z.jsxs)(`tbody`,{children:[d.indexes.map(e=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{className:`${K9} font-mono`,children:e.definition}),(0,z.jsx)(`td`,{className:`${K9} font-mono text-[11px] text-muted-foreground`,children:e.name}),(0,z.jsx)(`td`,{className:`${K9} ${e.inDb?`text-ok`:`text-warn`}`,children:e.inDb?Wc():tl()})]},e.name)),d.otherIndexes.map(e=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{className:`${K9} font-mono`,children:e}),(0,z.jsx)(`td`,{className:`${K9} text-[11px] text-muted-foreground`,colSpan:2,children:ml()})]},e))]})})}),d.indexes.some(e=>!e.inDb)&&(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:nl()})]}),(0,z.jsx)(A9,{title:Yc(),children:d.views.length===0?(0,z.jsx)(J9,{}):d.views.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border px-3 py-2`,style:{marginLeft:`${(e.depth-1)*16}px`},children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-mono`,children:[(0,z.jsx)(`a`,{href:`#/t/${encodeURIComponent(e.name)}`,className:`underline-offset-2 hover:underline`,onClick:()=>i(!1),children:e.name}),(0,z.jsx)(`span`,{className:`ml-auto font-sans text-[11px] ${e.inDb?`text-ok`:`text-warn`}`,children:e.inDb?Wc():tl()})]}),e.inDb&&(0,z.jsx)(`p`,{className:`mt-1 font-mono text-[11.5px] text-muted-foreground`,children:Object.keys(e.columns).join(`, `)}),e.problems.length>0&&(0,z.jsx)(`ul`,{className:`mt-1.5 list-disc pl-5 text-[11.5px] text-muted-foreground`,children:e.problems.map(e=>(0,z.jsx)(`li`,{children:e},e))})]},e.name))})]})]})]})}),(0,z.jsx)(`div`,{ref:c,className:`shrink-0 empty:hidden`})]})})}function due({items:e,onOpenRecord:t}){return e.length===0?null:(0,z.jsxs)(ok,{children:[(0,z.jsx)(sk,{asChild:!0,children:(0,z.jsxs)(V,{variant:`outline`,size:`sm`,className:`text-warn`,children:[(0,z.jsx)(QO,{className:`size-3.5`}),` `,Cd({count:e.length})]})}),(0,z.jsx)(ck,{align:`end`,className:`max-h-80 w-[min(440px,calc(100vw-2rem))] overflow-auto p-0`,children:(0,z.jsx)(`ul`,{"aria-label":bd(),className:`text-[12px] max-md:text-[13px]`,children:e.map((e,n)=>(0,z.jsxs)(`li`,{className:`border-b px-3 py-2 last:border-b-0`,children:[e.key!==null&&(0,z.jsx)(`button`,{type:`button`,className:`font-mono font-semibold text-tomato hover:underline`,onClick:()=>t(e.key),children:e.key}),e.view!==null&&(0,z.jsx)(`a`,{href:`#/t/${encodeURIComponent(e.view)}`,className:`font-mono font-semibold text-tomato hover:underline`,children:e.view}),(0,z.jsx)(`p`,{className:`text-muted-foreground`,children:e.text})]},`${n}-${e.text}`))})})]})}var X9=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function fue(e,t){return e.path.flatMap((n,r)=>{let i=t[e.identity[r+1]];return[n,typeof i==`number`?i:String(i)]})}function Z9(e,t){let n=e;for(let e of t)if(Array.isArray(n)&&(typeof e==`number`||/^\d+$/.test(e)))n=n[Number(e)];else if(X9(n)&&typeof e==`string`&&Object.hasOwn(n,e))n=n[e];else return;return n}var Q9=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0;function pue({view:e,rowKey:t,row:n,onClose:r,onOpenRecord:i}){let a=Cg(),o=iy(),{connected:s}=ny(),[c,l]=jX(`yamlite-drawer-width`,360),u=IX(),d=RX(u),f=u?d?{height:d}:void 0:{width:c},p=n?String(n[e.identity[0]]):void 0,{data:m,error:h}=U_({queryKey:[`record`,e.table,p],queryFn:()=>Nv.record(e.table,p),enabled:p!==void 0}),g=n?fue(e,n):[],_=m?Z9(m.row,g):void 0,v=_!==void 0&&!X9(_),y=Object.keys(e.columns).filter(t=>!e.identity.includes(t)),b=_===void 0?void 0:v?{value:_}:Object.fromEntries(y.map(e=>[e,Q9(_,e)??null])),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),[E,D]=(0,B.useState)(new Set),[O,k]=(0,B.useState)(0),A=x!==null&&C!==null&&RJ(x,C).length>0,j=s&&!zv()&&_!==void 0,M=b?JSON.stringify(b):void 0;(0,B.useEffect)(()=>{b&&!A&&(S(b),w(b),D(new Set),k(e=>e+1))},[M,A]);let N=W_({mutationFn:({detail:t,values:n})=>{let r=e.path[0],i=Z9(t.row,g),a=v?n.value:Object.fromEntries(Object.entries({...i,...n}).filter(([,e])=>e!=null)),o=BJ(t.row,g,a);return Nv.update(e.table,p,{[r]:o[r]},{[r]:t.row[r]})},onMutate:()=>o({type:`saved`,table:e.table,key:p,at:Date.now()}),onSuccess:()=>{S(C),a.invalidateQueries({queryKey:[`record`,e.table,p]})},onError:t=>{o({type:`cancelled`,table:e.table,key:p}),t instanceof gv&&t.status===409&&a.invalidateQueries({queryKey:[`record`,e.table,p]})}}),P=()=>{if(!m||!x||!C||!A||E.size>0||!j||N.isPending)return;let e=Object.fromEntries(RJ(x,C).map(e=>[e,C[e]??null]));N.mutate({detail:m,values:e})};XZ(r,!A),(0,B.useEffect)(()=>{let e=e=>{e.key===`s`&&(e.metaKey||e.ctrlKey)&&!zv()&&(e.preventDefault(),P())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)});let ee=v?[`value`]:y,F=x&&C?RJ(x,C).length:0,I=n===void 0||m!==void 0&&_===void 0;return(0,z.jsxs)(`aside`,{"data-record-drawer":!0,"aria-label":jd(),className:T(JZ,`flex flex-col`),style:f,children:[!u&&(0,z.jsx)(NX,{width:c,label:$a(),onResize:l}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-4 py-3 max-md:gap-1 max-md:px-2 max-md:pt-[calc(0.5rem+env(safe-area-inset-top))] max-md:pb-2`,children:[u&&(0,z.jsx)(`button`,{type:`button`,"aria-label":_t(),onClick:r,className:`grid size-10 place-items-center`,children:(0,z.jsx)(RD,{className:`size-5`})}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono font-bold`,children:t}),(0,z.jsxs)(V,{variant:`ghost`,size:`sm`,disabled:!n,onClick:i,children:[(0,z.jsx)(HD,{className:`size-3.5`}),` `,Fd({table:e.table})]}),!u&&(0,z.jsx)(`button`,{type:`button`,"aria-label":_t(),onClick:r,className:`text-muted-foreground`,children:(0,z.jsx)(ik,{className:`size-4`})})]}),(0,z.jsx)(`div`,{className:`truncate px-4 pt-3 font-mono text-[11px] text-muted-foreground max-md:text-[12px]`,children:m?`${m.file} › ${g.join(`.`)}`:ad({parent:e.parent})}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:[h&&(0,z.jsx)(`p`,{className:`mb-2 text-[11.5px] text-err`,children:h.message}),I&&(0,z.jsx)(`p`,{className:`mb-2 text-[11.5px] text-err`,children:Md()}),!s&&(0,z.jsx)(`p`,{className:`mb-2 text-[11.5px] text-err`,children:Ia()}),n&&e.identity.length>0&&(0,z.jsx)(`dl`,{className:`mb-3.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[12px] max-md:text-[13px]`,children:e.identity.map(e=>(0,z.jsxs)(`div`,{className:`contents`,children:[(0,z.jsx)(`dt`,{className:`font-semibold text-muted-foreground`,children:e}),(0,z.jsx)(`dd`,{className:`truncate font-mono`,children:String(n[e]??``)})]},e))}),C&&(0,z.jsx)(`fieldset`,{disabled:!j,className:`m-0 min-w-0 border-0 p-0`,children:ee.map(t=>{let n=e.references.find(e=>e.column===t),r=Q9(e.formats,t),i=Q9(e.columns,t),a=e.required.includes(t);return(0,z.jsx)(`div`,{className:`mb-3.5`,children:(0,z.jsx)(vY,{readOnly:!j,path:[t],label:(0,z.jsxs)(`div`,{className:`flex flex-1 justify-between text-[12px] font-semibold text-muted-foreground max-md:text-[13px]`,children:[(0,z.jsxs)(`span`,{className:a&&C[t]==null?`text-warn`:void 0,children:[t,a&&(0,z.jsx)(`span`,{"aria-label":Qa(),children:` *`})]}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] font-medium max-md:text-[11.5px]`,children:n?`→ ${n.table}`:r??i})]}),value:C[t],type:i,format:r,allowed:Q9(e.values,t),min:Q9(e.min,t),max:Q9(e.max,t),reference:n,onChange:e=>w({...C,[t]:e}),onValidity:(e,t)=>D(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},`${t}:${O}`)},t)})})]}),!zv()&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-4 py-2.5 max-md:flex-wrap max-md:pb-[calc(0.625rem+env(safe-area-inset-bottom))]`,children:[(0,z.jsxs)(`span`,{className:`mr-auto flex min-w-0 flex-col text-[11px] text-muted-foreground max-md:basis-full max-md:text-[12px]`,children:[F>0?Da({count:F}):p===void 0?null:(0,z.jsx)(QX,{table:e.table,recordKey:p}),N.isError&&(0,z.jsx)(`span`,{className:`text-err`,children:N.error instanceof gv&&N.error.status===409?Id():N.error.message})]}),(0,z.jsx)(V,{variant:`outline`,size:u?`lg`:`sm`,disabled:!A,onClick:()=>{x&&(w(x),D(new Set),k(e=>e+1))},children:Fa()}),(0,z.jsx)(V,{size:u?`lg`:`sm`,className:`max-md:flex-1`,disabled:!A||E.size>0||N.isPending||!j,title:s?void 0:yt(),onClick:P,children:u?St():ro()})]})]})}var mue=100;function hue(e){try{return new Set(JSON.parse(localStorage.getItem(`yamlite-hidden:${e}`)??`[]`))}catch{return new Set}}function gue(e,t){try{localStorage.setItem(`yamlite-hidden:${e}`,JSON.stringify([...t]))}catch{}}function _ue({drawer:e,headerActions:t}){let{table:n}=y$.useParams(),r=y$.useSearch(),i=Nh({from:y$.fullPath}),a=Nh(),{data:o}=ey(),{warnings:s}=ny(),c=o?.tables.find(e=>e.name===n),l=c?void 0:o?.views.find(e=>e.name===n),u=r.filter??[],[d,f]=(0,B.useState)(()=>hue(n)),[p,m]=(0,B.useState)(!1),h=Wle(n),g=G_({queryKey:l?[`rows`,l.table,l.name,{sort:r.sort,filters:u,search:r.q}]:[`rows`,n,{sort:r.sort,filters:u,search:r.q}],queryFn:({pageParam:e})=>Nv.rows(n,{limit:mue,offset:e,sort:r.sort,filters:u,search:r.q}),initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.rows.length,0);return n<e.total?n:void 0},enabled:c!==void 0||l!==void 0}),_=(0,B.useMemo)(()=>g.data?.pages.flatMap(e=>e.rows)??[],[g.data]),v=$$(),y=c?.name,b=(0,B.useMemo)(()=>y?q$(v,y):void 0,[v,y]),x=(0,B.useMemo)(()=>{if(!b)return _;let e=[...b.values()].filter(e=>e.op===`insert`&&e.after).map(e=>e.after);return e.length>0?[...e,..._]:_},[b,_]),S=g.data?.pages[0]?.total??0,{hasNextPage:C,isFetchingNextPage:w,isFetchNextPageError:T,fetchNextPage:E}=g,D=(0,B.useCallback)(()=>{C&&!w&&!T&&E()},[C,w,T,E]),O=(0,B.useCallback)(e=>void i({search:t=>({...t,...e})}),[i]),k=(0,B.useCallback)(e=>O({filter:e.filters.length>0?e.filters:void 0,q:e.search}),[O]);if(!c&&!l)return null;let A=c?c.columns:l.columns,j=c?c.key:l?.identity[0]??``,M=c?[c.key]:l?.identity??[],N=Object.entries(A).filter(([e])=>M.includes(e)||!d.has(e)).sort(([e],[t])=>Number(t===j)-Number(e===j)).map(([e,t])=>{let n=c??l,r=n.references.find(t=>t.column===e);return{name:e,type:t,format:Object.hasOwn(n.formats,e)?n.formats[e]:void 0,note:r?`→ ${r.table}`:void 0,reference:r}}),P=l?e=>l.identity.map(t=>String(e[t])).join(`/`):void 0,ee=e=>O({key:e}),F=l&&r.key!==void 0?x.find(e=>P?.(e)===r.key):void 0,I=c?c.name:l.table,te=d7({[I]:s[I]??[]},new Set(o?.views.map(e=>e.name))),ne=te.filter(e=>e.view===(l?l.name:null)),re=e=>void a({to:`/t/$table`,params:{table:l?l.table:n},search:{key:e}}),ie=e=>{let[t,n]=(r.sort??``).split(`:`),i=t===e?n===`asc`?`${e}:desc`:void 0:`${e}:asc`;O({sort:i})},ae=c?c.mode===`files`?c.files:c.path:`from ${l?.parent}`;return(0,z.jsxs)(`div`,{className:`relative flex min-w-0 flex-1`,children:[(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5 border-b px-[18px] py-3 max-md:gap-2 max-md:px-3 max-md:py-2`,children:[(0,z.jsx)(`h1`,{title:n,className:`min-w-0 truncate text-lg font-semibold tracking-tight max-md:sr-only`,children:n}),c?(0,z.jsx)(`span`,{className:`min-w-0 shrink-[100] truncate rounded bg-panel px-1.5 font-mono text-[11px] text-muted-foreground max-md:hidden`,children:c.mode===`files`?c.files:c.path}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`min-w-0 shrink-[100] truncate rounded bg-panel px-1.5 font-mono text-[11px] text-muted-foreground max-md:hidden`,children:ad({parent:l?.parent??``})}),(0,z.jsx)(`span`,{className:`shrink-0 rounded border px-1.5 text-[11px] whitespace-nowrap text-muted-foreground`,children:nd()})]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[12px] whitespace-nowrap text-muted-foreground`,children:c?md({count:S}):_d({count:S})}),(0,z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2.5 max-md:ml-0 max-md:w-full max-md:shrink max-md:overflow-x-auto max-md:pb-0.5`,children:[(0,z.jsx)(due,{items:ne,onOpenRecord:re}),(0,z.jsxs)(V,{variant:`outline`,size:`sm`,onClick:()=>m(!0),children:[(0,z.jsx)(tne,{className:`size-3.5`}),` `,vd()]}),(0,z.jsxs)(C5,{children:[(0,z.jsx)(w5,{asChild:!0,children:(0,z.jsxs)(V,{variant:`outline`,size:`sm`,children:[(0,z.jsx)(ene,{className:`size-3.5`}),` `,td()]})}),(0,z.jsx)(T5,{children:Object.keys(A).filter(e=>!M.includes(e)).map(e=>(0,z.jsx)(joe,{checked:!d.has(e),onCheckedChange:t=>{let r=new Set(d);t?r.delete(e):r.add(e),f(r),gue(n,r)},children:e},e))})]}),c&&t?.(c)]})]}),(0,z.jsx)(Kle,{columns:A,filters:u,search:r.q,onChange:k}),g.isError&&(0,z.jsx)(`div`,{role:`alert`,className:`border-b px-[18px] py-2 text-err`,children:g.error.message}),(!g.isError||_.length>0)&&(0,z.jsx)(p9.Provider,{value:r.q?.trim()??``,children:(0,z.jsx)(S9,{columns:N,rows:x,preview:b,keyCol:j,rowId:P,selectedKey:r.key,onSelect:ee,onEndReached:D,flagged:c?Rse(te):void 0,sort:r.sort,onSort:ie,widths:h.widths,onResize:h.setWidth,pinned:!h.unpinned,onTogglePin:h.togglePin})})]}),c&&r.key!==void 0&&e?.(c,r.key),l&&r.key!==void 0&&(0,z.jsx)(pue,{view:l,rowKey:r.key,row:F,onClose:()=>O({key:void 0}),onOpenRecord:()=>F&&re(String(F[j]))},r.key),p&&(0,z.jsx)(uue,{table:n,view:l,path:ae,open:!0,onOpenChange:m})]})}function vue(){let{data:e}=ey(),t=e?.tables[0];return e?t?(0,z.jsx)(Ph,{to:`/t/$table`,params:{table:t.name}}):(0,z.jsx)(bY,{title:xt()}):null}function yue({table:e}){let[t,n]=(0,B.useState)(!1),{connected:r}=ny(),i=IX(),{filter:a}=y$.useSearch(),o=Gse(e,a??[]),s=Kse(e,a??[]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(V,{size:i?`lg`:`sm`,disabled:!r,title:r?void 0:yt(),className:i?`fixed right-4 bottom-[calc(56px+env(safe-area-inset-bottom))] z-30 rounded-full shadow-lg`:void 0,onClick:()=>n(!0),children:hi()}),(0,z.jsx)(yY,{table:e,open:t,onOpenChange:n,initial:o,initialKey:s},JSON.stringify([o,s]))]})}function bue({table:e,recordKey:t}){let[n,r]=(0,B.useState)(!1),{connected:i}=ny();return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":yi(),disabled:!i,className:`shrink-0 whitespace-nowrap text-[11px] text-muted-foreground hover:text-foreground disabled:opacity-50 max-md:px-2 max-md:py-2 max-md:text-[13px]`,onClick:()=>r(!0),children:vi()}),n&&(0,z.jsx)(QZ,{table:e,recordKey:t,open:!0,onOpenChange:r})]})}function xue(){let{table:e}=y$.useParams();return(0,z.jsx)(_ue,{headerActions:zv()?void 0:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(hk,{table:e}),(0,z.jsx)(yue,{table:e})]}),drawer:(e,t)=>(0,z.jsx)(ZZ,{table:e,recordKey:t,headerActions:zv()?void 0:(0,z.jsx)(bue,{table:e,recordKey:t})},`${e.name}:${t}`)},e)}var $9=ng(()=>rY(()=>import(`./PageView-BNleODcZ.js`),__vite__mapDeps([3,1,2]),import.meta.url),`PageView`);function Sue(){let{page:e}=C$.useParams();return(0,z.jsx)($9,{name:e},e)}function Cue(){let{page:e}=w$.useParams();return(0,z.jsx)($9,{name:e,app:!0},e)}v$.update({component:cce}),y$.update({component:xue}),b$.update({component:Lle}),T$.update({component:D$}),C$.update({component:Sue}),w$.update({component:Cue}),x$.update({component:()=>zv()?(0,z.jsx)(Ph,{to:`/`}):(0,z.jsx)(Hle,{})}),S$.update({component:ng(()=>rY(()=>import(`./ErdView-DoSS_2hC.js`),__vite__mapDeps([4,1,2,5]),import.meta.url),`ErdView`)});var wue=Qh({getParentRoute:()=>v$,path:`/`,component:vue}),Tue=v$.addChildren([wue,y$,b$,x$,S$,C$,w$,T$]);function Eue(e){return _g({routeTree:Tue,history:e===void 0?Tp():Ep({initialEntries:[`/app/${encodeURIComponent(e)}`]}),context:{app:e}})}function Due(e,t={}){let n=Eue(t.app);document.documentElement.lang=E();let r=(0,Ld.createRoot)(e);return r.render((0,z.jsx)(B.StrictMode,{children:(0,z.jsx)(oy,{children:(0,z.jsx)(bg,{router:n})})})),()=>r.unmount()}async function Oue(){let e=document.getElementById(`root`);if(Fv())try{let{loadStatic:e}=await rY(async()=>{let{loadStatic:e}=await import(`./load-DvgVYICA.js`);return{loadStatic:e}},__vite__mapDeps([6,1]),import.meta.url),{api:t,snapshot:n}=await e();Mv(t),Iv(n)}catch(t){document.documentElement.lang=E(),(0,Ld.createRoot)(e).render((0,z.jsx)(Rd,{error:t}));return}Due(e,{app:ZJ(location.href,document.baseURI)})}Oue();export{Qne as $,L_ as $t,wX as A,mne as At,cG as B,ey as Bt,o$ as C,Vk as Ct,IX as D,cA as Dt,ZZ as E,Lk as Et,XJ as F,BD as Ft,VB as G,kv as Gt,yK as H,gv as Ht,EJ as I,H as It,qB as J,z_ as Jt,Une as K,cv as Kt,uJ as L,V as Lt,bX as M,GO as Mt,bY as N,MO as Nt,SX as O,uA as Ot,rY as P,lO as Pt,sV as Q,R_ as Qt,eJ as R,ty as Rt,QQ as S,EA as St,JQ as T,Rk as Tt,GV as U,Nv as Ut,lG as V,zv as Vt,UB as W,Av as Wt,lV as X,B_ as Xt,LV as Y,V_ as Yt,zB as Z,I_ as Zt,l0 as _,ZA as _t,zse as a,kg as an,RB as at,s1 as b,DA as bt,z3 as c,Cg as cn,X as ct,f2 as d,Sh as dn,JM as dt,F_ as en,fV as et,p2 as f,Cd as fn,gM as ft,p0 as g,rj as gt,X0 as h,bj as ht,q7 as i,e_ as in,eV as it,TX as j,QO as jt,EX as k,Hk as kt,v2 as l,Yh as ln,TR as lt,e2 as m,xt as mn,KA as mt,ile as n,__ as nn,uV as nt,S5 as o,Bg as on,BB as ot,h2 as p,pi as pn,hN as pt,$B as q,U_ as qt,tle as r,n_ as rn,aV as rt,M8 as s,Vg as sn,WB as st,y9 as t,M_ as tn,dV as tt,$ as u,Nh as un,G as ut,g1 as v,W as vt,YQ as w,Pk as wt,a$ as x,VA as xt,h1 as y,BA as yt,aG as z,ny as zt};
|