@xcr1234/dbhub-fork 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ var yM=Object.defineProperty;var vM=(n,e,t)=>e in n?yM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>vM(n,typeof e!="symbol"?e+"":e,t);function xM(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in n)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function wM(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var dm={exports:{}},Ca={},hm={exports:{}},ft={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var H1;function bM(){if(H1)return ft;H1=1;var n=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;function g(I){return I===null||typeof I!="object"?null:(I=p&&I[p]||I["@@iterator"],typeof I=="function"?I:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function S(I,U,q){this.props=I,this.context=U,this.refs=w,this.updater=q||y}S.prototype.isReactComponent={},S.prototype.setState=function(I,U){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,U,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function C(){}C.prototype=S.prototype;function R(I,U,q){this.props=I,this.context=U,this.refs=w,this.updater=q||y}var T=R.prototype=new C;T.constructor=R,v(T,S.prototype),T.isPureReactComponent=!0;var M=Array.isArray,A=Object.prototype.hasOwnProperty,D={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function z(I,U,q){var Q,oe={},ie=null,de=null;if(U!=null)for(Q in U.ref!==void 0&&(de=U.ref),U.key!==void 0&&(ie=""+U.key),U)A.call(U,Q)&&!P.hasOwnProperty(Q)&&(oe[Q]=U[Q]);var J=arguments.length-2;if(J===1)oe.children=q;else if(1<J){for(var ae=Array(J),pe=0;pe<J;pe++)ae[pe]=arguments[pe+2];oe.children=ae}if(I&&I.defaultProps)for(Q in J=I.defaultProps,J)oe[Q]===void 0&&(oe[Q]=J[Q]);return{$$typeof:n,type:I,key:ie,ref:de,props:oe,_owner:D.current}}function H(I,U){return{$$typeof:n,type:I.type,key:U,ref:I.ref,props:I.props,_owner:I._owner}}function $(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function Z(I){var U={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(q){return U[q]})}var j=/\/+/g;function B(I,U){return typeof I=="object"&&I!==null&&I.key!=null?Z(""+I.key):U.toString(36)}function X(I,U,q,Q,oe){var ie=typeof I;(ie==="undefined"||ie==="boolean")&&(I=null);var de=!1;if(I===null)de=!0;else switch(ie){case"string":case"number":de=!0;break;case"object":switch(I.$$typeof){case n:case e:de=!0}}if(de)return de=I,oe=oe(de),I=Q===""?"."+B(de,0):Q,M(oe)?(q="",I!=null&&(q=I.replace(j,"$&/")+"/"),X(oe,U,q,"",function(pe){return pe})):oe!=null&&($(oe)&&(oe=H(oe,q+(!oe.key||de&&de.key===oe.key?"":(""+oe.key).replace(j,"$&/")+"/")+I)),U.push(oe)),1;if(de=0,Q=Q===""?".":Q+":",M(I))for(var J=0;J<I.length;J++){ie=I[J];var ae=Q+B(ie,J);de+=X(ie,U,q,ae,oe)}else if(ae=g(I),typeof ae=="function")for(I=ae.call(I),J=0;!(ie=I.next()).done;)ie=ie.value,ae=Q+B(ie,J++),de+=X(ie,U,q,ae,oe);else if(ie==="object")throw U=String(I),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.");return de}function _(I,U,q){if(I==null)return I;var Q=[],oe=0;return X(I,Q,"","",function(ie){return U.call(q,ie,oe++)}),Q}function ne(I){if(I._status===-1){var U=I._result;U=U(),U.then(function(q){(I._status===0||I._status===-1)&&(I._status=1,I._result=q)},function(q){(I._status===0||I._status===-1)&&(I._status=2,I._result=q)}),I._status===-1&&(I._status=0,I._result=U)}if(I._status===1)return I._result.default;throw I._result}var G={current:null},N={transition:null},W={ReactCurrentDispatcher:G,ReactCurrentBatchConfig:N,ReactCurrentOwner:D};function F(){throw Error("act(...) is not supported in production builds of React.")}return ft.Children={map:_,forEach:function(I,U,q){_(I,function(){U.apply(this,arguments)},q)},count:function(I){var U=0;return _(I,function(){U++}),U},toArray:function(I){return _(I,function(U){return U})||[]},only:function(I){if(!$(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},ft.Component=S,ft.Fragment=t,ft.Profiler=i,ft.PureComponent=R,ft.StrictMode=r,ft.Suspense=u,ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,ft.act=F,ft.cloneElement=function(I,U,q){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var Q=v({},I.props),oe=I.key,ie=I.ref,de=I._owner;if(U!=null){if(U.ref!==void 0&&(ie=U.ref,de=D.current),U.key!==void 0&&(oe=""+U.key),I.type&&I.type.defaultProps)var J=I.type.defaultProps;for(ae in U)A.call(U,ae)&&!P.hasOwnProperty(ae)&&(Q[ae]=U[ae]===void 0&&J!==void 0?J[ae]:U[ae])}var ae=arguments.length-2;if(ae===1)Q.children=q;else if(1<ae){J=Array(ae);for(var pe=0;pe<ae;pe++)J[pe]=arguments[pe+2];Q.children=J}return{$$typeof:n,type:I.type,key:oe,ref:ie,props:Q,_owner:de}},ft.createContext=function(I){return I={$$typeof:o,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:s,_context:I},I.Consumer=I},ft.createElement=z,ft.createFactory=function(I){var U=z.bind(null,I);return U.type=I,U},ft.createRef=function(){return{current:null}},ft.forwardRef=function(I){return{$$typeof:a,render:I}},ft.isValidElement=$,ft.lazy=function(I){return{$$typeof:d,_payload:{_status:-1,_result:I},_init:ne}},ft.memo=function(I,U){return{$$typeof:f,type:I,compare:U===void 0?null:U}},ft.startTransition=function(I){var U=N.transition;N.transition={};try{I()}finally{N.transition=U}},ft.unstable_act=F,ft.useCallback=function(I,U){return G.current.useCallback(I,U)},ft.useContext=function(I){return G.current.useContext(I)},ft.useDebugValue=function(){},ft.useDeferredValue=function(I){return G.current.useDeferredValue(I)},ft.useEffect=function(I,U){return G.current.useEffect(I,U)},ft.useId=function(){return G.current.useId()},ft.useImperativeHandle=function(I,U,q){return G.current.useImperativeHandle(I,U,q)},ft.useInsertionEffect=function(I,U){return G.current.useInsertionEffect(I,U)},ft.useLayoutEffect=function(I,U){return G.current.useLayoutEffect(I,U)},ft.useMemo=function(I,U){return G.current.useMemo(I,U)},ft.useReducer=function(I,U,q){return G.current.useReducer(I,U,q)},ft.useRef=function(I){return G.current.useRef(I)},ft.useState=function(I){return G.current.useState(I)},ft.useSyncExternalStore=function(I,U,q){return G.current.useSyncExternalStore(I,U,q)},ft.useTransition=function(){return G.current.useTransition()},ft.version="18.3.1",ft}var $1;function Oc(){return $1||($1=1,hm.exports=bM()),hm.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var U1;function SM(){if(U1)return Ca;U1=1;var n=Oc(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,f){var d,p={},g=null,y=null;f!==void 0&&(g=""+f),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(y=u.ref);for(d in u)r.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(a&&a.defaultProps)for(d in u=a.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:e,type:a,key:g,ref:y,props:p,_owner:i.current}}return Ca.Fragment=t,Ca.jsx=o,Ca.jsxs=o,Ca}var q1;function kM(){return q1||(q1=1,dm.exports=SM()),dm.exports}var E=kM(),b=Oc();const CM=wM(b),EM=xM({__proto__:null,default:CM},[b]);var Yu={},pm={exports:{}},ir={},mm={exports:{}},gm={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var K1;function RM(){return K1||(K1=1,(function(n){function e(N,W){var F=N.length;N.push(W);e:for(;0<F;){var I=F-1>>>1,U=N[I];if(0<i(U,W))N[I]=W,N[F]=U,F=I;else break e}}function t(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var W=N[0],F=N.pop();if(F!==W){N[0]=F;e:for(var I=0,U=N.length,q=U>>>1;I<q;){var Q=2*(I+1)-1,oe=N[Q],ie=Q+1,de=N[ie];if(0>i(oe,F))ie<U&&0>i(de,oe)?(N[I]=de,N[ie]=F,I=ie):(N[I]=oe,N[Q]=F,I=Q);else if(ie<U&&0>i(de,F))N[I]=de,N[ie]=F,I=ie;else break e}}return W}function i(N,W){var F=N.sortIndex-W.sortIndex;return F!==0?F:N.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var u=[],f=[],d=1,p=null,g=3,y=!1,v=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(N){for(var W=t(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=N)r(f),W.sortIndex=W.expirationTime,e(u,W);else break;W=t(f)}}function M(N){if(w=!1,T(N),!v)if(t(u)!==null)v=!0,ne(A);else{var W=t(f);W!==null&&G(M,W.startTime-N)}}function A(N,W){v=!1,w&&(w=!1,C(z),z=-1),y=!0;var F=g;try{for(T(W),p=t(u);p!==null&&(!(p.expirationTime>W)||N&&!Z());){var I=p.callback;if(typeof I=="function"){p.callback=null,g=p.priorityLevel;var U=I(p.expirationTime<=W);W=n.unstable_now(),typeof U=="function"?p.callback=U:p===t(u)&&r(u),T(W)}else r(u);p=t(u)}if(p!==null)var q=!0;else{var Q=t(f);Q!==null&&G(M,Q.startTime-W),q=!1}return q}finally{p=null,g=F,y=!1}}var D=!1,P=null,z=-1,H=5,$=-1;function Z(){return!(n.unstable_now()-$<H)}function j(){if(P!==null){var N=n.unstable_now();$=N;var W=!0;try{W=P(!0,N)}finally{W?B():(D=!1,P=null)}}else D=!1}var B;if(typeof R=="function")B=function(){R(j)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,_=X.port2;X.port1.onmessage=j,B=function(){_.postMessage(null)}}else B=function(){S(j,0)};function ne(N){P=N,D||(D=!0,B())}function G(N,W){z=S(function(){N(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(N){N.callback=null},n.unstable_continueExecution=function(){v||y||(v=!0,ne(A))},n.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<N?Math.floor(1e3/N):5},n.unstable_getCurrentPriorityLevel=function(){return g},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(N){switch(g){case 1:case 2:case 3:var W=3;break;default:W=g}var F=g;g=W;try{return N()}finally{g=F}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(N,W){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var F=g;g=N;try{return W()}finally{g=F}},n.unstable_scheduleCallback=function(N,W,F){var I=n.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?I+F:I):F=I,N){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=F+U,N={id:d++,callback:W,priorityLevel:N,startTime:F,expirationTime:U,sortIndex:-1},F>I?(N.sortIndex=F,e(f,N),t(u)===null&&N===t(f)&&(w?(C(z),z=-1):w=!0,G(M,F-I))):(N.sortIndex=U,e(u,N),v||y||(v=!0,ne(A))),N},n.unstable_shouldYield=Z,n.unstable_wrapCallback=function(N){var W=g;return function(){var F=g;g=W;try{return N.apply(this,arguments)}finally{g=F}}}})(gm)),gm}var Y1;function TM(){return Y1||(Y1=1,mm.exports=RM()),mm.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var G1;function OM(){if(G1)return ir;G1=1;var n=Oc(),e=TM();function t(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,h=1;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(l,c){o(l,c),o(l+"Capture",c)}function o(l,c){for(i[l]=c,l=0;l<c.length;l++)r.add(c[l])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,d={},p={};function g(l){return u.call(p,l)?!0:u.call(d,l)?!1:f.test(l)?p[l]=!0:(d[l]=!0,!1)}function y(l,c,h,m){if(h!==null&&h.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return m?!1:h!==null?!h.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,c,h,m){if(c===null||typeof c>"u"||y(l,c,h,m))return!0;if(m)return!1;if(h!==null)switch(h.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function w(l,c,h,m,x,k,O){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=m,this.attributeNamespace=x,this.mustUseProperty=h,this.propertyName=l,this.type=c,this.sanitizeURL=k,this.removeEmptyString=O}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){S[l]=new w(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var c=l[0];S[c]=new w(c,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){S[l]=new w(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){S[l]=new w(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){S[l]=new w(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){S[l]=new w(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){S[l]=new w(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){S[l]=new w(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){S[l]=new w(l,5,!1,l.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function R(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var c=l.replace(C,R);S[c]=new w(c,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var c=l.replace(C,R);S[c]=new w(c,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var c=l.replace(C,R);S[c]=new w(c,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){S[l]=new w(l,1,!1,l.toLowerCase(),null,!1,!1)}),S.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){S[l]=new w(l,1,!1,l.toLowerCase(),null,!0,!0)});function T(l,c,h,m){var x=S.hasOwnProperty(c)?S[c]:null;(x!==null?x.type!==0:m||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,h,x,m)&&(h=null),m||x===null?g(c)&&(h===null?l.removeAttribute(c):l.setAttribute(c,""+h)):x.mustUseProperty?l[x.propertyName]=h===null?x.type===3?!1:"":h:(c=x.attributeName,m=x.attributeNamespace,h===null?l.removeAttribute(c):(x=x.type,h=x===3||x===4&&h===!0?"":""+h,m?l.setAttributeNS(m,c,h):l.setAttribute(c,h))))}var M=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),D=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),Z=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),G=Symbol.for("react.offscreen"),N=Symbol.iterator;function W(l){return l===null||typeof l!="object"?null:(l=N&&l[N]||l["@@iterator"],typeof l=="function"?l:null)}var F=Object.assign,I;function U(l){if(I===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);I=c&&c[1]||""}return`
34
+ `+I+l}var q=!1;function Q(l,c){if(!l||q)return"";q=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(re){var m=re}Reflect.construct(l,[],c)}else{try{c.call()}catch(re){m=re}l.call(c.prototype)}else{try{throw Error()}catch(re){m=re}l()}}catch(re){if(re&&m&&typeof re.stack=="string"){for(var x=re.stack.split(`
35
+ `),k=m.stack.split(`
36
+ `),O=x.length-1,L=k.length-1;1<=O&&0<=L&&x[O]!==k[L];)L--;for(;1<=O&&0<=L;O--,L--)if(x[O]!==k[L]){if(O!==1||L!==1)do if(O--,L--,0>L||x[O]!==k[L]){var V=`
37
+ `+x[O].replace(" at new "," at ");return l.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",l.displayName)),V}while(1<=O&&0<=L);break}}}finally{q=!1,Error.prepareStackTrace=h}return(l=l?l.displayName||l.name:"")?U(l):""}function oe(l){switch(l.tag){case 5:return U(l.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return l=Q(l.type,!1),l;case 11:return l=Q(l.type.render,!1),l;case 1:return l=Q(l.type,!0),l;default:return""}}function ie(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case D:return"Portal";case H:return"Profiler";case z:return"StrictMode";case B:return"Suspense";case X:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case Z:return(l.displayName||"Context")+".Consumer";case $:return(l._context.displayName||"Context")+".Provider";case j:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case _:return c=l.displayName||null,c!==null?c:ie(l.type)||"Memo";case ne:c=l._payload,l=l._init;try{return ie(l(c))}catch{}}return null}function de(l){var c=l.type;switch(l.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=c.render,l=l.displayName||l.name||"",c.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(c);case 8:return c===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function J(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ae(l){var c=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function pe(l){var c=ae(l)?"checked":"value",h=Object.getOwnPropertyDescriptor(l.constructor.prototype,c),m=""+l[c];if(!l.hasOwnProperty(c)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var x=h.get,k=h.set;return Object.defineProperty(l,c,{configurable:!0,get:function(){return x.call(this)},set:function(O){m=""+O,k.call(this,O)}}),Object.defineProperty(l,c,{enumerable:h.enumerable}),{getValue:function(){return m},setValue:function(O){m=""+O},stopTracking:function(){l._valueTracker=null,delete l[c]}}}}function Re(l){l._valueTracker||(l._valueTracker=pe(l))}function ce(l){if(!l)return!1;var c=l._valueTracker;if(!c)return!0;var h=c.getValue(),m="";return l&&(m=ae(l)?l.checked?"true":"false":l.value),l=m,l!==h?(c.setValue(l),!0):!1}function ye(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function be(l,c){var h=c.checked;return F({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??l._wrapperState.initialChecked})}function je(l,c){var h=c.defaultValue==null?"":c.defaultValue,m=c.checked!=null?c.checked:c.defaultChecked;h=J(c.value!=null?c.value:h),l._wrapperState={initialChecked:m,initialValue:h,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Ne(l,c){c=c.checked,c!=null&&T(l,"checked",c,!1)}function ke(l,c){Ne(l,c);var h=J(c.value),m=c.type;if(h!=null)m==="number"?(h===0&&l.value===""||l.value!=h)&&(l.value=""+h):l.value!==""+h&&(l.value=""+h);else if(m==="submit"||m==="reset"){l.removeAttribute("value");return}c.hasOwnProperty("value")?Ce(l,c.type,h):c.hasOwnProperty("defaultValue")&&Ce(l,c.type,J(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(l.defaultChecked=!!c.defaultChecked)}function Ie(l,c,h){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var m=c.type;if(!(m!=="submit"&&m!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+l._wrapperState.initialValue,h||c===l.value||(l.value=c),l.defaultValue=c}h=l.name,h!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,h!==""&&(l.name=h)}function Ce(l,c,h){(c!=="number"||ye(l.ownerDocument)!==l)&&(h==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+h&&(l.defaultValue=""+h))}var Ke=Array.isArray;function He(l,c,h,m){if(l=l.options,c){c={};for(var x=0;x<h.length;x++)c["$"+h[x]]=!0;for(h=0;h<l.length;h++)x=c.hasOwnProperty("$"+l[h].value),l[h].selected!==x&&(l[h].selected=x),x&&m&&(l[h].defaultSelected=!0)}else{for(h=""+J(h),c=null,x=0;x<l.length;x++){if(l[x].value===h){l[x].selected=!0,m&&(l[x].defaultSelected=!0);return}c!==null||l[x].disabled||(c=l[x])}c!==null&&(c.selected=!0)}}function Je(l,c){if(c.dangerouslySetInnerHTML!=null)throw Error(t(91));return F({},c,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function $e(l,c){var h=c.value;if(h==null){if(h=c.children,c=c.defaultValue,h!=null){if(c!=null)throw Error(t(92));if(Ke(h)){if(1<h.length)throw Error(t(93));h=h[0]}c=h}c==null&&(c=""),h=c}l._wrapperState={initialValue:J(h)}}function we(l,c){var h=J(c.value),m=J(c.defaultValue);h!=null&&(h=""+h,h!==l.value&&(l.value=h),c.defaultValue==null&&l.defaultValue!==h&&(l.defaultValue=h)),m!=null&&(l.defaultValue=""+m)}function Y(l){var c=l.textContent;c===l._wrapperState.initialValue&&c!==""&&c!==null&&(l.value=c)}function se(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(l,c){return l==null||l==="http://www.w3.org/1999/xhtml"?se(c):l==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var ve,Le=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,h,m,x){MSApp.execUnsafeLocalFunction(function(){return l(c,h,m,x)})}:l})(function(l,c){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=c;else{for(ve=ve||document.createElement("div"),ve.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=ve.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;c.firstChild;)l.appendChild(c.firstChild)}});function Ve(l,c){if(c){var h=l.firstChild;if(h&&h===l.lastChild&&h.nodeType===3){h.nodeValue=c;return}}l.textContent=c}var Ue={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},it=["Webkit","ms","Moz","O"];Object.keys(Ue).forEach(function(l){it.forEach(function(c){c=c+l.charAt(0).toUpperCase()+l.substring(1),Ue[c]=Ue[l]})});function ht(l,c,h){return c==null||typeof c=="boolean"||c===""?"":h||typeof c!="number"||c===0||Ue.hasOwnProperty(l)&&Ue[l]?(""+c).trim():c+"px"}function st(l,c){l=l.style;for(var h in c)if(c.hasOwnProperty(h)){var m=h.indexOf("--")===0,x=ht(h,c[h],m);h==="float"&&(h="cssFloat"),m?l.setProperty(h,x):l[h]=x}}var Pt=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function zt(l,c){if(c){if(Pt[l]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(t(137,l));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(t(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(t(61))}if(c.style!=null&&typeof c.style!="object")throw Error(t(62))}}function It(l,c){if(l.indexOf("-")===-1)return typeof c.is=="string";switch(l){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 et=null;function kt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var St=null,qe=null,at=null;function Vt(l){if(l=ca(l)){if(typeof St!="function")throw Error(t(280));var c=l.stateNode;c&&(c=cu(c),St(l.stateNode,l.type,c))}}function wt(l){qe?at?at.push(l):at=[l]:qe=l}function Kt(){if(qe){var l=qe,c=at;if(at=qe=null,Vt(l),c)for(l=0;l<c.length;l++)Vt(c[l])}}function Dt(l,c){return l(c)}function In(){}var Cn=!1;function En(l,c,h){if(Cn)return l(c,h);Cn=!0;try{return Dt(l,c,h)}finally{Cn=!1,(qe!==null||at!==null)&&(In(),Kt())}}function hr(l,c){var h=l.stateNode;if(h===null)return null;var m=cu(h);if(m===null)return null;h=m[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(l=l.type,m=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!m;break e;default:l=!1}if(l)return null;if(h&&typeof h!="function")throw Error(t(231,c,typeof h));return h}var Ur=!1;if(a)try{var pr={};Object.defineProperty(pr,"passive",{get:function(){Ur=!0}}),window.addEventListener("test",pr,pr),window.removeEventListener("test",pr,pr)}catch{Ur=!1}function Dn(l,c,h,m,x,k,O,L,V){var re=Array.prototype.slice.call(arguments,3);try{c.apply(h,re)}catch(he){this.onError(he)}}var Nn=!1,tt=null,Rt=!1,Qt=null,fn={onError:function(l){Nn=!0,tt=l}};function qr(l,c,h,m,x,k,O,L,V){Nn=!1,tt=null,Dn.apply(fn,arguments)}function Kr(l,c,h,m,x,k,O,L,V){if(qr.apply(this,arguments),Nn){if(Nn){var re=tt;Nn=!1,tt=null}else throw Error(t(198));Rt||(Rt=!0,Qt=re)}}function Or(l){var c=l,h=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,(c.flags&4098)!==0&&(h=c.return),l=c.return;while(l)}return c.tag===3?h:null}function No(l){if(l.tag===13){var c=l.memoizedState;if(c===null&&(l=l.alternate,l!==null&&(c=l.memoizedState)),c!==null)return c.dehydrated}return null}function Lo(l){if(Or(l)!==l)throw Error(t(188))}function Wc(l){var c=l.alternate;if(!c){if(c=Or(l),c===null)throw Error(t(188));return c!==l?null:l}for(var h=l,m=c;;){var x=h.return;if(x===null)break;var k=x.alternate;if(k===null){if(m=x.return,m!==null){h=m;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===h)return Lo(x),l;if(k===m)return Lo(x),c;k=k.sibling}throw Error(t(188))}if(h.return!==m.return)h=x,m=k;else{for(var O=!1,L=x.child;L;){if(L===h){O=!0,h=x,m=k;break}if(L===m){O=!0,m=x,h=k;break}L=L.sibling}if(!O){for(L=k.child;L;){if(L===h){O=!0,h=k,m=x;break}if(L===m){O=!0,m=k,h=x;break}L=L.sibling}if(!O)throw Error(t(189))}}if(h.alternate!==m)throw Error(t(190))}if(h.tag!==3)throw Error(t(188));return h.stateNode.current===h?l:c}function pv(l){return l=Wc(l),l!==null?mv(l):null}function mv(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=mv(l);if(c!==null)return c;l=l.sibling}return null}var gv=e.unstable_scheduleCallback,yv=e.unstable_cancelCallback,OT=e.unstable_shouldYield,MT=e.unstable_requestPaint,tn=e.unstable_now,AT=e.unstable_getCurrentPriorityLevel,Ih=e.unstable_ImmediatePriority,vv=e.unstable_UserBlockingPriority,Hc=e.unstable_NormalPriority,PT=e.unstable_LowPriority,xv=e.unstable_IdlePriority,$c=null,fi=null;function IT(l){if(fi&&typeof fi.onCommitFiberRoot=="function")try{fi.onCommitFiberRoot($c,l,void 0,(l.current.flags&128)===128)}catch{}}var Yr=Math.clz32?Math.clz32:LT,DT=Math.log,NT=Math.LN2;function LT(l){return l>>>=0,l===0?32:31-(DT(l)/NT|0)|0}var Uc=64,qc=4194304;function Ul(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Kc(l,c){var h=l.pendingLanes;if(h===0)return 0;var m=0,x=l.suspendedLanes,k=l.pingedLanes,O=h&268435455;if(O!==0){var L=O&~x;L!==0?m=Ul(L):(k&=O,k!==0&&(m=Ul(k)))}else O=h&~x,O!==0?m=Ul(O):k!==0&&(m=Ul(k));if(m===0)return 0;if(c!==0&&c!==m&&(c&x)===0&&(x=m&-m,k=c&-c,x>=k||x===16&&(k&4194240)!==0))return c;if((m&4)!==0&&(m|=h&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=m;0<c;)h=31-Yr(c),x=1<<h,m|=l[h],c&=~x;return m}function BT(l,c){switch(l){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function FT(l,c){for(var h=l.suspendedLanes,m=l.pingedLanes,x=l.expirationTimes,k=l.pendingLanes;0<k;){var O=31-Yr(k),L=1<<O,V=x[O];V===-1?((L&h)===0||(L&m)!==0)&&(x[O]=BT(L,c)):V<=c&&(l.expiredLanes|=L),k&=~L}}function Dh(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function wv(){var l=Uc;return Uc<<=1,(Uc&4194240)===0&&(Uc=64),l}function Nh(l){for(var c=[],h=0;31>h;h++)c.push(l);return c}function ql(l,c,h){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-Yr(c),l[c]=h}function jT(l,c){var h=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var m=l.eventTimes;for(l=l.expirationTimes;0<h;){var x=31-Yr(h),k=1<<x;c[x]=0,m[x]=-1,l[x]=-1,h&=~k}}function Lh(l,c){var h=l.entangledLanes|=c;for(l=l.entanglements;h;){var m=31-Yr(h),x=1<<m;x&c|l[m]&c&&(l[m]|=c),h&=~x}}var Ct=0;function bv(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var Sv,Bh,kv,Cv,Ev,Fh=!1,Yc=[],is=null,ss=null,os=null,Kl=new Map,Yl=new Map,ls=[],_T="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Rv(l,c){switch(l){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":ss=null;break;case"mouseover":case"mouseout":os=null;break;case"pointerover":case"pointerout":Kl.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yl.delete(c.pointerId)}}function Gl(l,c,h,m,x,k){return l===null||l.nativeEvent!==k?(l={blockedOn:c,domEventName:h,eventSystemFlags:m,nativeEvent:k,targetContainers:[x]},c!==null&&(c=ca(c),c!==null&&Bh(c)),l):(l.eventSystemFlags|=m,c=l.targetContainers,x!==null&&c.indexOf(x)===-1&&c.push(x),l)}function zT(l,c,h,m,x){switch(c){case"focusin":return is=Gl(is,l,c,h,m,x),!0;case"dragenter":return ss=Gl(ss,l,c,h,m,x),!0;case"mouseover":return os=Gl(os,l,c,h,m,x),!0;case"pointerover":var k=x.pointerId;return Kl.set(k,Gl(Kl.get(k)||null,l,c,h,m,x)),!0;case"gotpointercapture":return k=x.pointerId,Yl.set(k,Gl(Yl.get(k)||null,l,c,h,m,x)),!0}return!1}function Tv(l){var c=Gs(l.target);if(c!==null){var h=Or(c);if(h!==null){if(c=h.tag,c===13){if(c=No(h),c!==null){l.blockedOn=c,Ev(l.priority,function(){kv(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){l.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}l.blockedOn=null}function Gc(l){if(l.blockedOn!==null)return!1;for(var c=l.targetContainers;0<c.length;){var h=_h(l.domEventName,l.eventSystemFlags,c[0],l.nativeEvent);if(h===null){h=l.nativeEvent;var m=new h.constructor(h.type,h);et=m,h.target.dispatchEvent(m),et=null}else return c=ca(h),c!==null&&Bh(c),l.blockedOn=h,!1;c.shift()}return!0}function Ov(l,c,h){Gc(l)&&h.delete(c)}function VT(){Fh=!1,is!==null&&Gc(is)&&(is=null),ss!==null&&Gc(ss)&&(ss=null),os!==null&&Gc(os)&&(os=null),Kl.forEach(Ov),Yl.forEach(Ov)}function Ql(l,c){l.blockedOn===c&&(l.blockedOn=null,Fh||(Fh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,VT)))}function Xl(l){function c(x){return Ql(x,l)}if(0<Yc.length){Ql(Yc[0],l);for(var h=1;h<Yc.length;h++){var m=Yc[h];m.blockedOn===l&&(m.blockedOn=null)}}for(is!==null&&Ql(is,l),ss!==null&&Ql(ss,l),os!==null&&Ql(os,l),Kl.forEach(c),Yl.forEach(c),h=0;h<ls.length;h++)m=ls[h],m.blockedOn===l&&(m.blockedOn=null);for(;0<ls.length&&(h=ls[0],h.blockedOn===null);)Tv(h),h.blockedOn===null&&ls.shift()}var Bo=M.ReactCurrentBatchConfig,Qc=!0;function WT(l,c,h,m){var x=Ct,k=Bo.transition;Bo.transition=null;try{Ct=1,jh(l,c,h,m)}finally{Ct=x,Bo.transition=k}}function HT(l,c,h,m){var x=Ct,k=Bo.transition;Bo.transition=null;try{Ct=4,jh(l,c,h,m)}finally{Ct=x,Bo.transition=k}}function jh(l,c,h,m){if(Qc){var x=_h(l,c,h,m);if(x===null)np(l,c,m,Xc,h),Rv(l,m);else if(zT(x,l,c,h,m))m.stopPropagation();else if(Rv(l,m),c&4&&-1<_T.indexOf(l)){for(;x!==null;){var k=ca(x);if(k!==null&&Sv(k),k=_h(l,c,h,m),k===null&&np(l,c,m,Xc,h),k===x)break;x=k}x!==null&&m.stopPropagation()}else np(l,c,m,null,h)}}var Xc=null;function _h(l,c,h,m){if(Xc=null,l=kt(m),l=Gs(l),l!==null)if(c=Or(l),c===null)l=null;else if(h=c.tag,h===13){if(l=No(c),l!==null)return l;l=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;l=null}else c!==l&&(l=null);return Xc=l,null}function Mv(l){switch(l){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(AT()){case Ih:return 1;case vv:return 4;case Hc:case PT:return 16;case xv:return 536870912;default:return 16}default:return 16}}var as=null,zh=null,Jc=null;function Av(){if(Jc)return Jc;var l,c=zh,h=c.length,m,x="value"in as?as.value:as.textContent,k=x.length;for(l=0;l<h&&c[l]===x[l];l++);var O=h-l;for(m=1;m<=O&&c[h-m]===x[k-m];m++);return Jc=x.slice(l,1<m?1-m:void 0)}function Zc(l){var c=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&c===13&&(l=13)):l=c,l===10&&(l=13),32<=l||l===13?l:0}function eu(){return!0}function Pv(){return!1}function mr(l){function c(h,m,x,k,O){this._reactName=h,this._targetInst=x,this.type=m,this.nativeEvent=k,this.target=O,this.currentTarget=null;for(var L in l)l.hasOwnProperty(L)&&(h=l[L],this[L]=h?h(k):k[L]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?eu:Pv,this.isPropagationStopped=Pv,this}return F(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),c}var Fo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vh=mr(Fo),Jl=F({},Fo,{view:0,detail:0}),$T=mr(Jl),Wh,Hh,Zl,tu=F({},Jl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uh,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Zl&&(Zl&&l.type==="mousemove"?(Wh=l.screenX-Zl.screenX,Hh=l.screenY-Zl.screenY):Hh=Wh=0,Zl=l),Wh)},movementY:function(l){return"movementY"in l?l.movementY:Hh}}),Iv=mr(tu),UT=F({},tu,{dataTransfer:0}),qT=mr(UT),KT=F({},Jl,{relatedTarget:0}),$h=mr(KT),YT=F({},Fo,{animationName:0,elapsedTime:0,pseudoElement:0}),GT=mr(YT),QT=F({},Fo,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),XT=mr(QT),JT=F({},Fo,{data:0}),Dv=mr(JT),ZT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eO={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"},tO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nO(l){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(l):(l=tO[l])?!!c[l]:!1}function Uh(){return nO}var rO=F({},Jl,{key:function(l){if(l.key){var c=ZT[l.key]||l.key;if(c!=="Unidentified")return c}return l.type==="keypress"?(l=Zc(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?eO[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uh,charCode:function(l){return l.type==="keypress"?Zc(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Zc(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),iO=mr(rO),sO=F({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nv=mr(sO),oO=F({},Jl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uh}),lO=mr(oO),aO=F({},Fo,{propertyName:0,elapsedTime:0,pseudoElement:0}),cO=mr(aO),uO=F({},tu,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),fO=mr(uO),dO=[9,13,27,32],qh=a&&"CompositionEvent"in window,ea=null;a&&"documentMode"in document&&(ea=document.documentMode);var hO=a&&"TextEvent"in window&&!ea,Lv=a&&(!qh||ea&&8<ea&&11>=ea),Bv=" ",Fv=!1;function jv(l,c){switch(l){case"keyup":return dO.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _v(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var jo=!1;function pO(l,c){switch(l){case"compositionend":return _v(c);case"keypress":return c.which!==32?null:(Fv=!0,Bv);case"textInput":return l=c.data,l===Bv&&Fv?null:l;default:return null}}function mO(l,c){if(jo)return l==="compositionend"||!qh&&jv(l,c)?(l=Av(),Jc=zh=as=null,jo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return Lv&&c.locale!=="ko"?null:c.data;default:return null}}var gO={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 zv(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c==="input"?!!gO[l.type]:c==="textarea"}function Vv(l,c,h,m){wt(m),c=ou(c,"onChange"),0<c.length&&(h=new Vh("onChange","change",null,h,m),l.push({event:h,listeners:c}))}var ta=null,na=null;function yO(l){sx(l,0)}function nu(l){var c=Ho(l);if(ce(c))return l}function vO(l,c){if(l==="change")return c}var Wv=!1;if(a){var Kh;if(a){var Yh="oninput"in document;if(!Yh){var Hv=document.createElement("div");Hv.setAttribute("oninput","return;"),Yh=typeof Hv.oninput=="function"}Kh=Yh}else Kh=!1;Wv=Kh&&(!document.documentMode||9<document.documentMode)}function $v(){ta&&(ta.detachEvent("onpropertychange",Uv),na=ta=null)}function Uv(l){if(l.propertyName==="value"&&nu(na)){var c=[];Vv(c,na,l,kt(l)),En(yO,c)}}function xO(l,c,h){l==="focusin"?($v(),ta=c,na=h,ta.attachEvent("onpropertychange",Uv)):l==="focusout"&&$v()}function wO(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return nu(na)}function bO(l,c){if(l==="click")return nu(c)}function SO(l,c){if(l==="input"||l==="change")return nu(c)}function kO(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var Gr=typeof Object.is=="function"?Object.is:kO;function ra(l,c){if(Gr(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var h=Object.keys(l),m=Object.keys(c);if(h.length!==m.length)return!1;for(m=0;m<h.length;m++){var x=h[m];if(!u.call(c,x)||!Gr(l[x],c[x]))return!1}return!0}function qv(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Kv(l,c){var h=qv(l);l=0;for(var m;h;){if(h.nodeType===3){if(m=l+h.textContent.length,l<=c&&m>=c)return{node:h,offset:c-l};l=m}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=qv(h)}}function Yv(l,c){return l&&c?l===c?!0:l&&l.nodeType===3?!1:c&&c.nodeType===3?Yv(l,c.parentNode):"contains"in l?l.contains(c):l.compareDocumentPosition?!!(l.compareDocumentPosition(c)&16):!1:!1}function Gv(){for(var l=window,c=ye();c instanceof l.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)l=c.contentWindow;else break;c=ye(l.document)}return c}function Gh(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c&&(c==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||c==="textarea"||l.contentEditable==="true")}function CO(l){var c=Gv(),h=l.focusedElem,m=l.selectionRange;if(c!==h&&h&&h.ownerDocument&&Yv(h.ownerDocument.documentElement,h)){if(m!==null&&Gh(h)){if(c=m.start,l=m.end,l===void 0&&(l=c),"selectionStart"in h)h.selectionStart=c,h.selectionEnd=Math.min(l,h.value.length);else if(l=(c=h.ownerDocument||document)&&c.defaultView||window,l.getSelection){l=l.getSelection();var x=h.textContent.length,k=Math.min(m.start,x);m=m.end===void 0?k:Math.min(m.end,x),!l.extend&&k>m&&(x=m,m=k,k=x),x=Kv(h,k);var O=Kv(h,m);x&&O&&(l.rangeCount!==1||l.anchorNode!==x.node||l.anchorOffset!==x.offset||l.focusNode!==O.node||l.focusOffset!==O.offset)&&(c=c.createRange(),c.setStart(x.node,x.offset),l.removeAllRanges(),k>m?(l.addRange(c),l.extend(O.node,O.offset)):(c.setEnd(O.node,O.offset),l.addRange(c)))}}for(c=[],l=h;l=l.parentNode;)l.nodeType===1&&c.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<c.length;h++)l=c[h],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var EO=a&&"documentMode"in document&&11>=document.documentMode,_o=null,Qh=null,ia=null,Xh=!1;function Qv(l,c,h){var m=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Xh||_o==null||_o!==ye(m)||(m=_o,"selectionStart"in m&&Gh(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),ia&&ra(ia,m)||(ia=m,m=ou(Qh,"onSelect"),0<m.length&&(c=new Vh("onSelect","select",null,c,h),l.push({event:c,listeners:m}),c.target=_o)))}function ru(l,c){var h={};return h[l.toLowerCase()]=c.toLowerCase(),h["Webkit"+l]="webkit"+c,h["Moz"+l]="moz"+c,h}var zo={animationend:ru("Animation","AnimationEnd"),animationiteration:ru("Animation","AnimationIteration"),animationstart:ru("Animation","AnimationStart"),transitionend:ru("Transition","TransitionEnd")},Jh={},Xv={};a&&(Xv=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function iu(l){if(Jh[l])return Jh[l];if(!zo[l])return l;var c=zo[l],h;for(h in c)if(c.hasOwnProperty(h)&&h in Xv)return Jh[l]=c[h];return l}var Jv=iu("animationend"),Zv=iu("animationiteration"),ex=iu("animationstart"),tx=iu("transitionend"),nx=new Map,rx="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function cs(l,c){nx.set(l,c),s(c,[l])}for(var Zh=0;Zh<rx.length;Zh++){var ep=rx[Zh],RO=ep.toLowerCase(),TO=ep[0].toUpperCase()+ep.slice(1);cs(RO,"on"+TO)}cs(Jv,"onAnimationEnd"),cs(Zv,"onAnimationIteration"),cs(ex,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(tx,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sa="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(" "),OO=new Set("cancel close invalid load scroll toggle".split(" ").concat(sa));function ix(l,c,h){var m=l.type||"unknown-event";l.currentTarget=h,Kr(m,c,void 0,l),l.currentTarget=null}function sx(l,c){c=(c&4)!==0;for(var h=0;h<l.length;h++){var m=l[h],x=m.event;m=m.listeners;e:{var k=void 0;if(c)for(var O=m.length-1;0<=O;O--){var L=m[O],V=L.instance,re=L.currentTarget;if(L=L.listener,V!==k&&x.isPropagationStopped())break e;ix(x,L,re),k=V}else for(O=0;O<m.length;O++){if(L=m[O],V=L.instance,re=L.currentTarget,L=L.listener,V!==k&&x.isPropagationStopped())break e;ix(x,L,re),k=V}}}if(Rt)throw l=Qt,Rt=!1,Qt=null,l}function Ft(l,c){var h=c[ap];h===void 0&&(h=c[ap]=new Set);var m=l+"__bubble";h.has(m)||(ox(c,l,2,!1),h.add(m))}function tp(l,c,h){var m=0;c&&(m|=4),ox(h,l,m,c)}var su="_reactListening"+Math.random().toString(36).slice(2);function oa(l){if(!l[su]){l[su]=!0,r.forEach(function(h){h!=="selectionchange"&&(OO.has(h)||tp(h,!1,l),tp(h,!0,l))});var c=l.nodeType===9?l:l.ownerDocument;c===null||c[su]||(c[su]=!0,tp("selectionchange",!1,c))}}function ox(l,c,h,m){switch(Mv(c)){case 1:var x=WT;break;case 4:x=HT;break;default:x=jh}h=x.bind(null,c,h,l),x=void 0,!Ur||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(x=!0),m?x!==void 0?l.addEventListener(c,h,{capture:!0,passive:x}):l.addEventListener(c,h,!0):x!==void 0?l.addEventListener(c,h,{passive:x}):l.addEventListener(c,h,!1)}function np(l,c,h,m,x){var k=m;if((c&1)===0&&(c&2)===0&&m!==null)e:for(;;){if(m===null)return;var O=m.tag;if(O===3||O===4){var L=m.stateNode.containerInfo;if(L===x||L.nodeType===8&&L.parentNode===x)break;if(O===4)for(O=m.return;O!==null;){var V=O.tag;if((V===3||V===4)&&(V=O.stateNode.containerInfo,V===x||V.nodeType===8&&V.parentNode===x))return;O=O.return}for(;L!==null;){if(O=Gs(L),O===null)return;if(V=O.tag,V===5||V===6){m=k=O;continue e}L=L.parentNode}}m=m.return}En(function(){var re=k,he=kt(h),me=[];e:{var fe=nx.get(l);if(fe!==void 0){var Pe=Vh,Be=l;switch(l){case"keypress":if(Zc(h)===0)break e;case"keydown":case"keyup":Pe=iO;break;case"focusin":Be="focus",Pe=$h;break;case"focusout":Be="blur",Pe=$h;break;case"beforeblur":case"afterblur":Pe=$h;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Pe=Iv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Pe=qT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Pe=lO;break;case Jv:case Zv:case ex:Pe=GT;break;case tx:Pe=cO;break;case"scroll":Pe=$T;break;case"wheel":Pe=fO;break;case"copy":case"cut":case"paste":Pe=XT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Pe=Nv}var _e=(c&4)!==0,nn=!_e&&l==="scroll",ee=_e?fe!==null?fe+"Capture":null:fe;_e=[];for(var K=re,te;K!==null;){te=K;var xe=te.stateNode;if(te.tag===5&&xe!==null&&(te=xe,ee!==null&&(xe=hr(K,ee),xe!=null&&_e.push(la(K,xe,te)))),nn)break;K=K.return}0<_e.length&&(fe=new Pe(fe,Be,null,h,he),me.push({event:fe,listeners:_e}))}}if((c&7)===0){e:{if(fe=l==="mouseover"||l==="pointerover",Pe=l==="mouseout"||l==="pointerout",fe&&h!==et&&(Be=h.relatedTarget||h.fromElement)&&(Gs(Be)||Be[Li]))break e;if((Pe||fe)&&(fe=he.window===he?he:(fe=he.ownerDocument)?fe.defaultView||fe.parentWindow:window,Pe?(Be=h.relatedTarget||h.toElement,Pe=re,Be=Be?Gs(Be):null,Be!==null&&(nn=Or(Be),Be!==nn||Be.tag!==5&&Be.tag!==6)&&(Be=null)):(Pe=null,Be=re),Pe!==Be)){if(_e=Iv,xe="onMouseLeave",ee="onMouseEnter",K="mouse",(l==="pointerout"||l==="pointerover")&&(_e=Nv,xe="onPointerLeave",ee="onPointerEnter",K="pointer"),nn=Pe==null?fe:Ho(Pe),te=Be==null?fe:Ho(Be),fe=new _e(xe,K+"leave",Pe,h,he),fe.target=nn,fe.relatedTarget=te,xe=null,Gs(he)===re&&(_e=new _e(ee,K+"enter",Be,h,he),_e.target=te,_e.relatedTarget=nn,xe=_e),nn=xe,Pe&&Be)t:{for(_e=Pe,ee=Be,K=0,te=_e;te;te=Vo(te))K++;for(te=0,xe=ee;xe;xe=Vo(xe))te++;for(;0<K-te;)_e=Vo(_e),K--;for(;0<te-K;)ee=Vo(ee),te--;for(;K--;){if(_e===ee||ee!==null&&_e===ee.alternate)break t;_e=Vo(_e),ee=Vo(ee)}_e=null}else _e=null;Pe!==null&&lx(me,fe,Pe,_e,!1),Be!==null&&nn!==null&&lx(me,nn,Be,_e,!0)}}e:{if(fe=re?Ho(re):window,Pe=fe.nodeName&&fe.nodeName.toLowerCase(),Pe==="select"||Pe==="input"&&fe.type==="file")var ze=vO;else if(zv(fe))if(Wv)ze=SO;else{ze=wO;var Qe=xO}else(Pe=fe.nodeName)&&Pe.toLowerCase()==="input"&&(fe.type==="checkbox"||fe.type==="radio")&&(ze=bO);if(ze&&(ze=ze(l,re))){Vv(me,ze,h,he);break e}Qe&&Qe(l,fe,re),l==="focusout"&&(Qe=fe._wrapperState)&&Qe.controlled&&fe.type==="number"&&Ce(fe,"number",fe.value)}switch(Qe=re?Ho(re):window,l){case"focusin":(zv(Qe)||Qe.contentEditable==="true")&&(_o=Qe,Qh=re,ia=null);break;case"focusout":ia=Qh=_o=null;break;case"mousedown":Xh=!0;break;case"contextmenu":case"mouseup":case"dragend":Xh=!1,Qv(me,h,he);break;case"selectionchange":if(EO)break;case"keydown":case"keyup":Qv(me,h,he)}var Xe;if(qh)e:{switch(l){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else jo?jv(l,h)&&(nt="onCompositionEnd"):l==="keydown"&&h.keyCode===229&&(nt="onCompositionStart");nt&&(Lv&&h.locale!=="ko"&&(jo||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&jo&&(Xe=Av()):(as=he,zh="value"in as?as.value:as.textContent,jo=!0)),Qe=ou(re,nt),0<Qe.length&&(nt=new Dv(nt,l,null,h,he),me.push({event:nt,listeners:Qe}),Xe?nt.data=Xe:(Xe=_v(h),Xe!==null&&(nt.data=Xe)))),(Xe=hO?pO(l,h):mO(l,h))&&(re=ou(re,"onBeforeInput"),0<re.length&&(he=new Dv("onBeforeInput","beforeinput",null,h,he),me.push({event:he,listeners:re}),he.data=Xe))}sx(me,c)})}function la(l,c,h){return{instance:l,listener:c,currentTarget:h}}function ou(l,c){for(var h=c+"Capture",m=[];l!==null;){var x=l,k=x.stateNode;x.tag===5&&k!==null&&(x=k,k=hr(l,h),k!=null&&m.unshift(la(l,k,x)),k=hr(l,c),k!=null&&m.push(la(l,k,x))),l=l.return}return m}function Vo(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function lx(l,c,h,m,x){for(var k=c._reactName,O=[];h!==null&&h!==m;){var L=h,V=L.alternate,re=L.stateNode;if(V!==null&&V===m)break;L.tag===5&&re!==null&&(L=re,x?(V=hr(h,k),V!=null&&O.unshift(la(h,V,L))):x||(V=hr(h,k),V!=null&&O.push(la(h,V,L)))),h=h.return}O.length!==0&&l.push({event:c,listeners:O})}var MO=/\r\n?/g,AO=/\u0000|\uFFFD/g;function ax(l){return(typeof l=="string"?l:""+l).replace(MO,`
38
+ `).replace(AO,"")}function lu(l,c,h){if(c=ax(c),ax(l)!==c&&h)throw Error(t(425))}function au(){}var rp=null,ip=null;function sp(l,c){return l==="textarea"||l==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var op=typeof setTimeout=="function"?setTimeout:void 0,PO=typeof clearTimeout=="function"?clearTimeout:void 0,cx=typeof Promise=="function"?Promise:void 0,IO=typeof queueMicrotask=="function"?queueMicrotask:typeof cx<"u"?function(l){return cx.resolve(null).then(l).catch(DO)}:op;function DO(l){setTimeout(function(){throw l})}function lp(l,c){var h=c,m=0;do{var x=h.nextSibling;if(l.removeChild(h),x&&x.nodeType===8)if(h=x.data,h==="/$"){if(m===0){l.removeChild(x),Xl(c);return}m--}else h!=="$"&&h!=="$?"&&h!=="$!"||m++;h=x}while(h);Xl(c)}function us(l){for(;l!=null;l=l.nextSibling){var c=l.nodeType;if(c===1||c===3)break;if(c===8){if(c=l.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return l}function ux(l){l=l.previousSibling;for(var c=0;l;){if(l.nodeType===8){var h=l.data;if(h==="$"||h==="$!"||h==="$?"){if(c===0)return l;c--}else h==="/$"&&c++}l=l.previousSibling}return null}var Wo=Math.random().toString(36).slice(2),di="__reactFiber$"+Wo,aa="__reactProps$"+Wo,Li="__reactContainer$"+Wo,ap="__reactEvents$"+Wo,NO="__reactListeners$"+Wo,LO="__reactHandles$"+Wo;function Gs(l){var c=l[di];if(c)return c;for(var h=l.parentNode;h;){if(c=h[Li]||h[di]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(l=ux(l);l!==null;){if(h=l[di])return h;l=ux(l)}return c}l=h,h=l.parentNode}return null}function ca(l){return l=l[di]||l[Li],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function Ho(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(t(33))}function cu(l){return l[aa]||null}var cp=[],$o=-1;function fs(l){return{current:l}}function jt(l){0>$o||(l.current=cp[$o],cp[$o]=null,$o--)}function Nt(l,c){$o++,cp[$o]=l.current,l.current=c}var ds={},Ln=fs(ds),Zn=fs(!1),Qs=ds;function Uo(l,c){var h=l.type.contextTypes;if(!h)return ds;var m=l.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===c)return m.__reactInternalMemoizedMaskedChildContext;var x={},k;for(k in h)x[k]=c[k];return m&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=x),x}function er(l){return l=l.childContextTypes,l!=null}function uu(){jt(Zn),jt(Ln)}function fx(l,c,h){if(Ln.current!==ds)throw Error(t(168));Nt(Ln,c),Nt(Zn,h)}function dx(l,c,h){var m=l.stateNode;if(c=c.childContextTypes,typeof m.getChildContext!="function")return h;m=m.getChildContext();for(var x in m)if(!(x in c))throw Error(t(108,de(l)||"Unknown",x));return F({},h,m)}function fu(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ds,Qs=Ln.current,Nt(Ln,l),Nt(Zn,Zn.current),!0}function hx(l,c,h){var m=l.stateNode;if(!m)throw Error(t(169));h?(l=dx(l,c,Qs),m.__reactInternalMemoizedMergedChildContext=l,jt(Zn),jt(Ln),Nt(Ln,l)):jt(Zn),Nt(Zn,h)}var Bi=null,du=!1,up=!1;function px(l){Bi===null?Bi=[l]:Bi.push(l)}function BO(l){du=!0,px(l)}function hs(){if(!up&&Bi!==null){up=!0;var l=0,c=Ct;try{var h=Bi;for(Ct=1;l<h.length;l++){var m=h[l];do m=m(!0);while(m!==null)}Bi=null,du=!1}catch(x){throw Bi!==null&&(Bi=Bi.slice(l+1)),gv(Ih,hs),x}finally{Ct=c,up=!1}}return null}var qo=[],Ko=0,hu=null,pu=0,Mr=[],Ar=0,Xs=null,Fi=1,ji="";function Js(l,c){qo[Ko++]=pu,qo[Ko++]=hu,hu=l,pu=c}function mx(l,c,h){Mr[Ar++]=Fi,Mr[Ar++]=ji,Mr[Ar++]=Xs,Xs=l;var m=Fi;l=ji;var x=32-Yr(m)-1;m&=~(1<<x),h+=1;var k=32-Yr(c)+x;if(30<k){var O=x-x%5;k=(m&(1<<O)-1).toString(32),m>>=O,x-=O,Fi=1<<32-Yr(c)+x|h<<x|m,ji=k+l}else Fi=1<<k|h<<x|m,ji=l}function fp(l){l.return!==null&&(Js(l,1),mx(l,1,0))}function dp(l){for(;l===hu;)hu=qo[--Ko],qo[Ko]=null,pu=qo[--Ko],qo[Ko]=null;for(;l===Xs;)Xs=Mr[--Ar],Mr[Ar]=null,ji=Mr[--Ar],Mr[Ar]=null,Fi=Mr[--Ar],Mr[Ar]=null}var gr=null,yr=null,Wt=!1,Qr=null;function gx(l,c){var h=Nr(5,null,null,0);h.elementType="DELETED",h.stateNode=c,h.return=l,c=l.deletions,c===null?(l.deletions=[h],l.flags|=16):c.push(h)}function yx(l,c){switch(l.tag){case 5:var h=l.type;return c=c.nodeType!==1||h.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(l.stateNode=c,gr=l,yr=us(c.firstChild),!0):!1;case 6:return c=l.pendingProps===""||c.nodeType!==3?null:c,c!==null?(l.stateNode=c,gr=l,yr=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(h=Xs!==null?{id:Fi,overflow:ji}:null,l.memoizedState={dehydrated:c,treeContext:h,retryLane:1073741824},h=Nr(18,null,null,0),h.stateNode=c,h.return=l,l.child=h,gr=l,yr=null,!0):!1;default:return!1}}function hp(l){return(l.mode&1)!==0&&(l.flags&128)===0}function pp(l){if(Wt){var c=yr;if(c){var h=c;if(!yx(l,c)){if(hp(l))throw Error(t(418));c=us(h.nextSibling);var m=gr;c&&yx(l,c)?gx(m,h):(l.flags=l.flags&-4097|2,Wt=!1,gr=l)}}else{if(hp(l))throw Error(t(418));l.flags=l.flags&-4097|2,Wt=!1,gr=l}}}function vx(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;gr=l}function mu(l){if(l!==gr)return!1;if(!Wt)return vx(l),Wt=!0,!1;var c;if((c=l.tag!==3)&&!(c=l.tag!==5)&&(c=l.type,c=c!=="head"&&c!=="body"&&!sp(l.type,l.memoizedProps)),c&&(c=yr)){if(hp(l))throw xx(),Error(t(418));for(;c;)gx(l,c),c=us(c.nextSibling)}if(vx(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(t(317));e:{for(l=l.nextSibling,c=0;l;){if(l.nodeType===8){var h=l.data;if(h==="/$"){if(c===0){yr=us(l.nextSibling);break e}c--}else h!=="$"&&h!=="$!"&&h!=="$?"||c++}l=l.nextSibling}yr=null}}else yr=gr?us(l.stateNode.nextSibling):null;return!0}function xx(){for(var l=yr;l;)l=us(l.nextSibling)}function Yo(){yr=gr=null,Wt=!1}function mp(l){Qr===null?Qr=[l]:Qr.push(l)}var FO=M.ReactCurrentBatchConfig;function ua(l,c,h){if(l=h.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(t(309));var m=h.stateNode}if(!m)throw Error(t(147,l));var x=m,k=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===k?c.ref:(c=function(O){var L=x.refs;O===null?delete L[k]:L[k]=O},c._stringRef=k,c)}if(typeof l!="string")throw Error(t(284));if(!h._owner)throw Error(t(290,l))}return l}function gu(l,c){throw l=Object.prototype.toString.call(c),Error(t(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function wx(l){var c=l._init;return c(l._payload)}function bx(l){function c(ee,K){if(l){var te=ee.deletions;te===null?(ee.deletions=[K],ee.flags|=16):te.push(K)}}function h(ee,K){if(!l)return null;for(;K!==null;)c(ee,K),K=K.sibling;return null}function m(ee,K){for(ee=new Map;K!==null;)K.key!==null?ee.set(K.key,K):ee.set(K.index,K),K=K.sibling;return ee}function x(ee,K){return ee=bs(ee,K),ee.index=0,ee.sibling=null,ee}function k(ee,K,te){return ee.index=te,l?(te=ee.alternate,te!==null?(te=te.index,te<K?(ee.flags|=2,K):te):(ee.flags|=2,K)):(ee.flags|=1048576,K)}function O(ee){return l&&ee.alternate===null&&(ee.flags|=2),ee}function L(ee,K,te,xe){return K===null||K.tag!==6?(K=om(te,ee.mode,xe),K.return=ee,K):(K=x(K,te),K.return=ee,K)}function V(ee,K,te,xe){var ze=te.type;return ze===P?he(ee,K,te.props.children,xe,te.key):K!==null&&(K.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===ne&&wx(ze)===K.type)?(xe=x(K,te.props),xe.ref=ua(ee,K,te),xe.return=ee,xe):(xe=zu(te.type,te.key,te.props,null,ee.mode,xe),xe.ref=ua(ee,K,te),xe.return=ee,xe)}function re(ee,K,te,xe){return K===null||K.tag!==4||K.stateNode.containerInfo!==te.containerInfo||K.stateNode.implementation!==te.implementation?(K=lm(te,ee.mode,xe),K.return=ee,K):(K=x(K,te.children||[]),K.return=ee,K)}function he(ee,K,te,xe,ze){return K===null||K.tag!==7?(K=oo(te,ee.mode,xe,ze),K.return=ee,K):(K=x(K,te),K.return=ee,K)}function me(ee,K,te){if(typeof K=="string"&&K!==""||typeof K=="number")return K=om(""+K,ee.mode,te),K.return=ee,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case A:return te=zu(K.type,K.key,K.props,null,ee.mode,te),te.ref=ua(ee,null,K),te.return=ee,te;case D:return K=lm(K,ee.mode,te),K.return=ee,K;case ne:var xe=K._init;return me(ee,xe(K._payload),te)}if(Ke(K)||W(K))return K=oo(K,ee.mode,te,null),K.return=ee,K;gu(ee,K)}return null}function fe(ee,K,te,xe){var ze=K!==null?K.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return ze!==null?null:L(ee,K,""+te,xe);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case A:return te.key===ze?V(ee,K,te,xe):null;case D:return te.key===ze?re(ee,K,te,xe):null;case ne:return ze=te._init,fe(ee,K,ze(te._payload),xe)}if(Ke(te)||W(te))return ze!==null?null:he(ee,K,te,xe,null);gu(ee,te)}return null}function Pe(ee,K,te,xe,ze){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ee=ee.get(te)||null,L(K,ee,""+xe,ze);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case A:return ee=ee.get(xe.key===null?te:xe.key)||null,V(K,ee,xe,ze);case D:return ee=ee.get(xe.key===null?te:xe.key)||null,re(K,ee,xe,ze);case ne:var Qe=xe._init;return Pe(ee,K,te,Qe(xe._payload),ze)}if(Ke(xe)||W(xe))return ee=ee.get(te)||null,he(K,ee,xe,ze,null);gu(K,xe)}return null}function Be(ee,K,te,xe){for(var ze=null,Qe=null,Xe=K,nt=K=0,wn=null;Xe!==null&&nt<te.length;nt++){Xe.index>nt?(wn=Xe,Xe=null):wn=Xe.sibling;var bt=fe(ee,Xe,te[nt],xe);if(bt===null){Xe===null&&(Xe=wn);break}l&&Xe&&bt.alternate===null&&c(ee,Xe),K=k(bt,K,nt),Qe===null?ze=bt:Qe.sibling=bt,Qe=bt,Xe=wn}if(nt===te.length)return h(ee,Xe),Wt&&Js(ee,nt),ze;if(Xe===null){for(;nt<te.length;nt++)Xe=me(ee,te[nt],xe),Xe!==null&&(K=k(Xe,K,nt),Qe===null?ze=Xe:Qe.sibling=Xe,Qe=Xe);return Wt&&Js(ee,nt),ze}for(Xe=m(ee,Xe);nt<te.length;nt++)wn=Pe(Xe,ee,nt,te[nt],xe),wn!==null&&(l&&wn.alternate!==null&&Xe.delete(wn.key===null?nt:wn.key),K=k(wn,K,nt),Qe===null?ze=wn:Qe.sibling=wn,Qe=wn);return l&&Xe.forEach(function(Ss){return c(ee,Ss)}),Wt&&Js(ee,nt),ze}function _e(ee,K,te,xe){var ze=W(te);if(typeof ze!="function")throw Error(t(150));if(te=ze.call(te),te==null)throw Error(t(151));for(var Qe=ze=null,Xe=K,nt=K=0,wn=null,bt=te.next();Xe!==null&&!bt.done;nt++,bt=te.next()){Xe.index>nt?(wn=Xe,Xe=null):wn=Xe.sibling;var Ss=fe(ee,Xe,bt.value,xe);if(Ss===null){Xe===null&&(Xe=wn);break}l&&Xe&&Ss.alternate===null&&c(ee,Xe),K=k(Ss,K,nt),Qe===null?ze=Ss:Qe.sibling=Ss,Qe=Ss,Xe=wn}if(bt.done)return h(ee,Xe),Wt&&Js(ee,nt),ze;if(Xe===null){for(;!bt.done;nt++,bt=te.next())bt=me(ee,bt.value,xe),bt!==null&&(K=k(bt,K,nt),Qe===null?ze=bt:Qe.sibling=bt,Qe=bt);return Wt&&Js(ee,nt),ze}for(Xe=m(ee,Xe);!bt.done;nt++,bt=te.next())bt=Pe(Xe,ee,nt,bt.value,xe),bt!==null&&(l&&bt.alternate!==null&&Xe.delete(bt.key===null?nt:bt.key),K=k(bt,K,nt),Qe===null?ze=bt:Qe.sibling=bt,Qe=bt);return l&&Xe.forEach(function(gM){return c(ee,gM)}),Wt&&Js(ee,nt),ze}function nn(ee,K,te,xe){if(typeof te=="object"&&te!==null&&te.type===P&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case A:e:{for(var ze=te.key,Qe=K;Qe!==null;){if(Qe.key===ze){if(ze=te.type,ze===P){if(Qe.tag===7){h(ee,Qe.sibling),K=x(Qe,te.props.children),K.return=ee,ee=K;break e}}else if(Qe.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===ne&&wx(ze)===Qe.type){h(ee,Qe.sibling),K=x(Qe,te.props),K.ref=ua(ee,Qe,te),K.return=ee,ee=K;break e}h(ee,Qe);break}else c(ee,Qe);Qe=Qe.sibling}te.type===P?(K=oo(te.props.children,ee.mode,xe,te.key),K.return=ee,ee=K):(xe=zu(te.type,te.key,te.props,null,ee.mode,xe),xe.ref=ua(ee,K,te),xe.return=ee,ee=xe)}return O(ee);case D:e:{for(Qe=te.key;K!==null;){if(K.key===Qe)if(K.tag===4&&K.stateNode.containerInfo===te.containerInfo&&K.stateNode.implementation===te.implementation){h(ee,K.sibling),K=x(K,te.children||[]),K.return=ee,ee=K;break e}else{h(ee,K);break}else c(ee,K);K=K.sibling}K=lm(te,ee.mode,xe),K.return=ee,ee=K}return O(ee);case ne:return Qe=te._init,nn(ee,K,Qe(te._payload),xe)}if(Ke(te))return Be(ee,K,te,xe);if(W(te))return _e(ee,K,te,xe);gu(ee,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,K!==null&&K.tag===6?(h(ee,K.sibling),K=x(K,te),K.return=ee,ee=K):(h(ee,K),K=om(te,ee.mode,xe),K.return=ee,ee=K),O(ee)):h(ee,K)}return nn}var Go=bx(!0),Sx=bx(!1),yu=fs(null),vu=null,Qo=null,gp=null;function yp(){gp=Qo=vu=null}function vp(l){var c=yu.current;jt(yu),l._currentValue=c}function xp(l,c,h){for(;l!==null;){var m=l.alternate;if((l.childLanes&c)!==c?(l.childLanes|=c,m!==null&&(m.childLanes|=c)):m!==null&&(m.childLanes&c)!==c&&(m.childLanes|=c),l===h)break;l=l.return}}function Xo(l,c){vu=l,gp=Qo=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&c)!==0&&(tr=!0),l.firstContext=null)}function Pr(l){var c=l._currentValue;if(gp!==l)if(l={context:l,memoizedValue:c,next:null},Qo===null){if(vu===null)throw Error(t(308));Qo=l,vu.dependencies={lanes:0,firstContext:l}}else Qo=Qo.next=l;return c}var Zs=null;function wp(l){Zs===null?Zs=[l]:Zs.push(l)}function kx(l,c,h,m){var x=c.interleaved;return x===null?(h.next=h,wp(c)):(h.next=x.next,x.next=h),c.interleaved=h,_i(l,m)}function _i(l,c){l.lanes|=c;var h=l.alternate;for(h!==null&&(h.lanes|=c),h=l,l=l.return;l!==null;)l.childLanes|=c,h=l.alternate,h!==null&&(h.childLanes|=c),h=l,l=l.return;return h.tag===3?h.stateNode:null}var ps=!1;function bp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cx(l,c){l=l.updateQueue,c.updateQueue===l&&(c.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function zi(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function ms(l,c,h){var m=l.updateQueue;if(m===null)return null;if(m=m.shared,(vt&2)!==0){var x=m.pending;return x===null?c.next=c:(c.next=x.next,x.next=c),m.pending=c,_i(l,h)}return x=m.interleaved,x===null?(c.next=c,wp(m)):(c.next=x.next,x.next=c),m.interleaved=c,_i(l,h)}function xu(l,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194240)!==0)){var m=c.lanes;m&=l.pendingLanes,h|=m,c.lanes=h,Lh(l,h)}}function Ex(l,c){var h=l.updateQueue,m=l.alternate;if(m!==null&&(m=m.updateQueue,h===m)){var x=null,k=null;if(h=h.firstBaseUpdate,h!==null){do{var O={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};k===null?x=k=O:k=k.next=O,h=h.next}while(h!==null);k===null?x=k=c:k=k.next=c}else x=k=c;h={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:m.shared,effects:m.effects},l.updateQueue=h;return}l=h.lastBaseUpdate,l===null?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=c}function wu(l,c,h,m){var x=l.updateQueue;ps=!1;var k=x.firstBaseUpdate,O=x.lastBaseUpdate,L=x.shared.pending;if(L!==null){x.shared.pending=null;var V=L,re=V.next;V.next=null,O===null?k=re:O.next=re,O=V;var he=l.alternate;he!==null&&(he=he.updateQueue,L=he.lastBaseUpdate,L!==O&&(L===null?he.firstBaseUpdate=re:L.next=re,he.lastBaseUpdate=V))}if(k!==null){var me=x.baseState;O=0,he=re=V=null,L=k;do{var fe=L.lane,Pe=L.eventTime;if((m&fe)===fe){he!==null&&(he=he.next={eventTime:Pe,lane:0,tag:L.tag,payload:L.payload,callback:L.callback,next:null});e:{var Be=l,_e=L;switch(fe=c,Pe=h,_e.tag){case 1:if(Be=_e.payload,typeof Be=="function"){me=Be.call(Pe,me,fe);break e}me=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=_e.payload,fe=typeof Be=="function"?Be.call(Pe,me,fe):Be,fe==null)break e;me=F({},me,fe);break e;case 2:ps=!0}}L.callback!==null&&L.lane!==0&&(l.flags|=64,fe=x.effects,fe===null?x.effects=[L]:fe.push(L))}else Pe={eventTime:Pe,lane:fe,tag:L.tag,payload:L.payload,callback:L.callback,next:null},he===null?(re=he=Pe,V=me):he=he.next=Pe,O|=fe;if(L=L.next,L===null){if(L=x.shared.pending,L===null)break;fe=L,L=fe.next,fe.next=null,x.lastBaseUpdate=fe,x.shared.pending=null}}while(!0);if(he===null&&(V=me),x.baseState=V,x.firstBaseUpdate=re,x.lastBaseUpdate=he,c=x.shared.interleaved,c!==null){x=c;do O|=x.lane,x=x.next;while(x!==c)}else k===null&&(x.shared.lanes=0);no|=O,l.lanes=O,l.memoizedState=me}}function Rx(l,c,h){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var m=l[c],x=m.callback;if(x!==null){if(m.callback=null,m=h,typeof x!="function")throw Error(t(191,x));x.call(m)}}}var fa={},hi=fs(fa),da=fs(fa),ha=fs(fa);function eo(l){if(l===fa)throw Error(t(174));return l}function Sp(l,c){switch(Nt(ha,c),Nt(da,l),Nt(hi,fa),l=c.nodeType,l){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:le(null,"");break;default:l=l===8?c.parentNode:c,c=l.namespaceURI||null,l=l.tagName,c=le(c,l)}jt(hi),Nt(hi,c)}function Jo(){jt(hi),jt(da),jt(ha)}function Tx(l){eo(ha.current);var c=eo(hi.current),h=le(c,l.type);c!==h&&(Nt(da,l),Nt(hi,h))}function kp(l){da.current===l&&(jt(hi),jt(da))}var Yt=fs(0);function bu(l){for(var c=l;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Cp=[];function Ep(){for(var l=0;l<Cp.length;l++)Cp[l]._workInProgressVersionPrimary=null;Cp.length=0}var Su=M.ReactCurrentDispatcher,Rp=M.ReactCurrentBatchConfig,to=0,Gt=null,dn=null,vn=null,ku=!1,pa=!1,ma=0,jO=0;function Bn(){throw Error(t(321))}function Tp(l,c){if(c===null)return!1;for(var h=0;h<c.length&&h<l.length;h++)if(!Gr(l[h],c[h]))return!1;return!0}function Op(l,c,h,m,x,k){if(to=k,Gt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Su.current=l===null||l.memoizedState===null?WO:HO,l=h(m,x),pa){k=0;do{if(pa=!1,ma=0,25<=k)throw Error(t(301));k+=1,vn=dn=null,c.updateQueue=null,Su.current=$O,l=h(m,x)}while(pa)}if(Su.current=Ru,c=dn!==null&&dn.next!==null,to=0,vn=dn=Gt=null,ku=!1,c)throw Error(t(300));return l}function Mp(){var l=ma!==0;return ma=0,l}function pi(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Gt.memoizedState=vn=l:vn=vn.next=l,vn}function Ir(){if(dn===null){var l=Gt.alternate;l=l!==null?l.memoizedState:null}else l=dn.next;var c=vn===null?Gt.memoizedState:vn.next;if(c!==null)vn=c,dn=l;else{if(l===null)throw Error(t(310));dn=l,l={memoizedState:dn.memoizedState,baseState:dn.baseState,baseQueue:dn.baseQueue,queue:dn.queue,next:null},vn===null?Gt.memoizedState=vn=l:vn=vn.next=l}return vn}function ga(l,c){return typeof c=="function"?c(l):c}function Ap(l){var c=Ir(),h=c.queue;if(h===null)throw Error(t(311));h.lastRenderedReducer=l;var m=dn,x=m.baseQueue,k=h.pending;if(k!==null){if(x!==null){var O=x.next;x.next=k.next,k.next=O}m.baseQueue=x=k,h.pending=null}if(x!==null){k=x.next,m=m.baseState;var L=O=null,V=null,re=k;do{var he=re.lane;if((to&he)===he)V!==null&&(V=V.next={lane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),m=re.hasEagerState?re.eagerState:l(m,re.action);else{var me={lane:he,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null};V===null?(L=V=me,O=m):V=V.next=me,Gt.lanes|=he,no|=he}re=re.next}while(re!==null&&re!==k);V===null?O=m:V.next=L,Gr(m,c.memoizedState)||(tr=!0),c.memoizedState=m,c.baseState=O,c.baseQueue=V,h.lastRenderedState=m}if(l=h.interleaved,l!==null){x=l;do k=x.lane,Gt.lanes|=k,no|=k,x=x.next;while(x!==l)}else x===null&&(h.lanes=0);return[c.memoizedState,h.dispatch]}function Pp(l){var c=Ir(),h=c.queue;if(h===null)throw Error(t(311));h.lastRenderedReducer=l;var m=h.dispatch,x=h.pending,k=c.memoizedState;if(x!==null){h.pending=null;var O=x=x.next;do k=l(k,O.action),O=O.next;while(O!==x);Gr(k,c.memoizedState)||(tr=!0),c.memoizedState=k,c.baseQueue===null&&(c.baseState=k),h.lastRenderedState=k}return[k,m]}function Ox(){}function Mx(l,c){var h=Gt,m=Ir(),x=c(),k=!Gr(m.memoizedState,x);if(k&&(m.memoizedState=x,tr=!0),m=m.queue,Ip(Ix.bind(null,h,m,l),[l]),m.getSnapshot!==c||k||vn!==null&&vn.memoizedState.tag&1){if(h.flags|=2048,ya(9,Px.bind(null,h,m,x,c),void 0,null),xn===null)throw Error(t(349));(to&30)!==0||Ax(h,c,x)}return x}function Ax(l,c,h){l.flags|=16384,l={getSnapshot:c,value:h},c=Gt.updateQueue,c===null?(c={lastEffect:null,stores:null},Gt.updateQueue=c,c.stores=[l]):(h=c.stores,h===null?c.stores=[l]:h.push(l))}function Px(l,c,h,m){c.value=h,c.getSnapshot=m,Dx(c)&&Nx(l)}function Ix(l,c,h){return h(function(){Dx(c)&&Nx(l)})}function Dx(l){var c=l.getSnapshot;l=l.value;try{var h=c();return!Gr(l,h)}catch{return!0}}function Nx(l){var c=_i(l,1);c!==null&&ei(c,l,1,-1)}function Lx(l){var c=pi();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:l},c.queue=l,l=l.dispatch=VO.bind(null,Gt,l),[c.memoizedState,l]}function ya(l,c,h,m){return l={tag:l,create:c,destroy:h,deps:m,next:null},c=Gt.updateQueue,c===null?(c={lastEffect:null,stores:null},Gt.updateQueue=c,c.lastEffect=l.next=l):(h=c.lastEffect,h===null?c.lastEffect=l.next=l:(m=h.next,h.next=l,l.next=m,c.lastEffect=l)),l}function Bx(){return Ir().memoizedState}function Cu(l,c,h,m){var x=pi();Gt.flags|=l,x.memoizedState=ya(1|c,h,void 0,m===void 0?null:m)}function Eu(l,c,h,m){var x=Ir();m=m===void 0?null:m;var k=void 0;if(dn!==null){var O=dn.memoizedState;if(k=O.destroy,m!==null&&Tp(m,O.deps)){x.memoizedState=ya(c,h,k,m);return}}Gt.flags|=l,x.memoizedState=ya(1|c,h,k,m)}function Fx(l,c){return Cu(8390656,8,l,c)}function Ip(l,c){return Eu(2048,8,l,c)}function jx(l,c){return Eu(4,2,l,c)}function _x(l,c){return Eu(4,4,l,c)}function zx(l,c){if(typeof c=="function")return l=l(),c(l),function(){c(null)};if(c!=null)return l=l(),c.current=l,function(){c.current=null}}function Vx(l,c,h){return h=h!=null?h.concat([l]):null,Eu(4,4,zx.bind(null,c,l),h)}function Dp(){}function Wx(l,c){var h=Ir();c=c===void 0?null:c;var m=h.memoizedState;return m!==null&&c!==null&&Tp(c,m[1])?m[0]:(h.memoizedState=[l,c],l)}function Hx(l,c){var h=Ir();c=c===void 0?null:c;var m=h.memoizedState;return m!==null&&c!==null&&Tp(c,m[1])?m[0]:(l=l(),h.memoizedState=[l,c],l)}function $x(l,c,h){return(to&21)===0?(l.baseState&&(l.baseState=!1,tr=!0),l.memoizedState=h):(Gr(h,c)||(h=wv(),Gt.lanes|=h,no|=h,l.baseState=!0),c)}function _O(l,c){var h=Ct;Ct=h!==0&&4>h?h:4,l(!0);var m=Rp.transition;Rp.transition={};try{l(!1),c()}finally{Ct=h,Rp.transition=m}}function Ux(){return Ir().memoizedState}function zO(l,c,h){var m=xs(l);if(h={lane:m,action:h,hasEagerState:!1,eagerState:null,next:null},qx(l))Kx(c,h);else if(h=kx(l,c,h,m),h!==null){var x=$n();ei(h,l,m,x),Yx(h,c,m)}}function VO(l,c,h){var m=xs(l),x={lane:m,action:h,hasEagerState:!1,eagerState:null,next:null};if(qx(l))Kx(c,x);else{var k=l.alternate;if(l.lanes===0&&(k===null||k.lanes===0)&&(k=c.lastRenderedReducer,k!==null))try{var O=c.lastRenderedState,L=k(O,h);if(x.hasEagerState=!0,x.eagerState=L,Gr(L,O)){var V=c.interleaved;V===null?(x.next=x,wp(c)):(x.next=V.next,V.next=x),c.interleaved=x;return}}catch{}finally{}h=kx(l,c,x,m),h!==null&&(x=$n(),ei(h,l,m,x),Yx(h,c,m))}}function qx(l){var c=l.alternate;return l===Gt||c!==null&&c===Gt}function Kx(l,c){pa=ku=!0;var h=l.pending;h===null?c.next=c:(c.next=h.next,h.next=c),l.pending=c}function Yx(l,c,h){if((h&4194240)!==0){var m=c.lanes;m&=l.pendingLanes,h|=m,c.lanes=h,Lh(l,h)}}var Ru={readContext:Pr,useCallback:Bn,useContext:Bn,useEffect:Bn,useImperativeHandle:Bn,useInsertionEffect:Bn,useLayoutEffect:Bn,useMemo:Bn,useReducer:Bn,useRef:Bn,useState:Bn,useDebugValue:Bn,useDeferredValue:Bn,useTransition:Bn,useMutableSource:Bn,useSyncExternalStore:Bn,useId:Bn,unstable_isNewReconciler:!1},WO={readContext:Pr,useCallback:function(l,c){return pi().memoizedState=[l,c===void 0?null:c],l},useContext:Pr,useEffect:Fx,useImperativeHandle:function(l,c,h){return h=h!=null?h.concat([l]):null,Cu(4194308,4,zx.bind(null,c,l),h)},useLayoutEffect:function(l,c){return Cu(4194308,4,l,c)},useInsertionEffect:function(l,c){return Cu(4,2,l,c)},useMemo:function(l,c){var h=pi();return c=c===void 0?null:c,l=l(),h.memoizedState=[l,c],l},useReducer:function(l,c,h){var m=pi();return c=h!==void 0?h(c):c,m.memoizedState=m.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},m.queue=l,l=l.dispatch=zO.bind(null,Gt,l),[m.memoizedState,l]},useRef:function(l){var c=pi();return l={current:l},c.memoizedState=l},useState:Lx,useDebugValue:Dp,useDeferredValue:function(l){return pi().memoizedState=l},useTransition:function(){var l=Lx(!1),c=l[0];return l=_O.bind(null,l[1]),pi().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,h){var m=Gt,x=pi();if(Wt){if(h===void 0)throw Error(t(407));h=h()}else{if(h=c(),xn===null)throw Error(t(349));(to&30)!==0||Ax(m,c,h)}x.memoizedState=h;var k={value:h,getSnapshot:c};return x.queue=k,Fx(Ix.bind(null,m,k,l),[l]),m.flags|=2048,ya(9,Px.bind(null,m,k,h,c),void 0,null),h},useId:function(){var l=pi(),c=xn.identifierPrefix;if(Wt){var h=ji,m=Fi;h=(m&~(1<<32-Yr(m)-1)).toString(32)+h,c=":"+c+"R"+h,h=ma++,0<h&&(c+="H"+h.toString(32)),c+=":"}else h=jO++,c=":"+c+"r"+h.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},HO={readContext:Pr,useCallback:Wx,useContext:Pr,useEffect:Ip,useImperativeHandle:Vx,useInsertionEffect:jx,useLayoutEffect:_x,useMemo:Hx,useReducer:Ap,useRef:Bx,useState:function(){return Ap(ga)},useDebugValue:Dp,useDeferredValue:function(l){var c=Ir();return $x(c,dn.memoizedState,l)},useTransition:function(){var l=Ap(ga)[0],c=Ir().memoizedState;return[l,c]},useMutableSource:Ox,useSyncExternalStore:Mx,useId:Ux,unstable_isNewReconciler:!1},$O={readContext:Pr,useCallback:Wx,useContext:Pr,useEffect:Ip,useImperativeHandle:Vx,useInsertionEffect:jx,useLayoutEffect:_x,useMemo:Hx,useReducer:Pp,useRef:Bx,useState:function(){return Pp(ga)},useDebugValue:Dp,useDeferredValue:function(l){var c=Ir();return dn===null?c.memoizedState=l:$x(c,dn.memoizedState,l)},useTransition:function(){var l=Pp(ga)[0],c=Ir().memoizedState;return[l,c]},useMutableSource:Ox,useSyncExternalStore:Mx,useId:Ux,unstable_isNewReconciler:!1};function Xr(l,c){if(l&&l.defaultProps){c=F({},c),l=l.defaultProps;for(var h in l)c[h]===void 0&&(c[h]=l[h]);return c}return c}function Np(l,c,h,m){c=l.memoizedState,h=h(m,c),h=h==null?c:F({},c,h),l.memoizedState=h,l.lanes===0&&(l.updateQueue.baseState=h)}var Tu={isMounted:function(l){return(l=l._reactInternals)?Or(l)===l:!1},enqueueSetState:function(l,c,h){l=l._reactInternals;var m=$n(),x=xs(l),k=zi(m,x);k.payload=c,h!=null&&(k.callback=h),c=ms(l,k,x),c!==null&&(ei(c,l,x,m),xu(c,l,x))},enqueueReplaceState:function(l,c,h){l=l._reactInternals;var m=$n(),x=xs(l),k=zi(m,x);k.tag=1,k.payload=c,h!=null&&(k.callback=h),c=ms(l,k,x),c!==null&&(ei(c,l,x,m),xu(c,l,x))},enqueueForceUpdate:function(l,c){l=l._reactInternals;var h=$n(),m=xs(l),x=zi(h,m);x.tag=2,c!=null&&(x.callback=c),c=ms(l,x,m),c!==null&&(ei(c,l,m,h),xu(c,l,m))}};function Gx(l,c,h,m,x,k,O){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(m,k,O):c.prototype&&c.prototype.isPureReactComponent?!ra(h,m)||!ra(x,k):!0}function Qx(l,c,h){var m=!1,x=ds,k=c.contextType;return typeof k=="object"&&k!==null?k=Pr(k):(x=er(c)?Qs:Ln.current,m=c.contextTypes,k=(m=m!=null)?Uo(l,x):ds),c=new c(h,k),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Tu,l.stateNode=c,c._reactInternals=l,m&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=x,l.__reactInternalMemoizedMaskedChildContext=k),c}function Xx(l,c,h,m){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,m),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,m),c.state!==l&&Tu.enqueueReplaceState(c,c.state,null)}function Lp(l,c,h,m){var x=l.stateNode;x.props=h,x.state=l.memoizedState,x.refs={},bp(l);var k=c.contextType;typeof k=="object"&&k!==null?x.context=Pr(k):(k=er(c)?Qs:Ln.current,x.context=Uo(l,k)),x.state=l.memoizedState,k=c.getDerivedStateFromProps,typeof k=="function"&&(Np(l,c,k,h),x.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(c=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),c!==x.state&&Tu.enqueueReplaceState(x,x.state,null),wu(l,h,x,m),x.state=l.memoizedState),typeof x.componentDidMount=="function"&&(l.flags|=4194308)}function Zo(l,c){try{var h="",m=c;do h+=oe(m),m=m.return;while(m);var x=h}catch(k){x=`
39
+ Error generating stack: `+k.message+`
40
+ `+k.stack}return{value:l,source:c,stack:x,digest:null}}function Bp(l,c,h){return{value:l,source:null,stack:h??null,digest:c??null}}function Fp(l,c){try{console.error(c.value)}catch(h){setTimeout(function(){throw h})}}var UO=typeof WeakMap=="function"?WeakMap:Map;function Jx(l,c,h){h=zi(-1,h),h.tag=3,h.payload={element:null};var m=c.value;return h.callback=function(){Nu||(Nu=!0,Jp=m),Fp(l,c)},h}function Zx(l,c,h){h=zi(-1,h),h.tag=3;var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var x=c.value;h.payload=function(){return m(x)},h.callback=function(){Fp(l,c)}}var k=l.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(h.callback=function(){Fp(l,c),typeof m!="function"&&(ys===null?ys=new Set([this]):ys.add(this));var O=c.stack;this.componentDidCatch(c.value,{componentStack:O!==null?O:""})}),h}function e1(l,c,h){var m=l.pingCache;if(m===null){m=l.pingCache=new UO;var x=new Set;m.set(c,x)}else x=m.get(c),x===void 0&&(x=new Set,m.set(c,x));x.has(h)||(x.add(h),l=sM.bind(null,l,c,h),c.then(l,l))}function t1(l){do{var c;if((c=l.tag===13)&&(c=l.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return l;l=l.return}while(l!==null);return null}function n1(l,c,h,m,x){return(l.mode&1)===0?(l===c?l.flags|=65536:(l.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(c=zi(-1,1),c.tag=2,ms(h,c,1))),h.lanes|=1),l):(l.flags|=65536,l.lanes=x,l)}var qO=M.ReactCurrentOwner,tr=!1;function Hn(l,c,h,m){c.child=l===null?Sx(c,null,h,m):Go(c,l.child,h,m)}function r1(l,c,h,m,x){h=h.render;var k=c.ref;return Xo(c,x),m=Op(l,c,h,m,k,x),h=Mp(),l!==null&&!tr?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~x,Vi(l,c,x)):(Wt&&h&&fp(c),c.flags|=1,Hn(l,c,m,x),c.child)}function i1(l,c,h,m,x){if(l===null){var k=h.type;return typeof k=="function"&&!sm(k)&&k.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(c.tag=15,c.type=k,s1(l,c,k,m,x)):(l=zu(h.type,null,m,c,c.mode,x),l.ref=c.ref,l.return=c,c.child=l)}if(k=l.child,(l.lanes&x)===0){var O=k.memoizedProps;if(h=h.compare,h=h!==null?h:ra,h(O,m)&&l.ref===c.ref)return Vi(l,c,x)}return c.flags|=1,l=bs(k,m),l.ref=c.ref,l.return=c,c.child=l}function s1(l,c,h,m,x){if(l!==null){var k=l.memoizedProps;if(ra(k,m)&&l.ref===c.ref)if(tr=!1,c.pendingProps=m=k,(l.lanes&x)!==0)(l.flags&131072)!==0&&(tr=!0);else return c.lanes=l.lanes,Vi(l,c,x)}return jp(l,c,h,m,x)}function o1(l,c,h){var m=c.pendingProps,x=m.children,k=l!==null?l.memoizedState:null;if(m.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nt(tl,vr),vr|=h;else{if((h&1073741824)===0)return l=k!==null?k.baseLanes|h:h,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null,transitions:null},c.updateQueue=null,Nt(tl,vr),vr|=l,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=k!==null?k.baseLanes:h,Nt(tl,vr),vr|=m}else k!==null?(m=k.baseLanes|h,c.memoizedState=null):m=h,Nt(tl,vr),vr|=m;return Hn(l,c,x,h),c.child}function l1(l,c){var h=c.ref;(l===null&&h!==null||l!==null&&l.ref!==h)&&(c.flags|=512,c.flags|=2097152)}function jp(l,c,h,m,x){var k=er(h)?Qs:Ln.current;return k=Uo(c,k),Xo(c,x),h=Op(l,c,h,m,k,x),m=Mp(),l!==null&&!tr?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~x,Vi(l,c,x)):(Wt&&m&&fp(c),c.flags|=1,Hn(l,c,h,x),c.child)}function a1(l,c,h,m,x){if(er(h)){var k=!0;fu(c)}else k=!1;if(Xo(c,x),c.stateNode===null)Mu(l,c),Qx(c,h,m),Lp(c,h,m,x),m=!0;else if(l===null){var O=c.stateNode,L=c.memoizedProps;O.props=L;var V=O.context,re=h.contextType;typeof re=="object"&&re!==null?re=Pr(re):(re=er(h)?Qs:Ln.current,re=Uo(c,re));var he=h.getDerivedStateFromProps,me=typeof he=="function"||typeof O.getSnapshotBeforeUpdate=="function";me||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(L!==m||V!==re)&&Xx(c,O,m,re),ps=!1;var fe=c.memoizedState;O.state=fe,wu(c,m,O,x),V=c.memoizedState,L!==m||fe!==V||Zn.current||ps?(typeof he=="function"&&(Np(c,h,he,m),V=c.memoizedState),(L=ps||Gx(c,h,L,m,fe,V,re))?(me||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(c.flags|=4194308)):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=m,c.memoizedState=V),O.props=m,O.state=V,O.context=re,m=L):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),m=!1)}else{O=c.stateNode,Cx(l,c),L=c.memoizedProps,re=c.type===c.elementType?L:Xr(c.type,L),O.props=re,me=c.pendingProps,fe=O.context,V=h.contextType,typeof V=="object"&&V!==null?V=Pr(V):(V=er(h)?Qs:Ln.current,V=Uo(c,V));var Pe=h.getDerivedStateFromProps;(he=typeof Pe=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(L!==me||fe!==V)&&Xx(c,O,m,V),ps=!1,fe=c.memoizedState,O.state=fe,wu(c,m,O,x);var Be=c.memoizedState;L!==me||fe!==Be||Zn.current||ps?(typeof Pe=="function"&&(Np(c,h,Pe,m),Be=c.memoizedState),(re=ps||Gx(c,h,re,m,fe,Be,V)||!1)?(he||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(m,Be,V),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(m,Be,V)),typeof O.componentDidUpdate=="function"&&(c.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof O.componentDidUpdate!="function"||L===l.memoizedProps&&fe===l.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||L===l.memoizedProps&&fe===l.memoizedState||(c.flags|=1024),c.memoizedProps=m,c.memoizedState=Be),O.props=m,O.state=Be,O.context=V,m=re):(typeof O.componentDidUpdate!="function"||L===l.memoizedProps&&fe===l.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||L===l.memoizedProps&&fe===l.memoizedState||(c.flags|=1024),m=!1)}return _p(l,c,h,m,k,x)}function _p(l,c,h,m,x,k){l1(l,c);var O=(c.flags&128)!==0;if(!m&&!O)return x&&hx(c,h,!1),Vi(l,c,k);m=c.stateNode,qO.current=c;var L=O&&typeof h.getDerivedStateFromError!="function"?null:m.render();return c.flags|=1,l!==null&&O?(c.child=Go(c,l.child,null,k),c.child=Go(c,null,L,k)):Hn(l,c,L,k),c.memoizedState=m.state,x&&hx(c,h,!0),c.child}function c1(l){var c=l.stateNode;c.pendingContext?fx(l,c.pendingContext,c.pendingContext!==c.context):c.context&&fx(l,c.context,!1),Sp(l,c.containerInfo)}function u1(l,c,h,m,x){return Yo(),mp(x),c.flags|=256,Hn(l,c,h,m),c.child}var zp={dehydrated:null,treeContext:null,retryLane:0};function Vp(l){return{baseLanes:l,cachePool:null,transitions:null}}function f1(l,c,h){var m=c.pendingProps,x=Yt.current,k=!1,O=(c.flags&128)!==0,L;if((L=O)||(L=l!==null&&l.memoizedState===null?!1:(x&2)!==0),L?(k=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(x|=1),Nt(Yt,x&1),l===null)return pp(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((c.mode&1)===0?c.lanes=1:l.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(O=m.children,l=m.fallback,k?(m=c.mode,k=c.child,O={mode:"hidden",children:O},(m&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=O):k=Vu(O,m,0,null),l=oo(l,m,h,null),k.return=c,l.return=c,k.sibling=l,c.child=k,c.child.memoizedState=Vp(h),c.memoizedState=zp,l):Wp(c,O));if(x=l.memoizedState,x!==null&&(L=x.dehydrated,L!==null))return KO(l,c,O,m,L,x,h);if(k){k=m.fallback,O=c.mode,x=l.child,L=x.sibling;var V={mode:"hidden",children:m.children};return(O&1)===0&&c.child!==x?(m=c.child,m.childLanes=0,m.pendingProps=V,c.deletions=null):(m=bs(x,V),m.subtreeFlags=x.subtreeFlags&14680064),L!==null?k=bs(L,k):(k=oo(k,O,h,null),k.flags|=2),k.return=c,m.return=c,m.sibling=k,c.child=m,m=k,k=c.child,O=l.child.memoizedState,O=O===null?Vp(h):{baseLanes:O.baseLanes|h,cachePool:null,transitions:O.transitions},k.memoizedState=O,k.childLanes=l.childLanes&~h,c.memoizedState=zp,m}return k=l.child,l=k.sibling,m=bs(k,{mode:"visible",children:m.children}),(c.mode&1)===0&&(m.lanes=h),m.return=c,m.sibling=null,l!==null&&(h=c.deletions,h===null?(c.deletions=[l],c.flags|=16):h.push(l)),c.child=m,c.memoizedState=null,m}function Wp(l,c){return c=Vu({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function Ou(l,c,h,m){return m!==null&&mp(m),Go(c,l.child,null,h),l=Wp(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function KO(l,c,h,m,x,k,O){if(h)return c.flags&256?(c.flags&=-257,m=Bp(Error(t(422))),Ou(l,c,O,m)):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(k=m.fallback,x=c.mode,m=Vu({mode:"visible",children:m.children},x,0,null),k=oo(k,x,O,null),k.flags|=2,m.return=c,k.return=c,m.sibling=k,c.child=m,(c.mode&1)!==0&&Go(c,l.child,null,O),c.child.memoizedState=Vp(O),c.memoizedState=zp,k);if((c.mode&1)===0)return Ou(l,c,O,null);if(x.data==="$!"){if(m=x.nextSibling&&x.nextSibling.dataset,m)var L=m.dgst;return m=L,k=Error(t(419)),m=Bp(k,m,void 0),Ou(l,c,O,m)}if(L=(O&l.childLanes)!==0,tr||L){if(m=xn,m!==null){switch(O&-O){case 4:x=2;break;case 16:x=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(m.suspendedLanes|O))!==0?0:x,x!==0&&x!==k.retryLane&&(k.retryLane=x,_i(l,x),ei(m,l,x,-1))}return im(),m=Bp(Error(t(421))),Ou(l,c,O,m)}return x.data==="$?"?(c.flags|=128,c.child=l.child,c=oM.bind(null,l),x._reactRetry=c,null):(l=k.treeContext,yr=us(x.nextSibling),gr=c,Wt=!0,Qr=null,l!==null&&(Mr[Ar++]=Fi,Mr[Ar++]=ji,Mr[Ar++]=Xs,Fi=l.id,ji=l.overflow,Xs=c),c=Wp(c,m.children),c.flags|=4096,c)}function d1(l,c,h){l.lanes|=c;var m=l.alternate;m!==null&&(m.lanes|=c),xp(l.return,c,h)}function Hp(l,c,h,m,x){var k=l.memoizedState;k===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:m,tail:h,tailMode:x}:(k.isBackwards=c,k.rendering=null,k.renderingStartTime=0,k.last=m,k.tail=h,k.tailMode=x)}function h1(l,c,h){var m=c.pendingProps,x=m.revealOrder,k=m.tail;if(Hn(l,c,m.children,h),m=Yt.current,(m&2)!==0)m=m&1|2,c.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=c.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&d1(l,h,c);else if(l.tag===19)d1(l,h,c);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===c)break e;for(;l.sibling===null;){if(l.return===null||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}m&=1}if(Nt(Yt,m),(c.mode&1)===0)c.memoizedState=null;else switch(x){case"forwards":for(h=c.child,x=null;h!==null;)l=h.alternate,l!==null&&bu(l)===null&&(x=h),h=h.sibling;h=x,h===null?(x=c.child,c.child=null):(x=h.sibling,h.sibling=null),Hp(c,!1,x,h,k);break;case"backwards":for(h=null,x=c.child,c.child=null;x!==null;){if(l=x.alternate,l!==null&&bu(l)===null){c.child=x;break}l=x.sibling,x.sibling=h,h=x,x=l}Hp(c,!0,h,null,k);break;case"together":Hp(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Mu(l,c){(c.mode&1)===0&&l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2)}function Vi(l,c,h){if(l!==null&&(c.dependencies=l.dependencies),no|=c.lanes,(h&c.childLanes)===0)return null;if(l!==null&&c.child!==l.child)throw Error(t(153));if(c.child!==null){for(l=c.child,h=bs(l,l.pendingProps),c.child=h,h.return=c;l.sibling!==null;)l=l.sibling,h=h.sibling=bs(l,l.pendingProps),h.return=c;h.sibling=null}return c.child}function YO(l,c,h){switch(c.tag){case 3:c1(c),Yo();break;case 5:Tx(c);break;case 1:er(c.type)&&fu(c);break;case 4:Sp(c,c.stateNode.containerInfo);break;case 10:var m=c.type._context,x=c.memoizedProps.value;Nt(yu,m._currentValue),m._currentValue=x;break;case 13:if(m=c.memoizedState,m!==null)return m.dehydrated!==null?(Nt(Yt,Yt.current&1),c.flags|=128,null):(h&c.child.childLanes)!==0?f1(l,c,h):(Nt(Yt,Yt.current&1),l=Vi(l,c,h),l!==null?l.sibling:null);Nt(Yt,Yt.current&1);break;case 19:if(m=(h&c.childLanes)!==0,(l.flags&128)!==0){if(m)return h1(l,c,h);c.flags|=128}if(x=c.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Nt(Yt,Yt.current),m)break;return null;case 22:case 23:return c.lanes=0,o1(l,c,h)}return Vi(l,c,h)}var p1,$p,m1,g1;p1=function(l,c){for(var h=c.child;h!==null;){if(h.tag===5||h.tag===6)l.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},$p=function(){},m1=function(l,c,h,m){var x=l.memoizedProps;if(x!==m){l=c.stateNode,eo(hi.current);var k=null;switch(h){case"input":x=be(l,x),m=be(l,m),k=[];break;case"select":x=F({},x,{value:void 0}),m=F({},m,{value:void 0}),k=[];break;case"textarea":x=Je(l,x),m=Je(l,m),k=[];break;default:typeof x.onClick!="function"&&typeof m.onClick=="function"&&(l.onclick=au)}zt(h,m);var O;h=null;for(re in x)if(!m.hasOwnProperty(re)&&x.hasOwnProperty(re)&&x[re]!=null)if(re==="style"){var L=x[re];for(O in L)L.hasOwnProperty(O)&&(h||(h={}),h[O]="")}else re!=="dangerouslySetInnerHTML"&&re!=="children"&&re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&re!=="autoFocus"&&(i.hasOwnProperty(re)?k||(k=[]):(k=k||[]).push(re,null));for(re in m){var V=m[re];if(L=x!=null?x[re]:void 0,m.hasOwnProperty(re)&&V!==L&&(V!=null||L!=null))if(re==="style")if(L){for(O in L)!L.hasOwnProperty(O)||V&&V.hasOwnProperty(O)||(h||(h={}),h[O]="");for(O in V)V.hasOwnProperty(O)&&L[O]!==V[O]&&(h||(h={}),h[O]=V[O])}else h||(k||(k=[]),k.push(re,h)),h=V;else re==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,L=L?L.__html:void 0,V!=null&&L!==V&&(k=k||[]).push(re,V)):re==="children"?typeof V!="string"&&typeof V!="number"||(k=k||[]).push(re,""+V):re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&(i.hasOwnProperty(re)?(V!=null&&re==="onScroll"&&Ft("scroll",l),k||L===V||(k=[])):(k=k||[]).push(re,V))}h&&(k=k||[]).push("style",h);var re=k;(c.updateQueue=re)&&(c.flags|=4)}},g1=function(l,c,h,m){h!==m&&(c.flags|=4)};function va(l,c){if(!Wt)switch(l.tailMode){case"hidden":c=l.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?l.tail=null:h.sibling=null;break;case"collapsed":h=l.tail;for(var m=null;h!==null;)h.alternate!==null&&(m=h),h=h.sibling;m===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:m.sibling=null}}function Fn(l){var c=l.alternate!==null&&l.alternate.child===l.child,h=0,m=0;if(c)for(var x=l.child;x!==null;)h|=x.lanes|x.childLanes,m|=x.subtreeFlags&14680064,m|=x.flags&14680064,x.return=l,x=x.sibling;else for(x=l.child;x!==null;)h|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=l,x=x.sibling;return l.subtreeFlags|=m,l.childLanes=h,c}function GO(l,c,h){var m=c.pendingProps;switch(dp(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fn(c),null;case 1:return er(c.type)&&uu(),Fn(c),null;case 3:return m=c.stateNode,Jo(),jt(Zn),jt(Ln),Ep(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(l===null||l.child===null)&&(mu(c)?c.flags|=4:l===null||l.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Qr!==null&&(tm(Qr),Qr=null))),$p(l,c),Fn(c),null;case 5:kp(c);var x=eo(ha.current);if(h=c.type,l!==null&&c.stateNode!=null)m1(l,c,h,m,x),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!m){if(c.stateNode===null)throw Error(t(166));return Fn(c),null}if(l=eo(hi.current),mu(c)){m=c.stateNode,h=c.type;var k=c.memoizedProps;switch(m[di]=c,m[aa]=k,l=(c.mode&1)!==0,h){case"dialog":Ft("cancel",m),Ft("close",m);break;case"iframe":case"object":case"embed":Ft("load",m);break;case"video":case"audio":for(x=0;x<sa.length;x++)Ft(sa[x],m);break;case"source":Ft("error",m);break;case"img":case"image":case"link":Ft("error",m),Ft("load",m);break;case"details":Ft("toggle",m);break;case"input":je(m,k),Ft("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!k.multiple},Ft("invalid",m);break;case"textarea":$e(m,k),Ft("invalid",m)}zt(h,k),x=null;for(var O in k)if(k.hasOwnProperty(O)){var L=k[O];O==="children"?typeof L=="string"?m.textContent!==L&&(k.suppressHydrationWarning!==!0&&lu(m.textContent,L,l),x=["children",L]):typeof L=="number"&&m.textContent!==""+L&&(k.suppressHydrationWarning!==!0&&lu(m.textContent,L,l),x=["children",""+L]):i.hasOwnProperty(O)&&L!=null&&O==="onScroll"&&Ft("scroll",m)}switch(h){case"input":Re(m),Ie(m,k,!0);break;case"textarea":Re(m),Y(m);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(m.onclick=au)}m=x,c.updateQueue=m,m!==null&&(c.flags|=4)}else{O=x.nodeType===9?x:x.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=se(h)),l==="http://www.w3.org/1999/xhtml"?h==="script"?(l=O.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof m.is=="string"?l=O.createElement(h,{is:m.is}):(l=O.createElement(h),h==="select"&&(O=l,m.multiple?O.multiple=!0:m.size&&(O.size=m.size))):l=O.createElementNS(l,h),l[di]=c,l[aa]=m,p1(l,c,!1,!1),c.stateNode=l;e:{switch(O=It(h,m),h){case"dialog":Ft("cancel",l),Ft("close",l),x=m;break;case"iframe":case"object":case"embed":Ft("load",l),x=m;break;case"video":case"audio":for(x=0;x<sa.length;x++)Ft(sa[x],l);x=m;break;case"source":Ft("error",l),x=m;break;case"img":case"image":case"link":Ft("error",l),Ft("load",l),x=m;break;case"details":Ft("toggle",l),x=m;break;case"input":je(l,m),x=be(l,m),Ft("invalid",l);break;case"option":x=m;break;case"select":l._wrapperState={wasMultiple:!!m.multiple},x=F({},m,{value:void 0}),Ft("invalid",l);break;case"textarea":$e(l,m),x=Je(l,m),Ft("invalid",l);break;default:x=m}zt(h,x),L=x;for(k in L)if(L.hasOwnProperty(k)){var V=L[k];k==="style"?st(l,V):k==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,V!=null&&Le(l,V)):k==="children"?typeof V=="string"?(h!=="textarea"||V!=="")&&Ve(l,V):typeof V=="number"&&Ve(l,""+V):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(i.hasOwnProperty(k)?V!=null&&k==="onScroll"&&Ft("scroll",l):V!=null&&T(l,k,V,O))}switch(h){case"input":Re(l),Ie(l,m,!1);break;case"textarea":Re(l),Y(l);break;case"option":m.value!=null&&l.setAttribute("value",""+J(m.value));break;case"select":l.multiple=!!m.multiple,k=m.value,k!=null?He(l,!!m.multiple,k,!1):m.defaultValue!=null&&He(l,!!m.multiple,m.defaultValue,!0);break;default:typeof x.onClick=="function"&&(l.onclick=au)}switch(h){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Fn(c),null;case 6:if(l&&c.stateNode!=null)g1(l,c,l.memoizedProps,m);else{if(typeof m!="string"&&c.stateNode===null)throw Error(t(166));if(h=eo(ha.current),eo(hi.current),mu(c)){if(m=c.stateNode,h=c.memoizedProps,m[di]=c,(k=m.nodeValue!==h)&&(l=gr,l!==null))switch(l.tag){case 3:lu(m.nodeValue,h,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&lu(m.nodeValue,h,(l.mode&1)!==0)}k&&(c.flags|=4)}else m=(h.nodeType===9?h:h.ownerDocument).createTextNode(m),m[di]=c,c.stateNode=m}return Fn(c),null;case 13:if(jt(Yt),m=c.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(Wt&&yr!==null&&(c.mode&1)!==0&&(c.flags&128)===0)xx(),Yo(),c.flags|=98560,k=!1;else if(k=mu(c),m!==null&&m.dehydrated!==null){if(l===null){if(!k)throw Error(t(318));if(k=c.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(t(317));k[di]=c}else Yo(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Fn(c),k=!1}else Qr!==null&&(tm(Qr),Qr=null),k=!0;if(!k)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=h,c):(m=m!==null,m!==(l!==null&&l.memoizedState!==null)&&m&&(c.child.flags|=8192,(c.mode&1)!==0&&(l===null||(Yt.current&1)!==0?hn===0&&(hn=3):im())),c.updateQueue!==null&&(c.flags|=4),Fn(c),null);case 4:return Jo(),$p(l,c),l===null&&oa(c.stateNode.containerInfo),Fn(c),null;case 10:return vp(c.type._context),Fn(c),null;case 17:return er(c.type)&&uu(),Fn(c),null;case 19:if(jt(Yt),k=c.memoizedState,k===null)return Fn(c),null;if(m=(c.flags&128)!==0,O=k.rendering,O===null)if(m)va(k,!1);else{if(hn!==0||l!==null&&(l.flags&128)!==0)for(l=c.child;l!==null;){if(O=bu(l),O!==null){for(c.flags|=128,va(k,!1),m=O.updateQueue,m!==null&&(c.updateQueue=m,c.flags|=4),c.subtreeFlags=0,m=h,h=c.child;h!==null;)k=h,l=m,k.flags&=14680066,O=k.alternate,O===null?(k.childLanes=0,k.lanes=l,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=O.childLanes,k.lanes=O.lanes,k.child=O.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=O.memoizedProps,k.memoizedState=O.memoizedState,k.updateQueue=O.updateQueue,k.type=O.type,l=O.dependencies,k.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),h=h.sibling;return Nt(Yt,Yt.current&1|2),c.child}l=l.sibling}k.tail!==null&&tn()>nl&&(c.flags|=128,m=!0,va(k,!1),c.lanes=4194304)}else{if(!m)if(l=bu(O),l!==null){if(c.flags|=128,m=!0,h=l.updateQueue,h!==null&&(c.updateQueue=h,c.flags|=4),va(k,!0),k.tail===null&&k.tailMode==="hidden"&&!O.alternate&&!Wt)return Fn(c),null}else 2*tn()-k.renderingStartTime>nl&&h!==1073741824&&(c.flags|=128,m=!0,va(k,!1),c.lanes=4194304);k.isBackwards?(O.sibling=c.child,c.child=O):(h=k.last,h!==null?h.sibling=O:c.child=O,k.last=O)}return k.tail!==null?(c=k.tail,k.rendering=c,k.tail=c.sibling,k.renderingStartTime=tn(),c.sibling=null,h=Yt.current,Nt(Yt,m?h&1|2:h&1),c):(Fn(c),null);case 22:case 23:return rm(),m=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==m&&(c.flags|=8192),m&&(c.mode&1)!==0?(vr&1073741824)!==0&&(Fn(c),c.subtreeFlags&6&&(c.flags|=8192)):Fn(c),null;case 24:return null;case 25:return null}throw Error(t(156,c.tag))}function QO(l,c){switch(dp(c),c.tag){case 1:return er(c.type)&&uu(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Jo(),jt(Zn),jt(Ln),Ep(),l=c.flags,(l&65536)!==0&&(l&128)===0?(c.flags=l&-65537|128,c):null;case 5:return kp(c),null;case 13:if(jt(Yt),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(t(340));Yo()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return jt(Yt),null;case 4:return Jo(),null;case 10:return vp(c.type._context),null;case 22:case 23:return rm(),null;case 24:return null;default:return null}}var Au=!1,jn=!1,XO=typeof WeakSet=="function"?WeakSet:Set,De=null;function el(l,c){var h=l.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(m){Xt(l,c,m)}else h.current=null}function Up(l,c,h){try{h()}catch(m){Xt(l,c,m)}}var y1=!1;function JO(l,c){if(rp=Qc,l=Gv(),Gh(l)){if("selectionStart"in l)var h={start:l.selectionStart,end:l.selectionEnd};else e:{h=(h=l.ownerDocument)&&h.defaultView||window;var m=h.getSelection&&h.getSelection();if(m&&m.rangeCount!==0){h=m.anchorNode;var x=m.anchorOffset,k=m.focusNode;m=m.focusOffset;try{h.nodeType,k.nodeType}catch{h=null;break e}var O=0,L=-1,V=-1,re=0,he=0,me=l,fe=null;t:for(;;){for(var Pe;me!==h||x!==0&&me.nodeType!==3||(L=O+x),me!==k||m!==0&&me.nodeType!==3||(V=O+m),me.nodeType===3&&(O+=me.nodeValue.length),(Pe=me.firstChild)!==null;)fe=me,me=Pe;for(;;){if(me===l)break t;if(fe===h&&++re===x&&(L=O),fe===k&&++he===m&&(V=O),(Pe=me.nextSibling)!==null)break;me=fe,fe=me.parentNode}me=Pe}h=L===-1||V===-1?null:{start:L,end:V}}else h=null}h=h||{start:0,end:0}}else h=null;for(ip={focusedElem:l,selectionRange:h},Qc=!1,De=c;De!==null;)if(c=De,l=c.child,(c.subtreeFlags&1028)!==0&&l!==null)l.return=c,De=l;else for(;De!==null;){c=De;try{var Be=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Be!==null){var _e=Be.memoizedProps,nn=Be.memoizedState,ee=c.stateNode,K=ee.getSnapshotBeforeUpdate(c.elementType===c.type?_e:Xr(c.type,_e),nn);ee.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var te=c.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(xe){Xt(c,c.return,xe)}if(l=c.sibling,l!==null){l.return=c.return,De=l;break}De=c.return}return Be=y1,y1=!1,Be}function xa(l,c,h){var m=c.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var x=m=m.next;do{if((x.tag&l)===l){var k=x.destroy;x.destroy=void 0,k!==void 0&&Up(c,h,k)}x=x.next}while(x!==m)}}function Pu(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&l)===l){var m=h.create;h.destroy=m()}h=h.next}while(h!==c)}}function qp(l){var c=l.ref;if(c!==null){var h=l.stateNode;switch(l.tag){case 5:l=h;break;default:l=h}typeof c=="function"?c(l):c.current=l}}function v1(l){var c=l.alternate;c!==null&&(l.alternate=null,v1(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&(delete c[di],delete c[aa],delete c[ap],delete c[NO],delete c[LO])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function x1(l){return l.tag===5||l.tag===3||l.tag===4}function w1(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||x1(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Kp(l,c,h){var m=l.tag;if(m===5||m===6)l=l.stateNode,c?h.nodeType===8?h.parentNode.insertBefore(l,c):h.insertBefore(l,c):(h.nodeType===8?(c=h.parentNode,c.insertBefore(l,h)):(c=h,c.appendChild(l)),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=au));else if(m!==4&&(l=l.child,l!==null))for(Kp(l,c,h),l=l.sibling;l!==null;)Kp(l,c,h),l=l.sibling}function Yp(l,c,h){var m=l.tag;if(m===5||m===6)l=l.stateNode,c?h.insertBefore(l,c):h.appendChild(l);else if(m!==4&&(l=l.child,l!==null))for(Yp(l,c,h),l=l.sibling;l!==null;)Yp(l,c,h),l=l.sibling}var Rn=null,Jr=!1;function gs(l,c,h){for(h=h.child;h!==null;)b1(l,c,h),h=h.sibling}function b1(l,c,h){if(fi&&typeof fi.onCommitFiberUnmount=="function")try{fi.onCommitFiberUnmount($c,h)}catch{}switch(h.tag){case 5:jn||el(h,c);case 6:var m=Rn,x=Jr;Rn=null,gs(l,c,h),Rn=m,Jr=x,Rn!==null&&(Jr?(l=Rn,h=h.stateNode,l.nodeType===8?l.parentNode.removeChild(h):l.removeChild(h)):Rn.removeChild(h.stateNode));break;case 18:Rn!==null&&(Jr?(l=Rn,h=h.stateNode,l.nodeType===8?lp(l.parentNode,h):l.nodeType===1&&lp(l,h),Xl(l)):lp(Rn,h.stateNode));break;case 4:m=Rn,x=Jr,Rn=h.stateNode.containerInfo,Jr=!0,gs(l,c,h),Rn=m,Jr=x;break;case 0:case 11:case 14:case 15:if(!jn&&(m=h.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){x=m=m.next;do{var k=x,O=k.destroy;k=k.tag,O!==void 0&&((k&2)!==0||(k&4)!==0)&&Up(h,c,O),x=x.next}while(x!==m)}gs(l,c,h);break;case 1:if(!jn&&(el(h,c),m=h.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=h.memoizedProps,m.state=h.memoizedState,m.componentWillUnmount()}catch(L){Xt(h,c,L)}gs(l,c,h);break;case 21:gs(l,c,h);break;case 22:h.mode&1?(jn=(m=jn)||h.memoizedState!==null,gs(l,c,h),jn=m):gs(l,c,h);break;default:gs(l,c,h)}}function S1(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var h=l.stateNode;h===null&&(h=l.stateNode=new XO),c.forEach(function(m){var x=lM.bind(null,l,m);h.has(m)||(h.add(m),m.then(x,x))})}}function Zr(l,c){var h=c.deletions;if(h!==null)for(var m=0;m<h.length;m++){var x=h[m];try{var k=l,O=c,L=O;e:for(;L!==null;){switch(L.tag){case 5:Rn=L.stateNode,Jr=!1;break e;case 3:Rn=L.stateNode.containerInfo,Jr=!0;break e;case 4:Rn=L.stateNode.containerInfo,Jr=!0;break e}L=L.return}if(Rn===null)throw Error(t(160));b1(k,O,x),Rn=null,Jr=!1;var V=x.alternate;V!==null&&(V.return=null),x.return=null}catch(re){Xt(x,c,re)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)k1(c,l),c=c.sibling}function k1(l,c){var h=l.alternate,m=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(Zr(c,l),mi(l),m&4){try{xa(3,l,l.return),Pu(3,l)}catch(_e){Xt(l,l.return,_e)}try{xa(5,l,l.return)}catch(_e){Xt(l,l.return,_e)}}break;case 1:Zr(c,l),mi(l),m&512&&h!==null&&el(h,h.return);break;case 5:if(Zr(c,l),mi(l),m&512&&h!==null&&el(h,h.return),l.flags&32){var x=l.stateNode;try{Ve(x,"")}catch(_e){Xt(l,l.return,_e)}}if(m&4&&(x=l.stateNode,x!=null)){var k=l.memoizedProps,O=h!==null?h.memoizedProps:k,L=l.type,V=l.updateQueue;if(l.updateQueue=null,V!==null)try{L==="input"&&k.type==="radio"&&k.name!=null&&Ne(x,k),It(L,O);var re=It(L,k);for(O=0;O<V.length;O+=2){var he=V[O],me=V[O+1];he==="style"?st(x,me):he==="dangerouslySetInnerHTML"?Le(x,me):he==="children"?Ve(x,me):T(x,he,me,re)}switch(L){case"input":ke(x,k);break;case"textarea":we(x,k);break;case"select":var fe=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!k.multiple;var Pe=k.value;Pe!=null?He(x,!!k.multiple,Pe,!1):fe!==!!k.multiple&&(k.defaultValue!=null?He(x,!!k.multiple,k.defaultValue,!0):He(x,!!k.multiple,k.multiple?[]:"",!1))}x[aa]=k}catch(_e){Xt(l,l.return,_e)}}break;case 6:if(Zr(c,l),mi(l),m&4){if(l.stateNode===null)throw Error(t(162));x=l.stateNode,k=l.memoizedProps;try{x.nodeValue=k}catch(_e){Xt(l,l.return,_e)}}break;case 3:if(Zr(c,l),mi(l),m&4&&h!==null&&h.memoizedState.isDehydrated)try{Xl(c.containerInfo)}catch(_e){Xt(l,l.return,_e)}break;case 4:Zr(c,l),mi(l);break;case 13:Zr(c,l),mi(l),x=l.child,x.flags&8192&&(k=x.memoizedState!==null,x.stateNode.isHidden=k,!k||x.alternate!==null&&x.alternate.memoizedState!==null||(Xp=tn())),m&4&&S1(l);break;case 22:if(he=h!==null&&h.memoizedState!==null,l.mode&1?(jn=(re=jn)||he,Zr(c,l),jn=re):Zr(c,l),mi(l),m&8192){if(re=l.memoizedState!==null,(l.stateNode.isHidden=re)&&!he&&(l.mode&1)!==0)for(De=l,he=l.child;he!==null;){for(me=De=he;De!==null;){switch(fe=De,Pe=fe.child,fe.tag){case 0:case 11:case 14:case 15:xa(4,fe,fe.return);break;case 1:el(fe,fe.return);var Be=fe.stateNode;if(typeof Be.componentWillUnmount=="function"){m=fe,h=fe.return;try{c=m,Be.props=c.memoizedProps,Be.state=c.memoizedState,Be.componentWillUnmount()}catch(_e){Xt(m,h,_e)}}break;case 5:el(fe,fe.return);break;case 22:if(fe.memoizedState!==null){R1(me);continue}}Pe!==null?(Pe.return=fe,De=Pe):R1(me)}he=he.sibling}e:for(he=null,me=l;;){if(me.tag===5){if(he===null){he=me;try{x=me.stateNode,re?(k=x.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(L=me.stateNode,V=me.memoizedProps.style,O=V!=null&&V.hasOwnProperty("display")?V.display:null,L.style.display=ht("display",O))}catch(_e){Xt(l,l.return,_e)}}}else if(me.tag===6){if(he===null)try{me.stateNode.nodeValue=re?"":me.memoizedProps}catch(_e){Xt(l,l.return,_e)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===l)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===l)break e;for(;me.sibling===null;){if(me.return===null||me.return===l)break e;he===me&&(he=null),me=me.return}he===me&&(he=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Zr(c,l),mi(l),m&4&&S1(l);break;case 21:break;default:Zr(c,l),mi(l)}}function mi(l){var c=l.flags;if(c&2){try{e:{for(var h=l.return;h!==null;){if(x1(h)){var m=h;break e}h=h.return}throw Error(t(160))}switch(m.tag){case 5:var x=m.stateNode;m.flags&32&&(Ve(x,""),m.flags&=-33);var k=w1(l);Yp(l,k,x);break;case 3:case 4:var O=m.stateNode.containerInfo,L=w1(l);Kp(l,L,O);break;default:throw Error(t(161))}}catch(V){Xt(l,l.return,V)}l.flags&=-3}c&4096&&(l.flags&=-4097)}function ZO(l,c,h){De=l,C1(l)}function C1(l,c,h){for(var m=(l.mode&1)!==0;De!==null;){var x=De,k=x.child;if(x.tag===22&&m){var O=x.memoizedState!==null||Au;if(!O){var L=x.alternate,V=L!==null&&L.memoizedState!==null||jn;L=Au;var re=jn;if(Au=O,(jn=V)&&!re)for(De=x;De!==null;)O=De,V=O.child,O.tag===22&&O.memoizedState!==null?T1(x):V!==null?(V.return=O,De=V):T1(x);for(;k!==null;)De=k,C1(k),k=k.sibling;De=x,Au=L,jn=re}E1(l)}else(x.subtreeFlags&8772)!==0&&k!==null?(k.return=x,De=k):E1(l)}}function E1(l){for(;De!==null;){var c=De;if((c.flags&8772)!==0){var h=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:jn||Pu(5,c);break;case 1:var m=c.stateNode;if(c.flags&4&&!jn)if(h===null)m.componentDidMount();else{var x=c.elementType===c.type?h.memoizedProps:Xr(c.type,h.memoizedProps);m.componentDidUpdate(x,h.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var k=c.updateQueue;k!==null&&Rx(c,k,m);break;case 3:var O=c.updateQueue;if(O!==null){if(h=null,c.child!==null)switch(c.child.tag){case 5:h=c.child.stateNode;break;case 1:h=c.child.stateNode}Rx(c,O,h)}break;case 5:var L=c.stateNode;if(h===null&&c.flags&4){h=L;var V=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":V.autoFocus&&h.focus();break;case"img":V.src&&(h.src=V.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var re=c.alternate;if(re!==null){var he=re.memoizedState;if(he!==null){var me=he.dehydrated;me!==null&&Xl(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}jn||c.flags&512&&qp(c)}catch(fe){Xt(c,c.return,fe)}}if(c===l){De=null;break}if(h=c.sibling,h!==null){h.return=c.return,De=h;break}De=c.return}}function R1(l){for(;De!==null;){var c=De;if(c===l){De=null;break}var h=c.sibling;if(h!==null){h.return=c.return,De=h;break}De=c.return}}function T1(l){for(;De!==null;){var c=De;try{switch(c.tag){case 0:case 11:case 15:var h=c.return;try{Pu(4,c)}catch(V){Xt(c,h,V)}break;case 1:var m=c.stateNode;if(typeof m.componentDidMount=="function"){var x=c.return;try{m.componentDidMount()}catch(V){Xt(c,x,V)}}var k=c.return;try{qp(c)}catch(V){Xt(c,k,V)}break;case 5:var O=c.return;try{qp(c)}catch(V){Xt(c,O,V)}}}catch(V){Xt(c,c.return,V)}if(c===l){De=null;break}var L=c.sibling;if(L!==null){L.return=c.return,De=L;break}De=c.return}}var eM=Math.ceil,Iu=M.ReactCurrentDispatcher,Gp=M.ReactCurrentOwner,Dr=M.ReactCurrentBatchConfig,vt=0,xn=null,an=null,Tn=0,vr=0,tl=fs(0),hn=0,wa=null,no=0,Du=0,Qp=0,ba=null,nr=null,Xp=0,nl=1/0,Wi=null,Nu=!1,Jp=null,ys=null,Lu=!1,vs=null,Bu=0,Sa=0,Zp=null,Fu=-1,ju=0;function $n(){return(vt&6)!==0?tn():Fu!==-1?Fu:Fu=tn()}function xs(l){return(l.mode&1)===0?1:(vt&2)!==0&&Tn!==0?Tn&-Tn:FO.transition!==null?(ju===0&&(ju=wv()),ju):(l=Ct,l!==0||(l=window.event,l=l===void 0?16:Mv(l.type)),l)}function ei(l,c,h,m){if(50<Sa)throw Sa=0,Zp=null,Error(t(185));ql(l,h,m),((vt&2)===0||l!==xn)&&(l===xn&&((vt&2)===0&&(Du|=h),hn===4&&ws(l,Tn)),rr(l,m),h===1&&vt===0&&(c.mode&1)===0&&(nl=tn()+500,du&&hs()))}function rr(l,c){var h=l.callbackNode;FT(l,c);var m=Kc(l,l===xn?Tn:0);if(m===0)h!==null&&yv(h),l.callbackNode=null,l.callbackPriority=0;else if(c=m&-m,l.callbackPriority!==c){if(h!=null&&yv(h),c===1)l.tag===0?BO(M1.bind(null,l)):px(M1.bind(null,l)),IO(function(){(vt&6)===0&&hs()}),h=null;else{switch(bv(m)){case 1:h=Ih;break;case 4:h=vv;break;case 16:h=Hc;break;case 536870912:h=xv;break;default:h=Hc}h=F1(h,O1.bind(null,l))}l.callbackPriority=c,l.callbackNode=h}}function O1(l,c){if(Fu=-1,ju=0,(vt&6)!==0)throw Error(t(327));var h=l.callbackNode;if(rl()&&l.callbackNode!==h)return null;var m=Kc(l,l===xn?Tn:0);if(m===0)return null;if((m&30)!==0||(m&l.expiredLanes)!==0||c)c=_u(l,m);else{c=m;var x=vt;vt|=2;var k=P1();(xn!==l||Tn!==c)&&(Wi=null,nl=tn()+500,io(l,c));do try{rM();break}catch(L){A1(l,L)}while(!0);yp(),Iu.current=k,vt=x,an!==null?c=0:(xn=null,Tn=0,c=hn)}if(c!==0){if(c===2&&(x=Dh(l),x!==0&&(m=x,c=em(l,x))),c===1)throw h=wa,io(l,0),ws(l,m),rr(l,tn()),h;if(c===6)ws(l,m);else{if(x=l.current.alternate,(m&30)===0&&!tM(x)&&(c=_u(l,m),c===2&&(k=Dh(l),k!==0&&(m=k,c=em(l,k))),c===1))throw h=wa,io(l,0),ws(l,m),rr(l,tn()),h;switch(l.finishedWork=x,l.finishedLanes=m,c){case 0:case 1:throw Error(t(345));case 2:so(l,nr,Wi);break;case 3:if(ws(l,m),(m&130023424)===m&&(c=Xp+500-tn(),10<c)){if(Kc(l,0)!==0)break;if(x=l.suspendedLanes,(x&m)!==m){$n(),l.pingedLanes|=l.suspendedLanes&x;break}l.timeoutHandle=op(so.bind(null,l,nr,Wi),c);break}so(l,nr,Wi);break;case 4:if(ws(l,m),(m&4194240)===m)break;for(c=l.eventTimes,x=-1;0<m;){var O=31-Yr(m);k=1<<O,O=c[O],O>x&&(x=O),m&=~k}if(m=x,m=tn()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*eM(m/1960))-m,10<m){l.timeoutHandle=op(so.bind(null,l,nr,Wi),m);break}so(l,nr,Wi);break;case 5:so(l,nr,Wi);break;default:throw Error(t(329))}}}return rr(l,tn()),l.callbackNode===h?O1.bind(null,l):null}function em(l,c){var h=ba;return l.current.memoizedState.isDehydrated&&(io(l,c).flags|=256),l=_u(l,c),l!==2&&(c=nr,nr=h,c!==null&&tm(c)),l}function tm(l){nr===null?nr=l:nr.push.apply(nr,l)}function tM(l){for(var c=l;;){if(c.flags&16384){var h=c.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var m=0;m<h.length;m++){var x=h[m],k=x.getSnapshot;x=x.value;try{if(!Gr(k(),x))return!1}catch{return!1}}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function ws(l,c){for(c&=~Qp,c&=~Du,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var h=31-Yr(c),m=1<<h;l[h]=-1,c&=~m}}function M1(l){if((vt&6)!==0)throw Error(t(327));rl();var c=Kc(l,0);if((c&1)===0)return rr(l,tn()),null;var h=_u(l,c);if(l.tag!==0&&h===2){var m=Dh(l);m!==0&&(c=m,h=em(l,m))}if(h===1)throw h=wa,io(l,0),ws(l,c),rr(l,tn()),h;if(h===6)throw Error(t(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,so(l,nr,Wi),rr(l,tn()),null}function nm(l,c){var h=vt;vt|=1;try{return l(c)}finally{vt=h,vt===0&&(nl=tn()+500,du&&hs())}}function ro(l){vs!==null&&vs.tag===0&&(vt&6)===0&&rl();var c=vt;vt|=1;var h=Dr.transition,m=Ct;try{if(Dr.transition=null,Ct=1,l)return l()}finally{Ct=m,Dr.transition=h,vt=c,(vt&6)===0&&hs()}}function rm(){vr=tl.current,jt(tl)}function io(l,c){l.finishedWork=null,l.finishedLanes=0;var h=l.timeoutHandle;if(h!==-1&&(l.timeoutHandle=-1,PO(h)),an!==null)for(h=an.return;h!==null;){var m=h;switch(dp(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&uu();break;case 3:Jo(),jt(Zn),jt(Ln),Ep();break;case 5:kp(m);break;case 4:Jo();break;case 13:jt(Yt);break;case 19:jt(Yt);break;case 10:vp(m.type._context);break;case 22:case 23:rm()}h=h.return}if(xn=l,an=l=bs(l.current,null),Tn=vr=c,hn=0,wa=null,Qp=Du=no=0,nr=ba=null,Zs!==null){for(c=0;c<Zs.length;c++)if(h=Zs[c],m=h.interleaved,m!==null){h.interleaved=null;var x=m.next,k=h.pending;if(k!==null){var O=k.next;k.next=x,m.next=O}h.pending=m}Zs=null}return l}function A1(l,c){do{var h=an;try{if(yp(),Su.current=Ru,ku){for(var m=Gt.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}ku=!1}if(to=0,vn=dn=Gt=null,pa=!1,ma=0,Gp.current=null,h===null||h.return===null){hn=1,wa=c,an=null;break}e:{var k=l,O=h.return,L=h,V=c;if(c=Tn,L.flags|=32768,V!==null&&typeof V=="object"&&typeof V.then=="function"){var re=V,he=L,me=he.tag;if((he.mode&1)===0&&(me===0||me===11||me===15)){var fe=he.alternate;fe?(he.updateQueue=fe.updateQueue,he.memoizedState=fe.memoizedState,he.lanes=fe.lanes):(he.updateQueue=null,he.memoizedState=null)}var Pe=t1(O);if(Pe!==null){Pe.flags&=-257,n1(Pe,O,L,k,c),Pe.mode&1&&e1(k,re,c),c=Pe,V=re;var Be=c.updateQueue;if(Be===null){var _e=new Set;_e.add(V),c.updateQueue=_e}else Be.add(V);break e}else{if((c&1)===0){e1(k,re,c),im();break e}V=Error(t(426))}}else if(Wt&&L.mode&1){var nn=t1(O);if(nn!==null){(nn.flags&65536)===0&&(nn.flags|=256),n1(nn,O,L,k,c),mp(Zo(V,L));break e}}k=V=Zo(V,L),hn!==4&&(hn=2),ba===null?ba=[k]:ba.push(k),k=O;do{switch(k.tag){case 3:k.flags|=65536,c&=-c,k.lanes|=c;var ee=Jx(k,V,c);Ex(k,ee);break e;case 1:L=V;var K=k.type,te=k.stateNode;if((k.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(ys===null||!ys.has(te)))){k.flags|=65536,c&=-c,k.lanes|=c;var xe=Zx(k,L,c);Ex(k,xe);break e}}k=k.return}while(k!==null)}D1(h)}catch(ze){c=ze,an===h&&h!==null&&(an=h=h.return);continue}break}while(!0)}function P1(){var l=Iu.current;return Iu.current=Ru,l===null?Ru:l}function im(){(hn===0||hn===3||hn===2)&&(hn=4),xn===null||(no&268435455)===0&&(Du&268435455)===0||ws(xn,Tn)}function _u(l,c){var h=vt;vt|=2;var m=P1();(xn!==l||Tn!==c)&&(Wi=null,io(l,c));do try{nM();break}catch(x){A1(l,x)}while(!0);if(yp(),vt=h,Iu.current=m,an!==null)throw Error(t(261));return xn=null,Tn=0,hn}function nM(){for(;an!==null;)I1(an)}function rM(){for(;an!==null&&!OT();)I1(an)}function I1(l){var c=B1(l.alternate,l,vr);l.memoizedProps=l.pendingProps,c===null?D1(l):an=c,Gp.current=null}function D1(l){var c=l;do{var h=c.alternate;if(l=c.return,(c.flags&32768)===0){if(h=GO(h,c,vr),h!==null){an=h;return}}else{if(h=QO(h,c),h!==null){h.flags&=32767,an=h;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{hn=6,an=null;return}}if(c=c.sibling,c!==null){an=c;return}an=c=l}while(c!==null);hn===0&&(hn=5)}function so(l,c,h){var m=Ct,x=Dr.transition;try{Dr.transition=null,Ct=1,iM(l,c,h,m)}finally{Dr.transition=x,Ct=m}return null}function iM(l,c,h,m){do rl();while(vs!==null);if((vt&6)!==0)throw Error(t(327));h=l.finishedWork;var x=l.finishedLanes;if(h===null)return null;if(l.finishedWork=null,l.finishedLanes=0,h===l.current)throw Error(t(177));l.callbackNode=null,l.callbackPriority=0;var k=h.lanes|h.childLanes;if(jT(l,k),l===xn&&(an=xn=null,Tn=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||Lu||(Lu=!0,F1(Hc,function(){return rl(),null})),k=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||k){k=Dr.transition,Dr.transition=null;var O=Ct;Ct=1;var L=vt;vt|=4,Gp.current=null,JO(l,h),k1(h,l),CO(ip),Qc=!!rp,ip=rp=null,l.current=h,ZO(h),MT(),vt=L,Ct=O,Dr.transition=k}else l.current=h;if(Lu&&(Lu=!1,vs=l,Bu=x),k=l.pendingLanes,k===0&&(ys=null),IT(h.stateNode),rr(l,tn()),c!==null)for(m=l.onRecoverableError,h=0;h<c.length;h++)x=c[h],m(x.value,{componentStack:x.stack,digest:x.digest});if(Nu)throw Nu=!1,l=Jp,Jp=null,l;return(Bu&1)!==0&&l.tag!==0&&rl(),k=l.pendingLanes,(k&1)!==0?l===Zp?Sa++:(Sa=0,Zp=l):Sa=0,hs(),null}function rl(){if(vs!==null){var l=bv(Bu),c=Dr.transition,h=Ct;try{if(Dr.transition=null,Ct=16>l?16:l,vs===null)var m=!1;else{if(l=vs,vs=null,Bu=0,(vt&6)!==0)throw Error(t(331));var x=vt;for(vt|=4,De=l.current;De!==null;){var k=De,O=k.child;if((De.flags&16)!==0){var L=k.deletions;if(L!==null){for(var V=0;V<L.length;V++){var re=L[V];for(De=re;De!==null;){var he=De;switch(he.tag){case 0:case 11:case 15:xa(8,he,k)}var me=he.child;if(me!==null)me.return=he,De=me;else for(;De!==null;){he=De;var fe=he.sibling,Pe=he.return;if(v1(he),he===re){De=null;break}if(fe!==null){fe.return=Pe,De=fe;break}De=Pe}}}var Be=k.alternate;if(Be!==null){var _e=Be.child;if(_e!==null){Be.child=null;do{var nn=_e.sibling;_e.sibling=null,_e=nn}while(_e!==null)}}De=k}}if((k.subtreeFlags&2064)!==0&&O!==null)O.return=k,De=O;else e:for(;De!==null;){if(k=De,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:xa(9,k,k.return)}var ee=k.sibling;if(ee!==null){ee.return=k.return,De=ee;break e}De=k.return}}var K=l.current;for(De=K;De!==null;){O=De;var te=O.child;if((O.subtreeFlags&2064)!==0&&te!==null)te.return=O,De=te;else e:for(O=K;De!==null;){if(L=De,(L.flags&2048)!==0)try{switch(L.tag){case 0:case 11:case 15:Pu(9,L)}}catch(ze){Xt(L,L.return,ze)}if(L===O){De=null;break e}var xe=L.sibling;if(xe!==null){xe.return=L.return,De=xe;break e}De=L.return}}if(vt=x,hs(),fi&&typeof fi.onPostCommitFiberRoot=="function")try{fi.onPostCommitFiberRoot($c,l)}catch{}m=!0}return m}finally{Ct=h,Dr.transition=c}}return!1}function N1(l,c,h){c=Zo(h,c),c=Jx(l,c,1),l=ms(l,c,1),c=$n(),l!==null&&(ql(l,1,c),rr(l,c))}function Xt(l,c,h){if(l.tag===3)N1(l,l,h);else for(;c!==null;){if(c.tag===3){N1(c,l,h);break}else if(c.tag===1){var m=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(ys===null||!ys.has(m))){l=Zo(h,l),l=Zx(c,l,1),c=ms(c,l,1),l=$n(),c!==null&&(ql(c,1,l),rr(c,l));break}}c=c.return}}function sM(l,c,h){var m=l.pingCache;m!==null&&m.delete(c),c=$n(),l.pingedLanes|=l.suspendedLanes&h,xn===l&&(Tn&h)===h&&(hn===4||hn===3&&(Tn&130023424)===Tn&&500>tn()-Xp?io(l,0):Qp|=h),rr(l,c)}function L1(l,c){c===0&&((l.mode&1)===0?c=1:(c=qc,qc<<=1,(qc&130023424)===0&&(qc=4194304)));var h=$n();l=_i(l,c),l!==null&&(ql(l,c,h),rr(l,h))}function oM(l){var c=l.memoizedState,h=0;c!==null&&(h=c.retryLane),L1(l,h)}function lM(l,c){var h=0;switch(l.tag){case 13:var m=l.stateNode,x=l.memoizedState;x!==null&&(h=x.retryLane);break;case 19:m=l.stateNode;break;default:throw Error(t(314))}m!==null&&m.delete(c),L1(l,h)}var B1;B1=function(l,c,h){if(l!==null)if(l.memoizedProps!==c.pendingProps||Zn.current)tr=!0;else{if((l.lanes&h)===0&&(c.flags&128)===0)return tr=!1,YO(l,c,h);tr=(l.flags&131072)!==0}else tr=!1,Wt&&(c.flags&1048576)!==0&&mx(c,pu,c.index);switch(c.lanes=0,c.tag){case 2:var m=c.type;Mu(l,c),l=c.pendingProps;var x=Uo(c,Ln.current);Xo(c,h),x=Op(null,c,m,l,x,h);var k=Mp();return c.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,er(m)?(k=!0,fu(c)):k=!1,c.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,bp(c),x.updater=Tu,c.stateNode=x,x._reactInternals=c,Lp(c,m,l,h),c=_p(null,c,m,!0,k,h)):(c.tag=0,Wt&&k&&fp(c),Hn(null,c,x,h),c=c.child),c;case 16:m=c.elementType;e:{switch(Mu(l,c),l=c.pendingProps,x=m._init,m=x(m._payload),c.type=m,x=c.tag=cM(m),l=Xr(m,l),x){case 0:c=jp(null,c,m,l,h);break e;case 1:c=a1(null,c,m,l,h);break e;case 11:c=r1(null,c,m,l,h);break e;case 14:c=i1(null,c,m,Xr(m.type,l),h);break e}throw Error(t(306,m,""))}return c;case 0:return m=c.type,x=c.pendingProps,x=c.elementType===m?x:Xr(m,x),jp(l,c,m,x,h);case 1:return m=c.type,x=c.pendingProps,x=c.elementType===m?x:Xr(m,x),a1(l,c,m,x,h);case 3:e:{if(c1(c),l===null)throw Error(t(387));m=c.pendingProps,k=c.memoizedState,x=k.element,Cx(l,c),wu(c,m,null,h);var O=c.memoizedState;if(m=O.element,k.isDehydrated)if(k={element:m,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},c.updateQueue.baseState=k,c.memoizedState=k,c.flags&256){x=Zo(Error(t(423)),c),c=u1(l,c,m,h,x);break e}else if(m!==x){x=Zo(Error(t(424)),c),c=u1(l,c,m,h,x);break e}else for(yr=us(c.stateNode.containerInfo.firstChild),gr=c,Wt=!0,Qr=null,h=Sx(c,null,m,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Yo(),m===x){c=Vi(l,c,h);break e}Hn(l,c,m,h)}c=c.child}return c;case 5:return Tx(c),l===null&&pp(c),m=c.type,x=c.pendingProps,k=l!==null?l.memoizedProps:null,O=x.children,sp(m,x)?O=null:k!==null&&sp(m,k)&&(c.flags|=32),l1(l,c),Hn(l,c,O,h),c.child;case 6:return l===null&&pp(c),null;case 13:return f1(l,c,h);case 4:return Sp(c,c.stateNode.containerInfo),m=c.pendingProps,l===null?c.child=Go(c,null,m,h):Hn(l,c,m,h),c.child;case 11:return m=c.type,x=c.pendingProps,x=c.elementType===m?x:Xr(m,x),r1(l,c,m,x,h);case 7:return Hn(l,c,c.pendingProps,h),c.child;case 8:return Hn(l,c,c.pendingProps.children,h),c.child;case 12:return Hn(l,c,c.pendingProps.children,h),c.child;case 10:e:{if(m=c.type._context,x=c.pendingProps,k=c.memoizedProps,O=x.value,Nt(yu,m._currentValue),m._currentValue=O,k!==null)if(Gr(k.value,O)){if(k.children===x.children&&!Zn.current){c=Vi(l,c,h);break e}}else for(k=c.child,k!==null&&(k.return=c);k!==null;){var L=k.dependencies;if(L!==null){O=k.child;for(var V=L.firstContext;V!==null;){if(V.context===m){if(k.tag===1){V=zi(-1,h&-h),V.tag=2;var re=k.updateQueue;if(re!==null){re=re.shared;var he=re.pending;he===null?V.next=V:(V.next=he.next,he.next=V),re.pending=V}}k.lanes|=h,V=k.alternate,V!==null&&(V.lanes|=h),xp(k.return,h,c),L.lanes|=h;break}V=V.next}}else if(k.tag===10)O=k.type===c.type?null:k.child;else if(k.tag===18){if(O=k.return,O===null)throw Error(t(341));O.lanes|=h,L=O.alternate,L!==null&&(L.lanes|=h),xp(O,h,c),O=k.sibling}else O=k.child;if(O!==null)O.return=k;else for(O=k;O!==null;){if(O===c){O=null;break}if(k=O.sibling,k!==null){k.return=O.return,O=k;break}O=O.return}k=O}Hn(l,c,x.children,h),c=c.child}return c;case 9:return x=c.type,m=c.pendingProps.children,Xo(c,h),x=Pr(x),m=m(x),c.flags|=1,Hn(l,c,m,h),c.child;case 14:return m=c.type,x=Xr(m,c.pendingProps),x=Xr(m.type,x),i1(l,c,m,x,h);case 15:return s1(l,c,c.type,c.pendingProps,h);case 17:return m=c.type,x=c.pendingProps,x=c.elementType===m?x:Xr(m,x),Mu(l,c),c.tag=1,er(m)?(l=!0,fu(c)):l=!1,Xo(c,h),Qx(c,m,x),Lp(c,m,x,h),_p(null,c,m,!0,l,h);case 19:return h1(l,c,h);case 22:return o1(l,c,h)}throw Error(t(156,c.tag))};function F1(l,c){return gv(l,c)}function aM(l,c,h,m){this.tag=l,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(l,c,h,m){return new aM(l,c,h,m)}function sm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function cM(l){if(typeof l=="function")return sm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===j)return 11;if(l===_)return 14}return 2}function bs(l,c){var h=l.alternate;return h===null?(h=Nr(l.tag,c,l.key,l.mode),h.elementType=l.elementType,h.type=l.type,h.stateNode=l.stateNode,h.alternate=l,l.alternate=h):(h.pendingProps=c,h.type=l.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=l.flags&14680064,h.childLanes=l.childLanes,h.lanes=l.lanes,h.child=l.child,h.memoizedProps=l.memoizedProps,h.memoizedState=l.memoizedState,h.updateQueue=l.updateQueue,c=l.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=l.sibling,h.index=l.index,h.ref=l.ref,h}function zu(l,c,h,m,x,k){var O=2;if(m=l,typeof l=="function")sm(l)&&(O=1);else if(typeof l=="string")O=5;else e:switch(l){case P:return oo(h.children,x,k,c);case z:O=8,x|=8;break;case H:return l=Nr(12,h,c,x|2),l.elementType=H,l.lanes=k,l;case B:return l=Nr(13,h,c,x),l.elementType=B,l.lanes=k,l;case X:return l=Nr(19,h,c,x),l.elementType=X,l.lanes=k,l;case G:return Vu(h,x,k,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case $:O=10;break e;case Z:O=9;break e;case j:O=11;break e;case _:O=14;break e;case ne:O=16,m=null;break e}throw Error(t(130,l==null?l:typeof l,""))}return c=Nr(O,h,c,x),c.elementType=l,c.type=m,c.lanes=k,c}function oo(l,c,h,m){return l=Nr(7,l,m,c),l.lanes=h,l}function Vu(l,c,h,m){return l=Nr(22,l,m,c),l.elementType=G,l.lanes=h,l.stateNode={isHidden:!1},l}function om(l,c,h){return l=Nr(6,l,null,c),l.lanes=h,l}function lm(l,c,h){return c=Nr(4,l.children!==null?l.children:[],l.key,c),c.lanes=h,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function uM(l,c,h,m,x){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nh(0),this.expirationTimes=Nh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nh(0),this.identifierPrefix=m,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function am(l,c,h,m,x,k,O,L,V){return l=new uM(l,c,h,L,V),c===1?(c=1,k===!0&&(c|=8)):c=0,k=Nr(3,null,null,c),l.current=k,k.stateNode=l,k.memoizedState={element:m,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},bp(k),l}function fM(l,c,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:D,key:m==null?null:""+m,children:l,containerInfo:c,implementation:h}}function j1(l){if(!l)return ds;l=l._reactInternals;e:{if(Or(l)!==l||l.tag!==1)throw Error(t(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(er(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(t(171))}if(l.tag===1){var h=l.type;if(er(h))return dx(l,h,c)}return c}function _1(l,c,h,m,x,k,O,L,V){return l=am(h,m,!0,l,x,k,O,L,V),l.context=j1(null),h=l.current,m=$n(),x=xs(h),k=zi(m,x),k.callback=c??null,ms(h,k,x),l.current.lanes=x,ql(l,x,m),rr(l,m),l}function Wu(l,c,h,m){var x=c.current,k=$n(),O=xs(x);return h=j1(h),c.context===null?c.context=h:c.pendingContext=h,c=zi(k,O),c.payload={element:l},m=m===void 0?null:m,m!==null&&(c.callback=m),l=ms(x,c,O),l!==null&&(ei(l,x,O,k),xu(l,x,O)),O}function Hu(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return l.child.stateNode;default:return l.child.stateNode}}function z1(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var h=l.retryLane;l.retryLane=h!==0&&h<c?h:c}}function cm(l,c){z1(l,c),(l=l.alternate)&&z1(l,c)}function dM(){return null}var V1=typeof reportError=="function"?reportError:function(l){console.error(l)};function um(l){this._internalRoot=l}$u.prototype.render=um.prototype.render=function(l){var c=this._internalRoot;if(c===null)throw Error(t(409));Wu(l,c,null,null)},$u.prototype.unmount=um.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var c=l.containerInfo;ro(function(){Wu(null,l,null,null)}),c[Li]=null}};function $u(l){this._internalRoot=l}$u.prototype.unstable_scheduleHydration=function(l){if(l){var c=Cv();l={blockedOn:null,target:l,priority:c};for(var h=0;h<ls.length&&c!==0&&c<ls[h].priority;h++);ls.splice(h,0,l),h===0&&Tv(l)}};function fm(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Uu(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function W1(){}function hM(l,c,h,m,x){if(x){if(typeof m=="function"){var k=m;m=function(){var re=Hu(O);k.call(re)}}var O=_1(c,m,l,0,null,!1,!1,"",W1);return l._reactRootContainer=O,l[Li]=O.current,oa(l.nodeType===8?l.parentNode:l),ro(),O}for(;x=l.lastChild;)l.removeChild(x);if(typeof m=="function"){var L=m;m=function(){var re=Hu(V);L.call(re)}}var V=am(l,0,!1,null,null,!1,!1,"",W1);return l._reactRootContainer=V,l[Li]=V.current,oa(l.nodeType===8?l.parentNode:l),ro(function(){Wu(c,V,h,m)}),V}function qu(l,c,h,m,x){var k=h._reactRootContainer;if(k){var O=k;if(typeof x=="function"){var L=x;x=function(){var V=Hu(O);L.call(V)}}Wu(c,O,l,x)}else O=hM(h,c,l,x,m);return Hu(O)}Sv=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var h=Ul(c.pendingLanes);h!==0&&(Lh(c,h|1),rr(c,tn()),(vt&6)===0&&(nl=tn()+500,hs()))}break;case 13:ro(function(){var m=_i(l,1);if(m!==null){var x=$n();ei(m,l,1,x)}}),cm(l,1)}},Bh=function(l){if(l.tag===13){var c=_i(l,134217728);if(c!==null){var h=$n();ei(c,l,134217728,h)}cm(l,134217728)}},kv=function(l){if(l.tag===13){var c=xs(l),h=_i(l,c);if(h!==null){var m=$n();ei(h,l,c,m)}cm(l,c)}},Cv=function(){return Ct},Ev=function(l,c){var h=Ct;try{return Ct=l,c()}finally{Ct=h}},St=function(l,c,h){switch(c){case"input":if(ke(l,h),c=h.name,h.type==="radio"&&c!=null){for(h=l;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<h.length;c++){var m=h[c];if(m!==l&&m.form===l.form){var x=cu(m);if(!x)throw Error(t(90));ce(m),ke(m,x)}}}break;case"textarea":we(l,h);break;case"select":c=h.value,c!=null&&He(l,!!h.multiple,c,!1)}},Dt=nm,In=ro;var pM={usingClientEntryPoint:!1,Events:[ca,Ho,cu,wt,Kt,nm]},ka={findFiberByHostInstance:Gs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},mM={bundleType:ka.bundleType,version:ka.version,rendererPackageName:ka.rendererPackageName,rendererConfig:ka.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=pv(l),l===null?null:l.stateNode},findFiberByHostInstance:ka.findFiberByHostInstance||dM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ku.isDisabled&&Ku.supportsFiber)try{$c=Ku.inject(mM),fi=Ku}catch{}}return ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=pM,ir.createPortal=function(l,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!fm(c))throw Error(t(200));return fM(l,c,null,h)},ir.createRoot=function(l,c){if(!fm(l))throw Error(t(299));var h=!1,m="",x=V1;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onRecoverableError!==void 0&&(x=c.onRecoverableError)),c=am(l,1,!1,null,null,h,!1,m,x),l[Li]=c.current,oa(l.nodeType===8?l.parentNode:l),new um(c)},ir.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(t(188)):(l=Object.keys(l).join(","),Error(t(268,l)));return l=pv(c),l=l===null?null:l.stateNode,l},ir.flushSync=function(l){return ro(l)},ir.hydrate=function(l,c,h){if(!Uu(c))throw Error(t(200));return qu(null,l,c,!0,h)},ir.hydrateRoot=function(l,c,h){if(!fm(l))throw Error(t(405));var m=h!=null&&h.hydratedSources||null,x=!1,k="",O=V1;if(h!=null&&(h.unstable_strictMode===!0&&(x=!0),h.identifierPrefix!==void 0&&(k=h.identifierPrefix),h.onRecoverableError!==void 0&&(O=h.onRecoverableError)),c=_1(c,null,l,1,h??null,x,!1,k,O),l[Li]=c.current,oa(l),m)for(l=0;l<m.length;l++)h=m[l],x=h._getVersion,x=x(h._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[h,x]:c.mutableSourceEagerHydrationData.push(h,x);return new $u(c)},ir.render=function(l,c,h){if(!Uu(c))throw Error(t(200));return qu(null,l,c,!1,h)},ir.unmountComponentAtNode=function(l){if(!Uu(l))throw Error(t(40));return l._reactRootContainer?(ro(function(){qu(null,null,l,!1,function(){l._reactRootContainer=null,l[Li]=null})}),!0):!1},ir.unstable_batchedUpdates=nm,ir.unstable_renderSubtreeIntoContainer=function(l,c,h,m){if(!Uu(h))throw Error(t(200));if(l==null||l._reactInternals===void 0)throw Error(t(38));return qu(l,c,h,!1,m)},ir.version="18.3.1-next-f1338f8080-20240426",ir}var Q1;function gS(){if(Q1)return pm.exports;Q1=1;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)}}return n(),pm.exports=OM(),pm.exports}var X1;function MM(){if(X1)return Yu;X1=1;var n=gS();return Yu.createRoot=n.createRoot,Yu.hydrateRoot=n.hydrateRoot,Yu}var AM=MM();/**
41
+ * react-router v7.15.1
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */var J1="popstate";function Z1(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function PM(n={}){function e(r,i){var f;let s=(f=i.state)==null?void 0:f.masked,{pathname:o,search:a,hash:u}=s||r.location;return Sg("",{pathname:o,search:a,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function t(r,i){return typeof i=="string"?i:rc(i)}return DM(e,t,null,n)}function Ut(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Vr(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function IM(){return Math.random().toString(36).substring(2,10)}function ew(n,e){return{usr:n.state,key:n.key,idx:e,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Sg(n,e,t=null,r,i){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Ll(e):e,state:t,key:e&&e.key||r||IM(),mask:i}}function rc({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function Ll(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substring(r),n=n.substring(0,r)),n&&(e.pathname=n)}return e}function DM(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",u=null,f=d();f==null&&(f=0,o.replaceState({...o.state,idx:f},""));function d(){return(o.state||{idx:null}).idx}function p(){a="POP";let S=d(),C=S==null?null:S-f;f=S,u&&u({action:a,location:w.location,delta:C})}function g(S,C){a="PUSH";let R=Z1(S)?S:Sg(w.location,S,C);f=d()+1;let T=ew(R,f),M=w.createHref(R.mask||R);try{o.pushState(T,"",M)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(M)}s&&u&&u({action:a,location:w.location,delta:1})}function y(S,C){a="REPLACE";let R=Z1(S)?S:Sg(w.location,S,C);f=d();let T=ew(R,f),M=w.createHref(R.mask||R);o.replaceState(T,"",M),s&&u&&u({action:a,location:w.location,delta:0})}function v(S){return NM(S)}let w={get action(){return a},get location(){return n(i,o)},listen(S){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(J1,p),u=S,()=>{i.removeEventListener(J1,p),u=null}},createHref(S){return e(i,S)},createURL:v,encodeLocation(S){let C=v(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:g,replace:y,go(S){return o.go(S)}};return w}function NM(n,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),Ut(t,"No window.location.(origin|href) available to create URL");let r=typeof n=="string"?n:rc(n);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=t+r),new URL(r,t)}function yS(n,e,t="/"){return LM(n,e,t,!1)}function LM(n,e,t,r,i){let s=typeof e=="string"?Ll(e):e,o=Qi(s.pathname||"/",t);if(o==null)return null;let a=BM(n),u=null,f=YM(o);for(let d=0;u==null&&d<a.length;++d)u=qM(a[d],f,r);return u}function BM(n){let e=vS(n);return FM(e),e}function vS(n,e=[],t=[],r="",i=!1){let s=(o,a,u=i,f)=>{let d={relativePath:f===void 0?o.path||"":f,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&u)return;Ut(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let p=si([r,d.relativePath]),g=t.concat(d);o.children&&o.children.length>0&&(Ut(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),vS(o.children,e,g,p,u)),!(o.path==null&&!o.index)&&e.push({path:p,score:$M(p,o.index),routesMeta:g})};return n.forEach((o,a)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))s(o,a);else for(let f of xS(o.path))s(o,a,!0,f)}),e}function xS(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,i=t.endsWith("?"),s=t.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=xS(r.join("/")),a=[];return a.push(...o.map(u=>u===""?s:[s,u].join("/"))),i&&a.push(...o),a.map(u=>n.startsWith("/")&&u===""?"/":u)}function FM(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:UM(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var jM=/^:[\w-]+$/,_M=3,zM=2,VM=1,WM=10,HM=-2,tw=n=>n==="*";function $M(n,e){let t=n.split("/"),r=t.length;return t.some(tw)&&(r+=HM),e&&(r+=zM),t.filter(i=>!tw(i)).reduce((i,s)=>i+(jM.test(s)?_M:s===""?VM:WM),r)}function UM(n,e){return n.length===e.length&&n.slice(0,-1).every((r,i)=>r===e[i])?n[n.length-1]-e[e.length-1]:0}function qM(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",o=[];for(let a=0;a<r.length;++a){let u=r[a],f=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",p=Qf({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},d),g=u.route;if(!p&&f&&t&&!r[r.length-1].route.index&&(p=Qf({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:si([s,p.pathname]),pathnameBase:JM(si([s,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(s=si([s,p.pathnameBase]))}return o}function Qf(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=KM(n.path,n.caseSensitive,n.end),i=e.match(t);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((f,{paramName:d,isOptional:p},g)=>{if(d==="*"){let v=a[g]||"";o=s.slice(0,s.length-v.length).replace(/(.)\/+$/,"$1")}const y=a[g];return p&&!y?f[d]=void 0:f[d]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:o,pattern:n}}function KM(n,e=!1,t=!0){Vr(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,u,f,d)=>{if(r.push({paramName:a,isOptional:u!=null}),u){let p=d.charAt(f+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),i+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":n!==""&&n!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function YM(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vr(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function Qi(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}var GM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function QM(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?Ll(n):n,s;return t?(t=wS(t),t.startsWith("/")?s=nw(t.substring(1),"/"):s=nw(t,e)):s=e,{pathname:s,search:ZM(r),hash:e4(i)}}function nw(n,e){let t=Xf(e).split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function ym(n,e,t,r){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function XM(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function L0(n){let e=XM(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function Ud(n,e,t,r=!1){let i;typeof n=="string"?i=Ll(n):(i={...n},Ut(!i.pathname||!i.pathname.includes("?"),ym("?","pathname","search",i)),Ut(!i.pathname||!i.pathname.includes("#"),ym("#","pathname","hash",i)),Ut(!i.search||!i.search.includes("#"),ym("#","search","hash",i)));let s=n===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=t;else{let p=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),p-=1;i.pathname=g.join("/")}a=p>=0?e[p]:"/"}let u=QM(i,a),f=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&t.endsWith("/");return!u.pathname.endsWith("/")&&(f||d)&&(u.pathname+="/"),u}var wS=n=>n.replace(/\/\/+/g,"/"),si=n=>wS(n.join("/")),Xf=n=>n.replace(/\/+$/,""),JM=n=>Xf(n).replace(/^\/*/,"/"),ZM=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,e4=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,t4=class{constructor(n,e,t,r=!1){this.status=n,this.statusText=e||"",this.internal=r,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function n4(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function r4(n){let e=n.map(t=>t.route.path).filter(Boolean);return si(e)||"/"}var bS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function SS(n,e){let t=n;if(typeof t!="string"||!GM.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let r=t,i=!1;if(bS)try{let s=new URL(window.location.href),o=t.startsWith("//")?new URL(s.protocol+t):new URL(t),a=Qi(o.pathname,e);o.origin===s.origin&&a!=null?t=a+o.search+o.hash:i=!0}catch{Vr(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var kS=["POST","PUT","PATCH","DELETE"];new Set(kS);var i4=["GET",...kS];new Set(i4);var Bl=b.createContext(null);Bl.displayName="DataRouter";var qd=b.createContext(null);qd.displayName="DataRouterState";var CS=b.createContext(!1);function s4(){return b.useContext(CS)}var ES=b.createContext({isTransitioning:!1});ES.displayName="ViewTransition";var o4=b.createContext(new Map);o4.displayName="Fetchers";var l4=b.createContext(null);l4.displayName="Await";var Rr=b.createContext(null);Rr.displayName="Navigation";var Mc=b.createContext(null);Mc.displayName="Location";var Wr=b.createContext({outlet:null,matches:[],isDataRoute:!1});Wr.displayName="Route";var B0=b.createContext(null);B0.displayName="RouteError";var RS="REACT_ROUTER_ERROR",a4="REDIRECT",c4="ROUTE_ERROR_RESPONSE";function u4(n){if(n.startsWith(`${RS}:${a4}:{`))try{let e=JSON.parse(n.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function f4(n){if(n.startsWith(`${RS}:${c4}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new t4(e.status,e.statusText,e.data)}catch{}}function d4(n,{relative:e}={}){Ut(Fl(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=b.useContext(Rr),{hash:i,pathname:s,search:o}=Ac(n,{relative:e}),a=s;return t!=="/"&&(a=s==="/"?t:si([t,s])),r.createHref({pathname:a,search:o,hash:i})}function Fl(){return b.useContext(Mc)!=null}function Tr(){return Ut(Fl(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Mc).location}var TS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function OS(n){b.useContext(Rr).static||b.useLayoutEffect(n)}function Kd(){let{isDataRoute:n}=b.useContext(Wr);return n?T4():h4()}function h4(){Ut(Fl(),"useNavigate() may be used only in the context of a <Router> component.");let n=b.useContext(Bl),{basename:e,navigator:t}=b.useContext(Rr),{matches:r}=b.useContext(Wr),{pathname:i}=Tr(),s=JSON.stringify(L0(r)),o=b.useRef(!1);return OS(()=>{o.current=!0}),b.useCallback((u,f={})=>{if(Vr(o.current,TS),!o.current)return;if(typeof u=="number"){t.go(u);return}let d=Ud(u,JSON.parse(s),i,f.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:si([e,d.pathname])),(f.replace?t.replace:t.push)(d,f.state,f)},[e,t,s,i,n])}var p4=b.createContext(null);function m4(n){let e=b.useContext(Wr).outlet;return b.useMemo(()=>e&&b.createElement(p4.Provider,{value:n},e),[e,n])}function Yd(){let{matches:n}=b.useContext(Wr),e=n[n.length-1];return(e==null?void 0:e.params)??{}}function Ac(n,{relative:e}={}){let{matches:t}=b.useContext(Wr),{pathname:r}=Tr(),i=JSON.stringify(L0(t));return b.useMemo(()=>Ud(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function g4(n,e){return MS(n,e)}function MS(n,e,t){var S;Ut(Fl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(Rr),{matches:i}=b.useContext(Wr),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",u=s?s.pathnameBase:"/",f=s&&s.route;{let C=f&&f.path||"";PS(a,!f||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
+
51
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let d=Tr(),p;if(e){let C=typeof e=="string"?Ll(e):e;Ut(u==="/"||((S=C.pathname)==null?void 0:S.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${C.pathname}" was given in the \`location\` prop.`),p=C}else p=d;let g=p.pathname||"/",y=g;if(u!=="/"){let C=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let v=t&&t.state.matches.length?t.state.matches.map(C=>Object.assign(C,{route:t.manifest[C.route.id]||C.route})):yS(n,{pathname:y});Vr(f||v!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Vr(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=b4(v&&v.map(C=>Object.assign({},C,{params:Object.assign({},o,C.params),pathname:si([u,r.encodeLocation?r.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?u:si([u,r.encodeLocation?r.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,t);return e&&w?b.createElement(Mc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...p},navigationType:"POP"}},w):w}function y4(){let n=R4(),e=n4(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",n),o=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:s},"ErrorBoundary")," or"," ",b.createElement("code",{style:s},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),t?b.createElement("pre",{style:i},t):null,o)}var v4=b.createElement(y4,null),AS=class extends b.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=f4(n.digest);t&&(n=t)}let e=n!==void 0?b.createElement(Wr.Provider,{value:this.props.routeContext},b.createElement(B0.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?b.createElement(x4,{error:n},e):e}};AS.contextType=CS;var vm=new WeakMap;function x4({children:n,error:e}){let{basename:t}=b.useContext(Rr);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=u4(e.digest);if(r){let i=vm.get(e);if(i)throw i;let s=SS(r.location,t);if(bS&&!vm.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw vm.set(e,o),o}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return n}function w4({routeContext:n,match:e,children:t}){let r=b.useContext(Bl);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),b.createElement(Wr.Provider,{value:n},t)}function b4(n,e=[],t){let r=t==null?void 0:t.state;if(n==null){if(!r)return null;if(r.errors)n=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)n=r.matches;else return null}let i=n,s=r==null?void 0:r.errors;if(s!=null){let d=i.findIndex(p=>p.route.id&&(s==null?void 0:s[p.route.id])!==void 0);Ut(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let o=!1,a=-1;if(t&&r){o=r.renderFallback;for(let d=0;d<i.length;d++){let p=i[d];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(a=d),p.route.id){let{loaderData:g,errors:y}=r,v=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||v){t.isStatic&&(o=!0),a>=0?i=i.slice(0,a+1):i=[i[0]];break}}}}let u=t==null?void 0:t.onError,f=r&&u?(d,p)=>{var g,y;u(d,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},pattern:r4(r.matches),errorInfo:p})}:void 0;return i.reduceRight((d,p,g)=>{let y,v=!1,w=null,S=null;r&&(y=s&&p.route.id?s[p.route.id]:void 0,w=p.route.errorElement||v4,o&&(a<0&&g===0?(PS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,S=null):a===g&&(v=!0,S=p.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,g+1)),R=()=>{let T;return y?T=w:v?T=S:p.route.Component?T=b.createElement(p.route.Component,null):p.route.element?T=p.route.element:T=d,b.createElement(w4,{match:p,routeContext:{outlet:d,matches:C,isDataRoute:r!=null},children:T})};return r&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?b.createElement(AS,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:R(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:f}):R()},null)}function F0(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function S4(n){let e=b.useContext(Bl);return Ut(e,F0(n)),e}function k4(n){let e=b.useContext(qd);return Ut(e,F0(n)),e}function C4(n){let e=b.useContext(Wr);return Ut(e,F0(n)),e}function j0(n){let e=C4(n),t=e.matches[e.matches.length-1];return Ut(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function E4(){return j0("useRouteId")}function R4(){var r;let n=b.useContext(B0),e=k4("useRouteError"),t=j0("useRouteError");return n!==void 0?n:(r=e.errors)==null?void 0:r[t]}function T4(){let{router:n}=S4("useNavigate"),e=j0("useNavigate"),t=b.useRef(!1);return OS(()=>{t.current=!0}),b.useCallback(async(i,s={})=>{Vr(t.current,TS),t.current&&(typeof i=="number"?await n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var rw={};function PS(n,e,t){!e&&!rw[n]&&(rw[n]=!0,Vr(!1,t))}b.memo(O4);function O4({routes:n,manifest:e,future:t,state:r,isStatic:i,onError:s}){return MS(n,void 0,{manifest:e,state:r,isStatic:i,onError:s})}function Ua({to:n,replace:e,state:t,relative:r}){Ut(Fl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=b.useContext(Rr);Vr(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=b.useContext(Wr),{pathname:o}=Tr(),a=Kd(),u=Ud(n,L0(s),o,r==="path"),f=JSON.stringify(u);return b.useEffect(()=>{a(JSON.parse(f),{replace:e,state:t,relative:r})},[a,f,r,e,t]),null}function M4(n){return m4(n.context)}function fo(n){Ut(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function A4({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1,useTransitions:o}){Ut(!Fl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=n.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:a,navigator:i,static:s,useTransitions:o,future:{}}),[a,i,s,o]);typeof t=="string"&&(t=Ll(t));let{pathname:f="/",search:d="",hash:p="",state:g=null,key:y="default",mask:v}=t,w=b.useMemo(()=>{let S=Qi(f,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:g,key:y,mask:v},navigationType:r}},[a,f,d,p,g,y,r,v]);return Vr(w!=null,`<Router basename="${a}"> is not able to match the URL "${f}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:b.createElement(Rr.Provider,{value:u},b.createElement(Mc.Provider,{children:e,value:w}))}function P4({children:n,location:e}){return g4(kg(n),e)}function kg(n,e=[]){let t=[];return b.Children.forEach(n,(r,i)=>{if(!b.isValidElement(r))return;let s=[...e,i];if(r.type===b.Fragment){t.push.apply(t,kg(r.props.children,s));return}Ut(r.type===fo,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ut(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=kg(r.props.children,s)),t.push(o)}),t}var Lf="get",Bf="application/x-www-form-urlencoded";function Gd(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function I4(n){return Gd(n)&&n.tagName.toLowerCase()==="button"}function D4(n){return Gd(n)&&n.tagName.toLowerCase()==="form"}function N4(n){return Gd(n)&&n.tagName.toLowerCase()==="input"}function L4(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function B4(n,e){return n.button===0&&(!e||e==="_self")&&!L4(n)}function Cg(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let r=n[t];return e.concat(Array.isArray(r)?r.map(i=>[t,i]):[[t,r]])},[]))}function F4(n,e){let t=Cg(n);return e&&e.forEach((r,i)=>{t.has(i)||e.getAll(i).forEach(s=>{t.append(i,s)})}),t}var Gu=null;function j4(){if(Gu===null)try{new FormData(document.createElement("form"),0),Gu=!1}catch{Gu=!0}return Gu}var _4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xm(n){return n!=null&&!_4.has(n)?(Vr(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bf}"`),null):n}function z4(n,e){let t,r,i,s,o;if(D4(n)){let a=n.getAttribute("action");r=a?Qi(a,e):null,t=n.getAttribute("method")||Lf,i=xm(n.getAttribute("enctype"))||Bf,s=new FormData(n)}else if(I4(n)||N4(n)&&(n.type==="submit"||n.type==="image")){let a=n.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=n.getAttribute("formaction")||a.getAttribute("action");if(r=u?Qi(u,e):null,t=n.getAttribute("formmethod")||a.getAttribute("method")||Lf,i=xm(n.getAttribute("formenctype"))||xm(a.getAttribute("enctype"))||Bf,s=new FormData(a,n),!j4()){let{name:f,type:d,value:p}=n;if(d==="image"){let g=f?`${f}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else f&&s.append(f,p)}}else{if(Gd(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Lf,r=null,i=Bf,o=n}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function _0(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function IS(n,e,t,r){let i=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return t?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&Qi(i.pathname,e)==="/"?i.pathname=`${Xf(e)}/_root.${r}`:i.pathname=`${Xf(i.pathname)}.${r}`,i}async function V4(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function W4(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function H4(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await V4(s,t);return o.links?o.links():[]}return[]}));return K4(r.flat(1).filter(W4).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function iw(n,e,t,r,i,s){let o=(u,f)=>t[f]?u.route.id!==t[f].route.id:!0,a=(u,f)=>{var d;return t[f].pathname!==u.pathname||((d=t[f].route.path)==null?void 0:d.endsWith("*"))&&t[f].params["*"]!==u.params["*"]};return s==="assets"?e.filter((u,f)=>o(u,f)||a(u,f)):s==="data"?e.filter((u,f)=>{var p;let d=r.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(o(u,f)||a(u,f))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((p=t[0])==null?void 0:p.params)||{},nextUrl:new URL(n,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function $4(n,e,{includeHydrateFallback:t}={}){return U4(n.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),t&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function U4(n){return[...new Set(n)]}function q4(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function K4(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(q4(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function z0(){let n=b.useContext(Bl);return _0(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Y4(){let n=b.useContext(qd);return _0(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var V0=b.createContext(void 0);V0.displayName="FrameworkContext";function W0(){let n=b.useContext(V0);return _0(n,"You must render this element inside a <HydratedRouter> element"),n}function G4(n,e){let t=b.useContext(V0),[r,i]=b.useState(!1),[s,o]=b.useState(!1),{onFocus:a,onBlur:u,onMouseEnter:f,onMouseLeave:d,onTouchStart:p}=e,g=b.useRef(null);b.useEffect(()=>{if(n==="render"&&o(!0),n==="viewport"){let w=C=>{C.forEach(R=>{o(R.isIntersecting)})},S=new IntersectionObserver(w,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[n]),b.useEffect(()=>{if(r){let w=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{i(!0)},v=()=>{i(!1),o(!1)};return t?n!=="intent"?[s,g,{}]:[s,g,{onFocus:Ea(a,y),onBlur:Ea(u,v),onMouseEnter:Ea(f,y),onMouseLeave:Ea(d,v),onTouchStart:Ea(p,y)}]:[!1,g,{}]}function Ea(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function Q4({page:n,...e}){let t=s4(),{router:r}=z0(),i=b.useMemo(()=>yS(r.routes,n,r.basename),[r.routes,n,r.basename]);return i?t?b.createElement(J4,{page:n,matches:i,...e}):b.createElement(Z4,{page:n,matches:i,...e}):null}function X4(n){let{manifest:e,routeModules:t}=W0(),[r,i]=b.useState([]);return b.useEffect(()=>{let s=!1;return H4(n,e,t).then(o=>{s||i(o)}),()=>{s=!0}},[n,e,t]),r}function J4({page:n,matches:e,...t}){let r=Tr(),{future:i}=W0(),{basename:s}=z0(),o=b.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let a=IS(n,s,i.unstable_trailingSlashAwareDataRequests,"rsc"),u=!1,f=[];for(let d of e)typeof d.route.shouldRevalidate=="function"?u=!0:f.push(d.route.id);return u&&f.length>0&&a.searchParams.set("_routes",f.join(",")),[a.pathname+a.search]},[s,i.unstable_trailingSlashAwareDataRequests,n,r,e]);return b.createElement(b.Fragment,null,o.map(a=>b.createElement("link",{key:a,rel:"prefetch",as:"fetch",href:a,...t})))}function Z4({page:n,matches:e,...t}){let r=Tr(),{future:i,manifest:s,routeModules:o}=W0(),{basename:a}=z0(),{loaderData:u,matches:f}=Y4(),d=b.useMemo(()=>iw(n,e,f,s,r,"data"),[n,e,f,s,r]),p=b.useMemo(()=>iw(n,e,f,s,r,"assets"),[n,e,f,s,r]),g=b.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let w=new Set,S=!1;if(e.forEach(R=>{var M;let T=s.routes[R.route.id];!T||!T.hasLoader||(!d.some(A=>A.route.id===R.route.id)&&R.route.id in u&&((M=o[R.route.id])!=null&&M.shouldRevalidate)||T.hasClientLoader?S=!0:w.add(R.route.id))}),w.size===0)return[];let C=IS(n,a,i.unstable_trailingSlashAwareDataRequests,"data");return S&&w.size>0&&C.searchParams.set("_routes",e.filter(R=>w.has(R.route.id)).map(R=>R.route.id).join(",")),[C.pathname+C.search]},[a,i.unstable_trailingSlashAwareDataRequests,u,r,s,d,e,n,o]),y=b.useMemo(()=>$4(p,s),[p,s]),v=X4(p);return b.createElement(b.Fragment,null,g.map(w=>b.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...t})),y.map(w=>b.createElement("link",{key:w,rel:"modulepreload",href:w,...t})),v.map(({key:w,link:S})=>b.createElement("link",{key:w,nonce:t.nonce,...S,crossOrigin:S.crossOrigin??t.crossOrigin})))}function eA(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var tA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{tA&&(window.__reactRouterVersion="7.15.1")}catch{}function nA({basename:n,children:e,useTransitions:t,window:r}){let i=b.useRef();i.current==null&&(i.current=PM({window:r,v5Compat:!0}));let s=i.current,[o,a]=b.useState({action:s.action,location:s.location}),u=b.useCallback(f=>{t===!1?a(f):b.startTransition(()=>a(f))},[t]);return b.useLayoutEffect(()=>s.listen(u),[s,u]),b.createElement(A4,{basename:n,children:e,location:o.location,navigationType:o.action,navigator:s,useTransitions:t})}var DS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xi=b.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,mask:a,state:u,target:f,to:d,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:y,...v},w){let{basename:S,navigator:C,useTransitions:R}=b.useContext(Rr),T=typeof d=="string"&&DS.test(d),M=SS(d,S);d=M.to;let A=d4(d,{relative:i}),D=Tr(),P=null;if(a){let _=Ud(a,[],D.mask?D.mask.pathname:"/",!0);S!=="/"&&(_.pathname=_.pathname==="/"?S:si([S,_.pathname])),P=C.createHref(_)}let[z,H,$]=G4(r,v),Z=oA(d,{replace:o,mask:a,state:u,target:f,preventScrollReset:p,relative:i,viewTransition:g,defaultShouldRevalidate:y,useTransitions:R});function j(_){e&&e(_),_.defaultPrevented||Z(_)}let B=!(M.isExternal||s),X=b.createElement("a",{...v,...$,href:(B?P:void 0)||M.absoluteURL||A,onClick:B?j:e,ref:eA(w,H),target:f,"data-discover":!T&&t==="render"?"true":void 0});return z&&!T?b.createElement(b.Fragment,null,X,b.createElement(Q4,{page:A})):X});Xi.displayName="Link";var rA=b.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:u,...f},d){let p=Ac(o,{relative:f.relative}),g=Tr(),y=b.useContext(qd),{navigator:v,basename:w}=b.useContext(Rr),S=y!=null&&dA(p)&&a===!0,C=v.encodeLocation?v.encodeLocation(p).pathname:p.pathname,R=g.pathname,T=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;t||(R=R.toLowerCase(),T=T?T.toLowerCase():null,C=C.toLowerCase()),T&&w&&(T=Qi(T,w)||T);const M=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let A=R===C||!i&&R.startsWith(C)&&R.charAt(M)==="/",D=T!=null&&(T===C||!i&&T.startsWith(C)&&T.charAt(C.length)==="/"),P={isActive:A,isPending:D,isTransitioning:S},z=A?e:void 0,H;typeof r=="function"?H=r(P):H=[r,A?"active":null,D?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let $=typeof s=="function"?s(P):s;return b.createElement(Xi,{...f,"aria-current":z,className:H,ref:d,style:$,to:o,viewTransition:a},typeof u=="function"?u(P):u)});rA.displayName="NavLink";var iA=b.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:o=Lf,action:a,onSubmit:u,relative:f,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:g,...y},v)=>{let{useTransitions:w}=b.useContext(Rr),S=uA(),C=fA(a,{relative:f}),R=o.toLowerCase()==="get"?"get":"post",T=typeof a=="string"&&DS.test(a),M=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let D=A.nativeEvent.submitter,P=(D==null?void 0:D.getAttribute("formmethod"))||o,z=()=>S(D||A.currentTarget,{fetcherKey:e,method:P,navigate:t,replace:i,state:s,relative:f,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:g});w&&t!==!1?b.startTransition(()=>z()):z()};return b.createElement("form",{ref:v,method:R,action:C,onSubmit:r?u:M,...y,"data-discover":!T&&n==="render"?"true":void 0})});iA.displayName="Form";function sA(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function NS(n){let e=b.useContext(Bl);return Ut(e,sA(n)),e}function oA(n,{target:e,replace:t,mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,defaultShouldRevalidate:u,useTransitions:f}={}){let d=Kd(),p=Tr(),g=Ac(n,{relative:o});return b.useCallback(y=>{if(B4(y,e)){y.preventDefault();let v=t!==void 0?t:rc(p)===rc(g),w=()=>d(n,{replace:v,mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,defaultShouldRevalidate:u});f?b.startTransition(()=>w()):w()}},[p,d,g,t,r,i,e,n,s,o,a,u,f])}function lA(n){Vr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=b.useRef(Cg(n)),t=b.useRef(!1),r=Tr(),i=b.useMemo(()=>F4(r.search,t.current?null:e.current),[r.search]),s=Kd(),o=b.useCallback((a,u)=>{const f=Cg(typeof a=="function"?a(new URLSearchParams(i)):a);t.current=!0,s("?"+f,u)},[s,i]);return[i,o]}var aA=0,cA=()=>`__${String(++aA)}__`;function uA(){let{router:n}=NS("useSubmit"),{basename:e}=b.useContext(Rr),t=E4(),r=n.fetch,i=n.navigate;return b.useCallback(async(s,o={})=>{let{action:a,method:u,encType:f,formData:d,body:p}=z4(s,e);if(o.navigate===!1){let g=o.fetcherKey||cA();await r(g,t,o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||u,formEncType:o.encType||f,flushSync:o.flushSync})}else await i(o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:p,formMethod:o.method||u,formEncType:o.encType||f,replace:o.replace,state:o.state,fromRouteId:t,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,t])}function fA(n,{relative:e}={}){let{basename:t}=b.useContext(Rr),r=b.useContext(Wr);Ut(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Ac(n||".",{relative:e})},o=Tr();if(n==null){s.search=o.search;let a=new URLSearchParams(s.search),u=a.getAll("index");if(u.some(d=>d==="")){a.delete("index"),u.filter(p=>p).forEach(p=>a.append("index",p));let d=a.toString();s.search=d?`?${d}`:""}}return(!n||n===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(s.pathname=s.pathname==="/"?t:si([t,s.pathname])),rc(s)}function dA(n,{relative:e}={}){let t=b.useContext(ES);Ut(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=NS("useViewTransitionState"),i=Ac(n,{relative:e});if(!t.isTransitioning)return!1;let s=Qi(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=Qi(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Qf(i.pathname,o)!=null||Qf(i.pathname,s)!=null}var Ai=gS();const sw={};function Xn(n,e){const t=b.useRef(sw);return t.current===sw&&(t.current=n(e)),t}const Eg=[];let Rg;function hA(){return Rg}function pA(n){Eg.push(n)}function LS(n){const e=(t,r)=>{const i=Xn(gA).current;let s;try{Rg=i;for(const o of Eg)o.before(i);s=n(t,r);for(const o of Eg)o.after(i);i.didInitialize=!0}finally{Rg=void 0}return s};return e.displayName=n.displayName||n.name,e}function mA(n){return b.forwardRef(LS(n))}function gA(){return{didInitialize:!1}}function BS(n){const e=b.useRef(!0);e.current&&(e.current=!1,n())}const yA=()=>{},Se=typeof document<"u"?b.useLayoutEffect:yA;function vA(n,e){return function(r,...i){const s=new URL(n);return s.searchParams.set("code",r.toString()),i.forEach(o=>s.searchParams.append("args[]",o)),`${e} error #${r}; visit ${s} for the full message.`}}const Pn=vA("https://base-ui.com/production-error","Base UI"),FS=b.createContext(void 0);function Pc(n){const e=b.useContext(FS);if(e===void 0&&!n)throw new Error(Pn(72));return e}const xA=[];function Qd(n){b.useEffect(n,xA)}const Ra=0;class Er{constructor(){pt(this,"currentId",Ra);pt(this,"clear",()=>{this.currentId!==Ra&&(clearTimeout(this.currentId),this.currentId=Ra)});pt(this,"disposeEffect",()=>this.clear)}static create(){return new Er}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ra,t()},e)}isStarted(){return this.currentId!==Ra}}function Gn(){const n=Xn(Er.create).current;return Qd(n.disposeEffect),n}const jl=typeof navigator<"u",wm=bA(),jS=kA(),_S=SA(),H0=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),zS=wm.platform==="MacIntel"&&wm.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(wm.platform),VS=jl&&/apple/i.test(navigator.vendor),Tg=jl&&/android/i.test(jS)||/android/i.test(_S),wA=jl&&jS.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,WS=_S.includes("jsdom/");function bA(){if(!jl)return{platform:"",maxTouchPoints:-1};const n=navigator.userAgentData;return n!=null&&n.platform?{platform:n.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function SA(){if(!jl)return"";const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}function kA(){if(!jl)return"";const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform??""}function Sr(n){n.preventDefault(),n.stopPropagation()}function CA(n){return"nativeEvent"in n}function $0(n){return n.pointerType===""&&n.isTrusted?!0:Tg&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function HS(n){return WS?!1:!Tg&&n.width===0&&n.height===0||Tg&&n.width===1&&n.height===1&&n.pressure===0&&n.detail===0&&n.pointerType==="mouse"||n.width<1&&n.height<1&&n.pressure===0&&n.detail===0&&n.pointerType==="touch"}function Ro(n,e){const t=["mouse","pen"];return e||t.push("",void 0),t.includes(n)}function EA(n){const e=n.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}function Xd(){return typeof window<"u"}function zn(n){return U0(n)?(n.nodeName||"").toLowerCase():"#document"}function Et(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Pi(n){var e;return(e=(U0(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function U0(n){return Xd()?n instanceof Node||n instanceof Et(n).Node:!1}function ut(n){return Xd()?n instanceof Element||n instanceof Et(n).Element:!1}function Bt(n){return Xd()?n instanceof HTMLElement||n instanceof Et(n).HTMLElement:!1}function Cl(n){return!Xd()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Et(n).ShadowRoot}function $s(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Jn(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&i!=="inline"&&i!=="contents"}function RA(n){return/^(table|td|th)$/.test(zn(n))}function Jd(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const TA=/transform|translate|scale|rotate|perspective|filter/,OA=/paint|layout|strict|content/,lo=n=>!!n&&n!=="none";let bm;function q0(n){const e=ut(n)?Jn(n):n;return lo(e.transform)||lo(e.translate)||lo(e.scale)||lo(e.rotate)||lo(e.perspective)||!Zd()&&(lo(e.backdropFilter)||lo(e.filter))||TA.test(e.willChange||"")||OA.test(e.contain||"")}function MA(n){let e=Ji(n);for(;Bt(e)&&!Yi(e);){if(q0(e))return e;if(Jd(e))return null;e=Ji(e)}return null}function Zd(){return bm==null&&(bm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),bm}function Yi(n){return/^(html|body|#document)$/.test(zn(n))}function Jn(n){return Et(n).getComputedStyle(n)}function eh(n){return ut(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ji(n){if(zn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Cl(n)&&n.host||Pi(n);return Cl(e)?e.host:e}function $S(n){const e=Ji(n);return Yi(e)?n.ownerDocument?n.ownerDocument.body:n.body:Bt(e)&&$s(e)?e:$S(e)}function ic(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=$S(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Et(i);if(s){const a=Og(o);return e.concat(o,o.visualViewport||[],$s(i)?i:[],a&&t?ic(a):[])}else return e.concat(i,ic(i,[],t))}function Og(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const Mg="data-base-ui-focusable",US="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Is="ArrowLeft",Ds="ArrowRight",K0="ArrowUp",Ic="ArrowDown";function cn(n){var t;let e=n.activeElement;for(;((t=e==null?void 0:e.shadowRoot)==null?void 0:t.activeElement)!=null;)e=e.shadowRoot.activeElement;return e}function We(n,e){var r;if(!n||!e)return!1;const t=(r=e.getRootNode)==null?void 0:r.call(e);if(n.contains(e))return!0;if(t&&Cl(t)){let i=e;for(;i;){if(n===i)return!0;i=i.parentNode||i.host}}return!1}function on(n){return"composedPath"in n?n.composedPath()[0]:n.target}function Jf(n,e){if(!ut(n))return!1;const t=n;if(e.hasElement(t))return!t.hasAttribute("data-trigger-disabled");for(const[,r]of e.entries())if(We(r,t))return!r.hasAttribute("data-trigger-disabled");return!1}function Sm(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function AA(n){return n.matches("html,body")}function th(n){return Bt(n)&&n.matches(US)}function PA(n){return(n==null?void 0:n.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${US}`))!=null}function Ag(n){return n?n.getAttribute("role")==="combobox"&&th(n):!1}function Zf(n){if(!n||WS)return!0;try{return n.matches(":focus-visible")}catch{return!0}}function ed(n){return n?n.hasAttribute(Mg)?n:n.querySelector(`[${Mg}]`)||n:null}function IA(n,e){return e!=null&&!Ro(e)?0:typeof n=="function"?n():n}function td(n,e,t){const r=IA(n,t);return typeof r=="number"?r:r==null?void 0:r[e]}function ow(n){return typeof n=="function"?n():n}function qS(n,e){return e||n==="click"||n==="mousedown"}function DA(n){return(n==null?void 0:n.includes("mouse"))&&n!=="mousedown"}function Ht(){}const lw=Object.freeze([]),un=Object.freeze({}),Do="none",sc="trigger-press",qn="trigger-hover",Ff="trigger-focus",Y0="outside-press",km="item-press",nh="focus-out",G0="escape-key",aw="list-navigation",NA="cancel-open",LA="disabled",BA="imperative-action",FA="window-resize";function gt(n,e,t,r){let i=!1,s=!1;const o=un;return{reason:n,event:e??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:t,...o}}const KS=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Er,currentIdRef:{current:null},currentContextRef:{current:null}});function jA(n){const{children:e,delay:t,timeoutMs:r=0}=n,i=b.useRef(t),s=b.useRef(t),o=b.useRef(null),a=b.useRef(null),u=Gn();return E.jsx(KS.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:s,currentIdRef:o,timeoutMs:r,currentContextRef:a,timeout:u}),[r,u]),children:e})}function _A(n,e={open:!1}){const{open:t}=e,r="rootStore"in n?n.rootStore:n,i=r.useState("floatingId"),s=b.useContext(KS),{currentIdRef:o,delayRef:a,timeoutMs:u,initialDelayRef:f,currentContextRef:d,hasProvider:p,timeout:g}=s,[y,v]=b.useState(!1);return Se(()=>{function w(){var S;v(!1),(S=d.current)==null||S.setIsInstantPhase(!1),o.current=null,d.current=null,a.current=f.current}if(o.current&&!t&&o.current===i){if(v(!1),u){const S=i;return g.start(u,()=>{r.select("open")||o.current&&o.current!==S||w()}),()=>{g.clear()}}w()}},[t,i,o,a,u,f,d,g,r]),Se(()=>{if(!t)return;const w=d.current,S=o.current;g.clear(),d.current={onOpenChange:r.setOpen,setIsInstantPhase:v},o.current=i,a.current={open:0,close:td(f.current,"close")},S!==null&&S!==i?(v(!0),w==null||w.setIsInstantPhase(!0),w==null||w.onOpenChange(!1,gt(Do))):(v(!1),w==null||w.setIsInstantPhase(!1))},[t,i,r,o,a,f,d,g]),Se(()=>()=>{d.current=null},[d]),b.useMemo(()=>({hasProvider:p,delayRef:a,isInstantPhase:y}),[p,a,y])}function rt(n,e,t,r){return n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}}function oi(...n){return()=>{for(let e=0;e<n.length;e+=1){const t=n[e];t&&t()}}}function To(n,e,t,r){const i=Xn(YS).current;return VA(i,n,e,t,r)&&GS(i,[n,e,t,r]),i.callback}function zA(n){const e=Xn(YS).current;return WA(e,n)&&GS(e,n),e.callback}function YS(){return{callback:null,cleanup:null,refs:[]}}function VA(n,e,t,r,i){return n.refs[0]!==e||n.refs[1]!==t||n.refs[2]!==r||n.refs[3]!==i}function WA(n,e){return n.refs.length!==e.length||n.refs.some((t,r)=>t!==e[r])}function GS(n,e){if(n.refs=e,e.every(t=>t==null)){n.callback=null;return}n.callback=t=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),t!=null){const r=Array(e.length).fill(null);for(let i=0;i<e.length;i+=1){const s=e[i];if(s!=null)switch(typeof s){case"function":{const o=s(t);typeof o=="function"&&(r[i]=o);break}case"object":{s.current=t;break}}}n.cleanup=()=>{for(let i=0;i<e.length;i+=1){const s=e[i];if(s!=null)switch(typeof s){case"function":{const o=r[i];typeof o=="function"?o():s(null);break}case"object":{s.current=null;break}}}}}}}function sn(n){const e=Xn(HA,n).current;return e.next=n,Se(e.effect),e}function HA(n){const e={current:n,next:n,effect:()=>{e.current=e.next}};return e}const Q0={...EM},Cm=Q0.useInsertionEffect,$A=Cm&&Cm!==Q0.useLayoutEffect?Cm:n=>n();function Fe(n){const e=Xn(UA).current;return e.next=n,$A(e.effect),e.trampoline}function UA(){const n={next:void 0,callback:qA,trampoline:(...e)=>{var t;return(t=n.callback)==null?void 0:t.call(n,...e)},effect:()=>{n.callback=n.next}};return n}function qA(){}const Qu=null;class KA{constructor(){pt(this,"callbacks",[]);pt(this,"callbacksCount",0);pt(this,"nextId",1);pt(this,"startId",1);pt(this,"isScheduled",!1);pt(this,"tick",e=>{var i;this.isScheduled=!1;const t=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<t.length;s+=1)(i=t[s])==null||i.call(t,e)})}request(e){const t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const Xu=new KA;class bi{constructor(){pt(this,"currentId",Qu);pt(this,"cancel",()=>{this.currentId!==Qu&&(Xu.cancel(this.currentId),this.currentId=Qu)});pt(this,"disposeEffect",()=>this.cancel)}static create(){return new bi}static request(e){return Xu.request(e)}static cancel(e){return Xu.cancel(e)}request(e){this.cancel(),this.currentId=Xu.request(()=>{this.currentId=Qu,e()})}}function Ls(){const n=Xn(bi.create).current;return Qd(n.disposeEffect),n}function ot(n){return(n==null?void 0:n.ownerDocument)||document}const QS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},rh={...QS,position:"fixed",top:0,left:0},XS={...QS,position:"absolute"},So=b.forwardRef(function(e,t){const[r,i]=b.useState();Se(()=>{VS&&i("button")},[]);const s={tabIndex:0,role:r};return E.jsx("span",{...e,ref:t,style:rh,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})}),YA=["top","right","bottom","left"],El=Math.min,kr=Math.max,Rl=Math.round,yo=Math.floor,Oi=n=>({x:n,y:n}),GA={left:"right",right:"left",bottom:"top",top:"bottom"};function Pg(n,e,t){return kr(n,El(e,t))}function Zi(n,e){return typeof n=="function"?n(e):n}function ur(n){return n.split("-")[0]}function Us(n){return n.split("-")[1]}function X0(n){return n==="x"?"y":"x"}function J0(n){return n==="y"?"height":"width"}function Br(n){const e=n[0];return e==="t"||e==="b"?"y":"x"}function Z0(n){return X0(Br(n))}function QA(n,e,t){t===void 0&&(t=!1);const r=Us(n),i=Z0(n),s=J0(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=nd(o)),[o,nd(o)]}function XA(n){const e=nd(n);return[Ig(n),e,Ig(e)]}function Ig(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const cw=["left","right"],uw=["right","left"],JA=["top","bottom"],ZA=["bottom","top"];function eP(n,e,t){switch(n){case"top":case"bottom":return t?e?uw:cw:e?cw:uw;case"left":case"right":return e?JA:ZA;default:return[]}}function tP(n,e,t,r){const i=Us(n);let s=eP(ur(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Ig)))),s}function nd(n){const e=ur(n);return GA[e]+n.slice(e.length)}function nP(n){return{top:0,right:0,bottom:0,left:0,...n}}function JS(n){return typeof n!="number"?nP(n):{top:n,right:n,bottom:n,left:n}}function oc(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Ju(n,e,t){return Math.floor(n/e)!==t}function rd(n,e){return e<0||e>=n.length}function Em(n,e){return Un(n.current,{disabledIndices:e})}function fw(n,e){return Un(n.current,{decrement:!0,startingIndex:n.current.length,disabledIndices:e})}function Un(n,{startingIndex:e=-1,decrement:t=!1,disabledIndices:r,amount:i=1}={}){let s=e;do s+=t?-i:i;while(s>=0&&s<=n.length-1&&pl(n,s,r));return s}function rP(n,{event:e,orientation:t,loopFocus:r,onLoop:i,rtl:s,cols:o,disabledIndices:a,minIndex:u,maxIndex:f,prevIndex:d,stopEvent:p=!1}){let g=d,y;if(e.key===K0?y="up":e.key===Ic&&(y="down"),y){const v=[],w=[];let S=!1,C=0;{let H=null,$=-1;n.forEach((Z,j)=>{if(Z==null)return;C+=1;const B=Z.closest('[role="row"]');B&&(S=!0),(B!==H||$===-1)&&(H=B,$+=1,v[$]=[]),v[$].push(j),w[j]=$})}let R=!1,T=0;if(S)for(const H of v){const $=H.length;$>T&&(T=$),$!==o&&(R=!0)}const M=R&&C<n.length,A=T||o,D=H=>{if(!R||d===-1)return;const $=w[d];if($==null)return;const Z=v[$].indexOf(d),j=H==="up"?-1:1;for(let B=$+j,X=0;X<v.length;X+=1,B+=j){if(B<0||B>=v.length){if(!r||M)return;if(B=B<0?v.length-1:0,i){const ne=Math.min(Z,v[B].length-1),G=v[B][ne]??v[B][0],N=i(e,d,G);B=w[N]??B}}const _=v[B];for(let ne=Math.min(Z,_.length-1);ne>=0;ne-=1){const G=_[ne];if(!pl(n,G,a))return G}}},P=H=>{if(!M||d===-1)return;const $=d%A,Z=H==="up"?-A:A,j=f-f%A,B=yo(f/A)+1;for(let X=d-$+Z,_=0;_<B;_+=1,X+=Z){if(X<0||X>f){if(!r)return;X=X<0?j:0}const ne=Math.min(X+A-1,f);for(let G=Math.min(X+$,ne);G>=X;G-=1)if(!pl(n,G,a))return G}};p&&Sr(e);const z=D(y)??P(y);if(z!==void 0)g=z;else if(d===-1)g=y==="up"?f:u;else if(g=Un(n,{startingIndex:d,amount:A,decrement:y==="up",disabledIndices:a}),r){if(y==="up"&&(d-A<u||g<0)){const H=d%A,$=f%A,Z=f-($-H);$===H?g=f:g=$>H?Z:Z-A,i&&(g=i(e,d,g))}y==="down"&&d+A>f&&(g=Un(n,{startingIndex:d%A-A,amount:A,disabledIndices:a}),i&&(g=i(e,d,g)))}rd(n,g)&&(g=d)}if(t==="both"){const v=yo(d/o);e.key===(s?Is:Ds)&&(p&&Sr(e),d%o!==o-1?(g=Un(n,{startingIndex:d,disabledIndices:a}),r&&Ju(g,o,v)&&(g=Un(n,{startingIndex:d-d%o-1,disabledIndices:a}),i&&(g=i(e,d,g)))):r&&(g=Un(n,{startingIndex:d-d%o-1,disabledIndices:a}),i&&(g=i(e,d,g))),Ju(g,o,v)&&(g=d)),e.key===(s?Ds:Is)&&(p&&Sr(e),d%o!==0?(g=Un(n,{startingIndex:d,decrement:!0,disabledIndices:a}),r&&Ju(g,o,v)&&(g=Un(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a}),i&&(g=i(e,d,g)))):r&&(g=Un(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a}),i&&(g=i(e,d,g))),Ju(g,o,v)&&(g=d));const w=yo(f/o)===v;rd(n,g)&&(r&&w?(g=e.key===(s?Ds:Is)?f:Un(n,{startingIndex:d-d%o-1,disabledIndices:a}),i&&(g=i(e,d,g))):g=d)}return g}function iP(n,e,t){const r=[];let i=0;return n.forEach(({width:s,height:o},a)=>{let u=!1;for(;!u;){const f=[];for(let d=0;d<s;d+=1)for(let p=0;p<o;p+=1)f.push(i+d+p*e);i%e+s<=e&&f.every(d=>r[d]==null)?(f.forEach(d=>{r[d]=a}),u=!0):i+=1}}),[...r]}function sP(n,e,t,r,i){if(n===-1)return-1;const s=t.indexOf(n),o=e[n];switch(i){case"tl":return s;case"tr":return o?s+o.width-1:s;case"bl":return o?s+(o.height-1)*r:s;case"br":return t.lastIndexOf(n);default:return-1}}function oP(n,e){return e.flatMap((t,r)=>n.includes(t)?[r]:[])}function pl(n,e,t){if(typeof t=="function"?t(e):(t==null?void 0:t.includes(e))??!1)return!0;const i=n[e];return i?ih(i)?!t&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function lP(n){return n.visibility==="hidden"||n.visibility==="collapse"}function ih(n,e=n?Jn(n):null){return!n||!n.isConnected||!e||lP(e)?!1:typeof n.checkVisibility=="function"?n.checkVisibility():e.display!=="none"&&e.display!=="contents"}const aP='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function cP(n){const e=n.assignedSlot;if(e)return e;if(n.parentElement)return n.parentElement;const t=n.getRootNode();return Cl(t)?t.host:null}function Dg(n){for(const e of Array.from(n.children))if(zn(e)==="summary")return e;return null}function uP(n,e){const t=Dg(e);return!!t&&(n===t||We(t,n))}function ZS(n){const e=n?zn(n):"";return n!=null&&n.matches(aP)&&(e!=="summary"||n.parentElement!=null&&zn(n.parentElement)==="details"&&Dg(n.parentElement)===n)&&(e!=="details"||Dg(n)==null)&&(e!=="input"||n.type!=="hidden")}function ek(n){if(!ZS(n)||!n.isConnected||n.matches(":disabled"))return!1;for(let e=n;e;e=cP(e)){const t=e!==n,r=zn(e)==="slot";if(e.hasAttribute("inert")||t&&zn(e)==="details"&&!e.open&&!uP(n,e)||e.hasAttribute("hidden")||!r&&!fP(e,t))return!1}return!0}function fP(n,e){const t=Jn(n);return e?t.display!=="none":ih(n,t)}function tk(n){const e=n.tabIndex;if(e<0){const t=zn(n);if(t==="details"||t==="audio"||t==="video"||Bt(n)&&n.isContentEditable)return 0}return e}function Rm(n){if(zn(n)!=="input")return null;const e=n;return e.type==="radio"&&e.name!==""?e:null}function dP(n,e){const t=Rm(n);if(!t)return!0;const r=e.find(i=>{const s=Rm(i);return(s==null?void 0:s.name)===t.name&&s.form===t.form&&s.checked});return r?r===t:e.find(i=>{const s=Rm(i);return(s==null?void 0:s.name)===t.name&&s.form===t.form})===t}function nk(n){if(Bt(n)&&zn(n)==="slot"){const e=n.assignedElements({flatten:!0});if(e.length>0)return e}return Bt(n)&&n.shadowRoot?Array.from(n.shadowRoot.children):Array.from(n.children)}function rk(n,e){nk(n).forEach(t=>{ZS(t)&&e.push(t),rk(t,e)})}function ik(n,e,t){nk(n).forEach(r=>{Bt(r)&&r.matches(e)&&t.push(r),ik(r,e,t)})}function ey(n){return ek(n)&&tk(n)>=0}function sk(n){const e=[];return rk(n,e),e.filter(ek)}function sh(n){const e=sk(n);return e.filter(t=>tk(t)>=0&&dP(t,e))}function ok(n,e){const t=sh(n),r=t.length;if(r===0)return;const i=cn(ot(n)),s=t.indexOf(i),o=s===-1?e===1?0:r-1:s+e;return t[o]}function lk(n){return ok(ot(n).body,1)||n}function ak(n){return ok(ot(n).body,-1)||n}function qa(n,e){const t=e||n.currentTarget,r=n.relatedTarget;return!r||!We(t,r)}function hP(n){sh(n).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function dw(n){const e=[];ik(n,"[data-tabindex]",e),e.forEach(t=>{const r=t.dataset.tabindex;delete t.dataset.tabindex,r?t.setAttribute("tabindex",r):t.removeAttribute("tabindex")})}function Bs(n,e,t=!0){return n.filter(i=>i.parentId===e).flatMap(i=>{var s;return[...!t||(s=i.context)!=null&&s.open?[i]:[],...Bs(n,i.id,t)]})}function hw(n,e){var i;let t=[],r=(i=n.find(s=>s.id===e))==null?void 0:i.parentId;for(;r;){const s=n.find(o=>o.id===r);r=s==null?void 0:s.parentId,s&&(t=t.concat(s))}return t}function lc(n){return`data-base-ui-${n}`}let Zu=0;function jf(n,e={}){const{preventScroll:t=!1,sync:r=!1,shouldFocus:i}=e;cancelAnimationFrame(Zu);function s(){i&&!i()||n==null||n.focus({preventScroll:t})}if(r)return s(),Ht;const o=requestAnimationFrame(s);return Zu=o,()=>{Zu===o&&(cancelAnimationFrame(o),Zu=0)}}const Tm={inert:new WeakMap,"aria-hidden":new WeakMap},pw="data-base-ui-inert",Ng={inert:new WeakSet,"aria-hidden":new WeakSet};let Ta=new WeakMap,Om=0;function pP(n){return Ng[n]}function ck(n){return n?Cl(n)?n.host:ck(n.parentNode):null}const Mm=(n,e)=>e.map(t=>{if(n.contains(t))return t;const r=ck(t);return n.contains(r)?r:null}).filter(t=>t!=null),mw=n=>{const e=new Set;return n.forEach(t=>{let r=t;for(;r&&!e.has(r);)e.add(r),r=r.parentNode}),e},gw=(n,e,t)=>{const r=[],i=s=>{!s||t.has(s)||Array.from(s.children).forEach(o=>{zn(o)!=="script"&&(e.has(o)?i(o):r.push(o))})};return i(n),r};function mP(n,e,t,r,{mark:i=!0,markerIgnoreElements:s=[]}){const o=r?"inert":t?"aria-hidden":null;let a=null,u=null;const f=Mm(e,n),d=i?Mm(e,s):[],p=new Set(d),g=i?gw(e,mw(f),new Set(f)).filter(w=>!p.has(w)):[],y=[],v=[];if(o){const w=Tm[o],S=pP(o);u=S,a=w;const C=Mm(e,Array.from(e.querySelectorAll("[aria-live]"))),R=f.concat(C);gw(e,mw(R),new Set(R)).forEach(M=>{const A=M.getAttribute(o),D=A!==null&&A!=="false",P=(w.get(M)||0)+1;w.set(M,P),y.push(M),P===1&&D&&S.add(M),D||M.setAttribute(o,o==="inert"?"":"true")})}return i&&g.forEach(w=>{const S=(Ta.get(w)||0)+1;Ta.set(w,S),v.push(w),S===1&&w.setAttribute(pw,"")}),Om+=1,()=>{a&&y.forEach(w=>{const C=(a.get(w)||0)-1;a.set(w,C),C||(!(u!=null&&u.has(w))&&o&&w.removeAttribute(o),u==null||u.delete(w))}),i&&v.forEach(w=>{const S=(Ta.get(w)||0)-1;Ta.set(w,S),S||w.removeAttribute(pw)}),Om-=1,Om||(Tm.inert=new WeakMap,Tm["aria-hidden"]=new WeakMap,Ng.inert=new WeakSet,Ng["aria-hidden"]=new WeakSet,Ta=new WeakMap)}}function yw(n,e={}){const{ariaHidden:t=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:s=[]}=e,o=ot(n[0]).body;return mP(n,o,t,r,{mark:i,markerIgnoreElements:s})}let vw=0;function gP(n,e="mui"){const[t,r]=b.useState(n),i=n||t;return b.useEffect(()=>{t==null&&(vw+=1,r(`${e}-${vw}`))},[t,e]),i}const xw=Q0.useId;function _l(n,e){if(xw!==void 0){const t=xw();return n??(e?`${e}-${t}`:t)}return gP(n,e)}const yP=parseInt(b.version,10);function ty(n){return yP>=n}function ww(n){if(!b.isValidElement(n))return null;const e=n,t=e.props;return(ty(19)?t==null?void 0:t.ref:e.ref)??null}function Lg(n,e){if(n&&!e)return n;if(!n&&e)return e;if(n||e)return{...n,...e}}function vP(n,e){const t={};for(const r in n){const i=n[r];if(e!=null&&e.hasOwnProperty(r)){const s=e[r](i);s!=null&&Object.assign(t,s);continue}i===!0?t[`data-${r.toLowerCase()}`]="":i&&(t[`data-${r.toLowerCase()}`]=i.toString())}return t}function xP(n,e){return typeof n=="function"?n(e):n}function wP(n,e){return typeof n=="function"?n(e):n}const ny={};function li(n,e,t,r,i){if(!t&&!r&&!i&&!n)return id(e);let s=id(n);return e&&(s=ja(s,e)),t&&(s=ja(s,t)),r&&(s=ja(s,r)),i&&(s=ja(s,i)),s}function bP(n){if(n.length===0)return ny;if(n.length===1)return id(n[0]);let e=id(n[0]);for(let t=1;t<n.length;t+=1)e=ja(e,n[t]);return e}function id(n){return ry(n)?{...fk(n,ny)}:SP(n)}function ja(n,e){return ry(e)?fk(e,n):kP(n,e)}function SP(n){const e={...n};for(const t in e){const r=e[t];uk(t,r)&&(e[t]=dk(r))}return e}function kP(n,e){if(!e)return n;for(const t in e){const r=e[t];switch(t){case"style":{n[t]=Lg(n.style,r);break}case"className":{n[t]=hk(n.className,r);break}default:uk(t,r)?n[t]=CP(n[t],r):n[t]=r}}return n}function uk(n,e){const t=n.charCodeAt(0),r=n.charCodeAt(1),i=n.charCodeAt(2);return t===111&&r===110&&i>=65&&i<=90&&(typeof e=="function"||typeof e>"u")}function ry(n){return typeof n=="function"}function fk(n,e){return ry(n)?n(e):n??ny}function CP(n,e){return e?n?(...t)=>{const r=t[0];if(pk(r)){const s=r;sd(s);const o=e(...t);return s.baseUIHandlerPrevented||n==null||n(...t),o}const i=e(...t);return n==null||n(...t),i}:dk(e):n}function dk(n){return n&&((...e)=>{const t=e[0];return pk(t)&&sd(t),n(...e)})}function sd(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function hk(n,e){return e?n?e+" "+n:e:n}function pk(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function qt(n,e,t={}){const r=e.render,i=EP(e,t);if(t.enabled===!1)return null;const s=t.state??un;return OP(n,r,i,s)}function EP(n,e={}){const{className:t,style:r,render:i}=n,{state:s=un,ref:o,props:a,stateAttributesMapping:u,enabled:f=!0}=e,d=f?xP(t,s):void 0,p=f?wP(r,s):void 0,g=f?vP(s,u):un,y=f&&a?RP(a):void 0,v=f?Lg(g,y)??{}:un;return typeof document<"u"&&(f?Array.isArray(o)?v.ref=zA([v.ref,ww(i),...o]):v.ref=To(v.ref,ww(i),o):To(null,null)),f?(d!==void 0&&(v.className=hk(v.className,d)),p!==void 0&&(v.style=Lg(v.style,p)),v):un}function RP(n){return Array.isArray(n)?bP(n):li(void 0,n)}const TP=Symbol.for("react.lazy");function OP(n,e,t,r){if(e){if(typeof e=="function")return e(t,r);const i=li(t,e.props);i.ref=t.ref;let s=e;return(s==null?void 0:s.$$typeof)===TP&&(s=b.Children.toArray(e)[0]),b.cloneElement(s,i)}if(n&&typeof n=="string")return MP(n,t);throw new Error(Pn(8))}function MP(n,e){return n==="button"?b.createElement("button",{type:"button",...e,key:e.key}):n==="img"?b.createElement("img",{alt:"",...e,key:e.key}):b.createElement(n,e)}const AP={style:{transition:"none"}},PP="data-base-ui-click-trigger",IP="data-base-ui-swipe-ignore",DP="data-swipe-ignore",NP=`[${IP}]`,LP=`[${DP}]`,BP={fallbackAxisSide:"none"},FP={fallbackAxisSide:"end"},jP={clipPath:"inset(50%)",position:"fixed",top:0,left:0},mk=b.createContext(null),gk=()=>b.useContext(mk),_P=lc("portal");function yk(n={}){const{ref:e,container:t,componentProps:r=un,elementProps:i}=n,s=_l(),o=gk(),a=o==null?void 0:o.portalNode,[u,f]=b.useState(null),[d,p]=b.useState(null),g=Fe(S=>{S!==null&&p(S)}),y=b.useRef(null);Se(()=>{if(t===null){y.current&&(y.current=null,p(null),f(null));return}if(s==null)return;const S=(t&&(U0(t)?t:t.current))??a??document.body;if(S==null){y.current&&(y.current=null,p(null),f(null));return}y.current!==S&&(y.current=S,p(null),f(S))},[t,a,s]);const v=qt("div",r,{ref:[e,g],props:[{id:s,[_P]:""},i]});return{portalNode:d,portalSubtree:u&&v?Ai.createPortal(v,u):null}}const zP=b.forwardRef(function(e,t){const{render:r,className:i,style:s,children:o,container:a,renderGuards:u,...f}=e,{portalNode:d,portalSubtree:p}=yk({container:a,ref:t,componentProps:e,elementProps:f}),g=b.useRef(null),y=b.useRef(null),v=b.useRef(null),w=b.useRef(null),[S,C]=b.useState(null),R=b.useRef(!1),T=S==null?void 0:S.modal,M=S==null?void 0:S.open,A=typeof u=="boolean"?u:!!S&&!S.modal&&S.open&&!!d;b.useEffect(()=>{if(!d||T)return;function P(z){d&&z.relatedTarget&&qa(z)&&(z.type==="focusin"?R.current&&(dw(d),R.current=!1):(hP(d),R.current=!0))}return oi(rt(d,"focusin",P,!0),rt(d,"focusout",P,!0))},[d,T]),b.useEffect(()=>{!d||M!==!1||(dw(d),R.current=!1)},[M,d]);const D=b.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:y,beforeInsideRef:v,afterInsideRef:w,portalNode:d,setFocusManagerState:C}),[d]);return E.jsxs(b.Fragment,{children:[p,E.jsxs(mk.Provider,{value:D,children:[A&&d&&E.jsx(So,{"data-type":"outside",ref:g,onFocus:P=>{var z;if(qa(P,d))(z=v.current)==null||z.focus();else{const H=S?S.domReference:null,$=ak(H);$==null||$.focus()}}}),A&&d&&E.jsx("span",{"aria-owns":d.id,style:jP}),d&&Ai.createPortal(o,d),A&&d&&E.jsx(So,{"data-type":"outside",ref:y,onFocus:P=>{var z;if(qa(P,d))(z=w.current)==null||z.focus();else{const H=S?S.domReference:null,$=lk(H);$==null||$.focus(),S!=null&&S.closeOnFocusOut&&(S==null||S.onOpenChange(!1,gt(nh,P.nativeEvent)))}}})]})]})});function VP(){const n=new Map;return{emit(e,t){var r;(r=n.get(e))==null||r.forEach(i=>i(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var r;(r=n.get(e))==null||r.delete(t)}}}const WP=b.createContext(null),HP=b.createContext(null),oh=()=>{var n;return((n=b.useContext(WP))==null?void 0:n.id)||null},zl=n=>{const e=b.useContext(HP);return n??e};function Ui(n){return n==null?n:"current"in n?n.current:n}function $P(n,e){const t=Et(on(n));return n instanceof t.KeyboardEvent?"keyboard":n instanceof t.FocusEvent?e||"keyboard":"pointerType"in n?n.pointerType||"keyboard":"touches"in n?"touch":n instanceof t.MouseEvent?e||(n.detail===0?"keyboard":"mouse"):""}const bw=20;let Ms=[];function iy(){Ms=Ms.filter(n=>{var e;return(e=n.deref())==null?void 0:e.isConnected})}function UP(n){iy(),n&&zn(n)!=="body"&&(Ms.push(new WeakRef(n)),Ms.length>bw&&(Ms=Ms.slice(-bw)))}function Am(){var n;return iy(),(n=Ms[Ms.length-1])==null?void 0:n.deref()}function qP(n){return n?ey(n)?n:sh(n)[0]||n:null}function Sw(n,e){var s;if(n.hasAttribute("tabindex")&&!n.hasAttribute("data-tabindex")||!e.current.includes("floating")&&!((s=n.getAttribute("role"))!=null&&s.includes("dialog")))return;const r=sk(n).filter(o=>{const a=o.getAttribute("data-tabindex")||"";return ey(o)||o.hasAttribute("data-tabindex")&&!a.startsWith("-")}),i=n.getAttribute("tabindex");e.current.includes("floating")||r.length===0?i!=="0"&&n.setAttribute("tabindex","0"):(i!=="-1"||n.hasAttribute("data-tabindex")&&n.getAttribute("data-tabindex")!=="-1")&&(n.setAttribute("tabindex","-1"),n.setAttribute("data-tabindex","-1"))}function KP(n){const{context:e,children:t,disabled:r=!1,initialFocus:i=!0,returnFocus:s=!0,restoreFocus:o=!1,modal:a=!0,closeOnFocusOut:u=!0,openInteractionType:f="",nextFocusableElement:d,previousFocusableElement:p,beforeContentFocusGuardRef:g,externalTree:y,getInsideElements:v}=n,w="rootStore"in e?e.rootStore:e,S=w.useState("open"),C=w.useState("domReferenceElement"),R=w.useState("floatingElement"),{events:T,dataRef:M}=w.context,A=Fe(()=>{var ce;return(ce=M.current.floatingContext)==null?void 0:ce.nodeId}),D=i===!1,P=Ag(C)&&D,z=b.useRef(["content"]),H=sn(i),$=sn(s),Z=sn(f),j=zl(y),B=gk(),X=b.useRef(!1),_=b.useRef(!1),ne=b.useRef(!1),G=b.useRef(null),N=b.useRef(""),W=b.useRef(""),F=b.useRef(null),I=b.useRef(null),U=To(F,g,B==null?void 0:B.beforeInsideRef),q=To(I,B==null?void 0:B.afterInsideRef),Q=Gn(),oe=Gn(),ie=Ls(),de=B!=null,J=ed(R),ae=Fe((ce=J)=>ce?sh(ce):[]),pe=Fe(()=>(v==null?void 0:v().filter(ce=>ce!=null))??[]);b.useEffect(()=>{if(r||!a)return;function ce(be){be.key==="Tab"&&We(J,cn(ot(J)))&&ae().length===0&&!P&&Sr(be)}const ye=ot(J);return rt(ye,"keydown",ce)},[r,J,a,P,ae]),b.useEffect(()=>{if(r||!S)return;const ce=ot(J);function ye(){ne.current=!1}function be(Ne){const ke=on(Ne),Ie=pe(),Ce=We(R,ke)||We(C,ke)||We(B==null?void 0:B.portalNode,ke)||Ie.some(Ke=>Ke===ke||We(Ke,ke));ne.current=!Ce,W.current=Ne.pointerType||"keyboard",ke!=null&&ke.closest(`[${PP}]`)&&(_.current=!0)}function je(){W.current="keyboard"}return oi(rt(ce,"pointerdown",be,!0),rt(ce,"pointerup",ye,!0),rt(ce,"pointercancel",ye,!0),rt(ce,"keydown",je,!0))},[r,R,C,J,S,B,pe]),b.useEffect(()=>{if(r||!u)return;const ce=ot(J);function ye(){_.current=!0,oe.start(0,()=>{_.current=!1})}function be(Ie){const Ce=on(Ie);ey(Ce)&&(G.current=Ce)}function je(Ie){const Ce=Ie.relatedTarget,Ke=Ie.currentTarget,He=on(Ie);queueMicrotask(()=>{const Je=A(),$e=w.context.triggerElements,we=pe(),Y=(Ce==null?void 0:Ce.hasAttribute(lc("focus-guard")))&&[F.current,I.current,B==null?void 0:B.beforeInsideRef.current,B==null?void 0:B.afterInsideRef.current,B==null?void 0:B.beforeOutsideRef.current,B==null?void 0:B.afterOutsideRef.current,Ui(p),Ui(d)].includes(Ce),se=!(We(C,Ce)||We(R,Ce)||We(Ce,R)||We(B==null?void 0:B.portalNode,Ce)||we.some(le=>le===Ce||We(le,Ce))||Ce!=null&&$e.hasElement(Ce)||$e.hasMatchingElement(le=>We(le,Ce))||Y||j&&(Bs(j.nodesRef.current,Je).find(le=>{var ve,Le;return We((ve=le.context)==null?void 0:ve.elements.floating,Ce)||We((Le=le.context)==null?void 0:Le.elements.domReference,Ce)})||hw(j.nodesRef.current,Je).find(le=>{var ve,Le,Ve;return[(ve=le.context)==null?void 0:ve.elements.floating,ed((Le=le.context)==null?void 0:Le.elements.floating)].includes(Ce)||((Ve=le.context)==null?void 0:Ve.elements.domReference)===Ce})));if(Ke===C&&J&&Sw(J,z),o&&Ke!==C&&!ih(He)&&cn(ce)===ce.body){if(Bt(J)&&(J.focus(),o==="popup")){ie.request(()=>{J.focus()});return}const le=ae(),ve=G.current,Le=(ve&&le.includes(ve)?ve:null)||le[le.length-1]||J;Bt(Le)&&Le.focus()}if(M.current.insideReactTree){M.current.insideReactTree=!1;return}(P||!a)&&Ce&&se&&!_.current&&(P||Ce!==Am())&&(X.current=!0,w.setOpen(!1,gt(nh,Ie)))})}function Ne(){ne.current||(M.current.insideReactTree=!0,Q.start(0,()=>{M.current.insideReactTree=!1}))}const ke=Bt(C)?C:null;if(!(!R&&!ke))return oi(ke&&rt(ke,"focusout",je),ke&&rt(ke,"pointerdown",ye),R&&rt(R,"focusin",be),R&&rt(R,"focusout",je),R&&B&&rt(R,"focusout",Ne,!0))},[r,C,R,J,a,j,B,w,u,o,ae,P,A,z,M,Q,oe,ie,d,p,pe]),b.useEffect(()=>{var Ke,He,Je;if(r||!R||!S)return;const ce=Array.from(((Ke=B==null?void 0:B.portalNode)==null?void 0:Ke.querySelectorAll(`[${lc("portal")}]`))||[]),be=(Je=(He=(j?hw(j.nodesRef.current,A()):[]).find($e=>{var we;return Ag(((we=$e.context)==null?void 0:we.elements.domReference)||null)}))==null?void 0:He.context)==null?void 0:Je.elements.domReference,Ne=[...[R,...ce,F.current,I.current,B==null?void 0:B.beforeOutsideRef.current,B==null?void 0:B.afterOutsideRef.current,...pe()],be,Ui(p),Ui(d),P?C:null].filter($e=>$e!=null),ke=yw(Ne,{ariaHidden:a||P,mark:!1}),Ie=[R,...ce].filter($e=>$e!=null),Ce=yw(Ie);return()=>{Ce(),ke()}},[S,r,C,R,a,B,P,j,A,d,p,pe]),Se(()=>{if(!S||r||!Bt(J))return;const ce=ot(J),ye=cn(ce);queueMicrotask(()=>{const be=H.current,je=typeof be=="function"?be(Z.current||""):be;if(je===void 0||je===!1||We(J,ye))return;let ke=null;const Ie=()=>(ke==null&&(ke=ae(J)),ke[0]||J);let Ce;je===!0||je===null?Ce=Ie():Ce=Ui(je),Ce=Ce||Ie();const Ke=We(J,cn(ce));jf(Ce,{preventScroll:Ce===J,shouldFocus(){if(Ke)return!0;const He=cn(ce);return!(He!==Ce&&We(J,He))}})})},[r,S,J,ae,H,Z]),Se(()=>{if(r||!J)return;const ce=ot(J),ye=cn(ce);UP(ye);function be(Ne){if(Ne.open||(N.current=$P(Ne.nativeEvent,W.current)),Ne.reason===qn&&Ne.nativeEvent.type==="mouseleave"&&(X.current=!0),Ne.reason===Y0)if(Ne.nested)X.current=!1;else if($0(Ne.nativeEvent)||HS(Ne.nativeEvent))X.current=!1;else{let ke=!1;ot(J).createElement("div").focus({get preventScroll(){return ke=!0,!1}}),ke?X.current=!1:X.current=!0}}T.on("openchange",be);function je(){const Ne=$.current;let ke=typeof Ne=="function"?Ne(N.current):Ne;if(ke===void 0||ke===!1)return null;if(ke===null&&(ke=!0),typeof ke=="boolean")return C!=null&&C.isConnected?C:Am()||null;const Ie=C!=null&&C.isConnected?C:Am();return Ui(ke)||Ie||null}return()=>{T.off("openchange",be);const Ne=cn(ce),ke=pe(),Ie=We(R,Ne)||ke.some(He=>He===Ne||We(He,Ne))||j&&Bs(j.nodesRef.current,A(),!1).some(He=>{var Je;return We((Je=He.context)==null?void 0:Je.elements.floating,Ne)}),Ce=$.current,Ke=je();queueMicrotask(()=>{const He=qP(Ke),Je=typeof Ce!="boolean";Ce&&!X.current&&Bt(He)&&(!(!Je&&He!==Ne&&Ne!==ce.body)||Ie)&&He.focus({preventScroll:!0}),X.current=!1})}},[r,R,J,$,T,j,C,A,pe]),Se(()=>{if(!H0||S||!R)return;const ce=cn(ot(R));!Bt(ce)||!th(ce)||We(R,ce)&&ce.blur()},[S,R]),Se(()=>{if(!(r||!B))return B.setFocusManagerState({modal:a,closeOnFocusOut:u,open:S,onOpenChange:w.setOpen,domReference:C}),()=>{B.setFocusManagerState(null)}},[r,B,a,S,w,u,C]),Se(()=>{if(!(r||!J))return Sw(J,z),()=>{queueMicrotask(iy)}},[r,J,z]);const Re=!r&&(a?!P:!0)&&(de||a);return E.jsxs(b.Fragment,{children:[Re&&E.jsx(So,{"data-type":"inside",ref:U,onFocus:ce=>{var ye;if(a){const be=ae();jf(be[be.length-1])}else if(B!=null&&B.portalNode)if(X.current=!1,qa(ce,B.portalNode)){const be=lk(C);be==null||be.focus()}else(ye=Ui(p??B.beforeOutsideRef))==null||ye.focus()}}),t,Re&&E.jsx(So,{"data-type":"inside",ref:q,onFocus:ce=>{var ye;if(a)jf(ae()[0]);else if(B!=null&&B.portalNode)if(u&&(X.current=!0),qa(ce,B.portalNode)){const be=ak(C);be==null||be.focus()}else(ye=Ui(d??B.afterOutsideRef))==null||ye.focus()}})]})}function YP(n,e={}){const{enabled:t=!0,event:r="click",toggle:i=!0,ignoreMouse:s=!1,stickIfOpen:o=!0,touchOpenDelay:a=0,reason:u=sc}=e,f="rootStore"in n?n.rootStore:n,d=f.context.dataRef,p=b.useRef(void 0),g=Ls(),y=Gn(),v=b.useMemo(()=>{function w(C,R,T,M){const A=gt(u,R,T);C&&M==="touch"&&a>0?y.start(a,()=>{f.setOpen(!0,A)}):f.setOpen(C,A)}function S(C,R,T){const M=d.current.openEvent,A=f.select("domReferenceElement")!==R;return C&&A||!C||!i?!0:M&&o?!T(M.type):!1}return{onPointerDown(C){p.current=C.pointerType},onMouseDown(C){const R=p.current,T=C.nativeEvent,M=f.select("open");if(C.button!==0||r==="click"||Ro(R,!0)&&s)return;const A=S(M,C.currentTarget,z=>z==="click"||z==="mousedown"),D=on(T);if(th(D)){w(A,T,D,R);return}const P=C.currentTarget;g.request(()=>{w(A,T,P,R)})},onClick(C){if(r==="mousedown-only")return;const R=p.current;if(r==="mousedown"&&R){p.current=void 0;return}if(Ro(R,!0)&&s)return;const T=f.select("open"),M=S(T,C.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");w(M,C.nativeEvent,C.currentTarget,R)},onKeyDown(){p.current=void 0}}},[d,r,s,u,f,o,i,g,y,a]);return b.useMemo(()=>t?{reference:v}:un,[t,v])}function GP(n,e){let t=null,r=null,i=!1;return{contextElement:n||void 0,getBoundingClientRect(){var y;const s=(n==null?void 0:n.getBoundingClientRect())||{width:0,height:0,x:0,y:0},o=e.axis==="x"||e.axis==="both",a=e.axis==="y"||e.axis==="both",u=["mouseenter","mousemove"].includes(((y=e.dataRef.current.openEvent)==null?void 0:y.type)||"")&&e.pointerType!=="touch";let f=s.width,d=s.height,p=s.x,g=s.y;return t==null&&e.x&&o&&(t=s.x-e.x),r==null&&e.y&&a&&(r=s.y-e.y),p-=t||0,g-=r||0,f=0,d=0,!i||u?(f=e.axis==="y"?s.width:0,d=e.axis==="x"?s.height:0,p=o&&e.x!=null?e.x:p,g=a&&e.y!=null?e.y:g):i&&!u&&(d=e.axis==="x"?s.height:d,f=e.axis==="y"?s.width:f),i=!0,{width:f,height:d,x:p,y:g,top:g,right:p+f,bottom:g+d,left:p}}}}function kw(n){return n!=null&&n.clientX!=null}function QP(n,e={}){const{enabled:t=!0,axis:r="both"}=e,i="rootStore"in n?n.rootStore:n,s=i.useState("open"),o=i.useState("floatingElement"),a=i.useState("domReferenceElement"),u=i.context.dataRef,f=b.useRef(!1),d=b.useRef(null),[p,g]=b.useState(),[y,v]=b.useState([]),w=Fe(M=>{i.set("positionReference",M)}),S=Fe((M,A,D)=>{f.current||u.current.openEvent&&!kw(u.current.openEvent)||i.set("positionReference",GP(D??a,{x:M,y:A,axis:r,dataRef:u,pointerType:p}))}),C=Fe(M=>{s?d.current||(S(M.clientX,M.clientY,M.currentTarget),v([])):S(M.clientX,M.clientY,M.currentTarget)}),R=Ro(p)?o:s;b.useEffect(()=>{if(!t){w(a);return}if(!R)return;function M(){var P;(P=d.current)==null||P.call(d),d.current=null}const A=Et(o);function D(P){const z=on(P);We(o,z)?M():S(P.clientX,P.clientY)}return!u.current.openEvent||kw(u.current.openEvent)?d.current=rt(A,"mousemove",D):w(a),M},[R,t,o,u,a,i,S,w,y]),b.useEffect(()=>()=>{i.set("positionReference",null)},[i]),b.useEffect(()=>{t&&!o&&(f.current=!1)},[t,o]),b.useEffect(()=>{!t&&s&&(f.current=!0)},[t,s]);const T=b.useMemo(()=>{function M(A){g(A.pointerType)}return{onPointerDown:M,onPointerEnter:M,onMouseMove:C,onMouseEnter:C}},[C]);return b.useMemo(()=>t?{reference:T,trigger:T}:{},[t,T])}const XP={intentional:"onClick",sloppy:"onPointerDown"};function JP(){return!1}function ZP(n){return{escapeKey:typeof n=="boolean"?n:(n==null?void 0:n.escapeKey)??!1,outsidePress:typeof n=="boolean"?n:(n==null?void 0:n.outsidePress)??!0}}function vk(n,e={}){const{enabled:t=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:s="sloppy",referencePress:o=JP,referencePressEvent:a="sloppy",bubbles:u,externalTree:f}=e,d="rootStore"in n?n.rootStore:n,p=d.useState("open"),g=d.useState("floatingElement"),{dataRef:y}=d.context,v=zl(f),w=Fe(typeof i=="function"?i:()=>!1),S=typeof i=="function"?w:i,C=S!==!1,R=Fe(()=>s),{escapeKey:T,outsidePress:M}=ZP(u),A=b.useRef(!1),D=b.useRef(!1),P=b.useRef(!1),z=b.useRef(!1),H=b.useRef(""),$=b.useRef(null),Z=Gn(),j=Gn(),B=Fe(()=>{j.clear(),y.current.insideReactTree=!1}),X=Fe(q=>{var ie;const Q=(ie=y.current.floatingContext)==null?void 0:ie.nodeId;return(v?Bs(v.nodesRef.current,Q):[]).some(de=>{var J;return((J=de.context)==null?void 0:J.open)&&!de.context.dataRef.current[q]})}),_=Fe(q=>Sm(q,d.select("floatingElement"))||Sm(q,d.select("domReferenceElement"))),ne=Fe(q=>{o()&&d.setOpen(!1,gt(sc,q.nativeEvent))}),G=Fe(q=>{if(!p||!t||!r||q.key!=="Escape"||z.current||!T&&X("__escapeKeyBubbles"))return;const Q=CA(q)?q.nativeEvent:q,oe=gt(G0,Q);d.setOpen(!1,oe),oe.isCanceled||q.preventDefault(),!T&&!oe.isPropagationAllowed&&q.stopPropagation()}),N=Fe(()=>{y.current.insideReactTree=!0,j.start(0,B)}),W=Fe(q=>{if(!p||!t||q.button!==0)return;const Q=on(q.nativeEvent);We(d.select("floatingElement"),Q)&&(A.current||(A.current=!0,D.current=!1))}),F=Fe(q=>{!p||!t||(q.defaultPrevented||q.nativeEvent.defaultPrevented)&&A.current&&(D.current=!0)});b.useEffect(()=>{if(!p||!t)return;y.current.__escapeKeyBubbles=T,y.current.__outsidePressBubbles=M;const q=new Er,Q=new Er;function oe(){q.clear(),z.current=!0}function ie(){q.start(Zd()?5:0,()=>{z.current=!1})}function de(){P.current=!0,Q.start(0,()=>{P.current=!1})}function J(){A.current=!1,D.current=!1}function ae(){const Y=H.current,se=Y==="pen"||!Y?"mouse":Y,le=R(),ve=typeof le=="function"?le():le;return typeof ve=="string"?ve:ve[se]}function pe(Y){const se=ae();return se==="intentional"&&Y.type!=="click"||se==="sloppy"&&Y.type==="click"}function Re(Y){var ve;const se=(ve=y.current.floatingContext)==null?void 0:ve.nodeId,le=v&&Bs(v.nodesRef.current,se).some(Le=>{var Ve;return Sm(Y,(Ve=Le.context)==null?void 0:Ve.elements.floating)});return _(Y)||le}function ce(Y){if(pe(Y)){Y.type!=="click"&&!_(Y)&&(Q.clear(),P.current=!1),B();return}if(y.current.insideReactTree){B();return}const se=on(Y),le=`[${lc("inert")}]`,ve=ut(se)?se.getRootNode():null,Le=Array.from((Cl(ve)?ve:ot(d.select("floatingElement"))).querySelectorAll(le)),Ve=d.context.triggerElements;if(se&&(Ve.hasElement(se)||Ve.hasMatchingElement(it=>We(it,se))))return;let Ue=ut(se)?se:null;for(;Ue&&!Yi(Ue);){const it=Ji(Ue);if(Yi(it)||!ut(it))break;Ue=it}if(!(Le.length&&ut(se)&&!AA(se)&&!We(se,d.select("floatingElement"))&&Le.every(it=>!We(Ue,it)))){if(Bt(se)&&!("touches"in Y)){const it=Yi(se),ht=Jn(se),st=/auto|scroll/,Pt=it||st.test(ht.overflowX),zt=it||st.test(ht.overflowY),It=Pt&&se.clientWidth>0&&se.scrollWidth>se.clientWidth,et=zt&&se.clientHeight>0&&se.scrollHeight>se.clientHeight,kt=ht.direction==="rtl",St=et&&(kt?Y.offsetX<=se.offsetWidth-se.clientWidth:Y.offsetX>se.clientWidth),qe=It&&Y.offsetY>se.clientHeight;if(St||qe)return}if(!Re(Y)){if(ae()==="intentional"&&P.current){Q.clear(),P.current=!1;return}typeof S=="function"&&!S(Y)||X("__outsidePressBubbles")||(d.setOpen(!1,gt(Y0,Y)),B())}}}function ye(Y){ae()!=="sloppy"||Y.pointerType==="touch"||!d.select("open")||!t||_(Y)||ce(Y)}function be(Y){if(ae()!=="sloppy"||!d.select("open")||!t||_(Y))return;const se=Y.touches[0];se&&($.current={startTime:Date.now(),startX:se.clientX,startY:se.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},Z.start(1e3,()=>{$.current&&($.current.dismissOnTouchEnd=!1,$.current.dismissOnMouseDown=!1)}))}function je(Y,se){const le=on(Y);if(!le)return;const ve=rt(le,Y.type,()=>{se(Y),ve()})}function Ne(Y){H.current="touch",je(Y,be)}function ke(Y){Z.clear(),Y.type==="pointerdown"&&(H.current=Y.pointerType),!(Y.type==="mousedown"&&$.current&&!$.current.dismissOnMouseDown)&&je(Y,se=>{se.type==="pointerdown"?ye(se):ce(se)})}function Ie(Y){if(!A.current)return;const se=D.current;if(J(),ae()==="intentional"){if(Y.type==="pointercancel"){se&&de();return}if(!Re(Y)){if(se){de();return}typeof S=="function"&&!S(Y)||(Q.clear(),P.current=!0,B())}}}function Ce(Y){if(ae()!=="sloppy"||!$.current||_(Y))return;const se=Y.touches[0];if(!se)return;const le=Math.abs(se.clientX-$.current.startX),ve=Math.abs(se.clientY-$.current.startY),Le=Math.sqrt(le*le+ve*ve);Le>5&&($.current.dismissOnTouchEnd=!0),Le>10&&(ce(Y),Z.clear(),$.current=null)}function Ke(Y){je(Y,Ce)}function He(Y){ae()!=="sloppy"||!$.current||_(Y)||($.current.dismissOnTouchEnd&&ce(Y),Z.clear(),$.current=null)}function Je(Y){je(Y,He)}const $e=ot(g),we=oi(r&&oi(rt($e,"keydown",G),rt($e,"compositionstart",oe),rt($e,"compositionend",ie)),C&&oi(rt($e,"click",ke,!0),rt($e,"pointerdown",ke,!0),rt($e,"pointerup",Ie,!0),rt($e,"pointercancel",Ie,!0),rt($e,"mousedown",ke,!0),rt($e,"mouseup",Ie,!0),rt($e,"touchstart",Ne,!0),rt($e,"touchmove",Ke,!0),rt($e,"touchend",Je,!0)));return()=>{we(),q.clear(),Q.clear(),J(),P.current=!1}},[y,g,r,C,S,p,t,T,M,G,B,R,X,_,v,d,Z]),b.useEffect(B,[S,B]);const I=b.useMemo(()=>({onKeyDown:G,[XP[a]]:ne,...a!=="intentional"&&{onClick:ne}}),[G,ne,a]),U=b.useMemo(()=>({onKeyDown:G,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(q){N(),W(q)},onPointerDownCapture(q){N(),W(q)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[G,N,W,F]);return b.useMemo(()=>t?{reference:I,floating:U,trigger:I}:{},[t,I,U])}function Cw(n,e,t){let{reference:r,floating:i}=n;const s=Br(e),o=Z0(e),a=J0(o),u=ur(e),f=s==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/2;let y;switch(u){case"top":y={x:d,y:r.y-i.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-i.width,y:p};break;default:y={x:r.x,y:r.y}}switch(Us(e)){case"start":y[o]-=g*(t&&f?-1:1);break;case"end":y[o]+=g*(t&&f?-1:1);break}return y}async function e3(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:u}=n,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:g=!1,padding:y=0}=Zi(e,n),v=JS(y),S=a[g?p==="floating"?"reference":"floating":p],C=oc(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(S)))==null||t?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:f,rootBoundary:d,strategy:u})),R=p==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),M=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},A=oc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:T,strategy:u}):R);return{top:(C.top-A.top+v.top)/M.y,bottom:(A.bottom-C.bottom+v.bottom)/M.y,left:(C.left-A.left+v.left)/M.x,right:(A.right-C.right+v.right)/M.x}}const t3=50,n3=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=o.detectOverflow?o:{...o,detectOverflow:e3},u=await(o.isRTL==null?void 0:o.isRTL(e));let f=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:p}=Cw(f,r,u),g=r,y=0;const v={};for(let w=0;w<s.length;w++){const S=s[w];if(!S)continue;const{name:C,fn:R}=S,{x:T,y:M,data:A,reset:D}=await R({x:d,y:p,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:f,platform:a,elements:{reference:n,floating:e}});d=T??d,p=M??p,v[C]={...v[C],...A},D&&y<t3&&(y++,typeof D=="object"&&(D.placement&&(g=D.placement),D.rects&&(f=D.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):D.rects),{x:d,y:p}=Cw(f,g,u)),w=-1)}return{x:d,y:p,placement:g,strategy:i,middlewareData:v}},r3=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:u,elements:f}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...S}=Zi(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const C=ur(i),R=Br(a),T=ur(a)===a,M=await(u.isRTL==null?void 0:u.isRTL(f.floating)),A=g||(T||!w?[nd(a)]:XA(a)),D=v!=="none";!g&&D&&A.push(...tP(a,w,v,M));const P=[a,...A],z=await u.detectOverflow(e,S),H=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&H.push(z[C]),p){const X=QA(i,o,M);H.push(z[X[0]],z[X[1]])}if($=[...$,{placement:i,overflows:H}],!H.every(X=>X<=0)){var Z,j;const X=(((Z=s.flip)==null?void 0:Z.index)||0)+1,_=P[X];if(_&&(!(p==="alignment"?R!==Br(_):!1)||$.every(N=>Br(N.placement)===R?N.overflows[0]>0:!0)))return{data:{index:X,overflows:$},reset:{placement:_}};let ne=(j=$.filter(G=>G.overflows[0]<=0).sort((G,N)=>G.overflows[1]-N.overflows[1])[0])==null?void 0:j.placement;if(!ne)switch(y){case"bestFit":{var B;const G=(B=$.filter(N=>{if(D){const W=Br(N.placement);return W===R||W==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(W=>W>0).reduce((W,F)=>W+F,0)]).sort((N,W)=>N[1]-W[1])[0])==null?void 0:B[0];G&&(ne=G);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};function Ew(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Rw(n){return YA.some(e=>n[e]>=0)}const i3=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:r}=e,{strategy:i="referenceHidden",...s}=Zi(n,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Ew(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Rw(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Ew(o,t.floating);return{data:{escapedOffsets:a,escaped:Rw(a)}}}default:return{}}}}},xk=new Set(["left","top"]);async function s3(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ur(t),a=Us(t),u=Br(t)==="y",f=xk.has(o)?-1:1,d=s&&u?-1:1,p=Zi(e,n);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(y=a==="end"?v*-1:v),u?{x:y*d,y:g*f}:{x:g*f,y:y*d}}const o3=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:a}=e,u=await s3(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},l3=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:u={fn:C=>{let{x:R,y:T}=C;return{x:R,y:T}}},...f}=Zi(n,e),d={x:t,y:r},p=await s.detectOverflow(e,f),g=Br(ur(i)),y=X0(g);let v=d[y],w=d[g];if(o){const C=y==="y"?"top":"left",R=y==="y"?"bottom":"right",T=v+p[C],M=v-p[R];v=Pg(T,v,M)}if(a){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",T=w+p[C],M=w-p[R];w=Pg(T,w,M)}const S=u.fn({...e,[y]:v,[g]:w});return{...S,data:{x:S.x-t,y:S.y-r,enabled:{[y]:o,[g]:a}}}}}},a3=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:u=!0,crossAxis:f=!0}=Zi(n,e),d={x:t,y:r},p=Br(i),g=X0(p);let y=d[g],v=d[p];const w=Zi(a,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const T=g==="y"?"height":"width",M=s.reference[g]-s.floating[T]+S.mainAxis,A=s.reference[g]+s.reference[T]-S.mainAxis;y<M?y=M:y>A&&(y=A)}if(f){var C,R;const T=g==="y"?"width":"height",M=xk.has(ur(i)),A=s.reference[p]-s.floating[T]+(M&&((C=o.offset)==null?void 0:C[p])||0)+(M?0:S.crossAxis),D=s.reference[p]+s.reference[T]+(M?0:((R=o.offset)==null?void 0:R[p])||0)-(M?S.crossAxis:0);v<A?v=A:v>D&&(v=D)}return{[g]:y,[p]:v}}}},c3=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:u=()=>{},...f}=Zi(n,e),d=await o.detectOverflow(e,f),p=ur(i),g=Us(i),y=Br(i)==="y",{width:v,height:w}=s.floating;let S,C;p==="top"||p==="bottom"?(S=p,C=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(C=p,S=g==="end"?"top":"bottom");const R=w-d.top-d.bottom,T=v-d.left-d.right,M=El(w-d[S],R),A=El(v-d[C],T),D=!e.middlewareData.shift;let P=M,z=A;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(z=T),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(P=R),D&&!g){const $=kr(d.left,0),Z=kr(d.right,0),j=kr(d.top,0),B=kr(d.bottom,0);y?z=v-2*($!==0||Z!==0?$+Z:kr(d.left,d.right)):P=w-2*(j!==0||B!==0?j+B:kr(d.top,d.bottom))}await u({...e,availableWidth:z,availableHeight:P});const H=await o.getDimensions(a.floating);return v!==H.width||w!==H.height?{reset:{rects:!0}}:{}}}};function wk(n){const e=Jn(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Bt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=Rl(t)!==s||Rl(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function sy(n){return ut(n)?n:n.contextElement}function ml(n){const e=sy(n);if(!Bt(e))return Oi(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=wk(e);let o=(s?Rl(t.width):t.width)/r,a=(s?Rl(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const u3=Oi(0);function bk(n){const e=Et(n);return!Zd()||!e.visualViewport?u3:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function f3(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Et(n)?!1:e}function Oo(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=sy(n);let o=Oi(1);e&&(r?ut(r)&&(o=ml(r)):o=ml(n));const a=f3(s,t,r)?bk(s):Oi(0);let u=(i.left+a.x)/o.x,f=(i.top+a.y)/o.y,d=i.width/o.x,p=i.height/o.y;if(s){const g=Et(s),y=r&&ut(r)?Et(r):r;let v=g,w=Og(v);for(;w&&r&&y!==v;){const S=ml(w),C=w.getBoundingClientRect(),R=Jn(w),T=C.left+(w.clientLeft+parseFloat(R.paddingLeft))*S.x,M=C.top+(w.clientTop+parseFloat(R.paddingTop))*S.y;u*=S.x,f*=S.y,d*=S.x,p*=S.y,u+=T,f+=M,v=Et(w),w=Og(v)}}return oc({width:d,height:p,x:u,y:f})}function lh(n,e){const t=eh(n).scrollLeft;return e?e.left+t:Oo(Pi(n)).left+t}function Sk(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-lh(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function d3(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Pi(r),a=e?Jd(e.floating):!1;if(r===o||a&&s)return t;let u={scrollLeft:0,scrollTop:0},f=Oi(1);const d=Oi(0),p=Bt(r);if((p||!p&&!s)&&((zn(r)!=="body"||$s(o))&&(u=eh(r)),p)){const y=Oo(r);f=ml(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const g=o&&!p&&!s?Sk(o,u):Oi(0);return{width:t.width*f.x,height:t.height*f.y,x:t.x*f.x-u.scrollLeft*f.x+d.x+g.x,y:t.y*f.y-u.scrollTop*f.y+d.y+g.y}}function h3(n){return Array.from(n.getClientRects())}function p3(n){const e=Pi(n),t=eh(n),r=n.ownerDocument.body,i=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+lh(n);const a=-t.scrollTop;return Jn(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Tw=25;function m3(n,e){const t=Et(n),r=Pi(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,u=0;if(i){s=i.width,o=i.height;const d=Zd();(!d||d&&e==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}const f=lh(r);if(f<=0){const d=r.ownerDocument,p=d.body,g=getComputedStyle(p),y=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-p.clientWidth-y);v<=Tw&&(s-=v)}else f<=Tw&&(s+=f);return{width:s,height:o,x:a,y:u}}function g3(n,e){const t=Oo(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Bt(n)?ml(n):Oi(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,u=i*s.x,f=r*s.y;return{width:o,height:a,x:u,y:f}}function Ow(n,e,t){let r;if(e==="viewport")r=m3(n,t);else if(e==="document")r=p3(Pi(n));else if(ut(e))r=g3(e,t);else{const i=bk(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return oc(r)}function kk(n,e){const t=Ji(n);return t===e||!ut(t)||Yi(t)?!1:Jn(t).position==="fixed"||kk(t,e)}function y3(n,e){const t=e.get(n);if(t)return t;let r=ic(n,[],!1).filter(a=>ut(a)&&zn(a)!=="body"),i=null;const s=Jn(n).position==="fixed";let o=s?Ji(n):n;for(;ut(o)&&!Yi(o);){const a=Jn(o),u=q0(o);!u&&a.position==="fixed"&&(i=null),(s?!u&&!i:!u&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||$s(o)&&!u&&kk(n,o))?r=r.filter(d=>d!==o):i=a,o=Ji(o)}return e.set(n,r),r}function v3(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Jd(e)?[]:y3(e,this._c):[].concat(t),r],a=Ow(e,o[0],i);let u=a.top,f=a.right,d=a.bottom,p=a.left;for(let g=1;g<o.length;g++){const y=Ow(e,o[g],i);u=kr(y.top,u),f=El(y.right,f),d=El(y.bottom,d),p=kr(y.left,p)}return{width:f-p,height:d-u,x:p,y:u}}function x3(n){const{width:e,height:t}=wk(n);return{width:e,height:t}}function w3(n,e,t){const r=Bt(e),i=Pi(e),s=t==="fixed",o=Oo(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const u=Oi(0);function f(){u.x=lh(i)}if(r||!r&&!s)if((zn(e)!=="body"||$s(i))&&(a=eh(e)),r){const y=Oo(e,!0,s,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else i&&f();s&&!r&&i&&f();const d=i&&!r&&!s?Sk(i,a):Oi(0),p=o.left+a.scrollLeft-u.x-d.x,g=o.top+a.scrollTop-u.y-d.y;return{x:p,y:g,width:o.width,height:o.height}}function Pm(n){return Jn(n).position==="static"}function Mw(n,e){if(!Bt(n)||Jn(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Pi(n)===t&&(t=t.ownerDocument.body),t}function Ck(n,e){const t=Et(n);if(Jd(n))return t;if(!Bt(n)){let i=Ji(n);for(;i&&!Yi(i);){if(ut(i)&&!Pm(i))return i;i=Ji(i)}return t}let r=Mw(n,e);for(;r&&RA(r)&&Pm(r);)r=Mw(r,e);return r&&Yi(r)&&Pm(r)&&!q0(r)?t:r||MA(n)||t}const b3=async function(n){const e=this.getOffsetParent||Ck,t=this.getDimensions,r=await t(n.floating);return{reference:w3(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S3(n){return Jn(n).direction==="rtl"}const Ek={convertOffsetParentRelativeRectToViewportRelativeRect:d3,getDocumentElement:Pi,getClippingRect:v3,getOffsetParent:Ck,getElementRects:b3,getClientRects:h3,getDimensions:x3,getScale:ml,isElement:ut,isRTL:S3};function Rk(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function k3(n,e){let t=null,r;const i=Pi(n);function s(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const f=n.getBoundingClientRect(),{left:d,top:p,width:g,height:y}=f;if(a||e(),!g||!y)return;const v=yo(p),w=yo(i.clientWidth-(d+g)),S=yo(i.clientHeight-(p+y)),C=yo(d),T={rootMargin:-v+"px "+-w+"px "+-S+"px "+-C+"px",threshold:kr(0,El(1,u))||1};let M=!0;function A(D){const P=D[0].intersectionRatio;if(P!==u){if(!M)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!Rk(f,n.getBoundingClientRect())&&o(),M=!1}try{t=new IntersectionObserver(A,{...T,root:i.ownerDocument})}catch{t=new IntersectionObserver(A,T)}t.observe(n)}return o(!0),s}function Aw(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=sy(n),d=i||s?[...f?ic(f):[],...e?ic(e):[]]:[];d.forEach(C=>{i&&C.addEventListener("scroll",t,{passive:!0}),s&&C.addEventListener("resize",t)});const p=f&&a?k3(f,t):null;let g=-1,y=null;o&&(y=new ResizeObserver(C=>{let[R]=C;R&&R.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var T;(T=y)==null||T.observe(e)})),t()}),f&&!u&&y.observe(f),e&&y.observe(e));let v,w=u?Oo(n):null;u&&S();function S(){const C=Oo(n);w&&!Rk(w,C)&&t(),w=C,v=requestAnimationFrame(S)}return t(),()=>{var C;d.forEach(R=>{i&&R.removeEventListener("scroll",t),s&&R.removeEventListener("resize",t)}),p==null||p(),(C=y)==null||C.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const C3=o3,E3=l3,R3=r3,T3=c3,O3=i3,M3=a3,A3=(n,e,t)=>{const r=new Map,i={platform:Ek,...t},s={...i.platform,_c:r};return n3(n,e,{...i,platform:s})};var P3=typeof document<"u",I3=function(){},_f=P3?b.useLayoutEffect:I3;function od(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!od(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const s=i[r];if(!(s==="_owner"&&n.$$typeof)&&!od(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function Tk(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Pw(n,e){const t=Tk(n);return Math.round(e*t)/t}function Im(n){const e=b.useRef(n);return _f(()=>{e.current=n}),e}function D3(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:u,open:f}=n,[d,p]=b.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);od(g,r)||y(r);const[v,w]=b.useState(null),[S,C]=b.useState(null),R=b.useCallback(N=>{N!==D.current&&(D.current=N,w(N))},[]),T=b.useCallback(N=>{N!==P.current&&(P.current=N,C(N))},[]),M=s||v,A=o||S,D=b.useRef(null),P=b.useRef(null),z=b.useRef(d),H=u!=null,$=Im(u),Z=Im(i),j=Im(f),B=b.useCallback(()=>{if(!D.current||!P.current)return;const N={placement:e,strategy:t,middleware:g};Z.current&&(N.platform=Z.current),A3(D.current,P.current,N).then(W=>{const F={...W,isPositioned:j.current!==!1};X.current&&!od(z.current,F)&&(z.current=F,Ai.flushSync(()=>{p(F)}))})},[g,e,t,Z,j]);_f(()=>{f===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,p(N=>({...N,isPositioned:!1})))},[f]);const X=b.useRef(!1);_f(()=>(X.current=!0,()=>{X.current=!1}),[]),_f(()=>{if(M&&(D.current=M),A&&(P.current=A),M&&A){if($.current)return $.current(M,A,B);B()}},[M,A,B,$,H]);const _=b.useMemo(()=>({reference:D,floating:P,setReference:R,setFloating:T}),[R,T]),ne=b.useMemo(()=>({reference:M,floating:A}),[M,A]),G=b.useMemo(()=>{const N={position:t,left:0,top:0};if(!ne.floating)return N;const W=Pw(ne.floating,d.x),F=Pw(ne.floating,d.y);return a?{...N,transform:"translate("+W+"px, "+F+"px)",...Tk(ne.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:W,top:F}},[t,a,ne.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:B,refs:_,elements:ne,floatingStyles:G}),[d,B,_,ne,G])}const N3=(n,e)=>{const t=C3(n);return{name:t.name,fn:t.fn,options:[n,e]}},L3=(n,e)=>{const t=E3(n);return{name:t.name,fn:t.fn,options:[n,e]}},B3=(n,e)=>({fn:M3(n).fn,options:[n,e]}),F3=(n,e)=>{const t=R3(n);return{name:t.name,fn:t.fn,options:[n,e]}},j3=(n,e)=>{const t=T3(n);return{name:t.name,fn:t.fn,options:[n,e]}},_3=(n,e)=>{const t=O3(n);return{name:t.name,fn:t.fn,options:[n,e]}},Te=(n,e,t,r,i,s,...o)=>{if(o.length>0)throw new Error(Pn(1));let a;if(n&&e)a=(u,f,d,p)=>{const g=n(u,f,d,p);return e(g,f,d,p)};else if(n)a=n;else throw new Error("Missing arguments");return a};var Dm={exports:{}},Nm={};/**
52
+ * @license React
53
+ * use-sync-external-store-shim.production.js
54
+ *
55
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
56
+ *
57
+ * This source code is licensed under the MIT license found in the
58
+ * LICENSE file in the root directory of this source tree.
59
+ */var Iw;function z3(){if(Iw)return Nm;Iw=1;var n=Oc();function e(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,s=n.useLayoutEffect,o=n.useDebugValue;function a(p,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),w=v[0].inst,S=v[1];return s(function(){w.value=y,w.getSnapshot=g,u(w)&&S({inst:w})},[p,y,g]),i(function(){return u(w)&&S({inst:w}),p(function(){u(w)&&S({inst:w})})},[p]),o(y),y}function u(p){var g=p.getSnapshot;p=p.value;try{var y=g();return!t(p,y)}catch{return!0}}function f(p,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:a;return Nm.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:d,Nm}var Dw;function Ok(){return Dw||(Dw=1,Dm.exports=z3()),Dm.exports}var Mk=Ok(),Lm={exports:{}},Bm={};/**
60
+ * @license React
61
+ * use-sync-external-store-shim/with-selector.production.js
62
+ *
63
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
64
+ *
65
+ * This source code is licensed under the MIT license found in the
66
+ * LICENSE file in the root directory of this source tree.
67
+ */var Nw;function V3(){if(Nw)return Bm;Nw=1;var n=Oc(),e=Ok();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=n.useRef,o=n.useEffect,a=n.useMemo,u=n.useDebugValue;return Bm.useSyncExternalStoreWithSelector=function(f,d,p,g,y){var v=s(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=a(function(){function C(D){if(!R){if(R=!0,T=D,D=g(D),y!==void 0&&w.hasValue){var P=w.value;if(y(P,D))return M=P}return M=D}if(P=M,r(T,D))return P;var z=g(D);return y!==void 0&&y(P,z)?(T=D,P):(T=D,M=z)}var R=!1,T,M,A=p===void 0?null:p;return[function(){return C(d())},A===null?void 0:function(){return C(A())}]},[d,p,g,y]);var S=i(f,v[0],v[1]);return o(function(){w.hasValue=!0,w.value=S},[S]),u(S),S},Bm}var Lw;function W3(){return Lw||(Lw=1,Lm.exports=V3()),Lm.exports}var H3=W3();const $3=ty(19),U3=$3?K3:Y3;function Ze(n,e,t,r,i){return U3(n,e,t,r,i)}function q3(n,e,t,r,i){const s=b.useCallback(()=>e(n.getSnapshot(),t,r,i),[n,e,t,r,i]);return Mk.useSyncExternalStore(n.subscribe,s,s)}pA({before(n){n.syncIndex=0,n.didInitialize||(n.syncTick=1,n.syncHooks=[],n.didChangeStore=!0,n.getSnapshot=()=>{let e=!1;for(let t=0;t<n.syncHooks.length;t+=1){const r=n.syncHooks[t],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(e=!0,r.value=i,r.didChange=!1)}return e&&(n.syncTick+=1),n.syncTick})},after(n){n.syncHooks.length>0&&(n.didChangeStore&&(n.didChangeStore=!1,n.subscribe=e=>{const t=new Set;for(const i of n.syncHooks)t.add(i.store);const r=[];for(const i of t)r.push(i.subscribe(e));return()=>{for(const i of r)i()}}),Mk.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot))}});function K3(n,e,t,r,i){const s=hA();if(!s)return q3(n,e,t,r,i);const o=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[o],(a.store!==n||a.selector!==e||!Object.is(a.a1,t)||!Object.is(a.a2,r)||!Object.is(a.a3,i))&&(a.store!==n&&(s.didChangeStore=!0),a.store=n,a.selector=e,a.a1=t,a.a2=r,a.a3=i,a.didChange=!0)):(a={store:n,selector:e,a1:t,a2:r,a3:i,value:e(n.getSnapshot(),t,r,i),didChange:!1},s.syncHooks.push(a)),a.value}function Y3(n,e,t,r,i){return H3.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,s=>e(s,t,r,i))}class Ak{constructor(e){pt(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));pt(this,"getSnapshot",()=>this.state);this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const t=this.updateTick;for(const r of this.listeners){if(t!==this.updateTick)return;r(e)}}update(e){for(const t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){const e={...this.state};this.setState(e)}use(e,t,r,i){return Ze(this,e,t,r,i)}}class oy extends Ak{constructor(e,t={},r){super(e),this.context=t,this.selectors=r}useSyncedValue(e,t){b.useDebugValue(e);const r=this;Se(()=>{r.state[e]!==t&&r.set(e,t)},[r,e,t])}useSyncedValueWithCleanup(e,t){const r=this;Se(()=>(r.state[e]!==t&&r.set(e,t),()=>{r.set(e,void 0)}),[r,e,t])}useSyncedValues(e){const t=this,r=Object.values(e);Se(()=>{t.update(e)},[t,...r])}useControlledProp(e,t){b.useDebugValue(e);const r=this,i=t!==void 0;Se(()=>{i&&!Object.is(r.state[e],t)&&r.setState({...r.state,[e]:t})},[r,e,t,i])}select(e,t,r,i){const s=this.selectors[e];return s(this.state,t,r,i)}useState(e,t,r,i){return b.useDebugValue(e),Ze(this,this.selectors[e],t,r,i)}useContextCallback(e,t){b.useDebugValue(e);const r=Fe(t??Ht);this.context[e]=r}useStateSetter(e){const t=b.useRef(void 0);return t.current===void 0&&(t.current=r=>{this.set(e,r)}),t.current}observe(e,t){let r;typeof e=="function"?r=e:r=this.selectors[e];let i=r(this.state);return t(i,i,this),this.subscribe(s=>{const o=r(s);if(!Object.is(i,o)){const a=i;i=o,t(o,a,this)}})}}const G3={open:Te(n=>n.open),transitionStatus:Te(n=>n.transitionStatus),domReferenceElement:Te(n=>n.domReferenceElement),referenceElement:Te(n=>n.positionReference??n.referenceElement),floatingElement:Te(n=>n.floatingElement),floatingId:Te(n=>n.floatingId)};class ah extends oy{constructor(t){const{syncOnly:r,nested:i,onOpenChange:s,triggerElements:o,...a}=t;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:VP(),nested:i,triggerElements:o},G3);pt(this,"syncOpenEvent",(t,r)=>{(!t||!this.state.open||r!=null&&EA(r))&&(this.context.dataRef.current.openEvent=t?r:void 0)});pt(this,"dispatchOpenChange",(t,r)=>{this.syncOpenEvent(t,r.event);const i={open:t,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",i)});pt(this,"setOpen",(t,r)=>{var i,s,o,a;if(this.syncOnly){(s=(i=this.context).onOpenChange)==null||s.call(i,t,r);return}this.dispatchOpenChange(t,r),(a=(o=this.context).onOpenChange)==null||a.call(o,t,r)});this.syncOnly=r}}function Q3(n){const{popupStore:e,treatPopupAsFloatingElement:t=!1,floatingRootContext:r,floatingId:i,nested:s,onOpenChange:o}=n,a=e.useState("open"),u=e.useState("activeTriggerElement"),f=e.useState(t?"popupElement":"positionerElement"),d=e.context.triggerElements,p=o,g=b.useRef(null);r===void 0&&g.current===null&&(g.current=new ah({open:a,transitionStatus:void 0,referenceElement:u,floatingElement:f,triggerElements:d,onOpenChange:p,floatingId:i,syncOnly:!0,nested:s}));const y=r??g.current;return e.useSyncedValue("floatingId",i),Se(()=>{const v={open:a,floatingId:i,referenceElement:u,floatingElement:f};ut(u)&&(v.domReferenceElement=u),y.state.positionReference===y.state.referenceElement&&(v.positionReference=u),y.update(v)},[a,i,u,f,y]),y.context.onOpenChange=p,y.context.nested=s,y}function Dc(n,e=!1,t=!1){const[r,i]=b.useState(n&&e?"idle":void 0),[s,o]=b.useState(n);return n&&!s&&(o(!0),i("starting")),!n&&s&&r!=="ending"&&!t&&i("ending"),!n&&!s&&r==="ending"&&i(void 0),Se(()=>{if(!n&&s&&r!=="ending"&&t){const a=bi.request(()=>{i("ending")});return()=>{bi.cancel(a)}}},[n,s,r,t]),Se(()=>{if(!n||e)return;const a=bi.request(()=>{i(void 0)});return()=>{bi.cancel(a)}},[e,n]),Se(()=>{if(!n||!e)return;n&&s&&r!=="idle"&&i("starting");const a=bi.request(()=>{i("idle")});return()=>{bi.cancel(a)}},[e,n,s,r]),{mounted:s,setMounted:o,transitionStatus:r}}let ac=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const X3={[ac.startingStyle]:""},J3={[ac.endingStyle]:""},Nc={transitionStatus(n){return n==="starting"?X3:n==="ending"?J3:null}};function ly(n,e=!1,t=!0){const r=Ls();return Fe((i,s=null)=>{r.cancel();const o=Ui(n);if(o==null)return;const a=o,u=()=>{Ai.flushSync(i)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function f(){Promise.all(a.getAnimations().map(d=>d.finished)).then(()=>{s!=null&&s.aborted||u()}).catch(()=>{if(t){s!=null&&s.aborted||u();return}const d=a.getAnimations();!(s!=null&&s.aborted)&&d.length>0&&d.some(p=>p.pending||p.playState!=="finished")&&f()})}if(e){const d=ac.startingStyle;if(!a.hasAttribute(d)){r.request(f);return}const p=new MutationObserver(()=>{a.hasAttribute(d)||(p.disconnect(),f())});p.observe(a,{attributes:!0,attributeFilter:[d]}),s==null||s.addEventListener("abort",()=>p.disconnect(),{once:!0});return}r.request(f)})}function qs(n){const{enabled:e=!0,open:t,ref:r,onComplete:i}=n,s=Fe(i),o=ly(r,t,!1);b.useEffect(()=>{if(!e)return;const a=new AbortController;return o(s,a.signal),()=>{a.abort()}},[e,t,s,o])}const Pk={tabIndex:-1,[Mg]:""};function Z3(n,e,t=!1){const r=_l(),i=oh()!=null,s=b.useRef(null);n===void 0&&s.current===null&&(s.current=e(r,i));const o=n??s.current;return Q3({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:s.current}}function e5(n,e){const t=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(n===void 0)return;let s=!1;if(t.current!==null){const o=t.current,a=r.current,u=e.context.triggerElements.getById(o);a&&u===a&&(e.context.triggerElements.delete(o),s=!0),t.current=null,r.current=null}if(i!==null&&(t.current=n,r.current=i,e.context.triggerElements.add(n,i),s=!0),s){const o=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==o&&e.set("triggerCount",o)}},[e,n])}function t5(n,e,t){const r=(t==null?void 0:t.id)??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t??null)}function n5(n,e,t,r){const i=t.useState("isMountedByTrigger",n),s=e5(n,t),o=Fe(a=>{if(s(a),!a)return;const u=t.select("open"),f=t.select("activeTriggerId");if(f===n){t.update({activeTriggerElement:a,...u?r:null});return}f==null&&u&&t.update({activeTriggerId:n,activeTriggerElement:a,...r})});return Se(()=>{i&&t.update({activeTriggerElement:e.current,...r})},[i,t,e,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function r5(n){const e=n.useState("open"),t=n.useState("triggerCount");Se(()=>{if(!e){n.state.triggerCount!==0&&n.set("triggerCount",0);return}const r=n.context.triggerElements.size,i={};if(n.state.triggerCount!==r&&(i.triggerCount=r),!n.select("activeTriggerId")&&r===1){const s=n.context.triggerElements.entries().next();if(!s.done){const[o,a]=s.value;i.activeTriggerId=o,i.activeTriggerElement=a}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0)&&n.update(i)},[e,n,t])}function i5(n,e,t){const{mounted:r,setMounted:i,transitionStatus:s}=Dc(n);e.useSyncedValues({mounted:r,transitionStatus:s});const o=Fe(()=>{var u,f;i(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),(f=(u=e.context).onOpenChangeComplete)==null||f.call(u,!1)}),a=e.useState("preventUnmountingOnClose");return qs({enabled:r&&!n&&!a,open:n,ref:e.context.popupRef,onComplete(){n||o()}}),{forceUnmount:o,transitionStatus:s}}function s5(n,e){n.useSyncedValues(e),Se(()=>()=>{n.update({activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un})},[n])}class ay{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){const r=this.idMap.get(e);r!==t&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function o5(){return new ah({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new ay,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function l5(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:o5(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un}}function a5(n,e,t=!1){return new ah({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:n,floatingId:e,syncOnly:!0,nested:t,onOpenChange:void 0})}const Ka=Te(n=>n.triggerIdProp??n.activeTriggerId),cy=Te(n=>n.openProp??n.open),Bw=Te(n=>{var t;return(((t=n.popupElement)==null?void 0:t.id)??n.floatingId)||void 0});function Ik(n,e){return e!==void 0&&cy(n)&&Ka(n)===e}function c5(n,e){return Ik(n,e)?!0:e!==void 0&&cy(n)&&Ka(n)==null&&n.triggerCount===1}const u5={open:cy,mounted:Te(n=>n.mounted),transitionStatus:Te(n=>n.transitionStatus),floatingRootContext:Te(n=>n.floatingRootContext),triggerCount:Te(n=>n.triggerCount),preventUnmountingOnClose:Te(n=>n.preventUnmountingOnClose),payload:Te(n=>n.payload),activeTriggerId:Ka,activeTriggerElement:Te(n=>n.mounted?n.activeTriggerElement:null),popupId:Bw,isTriggerActive:Te((n,e)=>e!==void 0&&Ka(n)===e),isOpenedByTrigger:Te((n,e)=>Ik(n,e)),isMountedByTrigger:Te((n,e)=>e!==void 0&&Ka(n)===e&&n.mounted),triggerProps:Te((n,e)=>e?n.activeTriggerProps:n.inactiveTriggerProps),triggerPopupId:Te((n,e)=>c5(n,e)?Bw(n):void 0),popupProps:Te(n=>n.popupProps),popupElement:Te(n=>n.popupElement),positionerElement:Te(n=>n.positionerElement)};function Dk(n){const{open:e=!1,onOpenChange:t,elements:r={}}=n,i=_l(),s=oh()!=null,o=Xn(()=>new ah({open:e,transitionStatus:void 0,onOpenChange:t,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ay,floatingId:i,syncOnly:!1,nested:s})).current;return Se(()=>{const a={open:e,floatingId:i};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=ut(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),o.update(a)},[e,i,r.reference,r.floating,o]),o.context.onOpenChange=t,o.context.nested=s,o}function f5(n={}){const{nodeId:e,externalTree:t}=n,r=Dk(n),i=n.rootContext||r,s=i.useState("referenceElement"),o=i.useState("floatingElement"),a=i.useState("domReferenceElement"),u=i.useState("open"),f=i.useState("floatingId"),[d,p]=b.useState(null),[g,y]=b.useState(void 0),[v,w]=b.useState(void 0),S=b.useRef(null),C=zl(t),R=b.useMemo(()=>({reference:s,floating:o,domReference:a}),[s,o,a]),T=D3({...n,elements:{...R,...d&&{reference:d}}}),M=ut(g)?g:null,A=v===void 0?i.state.floatingElement:v;i.useSyncedValue("referenceElement",g??null),i.useSyncedValue("domReferenceElement",g===void 0?a:M),i.useSyncedValue("floatingElement",A);const D=b.useCallback(j=>{const B=ut(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;p(B),T.refs.setReference(B)},[T.refs]),P=b.useCallback(j=>{(ut(j)||j===null)&&(S.current=j,y(j)),(ut(T.refs.reference.current)||T.refs.reference.current===null||j!==null&&!ut(j))&&T.refs.setReference(j)},[T.refs,y]),z=b.useCallback(j=>{w(j),T.refs.setFloating(j)},[T.refs]),H=b.useMemo(()=>({...T.refs,setReference:P,setFloating:z,setPositionReference:D,domReference:S}),[T.refs,P,z,D]),$=b.useMemo(()=>({...T.elements,domReference:a}),[T.elements,a]),Z=b.useMemo(()=>({...T,dataRef:i.context.dataRef,open:u,onOpenChange:i.setOpen,events:i.context.events,floatingId:f,refs:H,elements:$,nodeId:e,rootStore:i}),[T,H,$,e,i,u,f]);return Se(()=>{a&&(S.current=a)},[a]),Se(()=>{i.context.dataRef.current.floatingContext=Z;const j=C==null?void 0:C.nodesRef.current.find(B=>B.id===e);j&&(j.context=Z)}),b.useMemo(()=>({...T,context:Z,refs:H,elements:$,rootStore:i}),[T,H,$,Z,i])}const Fm=wA&&VS;function d5(n,e={}){const{enabled:t=!0,delay:r}=e,i="rootStore"in n?n.rootStore:n,{events:s,dataRef:o}=i.context,a=b.useRef(!1),u=b.useRef(null),f=b.useRef(!0),d=Gn();b.useEffect(()=>{const g=i.select("domReferenceElement");if(!t)return;const y=Et(g);function v(){const C=i.select("domReferenceElement");!i.select("open")&&Bt(C)&&C===cn(ot(C))&&(a.current=!0)}function w(){f.current=!0}function S(){f.current=!1}return oi(rt(y,"blur",v),Fm&&rt(y,"keydown",w,!0),Fm&&rt(y,"pointerdown",S,!0))},[i,t]),b.useEffect(()=>{if(!t)return;function g(y){if(y.reason===sc||y.reason===G0){const v=i.select("domReferenceElement");ut(v)&&(u.current=v,a.current=!0)}}return s.on("openchange",g),()=>{s.off("openchange",g)}},[s,t,i]);const p=b.useMemo(()=>{function g(){a.current=!1,u.current=null}return{onMouseLeave(){g()},onFocus(y){const v=y.currentTarget;if(a.current){if(u.current===v)return;g()}const w=on(y.nativeEvent);if(ut(w)){if(Fm&&!y.relatedTarget){if(!f.current&&!th(w))return}else if(!Zf(w))return}const S=Jf(y.relatedTarget,i.context.triggerElements),{nativeEvent:C,currentTarget:R}=y,T=typeof r=="function"?r():r;if(i.select("open")&&S||T===0||T===void 0){i.setOpen(!0,gt(Ff,C,R));return}d.start(T,()=>{a.current||i.setOpen(!0,gt(Ff,C,R))})},onBlur(y){g();const v=y.relatedTarget,w=y.nativeEvent,S=ut(v)&&v.hasAttribute(lc("focus-guard"))&&v.getAttribute("data-type")==="outside";d.start(0,()=>{var M;const C=i.select("domReferenceElement"),R=cn(ot(C));!v&&R===C||We((M=o.current.floatingContext)==null?void 0:M.refs.floating.current,R)||We(C,R)||S||Jf(v??R,i.context.triggerElements)||i.setOpen(!1,gt(Ff,w))})}}},[o,r,i,d]);return b.useMemo(()=>t?{reference:p,trigger:p}:{},[t,p])}class uy{constructor(){pt(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});pt(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Er,this.restTimeout=new Er,this.handleCloseOptions=void 0}static create(){return new uy}}const ld=new WeakMap;function ad(n){var t,r,i;if(!n.performedPointerEventsMutation)return;const e=n.pointerEventsScopeElement;e&&ld.get(e)===n&&((t=n.pointerEventsScopeElement)==null||t.style.removeProperty("pointer-events"),(r=n.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(i=n.pointerEventsFloatingElement)==null||i.style.removeProperty("pointer-events"),ld.delete(e)),n.performedPointerEventsMutation=!1,n.pointerEventsScopeElement=null,n.pointerEventsReferenceElement=null,n.pointerEventsFloatingElement=null}function Nk(n,e){const{scopeElement:t,referenceElement:r,floatingElement:i}=e,s=ld.get(t);s&&s!==n&&ad(s),ad(n),n.performedPointerEventsMutation=!0,n.pointerEventsScopeElement=t,n.pointerEventsReferenceElement=r,n.pointerEventsFloatingElement=i,ld.set(t,n),t.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function fy(n){const e=n.context.dataRef.current,t=Xn(()=>e.hoverInteractionState??uy.create()).current;return e.hoverInteractionState||(e.hoverInteractionState=t),Qd(e.hoverInteractionState.disposeEffect),e.hoverInteractionState}function h5(n,e={}){const{enabled:t=!0,closeDelay:r=0,nodeId:i}=e,s="rootStore"in n?n.rootStore:n,o=s.useState("open"),a=s.useState("floatingElement"),u=s.useState("domReferenceElement"),{dataRef:f}=s.context,d=zl(),p=oh(),g=fy(s),y=Gn(),v=Fe(()=>{var C;return qS((C=f.current.openEvent)==null?void 0:C.type,g.interactedInside)}),w=Fe(()=>{var C;return DA((C=f.current.openEvent)==null?void 0:C.type)}),S=Fe(()=>{ad(g)});Se(()=>{o||(g.pointerType=void 0,g.restTimeoutPending=!1,g.interactedInside=!1,S())},[o,g,S]),b.useEffect(()=>S,[S]),Se(()=>{var C,R,T,M,A;if(t&&o&&(C=g.handleCloseOptions)!=null&&C.blockPointerEvents&&w()&&ut(u)&&a){const D=u,P=a,z=ot(a),H=(T=(R=d==null?void 0:d.nodesRef.current.find(B=>B.id===p))==null?void 0:R.context)==null?void 0:T.elements.floating;H&&(H.style.pointerEvents="");const $=g.pointerEventsScopeElement!==P?g.pointerEventsScopeElement:null,Z=H!==P?H:null,j=((A=(M=g.handleCloseOptions)==null?void 0:M.getScope)==null?void 0:A.call(M))??$??Z??D.closest("[data-rootownerid]")??z.body;return Nk(g,{scopeElement:j,referenceElement:D,floatingElement:P}),()=>{S()}}},[t,o,u,a,g,w,d,p,S]),b.useEffect(()=>{if(!t)return;function C(){return!!(d&&p&&Bs(d.nodesRef.current,p).length>0)}function R(z){const H=td(r,"close",g.pointerType),$=()=>{s.setOpen(!1,gt(qn,z)),d==null||d.events.emit("floating.closed",z)};H?g.openChangeTimeout.start(H,$):(g.openChangeTimeout.clear(),$())}function T(z){const H=on(z);if(!PA(H)){g.interactedInside=!1;return}g.interactedInside=(H==null?void 0:H.closest("[aria-haspopup]"))!=null}function M(){g.openChangeTimeout.clear(),y.clear(),d==null||d.events.off("floating.closed",D),S()}function A(z){var j;if(C()&&d){d.events.on("floating.closed",D);return}if(Jf(z.relatedTarget,s.context.triggerElements))return;const H=((j=f.current.floatingContext)==null?void 0:j.nodeId)??i,$=z.relatedTarget;if(!(d&&H&&ut($)&&Bs(d.nodesRef.current,H,!1).some(B=>{var X;return We((X=B.context)==null?void 0:X.elements.floating,$)}))){if(g.handler){g.handler(z);return}S(),v()||R(z)}}function D(z){!d||!p||C()||y.start(0,()=>{d.events.off("floating.closed",D),s.setOpen(!1,gt(qn,z)),d.events.emit("floating.closed",z)})}const P=a;return oi(P&&rt(P,"mouseenter",M),P&&rt(P,"mouseleave",A),P&&rt(P,"pointerdown",T,!0),()=>{d==null||d.events.off("floating.closed",D)})},[t,a,s,f,r,i,v,S,g,d,p,y])}const p5={current:null};function m5(n,e={}){var _;const{enabled:t=!0,delay:r=0,handleClose:i=null,mouseOnly:s=!1,restMs:o=0,move:a=!0,triggerElementRef:u=p5,externalTree:f,isActiveTrigger:d=!0,getHandleCloseContext:p,isClosing:g,shouldOpen:y}=e,v="rootStore"in n?n.rootStore:n,{dataRef:w,events:S}=v.context,C=zl(f),R=fy(v),T=b.useRef(!1),M=sn(i),A=sn(r),D=sn(o),P=sn(t),z=sn(y),H=sn(g),$=Fe(()=>{var ne;return qS((ne=w.current.openEvent)==null?void 0:ne.type,R.interactedInside)}),Z=Fe(()=>{var ne;return((ne=z.current)==null?void 0:ne.call(z))!==!1}),j=Fe((ne,G,N)=>{const W=v.context.triggerElements;if(W.hasElement(G))return!ne||!We(ne,G);if(!ut(N))return!1;const F=N;return W.hasMatchingElement(I=>We(I,F))&&(!ne||!We(ne,F))}),B=Fe(()=>{if(!R.handler)return;ot(v.select("domReferenceElement")).removeEventListener("mousemove",R.handler),R.handler=void 0}),X=Fe(()=>{ad(R)});return d&&(R.handleCloseOptions=(_=M.current)==null?void 0:_.__options),b.useEffect(()=>B,[B]),b.useEffect(()=>{if(!t)return;function ne(G){G.open?T.current=!1:(T.current=G.reason===qn,B(),R.openChangeTimeout.clear(),R.restTimeout.clear(),R.blockMouseMove=!0,R.restTimeoutPending=!1)}return S.on("openchange",ne),()=>{S.off("openchange",ne)}},[t,S,R,B]),b.useEffect(()=>{if(!t)return;function ne(F,I=!0){const U=td(A.current,"close",R.pointerType);U?R.openChangeTimeout.start(U,()=>{v.setOpen(!1,gt(qn,F)),C==null||C.events.emit("floating.closed",F)}):I&&(R.openChangeTimeout.clear(),v.setOpen(!1,gt(qn,F)),C==null||C.events.emit("floating.closed",F))}const G=u.current??(d?v.select("domReferenceElement"):null);if(!ut(G))return;function N(F){var je;if(R.openChangeTimeout.clear(),R.blockMouseMove=!1,s&&!Ro(R.pointerType))return;const I=ow(D.current),U=td(A.current,"open",R.pointerType),q=on(F),Q=F.currentTarget??null,oe=v.select("domReferenceElement");let ie=Q;if(ut(q)&&!v.context.triggerElements.hasElement(q)){for(const Ne of v.context.triggerElements.elements())if(We(Ne,q)){ie=Ne;break}}ut(Q)&&ut(oe)&&!v.context.triggerElements.hasElement(Q)&&We(Q,oe)&&(ie=oe);const de=ie==null?!1:j(oe,ie,q),J=v.select("open"),ae=((je=H.current)==null?void 0:je.call(H))??v.select("transitionStatus")==="ending",pe=!J&&ae&&T.current,Re=!de&&ut(ie)&&ut(oe)&&We(oe,ie)&&pe,ce=I>0&&!U,ye=de&&(J||pe)||Re,be=!J||de;if(ye){Z()&&v.setOpen(!0,gt(qn,F,ie));return}ce||(U?R.openChangeTimeout.start(U,()=>{be&&Z()&&v.setOpen(!0,gt(qn,F,ie))}):be&&Z()&&v.setOpen(!0,gt(qn,F,ie)))}function W(F){if($()){X();return}B();const I=v.select("domReferenceElement"),U=ot(I);R.restTimeout.clear(),R.restTimeoutPending=!1;const q=w.current.floatingContext??(p==null?void 0:p());if(Jf(F.relatedTarget,v.context.triggerElements))return;if(M.current&&q){v.select("open")||R.openChangeTimeout.clear();const oe=u.current;R.handler=M.current({...q,tree:C,x:F.clientX,y:F.clientY,onClose(){X(),B(),P.current&&!$()&&oe===v.select("domReferenceElement")&&ne(F,!0)}}),U.addEventListener("mousemove",R.handler),R.handler(F);return}(R.pointerType==="touch"?!We(v.select("floatingElement"),F.relatedTarget):!0)&&ne(F)}return a?oi(rt(G,"mousemove",N,{once:!0}),rt(G,"mouseenter",N),rt(G,"mouseleave",W)):oi(rt(G,"mouseenter",N),rt(G,"mouseleave",W))},[B,X,w,A,v,t,M,R,d,j,$,s,a,D,u,C,P,p,H,Z]),b.useMemo(()=>{if(!t)return;function ne(G){R.pointerType=G.pointerType}return{onPointerDown:ne,onPointerEnter:ne,onMouseMove(G){var oe,ie,de;const{nativeEvent:N}=G,W=G.currentTarget,F=v.select("domReferenceElement"),I=v.select("open"),U=j(F,W,G.target);if(s&&!Ro(R.pointerType))return;if(I&&U&&((oe=R.handleCloseOptions)!=null&&oe.blockPointerEvents)){const J=v.select("floatingElement");if(J){const ae=((de=(ie=R.handleCloseOptions)==null?void 0:ie.getScope)==null?void 0:de.call(ie))??W.ownerDocument.body;Nk(R,{scopeElement:ae,referenceElement:W,floatingElement:J})}}const q=ow(D.current);if(I&&!U||q===0||!U&&R.restTimeoutPending&&G.movementX**2+G.movementY**2<2)return;R.restTimeout.clear();function Q(){if(R.restTimeoutPending=!1,$())return;const J=v.select("open");!R.blockMouseMove&&(!J||U)&&Z()&&v.setOpen(!0,gt(qn,N,W))}R.pointerType==="touch"?Ai.flushSync(()=>{Q()}):U&&I?Q():(R.restTimeoutPending=!0,R.restTimeout.start(q,Q))}}},[t,R,$,j,s,v,D,Z])}const g5="Escape";function ch(n,e,t){switch(n){case"vertical":return e;case"horizontal":return t;default:return e||t}}function ef(n,e){return ch(e,n===K0||n===Ic,n===Is||n===Ds)}function jm(n,e,t){return ch(e,n===Ic,t?n===Is:n===Ds)||n==="Enter"||n===" "||n===""}function y5(n,e,t){return ch(e,t?n===Is:n===Ds,n===Ic)}function v5(n,e,t,r){const i=t?n===Ds:n===Is,s=n===K0;return e==="both"||e==="horizontal"&&r&&r>1?n===g5:ch(e,i,s)}function x5(n,e){const{listRef:t,activeIndex:r,onNavigate:i=()=>{},enabled:s=!0,selectedIndex:o=null,allowEscape:a=!1,loopFocus:u=!1,nested:f=!1,rtl:d=!1,virtual:p=!1,focusItemOnOpen:g="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:v=!0,disabledIndices:w=void 0,orientation:S="vertical",parentOrientation:C,cols:R=1,id:T,resetOnPointerLeave:M=!0,externalTree:A}=e,D="rootStore"in n?n.rootStore:n,P=D.useState("open"),z=D.useState("floatingElement"),H=D.useState("domReferenceElement"),$=D.context.dataRef,Z=ed(z),j=Ag(H),B=sn(Z),X=oh(),_=zl(A),ne=b.useRef(g),G=b.useRef(o??-1),N=b.useRef(null),W=b.useRef(!0),F=Fe(we=>{i(G.current===-1?null:G.current,we)}),I=b.useRef(F),U=b.useRef(!!z),q=b.useRef(P),Q=b.useRef(!1),oe=b.useRef(!1),ie=b.useRef(null),de=sn(w),J=sn(P),ae=sn(o),pe=sn(M),Re=Ls(),ce=Ls(),ye=Fe(()=>{function we(ve){p?_==null||_.events.emit("virtualfocus",ve):ie.current=jf(ve,{sync:Q.current,preventScroll:!0})}const Y=t.current[G.current],se=oe.current;Y&&we(Y),(Q.current?ve=>ve():ve=>Re.request(ve))(()=>{var Ve;const ve=t.current[G.current]||Y;if(!ve)return;Y||we(ve),Ce&&(se||!W.current)&&((Ve=ve.scrollIntoView)==null||Ve.call(ve,{block:"nearest",inline:"nearest"}))})});Se(()=>{$.current.orientation=S},[$,S]),Se(()=>{s&&(P&&z?(G.current=o??-1,ne.current&&o!=null&&(oe.current=!0,F())):U.current&&(G.current=-1,I.current()))},[s,P,z,o,F]),Se(()=>{if(s){if(!P){Q.current=!1;return}if(z)if(r==null){if(Q.current=!1,ae.current!=null)return;if(U.current&&(G.current=-1,ye()),(!q.current||!U.current)&&ne.current&&(N.current!=null||ne.current===!0&&N.current==null)){let we=0;const Y=()=>{t.current[0]==null?(we<2&&(we?le=>ce.request(le):queueMicrotask)(Y),we+=1):(G.current=N.current==null||jm(N.current,S,d)||f?Em(t):fw(t),N.current=null,F())};Y()}}else rd(t.current,r)||(G.current=r,ye(),oe.current=!1)}},[s,P,z,r,ae,f,t,S,d,F,ye,ce]),Se(()=>{var ve,Le;if(!s||z||!_||p||!U.current)return;const we=_.nodesRef.current,Y=(Le=(ve=we.find(Ve=>Ve.id===X))==null?void 0:ve.context)==null?void 0:Le.elements.floating,se=cn(ot(z)),le=we.some(Ve=>Ve.context&&We(Ve.context.elements.floating,se));Y&&!le&&W.current&&Y.focus({preventScroll:!0})},[s,z,_,X,p]),Se(()=>{I.current=F,q.current=P,U.current=!!z}),Se(()=>{P||(N.current=null,ne.current=g)},[P,g]);const be=r!=null,je=Fe(we=>{if(!J.current)return;const Y=t.current.indexOf(we.currentTarget);Y!==-1&&(G.current!==Y||r!==Y)&&(G.current=Y,F(we))}),Ne=Fe(()=>{var we,Y,se;return C??((se=(Y=(we=_==null?void 0:_.nodesRef.current.find(le=>le.id===X))==null?void 0:we.context)==null?void 0:Y.dataRef)==null?void 0:se.current.orientation)}),ke=Fe(()=>Em(t,de.current)),Ie=Fe(we=>{if(W.current=!1,Q.current=!0,we.which===229||!J.current&&we.currentTarget===B.current)return;if(f&&v5(we.key,S,d,R)){ef(we.key,Ne())||Sr(we),D.setOpen(!1,gt(aw,we.nativeEvent)),Bt(H)&&(p?_==null||_.events.emit("virtualfocus",H):H.focus());return}const Y=G.current,se=Em(t,w),le=fw(t,w);if(j||(we.key==="Home"&&(Sr(we),G.current=se,F(we)),we.key==="End"&&(Sr(we),G.current=le,F(we))),R>1){const ve=Array.from({length:t.current.length},()=>({width:1,height:1})),Le=iP(ve,R),Ve=Le.findIndex(ht=>ht!=null&&!pl(t.current,ht,w)),Ue=Le.reduce((ht,st,Pt)=>st!=null&&!pl(t.current,st,w)?Pt:ht,-1),it=Le[rP(Le.map(ht=>ht!=null?t.current[ht]:null),{event:we,orientation:S,loopFocus:u,rtl:d,cols:R,disabledIndices:oP([...(typeof w!="function"?w:null)||t.current.map((ht,st)=>pl(t.current,st,w)?st:void 0),void 0],Le),minIndex:Ve,maxIndex:Ue,prevIndex:sP(G.current>le?se:G.current,ve,Le,R,we.key===Ic?"bl":we.key===(d?Is:Ds)?"tr":"tl"),stopEvent:!0})];if(it!=null&&(G.current=it,F(we)),S==="both")return}if(ef(we.key,S)){if(Sr(we),P&&!p&&cn(we.currentTarget.ownerDocument)===we.currentTarget){G.current=jm(we.key,S,d)?se:le,F(we);return}jm(we.key,S,d)?u?Y>=le?a&&Y!==t.current.length?G.current=-1:(Q.current=!1,G.current=se):G.current=Un(t.current,{startingIndex:Y,disabledIndices:w}):G.current=Math.min(le,Un(t.current,{startingIndex:Y,disabledIndices:w})):u?Y<=se?a&&Y!==-1?G.current=t.current.length:(Q.current=!1,G.current=le):G.current=Un(t.current,{startingIndex:Y,decrement:!0,disabledIndices:w}):G.current=Math.max(se,Un(t.current,{startingIndex:Y,decrement:!0,disabledIndices:w})),rd(t.current,G.current)&&(G.current=-1),F(we)}}),Ce=b.useMemo(()=>({onFocus(Y){Q.current=!0,je(Y)},onClick:({currentTarget:Y})=>Y.focus({preventScroll:!0}),onMouseMove(Y){Q.current=!0,oe.current=!1,y&&je(Y)},onPointerLeave(Y){var le;if(!J.current||!W.current||Y.pointerType==="touch")return;Q.current=!0;const se=Y.relatedTarget;if(!(!y||t.current.includes(se))&&pe.current&&((le=ie.current)==null||le.call(ie),ie.current=null,G.current=-1,F(Y),!p)){const ve=B.current,Le=cn(ot(ve));ve&&We(ve,Le)&&ve.focus({preventScroll:!0})}}}),[je,J,B,y,t,F,pe,p]),Ke=b.useMemo(()=>p&&P&&be&&{"aria-activedescendant":`${T}-${r}`},[p,P,be,T,r]),He=b.useMemo(()=>({"aria-orientation":S==="both"?void 0:S,...j?{}:Ke,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&P&&!p){const Y=on(we.nativeEvent);if(Y&&!We(B.current,Y))return;Sr(we),D.setOpen(!1,gt(nh,we.nativeEvent)),Bt(H)&&H.focus();return}Ie(we)},onPointerMove(){W.current=!0}}),[Ke,Ie,B,S,j,D,P,p,H]),Je=b.useMemo(()=>{function we(le){D.setOpen(!0,gt(aw,le.nativeEvent,le.currentTarget))}function Y(le){g==="auto"&&$0(le.nativeEvent)&&(ne.current=!p)}function se(le){ne.current=g,g==="auto"&&HS(le.nativeEvent)&&(ne.current=!0)}return{onKeyDown(le){const ve=D.select("open");W.current=!1;const Le=le.key.startsWith("Arrow"),Ve=y5(le.key,Ne(),d),Ue=ef(le.key,S),it=(f?Ve:Ue)||le.key==="Enter"||le.key.trim()==="";if(p&&ve)return Ie(le);if(!(!ve&&!v&&Le)){if(it){const ht=ef(le.key,Ne());N.current=f&&ht?null:le.key}if(f){Ve&&(Sr(le),ve?(G.current=ke(),F(le)):we(le));return}Ue&&(ae.current!=null&&(G.current=ae.current),Sr(le),!ve&&v?we(le):Ie(le),ve&&F(le))}},onFocus(le){D.select("open")&&!p&&(G.current=-1,F(le))},onPointerDown:se,onPointerEnter:se,onMouseDown:Y,onClick:Y}},[Ie,g,ke,f,F,D,v,S,Ne,d,ae,p]),$e=b.useMemo(()=>({...Ke,...Je}),[Ke,Je]);return b.useMemo(()=>s?{reference:$e,floating:He,item:Ce,trigger:Je}:{},[s,$e,He,Je,Ce])}function w5(n,e){const{listRef:t,elementsRef:r,activeIndex:i,onMatch:s,onTyping:o,enabled:a=!0,resetMs:u=750,selectedIndex:f=null}=e,d="rootStore"in n?n.rootStore:n,p=d.useState("open"),g=Gn(),y=b.useRef(""),v=b.useRef(f??i??-1),w=b.useRef(null),S=Fe(T=>{function M(j){const B=r==null?void 0:r.current[j];return!B||ih(B)}function A(j,B,X=0){if(j.length===0)return-1;const _=(X%j.length+j.length)%j.length,ne=B.toLocaleLowerCase();for(let G=0;G<j.length;G+=1){const N=(_+G)%j.length,W=j[N];if(!(!(W!=null&&W.toLocaleLowerCase().startsWith(ne))||!M(N)))return N}return-1}const D=t.current;if(y.current.length>0&&T.key===" "&&(Sr(T),o==null||o(!0)),y.current.length>0&&y.current[0]!==" "&&A(D,y.current)===-1&&T.key!==" "&&(o==null||o(!1)),D==null||T.key.length!==1||T.ctrlKey||T.metaKey||T.altKey)return;p&&T.key!==" "&&(Sr(T),o==null||o(!0));const P=y.current==="";P&&(v.current=f??i??-1),D.every(j=>{var B,X;return j?((B=j[0])==null?void 0:B.toLocaleLowerCase())!==((X=j[1])==null?void 0:X.toLocaleLowerCase()):!0})&&y.current===T.key&&(y.current="",v.current=w.current),y.current+=T.key,g.start(u,()=>{y.current="",v.current=w.current,o==null||o(!1)});const $=((P?f??i??-1:v.current)??0)+1,Z=A(D,y.current,$);Z!==-1?(s==null||s(Z),w.current=Z):T.key!==" "&&(y.current="",o==null||o(!1))}),C=Fe(T=>{const M=T.relatedTarget,A=d.select("domReferenceElement"),D=d.select("floatingElement");We(A,M)||We(D,M)||(g.clear(),y.current="",v.current=w.current,o==null||o(!1))});Se(()=>{!p&&f!==null||(g.clear(),w.current=null,y.current!==""&&(y.current=""))},[p,f,g]),Se(()=>{p&&y.current===""&&(v.current=f??i??-1)},[p,f,i]);const R=b.useMemo(()=>({onKeyDown:S,onBlur:C}),[S,C]);return b.useMemo(()=>a?{reference:R,floating:R}:{},[a,R])}const Fw=.1,b5=Fw*Fw,Tt=.5;function tf(n,e,t,r,i,s){return r>=e!=s>=e&&n<=(i-t)*(e-r)/(s-r)+t}function nf(n,e,t,r,i,s,o,a,u,f){let d=!1;return tf(n,e,t,r,i,s)&&(d=!d),tf(n,e,i,s,o,a)&&(d=!d),tf(n,e,o,a,u,f)&&(d=!d),tf(n,e,u,f,t,r)&&(d=!d),d}function S5(n,e,t){return n>=t.x&&n<=t.x+t.width&&e>=t.y&&e<=t.y+t.height}function rf(n,e,t,r,i,s){const o=Math.min(t,i),a=Math.max(t,i),u=Math.min(r,s),f=Math.max(r,s);return n>=o&&n<=a&&e>=u&&e<=f}function k5(n={}){const{blockPointerEvents:e=!1}=n,t=new Er,r=({x:i,y:s,placement:o,elements:a,onClose:u,nodeId:f,tree:d})=>{const p=o==null?void 0:o.split("-")[0];let g=!1,y=null,v=null,w=typeof performance<"u"?performance.now():0;function S(R,T){const M=performance.now(),A=M-w;if(y===null||v===null||A===0)return y=R,v=T,w=M,!1;const D=R-y,P=T-v,z=D*D+P*P,H=A*A*b5;return y=R,v=T,w=M,z<H}function C(){t.clear(),u()}return function(T){t.clear();const M=a.domReference,A=a.floating;if(!M||!A||p==null||i==null||s==null)return;const{clientX:D,clientY:P}=T,z=on(T),H=T.type==="mouseleave",$=We(A,z),Z=We(M,z);if($&&(g=!0,!H))return;if(Z&&(g=!1,!H)){g=!0;return}if(H&&ut(T.relatedTarget)&&We(A,T.relatedTarget))return;function j(){return!!(d&&Bs(d.nodesRef.current,f).length>0)}function B(){j()||C()}if(j())return;const X=M.getBoundingClientRect(),_=A.getBoundingClientRect(),ne=i>_.right-_.width/2,G=s>_.bottom-_.height/2,N=_.width>X.width,W=_.height>X.height,F=(N?X:_).left,I=(N?X:_).right,U=(W?X:_).top,q=(W?X:_).bottom;if(p==="top"&&s>=X.bottom-1||p==="bottom"&&s<=X.top+1||p==="left"&&i>=X.right-1||p==="right"&&i<=X.left+1){B();return}let Q=!1;switch(p){case"top":Q=rf(D,P,F,X.top+1,I,_.bottom-1);break;case"bottom":Q=rf(D,P,F,_.top+1,I,X.bottom-1);break;case"left":Q=rf(D,P,_.right-1,q,X.left+1,U);break;case"right":Q=rf(D,P,X.right-1,q,_.left+1,U);break}if(Q)return;if(g&&!S5(D,P,X)){B();return}if(!H&&S(D,P)){B();return}let oe=!1;switch(p){case"top":{const ie=N?Tt/2:Tt*4,de=N||ne?i+ie:i-ie,J=N?i-ie:ne?i+ie:i-ie,ae=s+Tt+1,pe=ne||N?_.bottom-Tt:_.top,Re=ne?N?_.bottom-Tt:_.top:_.bottom-Tt;oe=nf(D,P,de,ae,J,ae,_.left,pe,_.right,Re);break}case"bottom":{const ie=N?Tt/2:Tt*4,de=N||ne?i+ie:i-ie,J=N?i-ie:ne?i+ie:i-ie,ae=s-Tt,pe=ne||N?_.top+Tt:_.bottom,Re=ne?N?_.top+Tt:_.bottom:_.top+Tt;oe=nf(D,P,de,ae,J,ae,_.left,pe,_.right,Re);break}case"left":{const ie=W?Tt/2:Tt*4,de=W||G?s+ie:s-ie,J=W?s-ie:G?s+ie:s-ie,ae=i+Tt+1,pe=G||W?_.right-Tt:_.left,Re=G?W?_.right-Tt:_.left:_.right-Tt;oe=nf(D,P,pe,_.top,Re,_.bottom,ae,de,ae,J);break}case"right":{const ie=W?Tt/2:Tt*4,de=W||G?s+ie:s-ie,J=W?s-ie:G?s+ie:s-ie,ae=i-Tt,pe=G||W?_.left+Tt:_.right,Re=G?W?_.left+Tt:_.right:_.left+Tt;oe=nf(D,P,ae,de,ae,J,pe,_.top,Re,_.bottom);break}}oe?g||t.start(40,B):B()}};return r.__options={...n,blockPointerEvents:e},r}const C5={...u5,disabled:Te(n=>n.disabled),instantType:Te(n=>n.instantType),isInstantPhase:Te(n=>n.isInstantPhase),trackCursorAxis:Te(n=>n.trackCursorAxis),disableHoverablePopup:Te(n=>n.disableHoverablePopup),lastOpenChangeReason:Te(n=>n.openChangeReason),closeOnClick:Te(n=>n.closeOnClick),closeDelay:Te(n=>n.closeDelay),hasViewport:Te(n=>n.hasViewport)};class dy extends oy{constructor(t,r,i=!1){const s=new ay,o={...E5(),...t};o.floatingRootContext=a5(s,r,i);super(o,{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:s},C5);pt(this,"setOpen",(t,r)=>{var f,d;const i=r.reason,s=i===qn,o=t&&i===Ff,a=!t&&(i===sc||i===G0);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(d=(f=this.context).onOpenChange)==null||d.call(f,t,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,r);const u=()=>{const p={open:t,openChangeReason:i};o?p.instantType="focus":a?p.instantType="dismiss":i===qn&&(p.instantType=void 0),t5(p,t,r.trigger),this.update(p)};s?Ai.flushSync(u):u()})}cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,gt(sc,t))}static useStore(t,r){return Z3(t,(s,o)=>new dy(r,s,o)).store}}function E5(){return{...l5(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const R5=LS(function(e){const{disabled:t=!1,defaultOpen:r=!1,open:i,disableHoverablePopup:s=!1,trackCursorAxis:o="none",actionsRef:a,onOpenChange:u,onOpenChangeComplete:f,handle:d,triggerId:p,defaultTriggerId:g=null,children:y}=e,v=dy.useStore(d==null?void 0:d.store,{open:r,openProp:i,activeTriggerId:g,triggerIdProp:p});BS(()=>{i===void 0&&v.state.open===!1&&r===!0&&v.update({open:!0,activeTriggerId:g})}),v.useControlledProp("openProp",i),v.useControlledProp("triggerIdProp",p),v.useContextCallback("onOpenChange",u),v.useContextCallback("onOpenChangeComplete",f);const w=v.useState("open"),S=!t&&w,C=v.useState("activeTriggerId"),R=v.useState("mounted"),T=v.useState("payload");v.useSyncedValues({trackCursorAxis:o,disableHoverablePopup:s}),v.useSyncedValue("disabled",t),r5(v);const{forceUnmount:M,transitionStatus:A}=i5(S,v),D=v.useState("isInstantPhase"),P=v.useState("instantType"),z=v.useState("lastOpenChangeReason"),H=b.useRef(null);Se(()=>{w&&t&&v.setOpen(!1,gt(LA))},[w,t,v]),Se(()=>{A==="ending"&&z===Do||A!=="ending"&&D?(P!=="delay"&&(H.current=P),v.set("instantType","delay")):H.current!==null&&(v.set("instantType",H.current),H.current=null)},[A,D,z,P,v]),Se(()=>{S&&C==null&&v.set("payload",void 0)},[v,C,S]);const $=b.useCallback(()=>{v.setOpen(!1,gt(BA))},[v]);b.useImperativeHandle(a,()=>({unmount:M,close:$}),[M,$]);const Z=S||R||!t&&o!=="none";return E.jsxs(FS.Provider,{value:v,children:[Z&&E.jsx(T5,{store:v,disabled:t,trackCursorAxis:o}),typeof y=="function"?y({payload:T}):y]})});function T5({store:n,disabled:e,trackCursorAxis:t}){const r=n.useState("floatingRootContext"),i=vk(r,{enabled:!e,referencePress:()=>n.select("closeOnClick")}),s=QP(r,{enabled:!e&&t!=="none",axis:t==="none"?void 0:t}),o=b.useMemo(()=>li(s.reference,i.reference),[s.reference,i.reference]),a=b.useMemo(()=>li(s.trigger,i.trigger),[s.trigger,i.trigger]),u=b.useMemo(()=>li(Pk,s.floating,i.floating),[s.floating,i.floating]);return s5(n,{activeTriggerProps:o,inactiveTriggerProps:a,popupProps:u}),null}let hy=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=ac.startingStyle]="startingStyle",n[n.endingStyle=ac.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n.side="data-side",n.align="data-align",n})({}),cd=(function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n})({});const O5={[cd.popupOpen]:""},M5={[cd.popupOpen]:"",[cd.pressed]:""},A5={[hy.open]:""},P5={[hy.closed]:""},I5={[hy.anchorHidden]:""},Lk={open(n){return n?O5:null}},D5={open(n){return n?M5:null}},py={open(n){return n?A5:P5},anchorHidden(n){return n?I5:null}};function cc(n){return _l(n,"base-ui")}const Bk=b.createContext(void 0);function N5(){return b.useContext(Bk)}let L5=(function(n){return n[n.popupOpen=cd.popupOpen]="popupOpen",n.triggerDisabled="data-trigger-disabled",n})({});const B5=600,Fk="data-base-ui-tooltip-trigger";function jw(n){if("composedPath"in n){const t=n.composedPath();for(let r=0;r<t.length;r+=1){const i=t[r];if(ut(i))return i}}const e=n.target;return ut(e)?e:null}function F5(n){let e=n;for(;e;){if(e.hasAttribute(Fk))return e;const t=e.parentElement;if(t){e=t;continue}const r=e.getRootNode();e="host"in r&&ut(r.host)?r.host:null}return null}const j5=mA(function(e,t){const{render:r,className:i,style:s,handle:o,payload:a,disabled:u,delay:f,closeOnClick:d=!0,closeDelay:p,id:g,...y}=e,v=Pc(!0),w=(o==null?void 0:o.store)??v;if(!w)throw new Error(Pn(82));const S=cc(g),C=w.useState("isTriggerActive",S),R=w.useState("isOpenedByTrigger",S),T=w.useState("floatingRootContext"),M=b.useRef(null),A=f??B5,D=p??0,{registerTrigger:P,isMountedByThisTrigger:z}=n5(S,M,w,{payload:a,closeOnClick:d,closeDelay:D}),H=N5(),{delayRef:$,isInstantPhase:Z,hasProvider:j}=_A(T,{open:R}),B=fy(T);w.useSyncedValue("isInstantPhase",Z);const X=w.useState("disabled"),_=u??X,ne=sn(_),G=w.useState("trackCursorAxis"),N=w.useState("disableHoverablePopup"),W=b.useRef(!1),F=Gn(),I=b.useRef(void 0);function U(){const ce=H==null?void 0:H.delay,ye=typeof $.current=="object"?$.current.open:void 0;let be=A;return j&&(ye!==0?be=f??ce??A:be=0),be}function q(ce){const ye=M.current;if(!ye||!ce)return!1;const be=F5(ce);return be!==null&&be!==ye&&We(ye,be)}function Q(ce){const ye=q(ce);return W.current=ye,ye&&(B.openChangeTimeout.clear(),B.restTimeout.clear(),B.restTimeoutPending=!1,F.clear()),ye}const oe=m5(T,{enabled:!_,mouseOnly:!0,move:!1,handleClose:!N&&G!=="both"?k5():null,restMs:U,delay(){const ce=typeof $.current=="object"?$.current.close:void 0;let ye=D;return p==null&&j&&(ye=ce),{close:ye}},triggerElementRef:M,isActiveTrigger:C,isClosing:()=>w.select("transitionStatus")==="ending",shouldOpen(){return!W.current}}),ie=d5(T,{enabled:!_}).reference,de=ce=>{const ye=W.current,be=jw(ce),je=Q(be),Ne=M.current,ke=Ne&&be&&We(Ne,be);if(je&&w.select("open")&&w.select("lastOpenChangeReason")===qn){w.setOpen(!1,gt(qn,ce));return}if(ye&&!je&&ke&&!ne.current&&!w.select("open")&&Ne&&Ro(I.current)){const Ie=()=>{!W.current&&!ne.current&&!w.select("open")&&w.setOpen(!0,gt(qn,ce,Ne))},Ce=U();Ce===0?(F.clear(),Ie()):F.start(Ce,Ie)}},J=w.useState("triggerProps",z);return qt("button",e,{state:{open:R},ref:[t,P,M],props:[oe,ie,z||G!=="none"?J:void 0,{onMouseOver(ce){de(ce.nativeEvent)},onFocus(ce){q(jw(ce.nativeEvent))&&ce.preventBaseUIHandler()},onMouseLeave(){W.current=!1,F.clear(),I.current=void 0},onPointerEnter(ce){I.current=ce.pointerType},onPointerDown(ce){I.current=ce.pointerType,w.set("closeOnClick",d),d&&!w.select("open")&&w.cancelPendingOpen(ce.nativeEvent)},onClick(ce){d&&!w.select("open")&&w.cancelPendingOpen(ce.nativeEvent)},id:S,[L5.triggerDisabled]:_?"":void 0,[Fk]:_?void 0:""},y],stateAttributesMapping:Lk})}),jk=b.createContext(void 0);function _5(){const n=b.useContext(jk);if(n===void 0)throw new Error(Pn(70));return n}const _k=b.forwardRef(function(e,t){const{children:r,container:i,className:s,render:o,style:a,...u}=e,{portalNode:f,portalSubtree:d}=yk({container:i,ref:t,componentProps:e,elementProps:u});return!d&&!f?null:E.jsxs(b.Fragment,{children:[d,f&&Ai.createPortal(r,f)]})}),z5=b.forwardRef(function(e,t){const{keepMounted:r=!1,...i}=e;return Pc().useState("mounted")||r?E.jsx(jk.Provider,{value:r,children:E.jsx(_k,{ref:t,...i})}):null}),zk=b.createContext(void 0);function Vk(){const n=b.useContext(zk);if(n===void 0)throw new Error(Pn(71));return n}const V5=b.createContext(void 0);function my(){const n=b.useContext(V5);return(n==null?void 0:n.direction)??"ltr"}const W5=n=>({name:"arrow",options:n,async fn(e){var W,F;const{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:u}=e,{element:f,padding:d=0,offsetParent:p="real"}=Zi(n,e)||{};if(f==null)return{};const g=JS(d),y={x:t,y:r},v=Z0(i),w=J0(v),S=await o.getDimensions(f),C=v==="y",R=C?"top":"left",T=C?"bottom":"right",M=C?"clientHeight":"clientWidth",A=s.reference[w]+s.reference[v]-y[v]-s.floating[w],D=y[v]-s.reference[v],P=p==="real"?await((W=o.getOffsetParent)==null?void 0:W.call(o,f)):a.floating;let z=a.floating[M]||s.floating[w];(!z||!await((F=o.isElement)==null?void 0:F.call(o,P)))&&(z=a.floating[M]||s.floating[w]);const H=A/2-D/2,$=z/2-S[w]/2-1,Z=Math.min(g[R],$),j=Math.min(g[T],$),B=Z,X=z-S[w]-j,_=z/2-S[w]/2+H,ne=Pg(B,_,X),G=!u.arrow&&Us(i)!=null&&_!==ne&&s.reference[w]/2-(_<B?Z:j)-S[w]/2<0,N=G?_<B?_-B:_-X:0;return{[v]:y[v]+N,data:{[v]:ne,centerOffset:_-ne-N,...G&&{alignmentOffset:N}},reset:G}}}),H5=(n,e)=>({...W5(n),options:[n,e]}),$5={name:"hide",async fn(n){var a;const{width:e,height:t,x:r,y:i}=n.rects.reference,s=e===0&&t===0&&r===0&&i===0;return{data:{referenceHidden:((a=(await _3().fn(n)).data)==null?void 0:a.referenceHidden)||s}}}},zf={sideX:"left",sideY:"top"},U5={name:"adaptiveOrigin",async fn(n){var R,T;const{x:e,y:t,rects:{floating:r},elements:{floating:i},platform:s,strategy:o,placement:a}=n,u=Et(i),f=u.getComputedStyle(i);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:e,y:t,data:zf};const p=await((R=s.getOffsetParent)==null?void 0:R.call(s,i));let g={width:0,height:0};if(o==="fixed"&&(u!=null&&u.visualViewport))g={width:u.visualViewport.width,height:u.visualViewport.height};else if(p===u){const M=ot(i);g={width:M.documentElement.clientWidth,height:M.documentElement.clientHeight}}else await((T=s.isElement)==null?void 0:T.call(s,p))&&(g=await s.getDimensions(p));const y=ur(a);let v=e,w=t;y==="left"&&(v=g.width-(e+r.width)),y==="top"&&(w=g.height-(t+r.height));const S=y==="left"?"right":zf.sideX,C=y==="top"?"bottom":zf.sideY;return{x:v,y:w,data:{sideX:S,sideY:C}}}};function Wk(n,e,t){const r=n==="inline-start"||n==="inline-end";return{top:"top",right:r?t?"inline-start":"inline-end":"right",bottom:"bottom",left:r?t?"inline-end":"inline-start":"left"}[e]}function _w(n,e,t){const{rects:r,placement:i}=n;return{side:Wk(e,ur(i),t),align:Us(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Hk(n){var kt,St;const{anchor:e,positionMethod:t="absolute",side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,collisionBoundary:a,collisionPadding:u=5,sticky:f=!1,arrowPadding:d=5,disableAnchorTracking:p=!1,inline:g,keepMounted:y=!1,floatingRootContext:v,mounted:w,collisionAvoidance:S,shiftCrossAxis:C=!1,nodeId:R,adaptiveOrigin:T,lazyFlip:M=!1,externalTree:A}=n,[D,P]=b.useState(null);!w&&D!==null&&P(null);const z=S.side||"flip",H=S.align||"flip",$=S.fallbackAxisSide||"end",Z=typeof e=="function"?e:void 0,j=Fe(Z),B=Z?j:e,X=sn(e),_=sn(w),G=my()==="rtl",N=D||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":G?"left":"right","inline-start":G?"right":"left"}[r],W=s==="center"?N:`${N}-${s}`;let F=u;const I=1,U=r==="bottom"?I:0,q=r==="top"?I:0,Q=r==="right"?I:0,oe=r==="left"?I:0;typeof F=="number"?F={top:F+U,right:F+oe,bottom:F+q,left:F+Q}:F&&(F={top:(F.top||0)+U,right:(F.right||0)+oe,bottom:(F.bottom||0)+q,left:(F.left||0)+Q});const ie={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:F},de=b.useRef(null),J=sn(i),ae=sn(o),pe=typeof i!="function"?i:0,Re=typeof o!="function"?o:0,ce=[];g&&ce.push(g),ce.push(N3(qe=>{const at=_w(qe,r,G),Vt=typeof J.current=="function"?J.current(at):J.current,wt=typeof ae.current=="function"?ae.current(at):ae.current;return{mainAxis:Vt,crossAxis:wt,alignmentAxis:wt}},[pe,Re,G,r]));const ye=H==="none"&&z!=="shift",be=!ye&&(f||C||z==="shift"),je=z==="none"?null:F3({...ie,padding:{top:F.top+I,right:F.right+I,bottom:F.bottom+I,left:F.left+I},mainAxis:!C&&z==="flip",crossAxis:H==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),Ne=ye?null:L3(qe=>{const at=ot(qe.elements.floating).documentElement;return{...ie,rootBoundary:C?{x:0,y:0,width:at.clientWidth,height:at.clientHeight}:void 0,mainAxis:H!=="none",crossAxis:be,limiter:f||C?void 0:B3(Vt=>{if(!de.current)return{};const{width:wt,height:Kt}=de.current.getBoundingClientRect(),Dt=Br(ur(Vt.placement)),In=Dt==="y"?wt:Kt,Cn=Dt==="y"?F.left+F.right:F.top+F.bottom;return{offset:In/2+Cn/2}})}},[ie,f,C,F,H]);z==="shift"||H==="shift"||s==="center"?ce.push(Ne,je):ce.push(je,Ne),ce.push(j3({...ie,apply({elements:{floating:qe},availableWidth:at,availableHeight:Vt,rects:wt}){if(!_.current)return;const Kt=qe.style;Kt.setProperty("--available-width",`${at}px`),Kt.setProperty("--available-height",`${Vt}px`);const Dt=Et(qe).devicePixelRatio||1,{x:In,y:Cn,width:En,height:hr}=wt.reference,Ur=(Math.round((In+En)*Dt)-Math.round(In*Dt))/Dt,pr=(Math.round((Cn+hr)*Dt)-Math.round(Cn*Dt))/Dt;Kt.setProperty("--anchor-width",`${Ur}px`),Kt.setProperty("--anchor-height",`${pr}px`)}}),H5(qe=>({element:de.current||ot(qe.elements.floating).createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(qe){var No,Lo,Wc;const{elements:at,middlewareData:Vt,placement:wt,rects:Kt,y:Dt}=qe,In=ur(wt),Cn=Br(In),En=de.current,hr=((No=Vt.arrow)==null?void 0:No.x)||0,Ur=((Lo=Vt.arrow)==null?void 0:Lo.y)||0,pr=(En==null?void 0:En.clientWidth)||0,Dn=(En==null?void 0:En.clientHeight)||0,Nn=hr+pr/2,tt=Ur+Dn/2,Rt=Math.abs(((Wc=Vt.shift)==null?void 0:Wc.y)||0),Qt=Kt.reference.height/2,fn=typeof i=="function"?i(_w(qe,r,G)):i,qr=Rt>fn,Kr={top:`${Nn}px calc(100% + ${fn}px)`,bottom:`${Nn}px ${-fn}px`,left:`calc(100% + ${fn}px) ${tt}px`,right:`${-fn}px ${tt}px`}[In],Or=`${Nn}px ${Kt.reference.y+Qt-Dt}px`;return at.floating.style.setProperty("--transform-origin",be&&Cn==="y"&&qr?Or:Kr),{}}},$5,T),Se(()=>{!w&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[w,v]);const ke=b.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:Ie,elements:Ce,x:Ke,y:He,middlewareData:Je,update:$e,placement:we,context:Y,isPositioned:se,floatingStyles:le}=f5({rootContext:v,open:y?w:void 0,placement:W,middleware:ce,strategy:t,whileElementsMounted:y?void 0:(...qe)=>Aw(...qe,ke),nodeId:R,externalTree:A}),{sideX:ve,sideY:Le}=Je.adaptiveOrigin||zf,Ve=se?t:"fixed",Ue=b.useMemo(()=>{const qe=T?{position:Ve,[ve]:Ke,[Le]:He}:{position:Ve,...le};return se||(qe.opacity=0),qe},[T,Ve,ve,Ke,Le,He,le,se]),it=b.useRef(null);Se(()=>{if(!w)return;const qe=X.current,at=typeof qe=="function"?qe():qe,wt=(zw(at)?at.current:at)||null||null;wt!==it.current&&(Ie.setPositionReference(wt),it.current=wt)},[w,Ie,B,X]),b.useEffect(()=>{if(!w)return;const qe=X.current;typeof qe!="function"&&zw(qe)&&qe.current!==it.current&&(Ie.setPositionReference(qe.current),it.current=qe.current)},[w,Ie,B,X]),b.useEffect(()=>{if(y&&w&&Ce.domReference&&Ce.floating)return Aw(Ce.domReference,Ce.floating,$e,ke)},[y,w,Ce,$e,ke]);const ht=ur(we),st=Wk(r,ht,G),Pt=Us(we)||"center",zt=!!((kt=Je.hide)!=null&&kt.referenceHidden);Se(()=>{M&&w&&se&&P(ht)},[M,w,se,ht]);const It=b.useMemo(()=>{var qe,at;return{position:"absolute",top:(qe=Je.arrow)==null?void 0:qe.y,left:(at=Je.arrow)==null?void 0:at.x}},[Je.arrow]),et=((St=Je.arrow)==null?void 0:St.centerOffset)!==0;return b.useMemo(()=>({positionerStyles:Ue,arrowStyles:It,arrowRef:de,arrowUncentered:et,side:st,align:Pt,physicalSide:ht,anchorHidden:zt,refs:Ie,context:Y,isPositioned:se,update:$e}),[Ue,It,de,et,st,Pt,ht,zt,Ie,Y,se,$e])}function zw(n){return n!=null&&"current"in n}function gy(n){return n==="starting"?AP:un}function $k(n,e,{styles:t,transitionStatus:r,props:i,refs:s,hidden:o,inert:a=!1}){const u={...t};return a&&(u.pointerEvents="none"),qt("div",n,{state:e,ref:s,props:[{role:"presentation",hidden:o,style:u},gy(r),i],stateAttributesMapping:py})}const q5=b.forwardRef(function(e,t){const{render:r,className:i,anchor:s,positionMethod:o="absolute",side:a="top",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:p="clipping-ancestors",collisionPadding:g=5,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w=!1,collisionAvoidance:S=FP,style:C,...R}=e,T=Pc(),M=_5(),A=T.useState("open"),D=T.useState("mounted"),P=T.useState("trackCursorAxis"),z=T.useState("disableHoverablePopup"),H=T.useState("floatingRootContext"),$=T.useState("instantType"),Z=T.useState("transitionStatus"),j=T.useState("hasViewport"),B=Hk({anchor:s,positionMethod:o,floatingRootContext:H,mounted:D,side:a,sideOffset:f,align:u,alignOffset:d,collisionBoundary:p,collisionPadding:g,sticky:v,arrowPadding:y,disableAnchorTracking:w,keepMounted:M,collisionAvoidance:S,adaptiveOrigin:j?U5:void 0}),X=b.useMemo(()=>({open:A,side:B.side,align:B.align,anchorHidden:B.anchorHidden,instant:P!=="none"?"tracking-cursor":$}),[A,B.side,B.align,B.anchorHidden,P,$]),_=$k(e,X,{styles:B.positionerStyles,transitionStatus:Z,props:R,refs:[t,T.useStateSetter("positionerElement")],hidden:!D,inert:!A||P==="both"||z});return E.jsx(zk.Provider,{value:B,children:_})}),K5={...py,...Nc},Y5=b.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,a=Pc(),{side:u,align:f}=Vk(),d=a.useState("open"),p=a.useState("instantType"),g=a.useState("transitionStatus"),y=a.useState("popupProps"),v=a.useState("floatingRootContext"),w=a.useState("disabled"),S=a.useState("closeDelay");qs({open:d,ref:a.context.popupRef,onComplete(){var M,A;d&&((A=(M=a.context).onOpenChangeComplete)==null||A.call(M,!0))}}),h5(v,{enabled:!w,closeDelay:S});const C=a.useStateSetter("popupElement");return qt("div",e,{state:{open:d,side:u,align:f,instant:p,transitionStatus:g},ref:[t,a.context.popupRef,C],props:[y,gy(g),o],stateAttributesMapping:K5})}),G5=function(e){const{delay:t,closeDelay:r,timeout:i=400}=e,s=b.useMemo(()=>({delay:t,closeDelay:r}),[t,r]),o=b.useMemo(()=>({open:t,close:r}),[t,r]);return E.jsx(Bk.Provider,{value:s,children:E.jsx(jA,{delay:o,timeoutMs:i,children:e.children})})};let Q5=(function(n){return n.popupWidth="--popup-width",n.popupHeight="--popup-height",n})({});function yy(n){return ty(19)?n:n?"true":void 0}function Uk(n){const[e,t]=b.useState({current:n,previous:null});return n!==e.current&&t({current:n,previous:e.current}),e.previous}function Vw(n){const e=Jn(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Bt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r;return(Rl(t)!==s||Rl(r)!==o)&&(t=s,r=o),{width:t,height:r}}const X5=()=>!0;function J5(n){const{popupElement:e,positionerElement:t,content:r,mounted:i,enabled:s=X5,onMeasureLayout:o,onMeasureLayoutComplete:a,side:u,direction:f}=n,d=ly(e,!0,!1),p=Ls(),g=b.useRef(null),y=b.useRef(null),v=b.useRef(!0),w=b.useRef(Ht),S=Fe(o),C=Fe(a),R=b.useMemo(()=>{let T=u==="top",M=u==="left";return f==="rtl"?(T=T||u==="inline-end",M=M||u==="inline-end"):(T=T||u==="inline-start",M=M||u==="inline-start"),T?{position:"absolute",[u==="top"?"bottom":"top"]:"0",[M?"right":"left"]:"0"}:un},[u,f]);Se(()=>{if(!i||!s()||typeof ResizeObserver!="function"){w.current=Ht,v.current=!0,g.current=null,y.current=null;return}if(!e||!t)return;w.current=Ww(e,R);const T=new ResizeObserver(B=>{const X=B[0];X&&(y.current={width:Math.ceil(X.borderBoxSize[0].inlineSize),height:Math.ceil(X.borderBoxSize[0].blockSize)})});T.observe(e),sf(e,"auto");const M=Vf(e,"position","static"),A=Vf(e,"transform","none"),D=Vf(e,"scale","1"),P=Ww(t,{"--available-width":"max-content","--available-height":"max-content"});function z(){M(),A(),P()}function H(){z(),D()}if(S==null||S(),v.current||g.current===null){Oa(t,"max-content");const B=Vw(e);return g.current=B,Oa(t,B),H(),C==null||C(null,B),v.current=!1,()=>{T.disconnect(),w.current(),w.current=Ht}}sf(e,"auto"),Oa(t,"max-content");const $=g.current??y.current,Z=Vw(e);if(g.current=Z,!$)return Oa(t,Z),H(),C==null||C(null,Z),()=>{T.disconnect(),p.cancel(),w.current(),w.current=Ht};sf(e,$),H(),C==null||C($,Z),Oa(t,Z);const j=new AbortController;return p.request(()=>{sf(e,Z),d(()=>{e.style.setProperty("--popup-width","auto"),e.style.setProperty("--popup-height","auto")},j.signal)}),()=>{T.disconnect(),j.abort(),p.cancel(),w.current(),w.current=Ht}},[r,e,t,d,p,s,i,S,C,R])}function Vf(n,e,t){const r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{n.style.setProperty(e,r)}}function Ww(n,e){const t=[];for(const[r,i]of Object.entries(e))t.push(Vf(n,r,i));return t.length?()=>{t.forEach(r=>r())}:Ht}function sf(n,e){const t=e==="auto"?"auto":`${e.width}px`,r=e==="auto"?"auto":`${e.height}px`;n.style.setProperty("--popup-width",t),n.style.setProperty("--popup-height",r)}function Oa(n,e){const t=e==="max-content"?"max-content":`${e.width}px`,r=e==="max-content"?"max-content":`${e.height}px`;n.style.setProperty("--positioner-width",t),n.style.setProperty("--positioner-height",r)}function Z5(n){const{store:e,side:t,cssVars:r,children:i}=n,s=my(),o=e.useState("activeTriggerElement"),a=e.useState("activeTriggerId"),u=e.useState("open"),f=e.useState("payload"),d=e.useState("mounted"),p=e.useState("popupElement"),g=e.useState("positionerElement"),y=Uk(u?o:null),v=nI(a,f),w=b.useRef(null),[S,C]=b.useState(null),[R,T]=b.useState(null),M=b.useRef(null),A=b.useRef(null),D=ly(M,!0,!1),P=Ls(),[z,H]=b.useState(null),[$,Z]=b.useState(!1);Se(()=>(e.set("hasViewport",!0),()=>{e.set("hasViewport",!1)}),[e]);const j=Fe(()=>{var N,W,F;(N=M.current)==null||N.style.setProperty("animation","none"),(W=M.current)==null||W.style.setProperty("transition","none"),(F=A.current)==null||F.style.setProperty("display","none")}),B=Fe(N=>{var W,F,I;(W=M.current)==null||W.style.removeProperty("animation"),(F=M.current)==null||F.style.removeProperty("transition"),(I=A.current)==null||I.style.removeProperty("display"),N&&H(N)}),X=b.useRef(null);Se(()=>{if(o&&y&&o!==y&&X.current!==o&&w.current){C(w.current),Z(!0);const N=tI(y,o);T(N),P.request(()=>{Ai.flushSync(()=>{Z(!1)}),D(()=>{C(null),H(null),w.current=null})}),X.current=o}},[o,y,S,D,P]),Se(()=>{const N=M.current;if(!N)return;const W=ot(N).createElement("div");for(const F of Array.from(N.childNodes))W.appendChild(F.cloneNode(!0));w.current=W});const _=S!=null;let ne;_?ne=E.jsxs(b.Fragment,{children:[E.jsx("div",{"data-previous":!0,inert:yy(!0),ref:A,style:{...z?{[r.popupWidth]:`${z.width}px`,[r.popupHeight]:`${z.height}px`}:null,position:"absolute"},"data-ending-style":$?void 0:""},"previous"),E.jsx("div",{"data-current":!0,ref:M,"data-starting-style":$?"":void 0,children:i},v)]}):ne=E.jsx("div",{"data-current":!0,ref:M,children:i},v),Se(()=>{const N=A.current;!N||!S||N.replaceChildren(...Array.from(S.childNodes))},[S]),J5({popupElement:p,positionerElement:g,mounted:d,content:f,onMeasureLayout:j,onMeasureLayoutComplete:B,side:t,direction:s});const G={activationDirection:eI(R),transitioning:_};return{children:ne,state:G}}function eI(n){if(n)return`${Hw(n.horizontal,5,"right","left")} ${Hw(n.vertical,5,"down","up")}`}function Hw(n,e,t,r){return n>e?t:n<-e?r:""}function tI(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:t.left+t.width/2,y:t.top+t.height/2},s={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:s.x-i.x,vertical:s.y-i.y}}function nI(n,e){const[t,r]=b.useState(0),i=b.useRef(n),s=b.useRef(e),o=b.useRef(!1);return Se(()=>{const a=i.current,u=s.current,f=n!==a,d=e!==u;f?(r(p=>p+1),o.current=!d):o.current&&d&&(r(p=>p+1),o.current=!1),i.current=n,s.current=e},[n,e]),`${n??"current"}-${t}`}const rI={activationDirection:n=>n?{"data-activation-direction":n}:null},iI=b.forwardRef(function(e,t){const{render:r,className:i,style:s,children:o,...a}=e,u=Pc(),f=Vk(),d=u.useState("instantType"),{children:p,state:g}=Z5({store:u,side:f.side,cssVars:Q5,children:o}),y={activationDirection:g.activationDirection,transitioning:g.transitioning,instant:d};return qt("div",e,{state:y,ref:t,props:[a,{children:p}],stateAttributesMapping:rI})});function qk(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=qk(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Kk(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=qk(n))&&(r&&(r+=" "),r+=e);return r}const vy="-",sI=n=>{const e=lI(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split(vy);return a[0]===""&&a.length!==1&&a.shift(),Yk(a,e)||oI(o)},getConflictingClassGroupIds:(o,a)=>{const u=t[o]||[];return a&&r[o]?[...u,...r[o]]:u}}},Yk=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?Yk(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join(vy);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},$w=/^\[(.+)\]$/,oI=n=>{if($w.test(n)){const e=$w.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},lI=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return cI(Object.entries(n.classGroups),t).forEach(([s,o])=>{Bg(o,r,s,e)}),r},Bg=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Uw(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(aI(i)){Bg(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Bg(o,Uw(e,s),t,r)})})},Uw=(n,e)=>{let t=n;return e.split(vy).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},aI=n=>n.isThemeGetter,cI=(n,e)=>e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,i]}):n,uI=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},Gk="!",fI=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],s=e.length,o=a=>{const u=[];let f=0,d=0,p;for(let S=0;S<a.length;S++){let C=a[S];if(f===0){if(C===i&&(r||a.slice(S,S+s)===e)){u.push(a.slice(d,S)),d=S+s;continue}if(C==="/"){p=S;continue}}C==="["?f++:C==="]"&&f--}const g=u.length===0?a:a.substring(d),y=g.startsWith(Gk),v=y?g.substring(1):g,w=p&&p>d?p-d:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}};return t?a=>t({className:a,parseClassName:o}):o},dI=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},hI=n=>({cache:uI(n.cacheSize),parseClassName:fI(n),...sI(n)}),pI=/\s+/,mI=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=n.trim().split(pI);let a="";for(let u=o.length-1;u>=0;u-=1){const f=o[u],{modifiers:d,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:y}=t(f);let v=!!y,w=r(v?g.substring(0,y):g);if(!w){if(!v){a=f+(a.length>0?" "+a:a);continue}if(w=r(g),!w){a=f+(a.length>0?" "+a:a);continue}v=!1}const S=dI(d).join(":"),C=p?S+Gk:S,R=C+w;if(s.includes(R))continue;s.push(R);const T=i(w,v);for(let M=0;M<T.length;++M){const A=T[M];s.push(C+A)}a=f+(a.length>0?" "+a:a)}return a};function gI(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=Qk(e))&&(r&&(r+=" "),r+=t);return r}const Qk=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=Qk(n[r]))&&(t&&(t+=" "),t+=e);return t};function yI(n,...e){let t,r,i,s=o;function o(u){const f=e.reduce((d,p)=>p(d),n());return t=hI(f),r=t.cache.get,i=t.cache.set,s=a,a(u)}function a(u){const f=r(u);if(f)return f;const d=mI(u,t);return i(u,d),d}return function(){return s(gI.apply(null,arguments))}}const _t=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Xk=/^\[(?:([a-z-]+):)?(.+)\]$/i,vI=/^\d+\/\d+$/,xI=new Set(["px","full","screen"]),wI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,SI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Hi=n=>gl(n)||xI.has(n)||vI.test(n),ks=n=>Vl(n,"length",II),gl=n=>!!n&&!Number.isNaN(Number(n)),_m=n=>Vl(n,"number",gl),Ma=n=>!!n&&Number.isInteger(Number(n)),EI=n=>n.endsWith("%")&&gl(n.slice(0,-1)),ct=n=>Xk.test(n),Cs=n=>wI.test(n),RI=new Set(["length","size","percentage"]),TI=n=>Vl(n,RI,Jk),OI=n=>Vl(n,"position",Jk),MI=new Set(["image","url"]),AI=n=>Vl(n,MI,NI),PI=n=>Vl(n,"",DI),Aa=()=>!0,Vl=(n,e,t)=>{const r=Xk.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},II=n=>bI.test(n)&&!SI.test(n),Jk=()=>!1,DI=n=>kI.test(n),NI=n=>CI.test(n),LI=()=>{const n=_t("colors"),e=_t("spacing"),t=_t("blur"),r=_t("brightness"),i=_t("borderColor"),s=_t("borderRadius"),o=_t("borderSpacing"),a=_t("borderWidth"),u=_t("contrast"),f=_t("grayscale"),d=_t("hueRotate"),p=_t("invert"),g=_t("gap"),y=_t("gradientColorStops"),v=_t("gradientColorStopPositions"),w=_t("inset"),S=_t("margin"),C=_t("opacity"),R=_t("padding"),T=_t("saturate"),M=_t("scale"),A=_t("sepia"),D=_t("skew"),P=_t("space"),z=_t("translate"),H=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],Z=()=>["auto",ct,e],j=()=>[ct,e],B=()=>["",Hi,ks],X=()=>["auto",gl,ct],_=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",ct],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[gl,ct];return{cacheSize:500,separator:":",theme:{colors:[Aa],spacing:[Hi,ks],blur:["none","",Cs,ct],brightness:I(),borderColor:[n],borderRadius:["none","","full",Cs,ct],borderSpacing:j(),borderWidth:B(),contrast:I(),grayscale:W(),hueRotate:I(),invert:W(),gap:j(),gradientColorStops:[n],gradientColorStopPositions:[EI,ks],inset:Z(),margin:Z(),opacity:I(),padding:j(),saturate:I(),scale:I(),sepia:W(),skew:I(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",ct]}],container:["container"],columns:[{columns:[Cs]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[..._(),ct]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ma,ct]}],basis:[{basis:Z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ct]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Ma,ct]}],"grid-cols":[{"grid-cols":[Aa]}],"col-start-end":[{col:["auto",{span:["full",Ma,ct]},ct]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[Aa]}],"row-start-end":[{row:["auto",{span:[Ma,ct]},ct]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ct]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ct]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ct,e]}],"min-w":[{"min-w":[ct,e,"min","max","fit"]}],"max-w":[{"max-w":[ct,e,"none","full","min","max","fit","prose",{screen:[Cs]},Cs]}],h:[{h:[ct,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ct,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ct,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ct,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cs,ks]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_m]}],"font-family":[{font:[Aa]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ct]}],"line-clamp":[{"line-clamp":["none",gl,_m]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Hi,ct]}],"list-image":[{"list-image":["none",ct]}],"list-style-type":[{list:["none","disc","decimal",ct]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Hi,ks]}],"underline-offset":[{"underline-offset":["auto",Hi,ct]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ct]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ct]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[..._(),OI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",TI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},AI]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:ne()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[Hi,ct]}],"outline-w":[{outline:[Hi,ks]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Hi,ks]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Cs,PI]}],"shadow-color":[{shadow:[Aa]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Cs,ct]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[T]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ct]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",ct]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",ct]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[M]}],"scale-x":[{"scale-x":[M]}],"scale-y":[{"scale-y":[M]}],rotate:[{rotate:[Ma,ct]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ct]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ct]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ct]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Hi,ks,_m]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},BI=yI(LI);function yn(...n){return BI(Kk(n))}const Zk=G5,uh=R5;function fh(n){return E.jsx(j5,{"data-slot":"tooltip-trigger",...n})}function dh({className:n,align:e="center",sideOffset:t=4,side:r="top",children:i,...s}){return E.jsx(z5,{children:E.jsx(q5,{align:e,className:"z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none","data-slot":"tooltip-positioner",side:r,sideOffset:t,children:E.jsx(Y5,{className:yn("relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md border bg-popover bg-clip-padding text-popover-foreground text-xs shadow-black/5 shadow-md transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",n),"data-slot":"tooltip-popup",...s,children:E.jsx(iI,{className:"relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity","data-slot":"tooltip-viewport",children:i})})})})}function qw({icon:n,tooltip:e,to:t,href:r}){const i=Tr(),s=t?i.pathname===t:!1,o=E.jsx("div",{className:yn("w-full h-10 rounded-l-lg p-2 flex items-center justify-center transition-colors",s&&"bg-accent shadow"),children:n}),a=t?E.jsx(Xi,{to:t,"aria-label":e,children:o}):r?E.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer","aria-label":e,children:o}):o;return E.jsxs(uh,{children:[E.jsx(fh,{render:a}),E.jsx(dh,{side:"right",sideOffset:8,children:e})]})}const FI="/assets/postgres-BpcazhJg.svg",jI="data:image/svg+xml,%3csvg%20width='600'%20height='600'%20viewBox='0%200%20600%20600'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M548.194%20458.47C516.023%20457.594%20491.456%20460.589%20470.451%20469.444C464.484%20471.961%20454.959%20472.031%20453.984%20479.508C457.266%20482.944%20457.776%20488.081%20460.383%20492.309C465.398%20500.419%20473.864%20511.303%20481.42%20517.003C489.68%20523.237%20498.187%20529.898%20507.037%20535.294C522.778%20544.889%20540.352%20550.373%20555.506%20559.987C564.441%20565.659%20573.314%20572.798%20582.028%20579.192C586.341%20582.356%20589.233%20587.273%20594.834%20589.256V588.347C591.891%20584.597%20591.131%20579.45%20588.431%20575.536L576.539%20563.644C564.914%20548.213%20550.153%20534.656%20534.464%20523.402C521.953%20514.42%20493.955%20502.289%20488.737%20487.734L487.823%20486.82C496.692%20485.817%20507.075%20482.611%20515.264%20480.412C529.017%20476.728%20541.308%20477.68%20555.506%20474.014L574.711%20468.525V464.869C567.534%20457.505%20562.416%20447.755%20554.592%20441.089C534.108%20423.652%20511.758%20406.228%20488.742%20391.697C475.973%20383.644%20460.2%20378.408%20446.667%20371.578C442.116%20369.277%20434.119%20368.081%20431.114%20364.256C424.003%20355.2%20420.136%20343.716%20414.656%20333.164C403.177%20311.053%20391.903%20286.908%20381.731%20263.644C374.794%20247.781%20370.261%20232.144%20361.608%20217.912C320.076%20149.63%20275.376%20108.422%20206.128%2067.9125C191.391%2059.2969%20173.648%2055.8984%20154.898%2051.4453C144.844%2050.8406%20134.78%2050.2266%20124.72%2049.6125C118.575%2047.0531%20112.191%2039.5391%20106.43%2035.8922C83.489%2021.3984%2024.6421%20-10.125%207.65463%2031.3219C-3.07506%2057.4828%2023.6906%2083.0016%2033.2578%2096.2625C39.9796%20105.553%2048.5812%20115.983%2053.3812%20126.441C56.5406%20133.317%2057.0843%20140.212%2059.789%20147.483C66.4312%20165.398%2072.2203%20184.889%2080.8218%20201.441C85.1671%20209.822%2089.9578%20218.644%2095.4562%20226.134C98.8218%20230.733%20104.602%20232.758%20105.511%20239.855C99.8671%20247.758%2099.5437%20260.03%2096.3703%20270.042C82.0734%20315.113%2087.4687%20371.138%20108.262%20404.494C114.637%20414.741%20129.67%20436.702%20150.333%20428.273C168.408%20420.914%20164.372%20398.095%20169.542%20377.967C170.709%20373.406%20169.992%20370.05%20172.284%20366.994V367.908L188.751%20400.833C200.939%20420.459%20222.558%20440.967%20240.886%20454.805C250.387%20461.981%20257.869%20474.384%20270.155%20478.584V477.666H269.241C266.859%20473.958%20263.133%20472.42%20260.095%20469.439C252.937%20462.422%20244.978%20453.698%20239.062%20445.659C222.394%20423.033%20207.666%20398.269%20194.245%20372.492C187.833%20360.178%20182.259%20346.603%20176.859%20334.073C174.778%20329.245%20174.806%20321.938%20170.466%20319.439C164.545%20328.617%20155.831%20336.042%20151.256%20346.88C143.939%20364.205%20142.997%20385.336%20140.283%20407.245C138.68%20407.817%20139.392%20407.423%20138.45%20408.155C125.709%20405.084%20121.237%20391.973%20116.498%20380.719C104.527%20352.266%20102.3%20306.459%20112.837%20273.708C115.566%20265.228%20127.884%20238.547%20122.897%20230.714C120.516%20222.905%20112.659%20218.386%20108.267%20212.419C102.825%20205.041%2097.3968%20195.328%2093.6234%20186.806C83.8265%20164.63%2079.2515%20139.725%2068.9343%20117.3C63.9984%20106.58%2055.6593%2095.7281%2048.8109%2086.2031C41.2312%2075.6422%2032.7374%2067.8656%2026.8593%2055.1016C24.7687%2050.5641%2021.9328%2043.2984%2025.0265%2038.6344C26.0109%2035.4891%2027.4078%2034.1766%2030.5156%2033.15C35.8218%2029.0578%2050.5968%2034.5094%2056.1187%2036.8016C70.7859%2042.8953%2083.0296%2048.6984%2095.4562%2056.9297C101.414%2060.8859%20107.452%2068.5312%20114.661%2070.65H122.892C135.769%2073.6078%20150.192%2071.5641%20162.225%2075.2203C183.487%2081.6797%20202.542%2091.7344%20219.844%20102.661C272.559%20135.952%20315.666%20183.333%20345.15%20239.859C349.894%20248.962%20351.947%20257.644%20356.123%20267.3C364.552%20286.767%20375.169%20306.797%20383.555%20325.838C391.926%20344.831%20400.083%20363.998%20411.914%20379.805C418.134%20388.111%20442.153%20392.569%20453.075%20397.186C460.725%20400.416%20473.264%20403.791%20480.516%20408.155C494.358%20416.508%20507.773%20426.45%20520.762%20435.6C527.245%20440.17%20547.2%20450.206%20548.194%20458.47ZM139.355%20109.997C132.647%20109.87%20127.903%20110.728%20122.887%20111.82V112.734H123.802C127.003%20119.306%20132.652%20123.544%20136.603%20129.202C139.65%20135.609%20142.702%20142.008%20145.753%20148.406L146.662%20147.502C152.33%20143.503%20154.922%20137.123%20154.889%20127.373C152.62%20124.987%20152.287%20121.997%20150.319%20119.147C147.712%20115.345%20142.655%20113.184%20139.355%20109.997Z'%20fill='%2300618A'/%3e%3c/svg%3e",_I="data:image/svg+xml,%3csvg%20width='600'%20height='600'%20viewBox='0%200%20600%20600'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M597.196%20105.954C595.566%20104.609%20593.497%20103.916%20591.387%20104.008C585.598%20104.008%20578.111%20107.941%20574.081%20110.051L572.485%20110.87C565.726%20114.147%20558.367%20116.002%20550.863%20116.319C543.172%20116.565%20536.544%20117.016%20527.912%20117.917C476.771%20123.181%20453.963%20162.43%20431.993%20200.387C420.026%20221.035%20407.67%20242.482%20390.733%20258.87C387.228%20262.273%20383.504%20265.441%20379.584%20268.354C362.053%20281.403%20340.042%20290.723%20322.921%20297.319C306.433%20303.628%20288.432%20309.302%20271.044%20314.792C255.108%20319.811%20240.073%20324.563%20226.245%20329.705C220.006%20332.02%20214.708%20333.802%20210.023%20335.358C197.422%20339.455%20188.34%20342.589%20175.064%20351.746C169.888%20355.29%20164.692%20359.12%20161.174%20361.988C150.635%20370.408%20141.308%20380.245%20133.456%20391.219C126.703%20401.343%20118.9%20410.722%20110.177%20419.201C107.374%20421.946%20102.403%20423.298%2094.9574%20423.298C86.2431%20423.298%2075.6673%20421.495%2064.4777%20419.59C52.9405%20417.542%2041.0146%20415.596%2030.7865%20415.596C22.4813%20415.596%2016.1194%20416.948%2011.3736%20419.693C11.3736%20419.693%203.37526%20424.363%200%20430.406L3.3139%20431.901C8.45284%20434.691%2013.2107%20438.134%2017.4695%20442.143C21.913%20446.253%2026.8625%20449.778%2032.198%20452.631C33.9011%20453.257%2035.4499%20454.242%2036.7392%20455.52C35.3482%20457.568%2033.3026%20460.211%2031.1547%20463.038C19.3515%20478.503%2012.4578%20488.274%2016.4058%20493.6C18.2981%20494.584%2020.4115%20495.064%2022.5427%20494.993C48.2765%20494.993%2062.1048%20488.295%2079.5948%20479.814C84.668%20477.356%2089.8229%20474.837%2095.9597%20472.235C106.188%20467.79%20117.193%20460.702%20128.874%20453.205C144.154%20443.229%20160.131%20432.987%20175.636%20428.05C188.379%20424.159%20201.653%20422.293%20214.974%20422.519C231.338%20422.519%20248.563%20424.711%20265.173%20426.842C277.549%20428.439%20290.375%20430.078%20302.955%20430.836C307.844%20431.123%20312.365%20431.266%20316.763%20431.266C322.647%20431.284%20328.527%20430.976%20334.376%20430.344L335.787%20429.853C344.604%20424.424%20348.736%20412.769%20352.746%20401.502C355.323%20394.251%20357.491%20387.737%20360.928%20383.599C361.131%20383.397%20361.35%20383.212%20361.583%20383.046C361.744%20382.956%20361.93%20382.924%20362.112%20382.953C362.294%20382.983%20362.461%20383.074%20362.585%20383.21C362.585%20383.21%20362.585%20383.312%20362.585%20383.538C360.539%20427.6%20342.824%20455.581%20324.905%20480.449L312.938%20493.293C312.938%20493.293%20329.692%20493.293%20339.224%20489.606C374%20479.2%20400.245%20456.257%20419.351%20419.672C424.063%20410.281%20428.276%20400.646%20431.972%20390.81C432.3%20389.99%20435.307%20388.474%20435.02%20392.715C434.918%20393.964%20434.836%20395.357%20434.734%20396.812C434.734%20397.672%20434.734%20398.553%20434.57%20399.434C434.079%20405.579%20432.627%20418.566%20432.627%20418.566L443.366%20412.81C469.264%20396.422%20489.229%20363.361%20504.367%20311.924C510.667%20290.498%20515.29%20269.214%20519.361%20250.471C524.229%20227.939%20528.423%20208.622%20533.23%20201.124C540.778%20189.366%20552.295%20181.419%20563.444%20173.696C564.958%20172.651%20566.492%20171.647%20567.985%20170.541C581.998%20160.688%20595.928%20149.32%20598.997%20128.118V127.647C601.226%20111.833%20599.344%20107.798%20597.196%20105.954Z'%20fill='%23003545'/%3e%3c/svg%3e",zI="/assets/sqlserver-ByfFYYpV.svg",VI="data:image/svg+xml,%3csvg%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M121.632%208.03622H22.1255C15.4565%208.03622%2010%2013.4937%2010%2020.1625V129.899C10%20136.567%2015.4565%20142.024%2022.1255%20142.024H87.6628C86.9189%20109.415%2098.0545%2046.1304%20121.632%208.03622Z'%20fill='%230F80CC'/%3e%3cpath%20d='M118.016%2011.5737H22.1255C17.3901%2011.5737%2013.5366%2015.4262%2013.5366%2020.1625V121.893C35.2539%20113.558%2067.8488%20106.366%2090.3862%20106.692C94.9151%2083.0114%20108.226%2036.6019%20118.016%2011.5737Z'%20fill='url(%23paint0_linear_2795_134)'/%3e%3cpath%20d='M144.841%204.44498C138.026%20-1.63252%20129.775%200.808728%20121.631%208.03623C120.423%209.10998%20119.216%2010.3012%20118.016%2011.5737C104.085%2026.3525%2091.154%2053.7275%2087.1365%2074.6337C88.7015%2077.8075%2089.924%2081.8575%2090.729%2084.9512C90.9352%2085.745%2091.1215%2086.49%2091.2702%2087.1237C91.624%2088.6236%2091.814%2089.5962%2091.814%2089.5962C91.814%2089.5962%2091.689%2089.1236%2091.1765%2087.6375C91.079%2087.3525%2090.9702%2087.0412%2090.8415%2086.675C90.7865%2086.5237%2090.7102%2086.34%2090.6265%2086.1437C89.7177%2084.0312%2087.204%2079.5725%2086.0977%2077.6312C85.1515%2080.4225%2084.3152%2083.0337%2083.6152%2085.3962C86.809%2091.2397%2088.7552%20101.254%2088.7552%20101.254C88.7552%20101.254%2088.5865%20100.605%2087.784%2098.3399C87.0715%2096.3365%2083.5227%2090.1187%2082.6821%2088.6651C81.2441%2093.9736%2080.6727%2097.5576%2081.188%2098.4302C82.1884%20100.121%2083.1411%20103.039%2083.9777%20106.265C85.8677%20113.534%2087.1815%20122.382%2087.1815%20122.382C87.1815%20122.382%2087.224%20122.969%2087.2952%20123.871C87.0327%20129.975%2087.1902%20136.304%2087.6627%20142.024C88.289%20149.596%2089.4677%20156.101%2090.9702%20159.582L91.9902%20159.026C89.784%20152.167%2088.8877%20143.179%2089.2802%20132.812C89.874%20116.967%2093.5202%2097.8589%20100.258%2077.9425C111.64%2047.8775%20127.433%2023.755%20141.886%2012.235C128.713%2024.1325%20110.883%2062.6437%20105.545%2076.905C99.569%2092.875%2095.334%20107.861%2092.7815%20122.22C97.1852%20108.759%20111.424%20102.973%20111.424%20102.973C111.424%20102.973%20118.408%2094.3599%20126.569%2082.055C121.68%2083.17%20113.653%2085.0787%20110.964%2086.2087C106.998%2087.8725%20105.929%2088.44%20105.929%2088.44C105.929%2088.44%20118.776%2080.6162%20129.799%2077.0737C144.958%2053.1987%20161.473%2019.2812%20144.841%204.44498Z'%20fill='%23003B57'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_2795_134'%20x1='73.7814'%20y1='13.8313'%20x2='73.7814'%20y2='115.758'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2397D9F6'/%3e%3cstop%20offset='0.920245'%20stop-color='%230F80CC'/%3e%3cstop%20offset='1'%20stop-color='%230F80CC'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",WI="data:image/svg+xml,%3csvg%20t='1779777044661'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1836'%20width='200'%20height='200'%3e%3cpath%20d='M826.5728%20512c0%2087.38133333-69.90506667%20157.2864-157.2864%20157.2864H354.7136c-87.38133333%200-157.2864-69.90506667-157.2864-157.2864s69.90506667-157.2864%20157.2864-157.2864h314.5728c87.38133333%200%20157.2864%2069.90506667%20157.2864%20157.2864z'%20fill='%23d22227'%20p-id='1837'%3e%3c/path%3e%3cpath%20d='M-70.54222222-70.54222222v1165.08444444h1165.08444444V-70.54222222H-70.54222222z%20m926.24213333%20768.95573333c-49.51608889%2049.51608889-116.50844445%2075.73048889-186.41351111%2075.73048889H354.7136c-145.63555555%200-262.144-116.50844445-262.144-262.144s116.50844445-262.144%20262.144-262.144h314.5728c145.63555555%200%20262.144%20116.50844445%20262.144%20262.144%200%2069.90506667-26.2144%20136.89742222-75.73048889%20186.41351111z'%20fill='%23d22227'%20p-id='1838'%3e%3c/path%3e%3c/svg%3e",xy={postgres:FI,mysql:jI,mariadb:_I,sqlserver:zI,sqlite:VI,oracle:WI};function HI({source:n}){const{sourceId:e}=Yd(),t=e===n.id;return E.jsxs(uh,{children:[E.jsx(fh,{render:E.jsxs(Xi,{to:`/source/${n.id}`,"aria-label":n.id,className:yn("w-full rounded-l-lg p-2 mt-1 flex flex-col items-center justify-center transition-colors",t&&"bg-accent shadow"),children:[E.jsx("img",{src:xy[n.type],alt:`${n.type} logo`,className:"w-7 h-7"}),E.jsx("span",{className:yn("text-[10px] w-full text-center mt-1 leading-tight break-words line-clamp-2",t?"text-foreground":"text-muted-foreground"),children:n.id})]})}),E.jsx(dh,{side:"right",sideOffset:8,children:n.id})]})}function $I({className:n="w-5 h-5"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("polyline",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function UI({className:n="w-5 h-5"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function qI({sources:n}){return E.jsx(Zk,{children:E.jsxs("aside",{className:"w-16 h-screen flex flex-col items-center bg-card pl-2 py-4 pt-6","aria-label":"Main navigation",children:[E.jsx("div",{className:"w-full flex-1 flex flex-col justify-start items-start overflow-auto",children:n.map(e=>E.jsx(HI,{source:e},e.id))}),E.jsxs("div",{className:"w-full flex flex-col gap-2 items-center",children:[E.jsx(qw,{icon:E.jsx($I,{}),to:"/requests",tooltip:"Requests"}),E.jsx(qw,{icon:E.jsx(UI,{}),href:"https://dbhub.ai",tooltip:"Help"})]})]})})}function KI(){return E.jsx("div",{className:"px-6 py-4",children:E.jsx(Xi,{to:"/",className:"block hover:opacity-80 transition-opacity",children:E.jsx("img",{src:"/logo-full-light.svg",alt:"DBHub",className:"w-[200px] h-auto"})})})}function ud({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}function YI({sources:n,isLoading:e}){const{sourceId:t,toolName:r}=Yd(),i=n.find(s=>s.id===t);return E.jsxs("aside",{className:"w-[200px] sm:w-[220px] md:w-[240px] lg:w-[280px] border-r border-border bg-gray-100 dark:bg-zinc-700 flex flex-col","aria-label":"Data sources sidebar",children:[E.jsx(KI,{}),E.jsx("nav",{className:"flex-1 flex flex-col overflow-hidden","aria-label":"Data sources navigation",children:e?E.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading..."}):i?E.jsxs("div",{className:"flex flex-col overflow-hidden px-2 pt-2",children:[E.jsx(Xi,{to:`/source/${i.id}`,className:yn("flex items-center gap-2 px-2 py-2 text-sm font-medium transition-colors rounded-md",r?"text-muted-foreground hover:text-foreground hover:bg-accent/50":"bg-accent text-accent-foreground"),children:E.jsx("span",{className:"truncate",children:i.id})}),E.jsx("div",{className:"flex-1 overflow-auto",children:i.tools.filter(s=>s.name!=="search_objects").map(s=>E.jsxs(Xi,{to:`/source/${i.id}/tool/${s.name}`,className:yn("flex items-center gap-2 px-4 py-2 text-sm transition-colors rounded-md",r===s.name?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:[E.jsx("span",{className:"truncate font-mono text-xs",children:s.name}),s.readonly&&E.jsx(ud,{className:"w-3 h-3 ml-auto flex-shrink-0"})]},s.name))})]}):E.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Select a data source"})})]})}function GI({sources:n,isLoading:e}){const r=Tr().pathname.startsWith("/source/");return E.jsxs("div",{className:"flex h-screen bg-background",children:[E.jsx(qI,{sources:n}),r&&E.jsx(YI,{sources:n,isLoading:e}),E.jsx("main",{className:"flex-1 overflow-auto","aria-label":"Main content",children:E.jsx(M4,{})})]})}class mn extends Error{constructor(e,t,r){super(e),this.status=t,this.statusText=r,this.name="ApiError"}}const eC="/api";async function tC(n){const e=n.headers.get("content-type");if(e&&e.includes("application/json"))return n.json();const t=await n.text();throw new mn(t||n.statusText,n.status,n.statusText)}async function wy(){try{const n=await fetch(`${eC}/sources`);if(!n.ok){const e=await tC(n).then(t=>t.error).catch(()=>n.statusText);throw new mn(`Failed to fetch sources: ${e}`,n.status,n.statusText)}return n.json()}catch(n){throw n instanceof mn?n:new mn(n instanceof Error?n.message:"Network error",0)}}async function nC(n){try{if(!n||n.trim()==="")throw new mn("Source ID cannot be empty",400);if(n.includes("/")||n.includes(".."))throw new mn("Invalid source ID format",400);const e=await fetch(`${eC}/sources/${encodeURIComponent(n)}`);if(!e.ok){const t=await tC(e).then(r=>r.error).catch(()=>e.statusText);throw new mn(e.status===404?`Source not found: ${n}`:`Failed to fetch source: ${t}`,e.status,e.statusText)}return e.json()}catch(e){throw e instanceof mn?e:new mn(e instanceof Error?e.message:"Network error",0)}}function QI(){const n=Kd();return b.useEffect(()=>{wy().then(e=>{e.length>0?n(`/source/${e[0].id}`,{replace:!0}):n("/requests",{replace:!0})}).catch(()=>{n("/requests",{replace:!0})})},[]),E.jsx("div",{className:"flex items-center justify-center h-full",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading..."})})}const Kw="/api";async function XI(n){try{const e=n?`${Kw}/requests?source_id=${encodeURIComponent(n)}`:`${Kw}/requests`,t=await fetch(e);if(!t.ok){const r=await t.json().then(i=>i.error).catch(()=>t.statusText);throw new mn(`Failed to fetch requests: ${r}`,t.status,t.statusText)}return t.json()}catch(e){throw e instanceof mn?e:new mn(e instanceof Error?e.message:"Network error",0)}}function JI(n){return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ZI(n){const e=new Date(n),t=new Date;return e.toDateString()===t.toDateString()?"Today":e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function eD(n){const e=n.match(/Edg(?:e|A|iOS)?\/(\d+)/);if(e)return`Edge ${e[1]}`;const t=n.match(/(?:OPR|Opera)\/(\d+)/);if(t)return`Opera ${t[1]}`;const r=n.match(/Chrome\/(\d+)/);if(r&&!n.includes("Edg")&&!n.includes("OPR"))return`Chrome ${r[1]}`;const i=n.match(/Version\/(\d+(?:\.\d+)?)\s+Safari/);if(i)return`Safari ${i[1]}`;const s=n.match(/Firefox\/(\d+)/);if(s)return`Firefox ${s[1]}`;if(n.includes("Claude"))return"Claude Desktop";if(n.includes("Electron"))return"Electron App";if(n.includes("Cursor"))return"Cursor";const o=n.match(/^(\w+)\/[\d.]+/);return o?o[1]:n.length>20?n.substring(0,20)+"...":n}function tD({sql:n,children:e}){return E.jsxs(uh,{children:[E.jsx(fh,{render:e}),E.jsx(dh,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,children:n})]})}function nD({error:n,children:e}){return E.jsxs(uh,{children:[E.jsx(fh,{render:e}),E.jsx(dh,{className:"whitespace-pre-wrap break-all max-w-md",sideOffset:5,side:"top",align:"end",children:n})]})}function rD({success:n,error:e}){if(n)return E.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-green-600 dark:text-green-400",children:E.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})});const t=E.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-red-600 dark:text-red-400 cursor-help",children:E.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})});return e?E.jsx(nD,{error:e,children:t}):t}function iD(){const[n,e]=b.useState([]),[t,r]=b.useState({}),[i,s]=b.useState({}),[o,a]=b.useState(!0),[u,f]=b.useState(null),[d,p]=b.useState(null);b.useEffect(()=>{Promise.all([XI(),wy()]).then(([v,w])=>{e(v.requests);const S={},C={};for(const R of w){S[R.id]=R.type;for(const T of R.tools)T.readonly&&(C[T.name]=!0)}r(S),s(C),a(!1)}).catch(v=>{console.error("Failed to fetch data:",v);const w=v instanceof mn?v.message:"Failed to load data";f(w),a(!1)})},[]);const g=[...new Set(n.map(v=>v.sourceId))].sort(),y=d?n.filter(v=>v.sourceId===d):n;return o?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):u?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:u})]})}):E.jsx(Zk,{children:E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-6xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Recent Requests"}),E.jsx("p",{className:"text-muted-foreground text-sm",children:"Up to 100 requests per source"})]}),n.length>0&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.jsxs("button",{onClick:()=>p(null),className:`px-3 py-1 text-sm font-medium rounded-full transition-colors ${d===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:["All (",n.length,")"]}),g.map(v=>{const w=n.filter(C=>C.sourceId===v).length,S=t[v];return E.jsxs("button",{onClick:()=>p(v),className:`px-3 py-1 text-sm font-medium rounded-full transition-colors flex items-center gap-1.5 ${d===v?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:[S&&E.jsx("img",{src:xy[S],alt:`${S} logo`,className:"w-4 h-4"}),v," (",w,")"]},v)})]}),E.jsx("div",{className:"bg-card border border-border rounded-lg overflow-x-auto",children:E.jsxs("table",{className:"w-full",children:[E.jsx("thead",{children:E.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Time"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Tool"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider w-full",children:"SQL"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Result"}),E.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:"Client"})]})}),E.jsx("tbody",{className:"divide-y divide-border",children:y.map(v=>E.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[E.jsxs("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:[ZI(v.timestamp)," ",JI(v.timestamp)]}),E.jsx("td",{className:"px-4 py-2 text-sm whitespace-nowrap",children:E.jsxs(Xi,{to:`/source/${v.sourceId}`,className:"text-primary hover:underline inline-flex items-center gap-1",children:[v.toolName,i[v.toolName]&&E.jsx(ud,{className:"w-3 h-3 text-muted-foreground"})]})}),E.jsx("td",{className:"px-4 py-2 text-sm font-mono text-foreground max-w-0",children:E.jsx(tD,{sql:v.sql,children:E.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap cursor-help",children:v.sql})})}),E.jsx("td",{className:"px-4 py-2 text-sm",children:E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(rD,{success:v.success,error:v.error}),E.jsxs("span",{className:"text-muted-foreground",children:[v.durationMs,"ms"]})]})}),E.jsx("td",{className:"px-4 py-2 text-sm text-muted-foreground whitespace-nowrap",children:eD(v.client)})]},v.id))})]})})]}),n.length===0&&E.jsx("div",{className:"bg-card border border-border rounded-lg p-12 text-center",children:E.jsx("p",{className:"text-muted-foreground",children:"No requests have been made yet. Execute some SQL queries via the MCP endpoint to see them here."})})]})})})}/**
68
+ * @license lucide-react v0.562.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const sD=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oD=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Yw=n=>{const e=oD(n);return e.charAt(0).toUpperCase()+e.slice(1)},rC=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),lD=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
73
+ * @license lucide-react v0.562.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */var aD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
78
+ * @license lucide-react v0.562.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const cD=b.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},u)=>b.createElement("svg",{ref:u,...aD,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:rC("lucide",i),...!s&&!lD(a)&&{"aria-hidden":"true"},...a},[...o.map(([f,d])=>b.createElement(f,d)),...Array.isArray(s)?s:[s]]));/**
83
+ * @license lucide-react v0.562.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const Hr=(n,e)=>{const t=b.forwardRef(({className:r,...i},s)=>b.createElement(cD,{ref:s,iconNode:e,className:rC(`lucide-${sD(Yw(n))}`,`lucide-${n}`,r),...i}));return t.displayName=Yw(n),t};/**
88
+ * @license lucide-react v0.562.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const uD=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fD=Hr("chevron-down",uD);/**
93
+ * @license lucide-react v0.562.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const dD=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],hD=Hr("chevron-left",dD);/**
98
+ * @license lucide-react v0.562.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const pD=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],mD=Hr("chevron-right",pD);/**
103
+ * @license lucide-react v0.562.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const gD=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yD=Hr("chevron-up",gD);/**
108
+ * @license lucide-react v0.562.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const vD=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],xD=Hr("chevrons-up-down",vD);/**
113
+ * @license lucide-react v0.562.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const wD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],bD=Hr("circle-alert",wD);/**
118
+ * @license lucide-react v0.562.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const SD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kD=Hr("circle-check",SD);/**
123
+ * @license lucide-react v0.562.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const CD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ED=Hr("info",CD);/**
128
+ * @license lucide-react v0.562.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const RD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],iC=Hr("loader-circle",RD);/**
133
+ * @license lucide-react v0.562.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const TD=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],OD=Hr("lock",TD);/**
138
+ * @license lucide-react v0.562.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const MD=[["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"}]],AD=Hr("play",MD);/**
143
+ * @license lucide-react v0.562.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const PD=[["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"}]],ID=Hr("triangle-alert",PD);function DD(){var a;const{sourceId:n}=Yd(),[e,t]=b.useState(null),[r,i]=b.useState(!0),[s,o]=b.useState(null);return b.useEffect(()=>{n&&(i(!0),o(null),nC(n).then(u=>{t(u),i(!1)}).catch(u=>{o(u),i(!1)}))},[n]),n?r?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading source details..."})}):s?s.status===404?E.jsx(Ua,{to:"/404",replace:!0}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:s.message})]})}):e?E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("h1",{className:"flex items-center gap-3 text-3xl font-bold text-foreground",children:[E.jsx("img",{src:xy[e.type],alt:`${e.type} logo`,className:"w-8 h-8"}),e.id]}),E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Connection Details"}),E.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database Type"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.type})]}),e.host&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Host"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.host})]}),e.port&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Port"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.port})]}),e.database&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Database"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.database})]}),e.user&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"User"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.user})]}),E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Default Source"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground",children:e.is_default?E.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:"Yes"}):E.jsx("span",{className:"text-muted-foreground",children:"No"})})]})]})]}),((a=e.ssh_tunnel)==null?void 0:a.enabled)&&E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"SSH Tunnel"}),E.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground",children:E.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400",children:"Enabled"})})]}),e.ssh_tunnel.ssh_host&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Host"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_host})]}),e.ssh_tunnel.ssh_port&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH Port"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_port})]}),e.ssh_tunnel.ssh_user&&E.jsxs("div",{children:[E.jsx("dt",{className:"text-sm font-medium text-muted-foreground",children:"SSH User"}),E.jsx("dd",{className:"mt-1 text-sm text-foreground font-mono",children:e.ssh_tunnel.ssh_user})]})]})]}),E.jsxs("div",{className:"bg-card border border-border rounded-lg p-6",children:[E.jsx("h2",{className:"text-xl font-semibold text-foreground mb-4",children:"Available Tools"}),e.tools.length>0?E.jsx("div",{className:"space-y-4",children:e.tools.map((u,f)=>E.jsxs("div",{children:[f>0&&E.jsx("div",{className:"border-t border-border mb-4"}),E.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 space-y-3",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"flex items-baseline gap-2",children:[E.jsxs("div",{className:"flex items-center gap-1.5",children:[E.jsx("div",{className:"text-sm font-semibold text-foreground font-mono",children:u.name}),u.readonly&&E.jsx(OD,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),E.jsxs("div",{className:"text-xs text-muted-foreground",children:["(",u.parameters.length," ",u.parameters.length===1?"parameter":"parameters",")"]})]}),E.jsx("div",{className:"mt-1.5 text-sm text-muted-foreground leading-relaxed",children:u.description})]}),u.parameters.length>0&&E.jsxs("div",{className:"pt-2 border-t border-border/50",children:[E.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2.5",children:"Parameters"}),E.jsx("ul",{className:"space-y-3",children:u.parameters.map(d=>E.jsxs("li",{className:"text-sm bg-background/50 rounded p-2.5",children:[E.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[E.jsx("span",{className:"font-mono text-foreground font-medium",children:d.name}),E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-primary/10 text-primary",children:d.type}),d.required?E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-destructive/10 text-destructive",children:"required"}):E.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted text-muted-foreground",children:"optional"})]}),d.description&&E.jsx("div",{className:"mt-2 text-xs text-muted-foreground leading-relaxed",children:d.description})]},d.name))})]})]})]},u.name))}):E.jsx("div",{className:"text-sm text-muted-foreground",children:"No tools available for this source"})]})]})}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Source not found"})}):E.jsx(Ua,{to:"/",replace:!0})}async function zm(n,e){var o,a,u;const t=await fetch("/mcp",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify({jsonrpc:"2.0",id:crypto.randomUUID(),method:"tools/call",params:{name:n,arguments:e}})});if(!t.ok)throw new mn(`HTTP error: ${t.status}`,t.status);const r=await t.json();if(r.error)throw new mn(r.error.message,r.error.code);if(!((u=(a=(o=r.result)==null?void 0:o.content)==null?void 0:a[0])!=null&&u.text))throw new mn("Invalid response format",500);const i=JSON.parse(r.result.content[0].text);if(!i.success||i.error)throw new mn(i.error||"Tool execution failed",500);const s=i.data;if(s.rows!==void 0){const f=s.rows;if(f.length===0)return{columns:[],rows:[],rowCount:s.count};const d=Object.keys(f[0]),p=f.map(g=>d.map(y=>g[y]));return{columns:d,rows:p,rowCount:s.count}}else if(s.results!==void 0){const f=s.results;if(f.length===0)return{columns:[],rows:[],rowCount:s.count};const d=Object.keys(f[0]),p=f.map(g=>d.map(y=>g[y]));return{columns:d,rows:p,rowCount:s.count}}return{columns:[],rows:[],rowCount:0}}let Fg=[],sC=[];(()=>{let n="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,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?sC:Fg).push(t=t+n[e])})();function ND(n){if(n<768)return!1;for(let e=0,t=Fg.length;;){let r=e+t>>1;if(n<Fg[r])t=r;else if(n>=sC[r])e=r+1;else return!0;if(e==t)return!1}}function Gw(n){return n>=127462&&n<=127487}const Qw=8205;function LD(n,e,t=!0,r=!0){return(t?oC:BD)(n,e,r)}function oC(n,e,t){if(e==n.length)return e;e&&lC(n.charCodeAt(e))&&aC(n.charCodeAt(e-1))&&e--;let r=Vm(n,e);for(e+=Xw(r);e<n.length;){let i=Vm(n,e);if(r==Qw||i==Qw||t&&ND(i))e+=Xw(i),r=i;else if(Gw(i)){let s=0,o=e-2;for(;o>=0&&Gw(Vm(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function BD(n,e,t){for(;e>0;){let r=oC(n,e-2,t);if(r<e)return r;e--}return 0}function Vm(n,e){let t=n.charCodeAt(e);if(!aC(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return lC(r)?(t-55296<<10)+(r-56320)+65536:t}function lC(n){return n>=56320&&n<57344}function aC(n){return n>=55296&&n<56320}function Xw(n){return n<65536?1:2}class xt{lineAt(e){if(e<0||e>this.length)throw new 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 new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Tl(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),Si.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Tl(this,e,t);let r=[];return this.decompose(e,t,r,0),Si.from(r,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),r=this.length-this.scanIdentical(e,-1),i=new Ya(this),s=new Ya(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new Ya(this,e)}iterRange(e,t=this.length){return new cC(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new uC(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?xt.empty:e.length<=32?new rn(e):Si.from(rn.split(e,[]))}}class rn extends xt{constructor(e,t=FD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?r:a)>=e)return new jD(i,a,r,o);i=a+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new rn(Jw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Wf(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new rn(a,o.length+s.length));else{let u=a.length>>1;r.push(new rn(a.slice(0,u)),new rn(a.slice(u)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof rn))return super.replace(e,t,r);[e,t]=Tl(this,e,t);let i=Wf(this.text,Wf(r.text,Jw(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new rn(i,s):Si.from(rn.split(i,[]),s)}sliceString(e,t=this.length,r=`
148
+ `){[e,t]=Tl(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],u=s+a.length;s>e&&o&&(i+=r),e<u&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=u+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new rn(r,i)),r=[],i=-1);return i>-1&&t.push(new rn(r,i)),t}}class Si extends xt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,u=r+o.lines-1;if((t?u:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=u+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],u=o+a.length;if(e<=u&&t>=o){let f=i&((o<=e?1:0)|(u>=t?2:0));o>=e&&u<=t&&!f?r.push(a):a.decompose(e-o,t-o,r,f)}o=u+1}}replace(e,t,r){if([e,t]=Tl(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let u=o.replace(e-s,t-s,r),f=this.lines-o.lines+u.lines;if(u.lines<f>>4&&u.lines>f>>6){let d=this.children.slice();return d[i]=u,new Si(d,this.length-(t-e)+r.length)}return super.replace(s,a,u)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
149
+ `){[e,t]=Tl(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],u=o+a.length;o>e&&s&&(i+=r),e<u&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=u+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Si))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let u=this.children[i],f=e.children[s];if(u!=f)return r+u.scanIdentical(f,t);r+=u.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let y of e)r+=y.lines;if(r<32){let y=[];for(let v of e)v.flatten(y);return new rn(y,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],u=0,f=-1,d=[];function p(y){let v;if(y.lines>s&&y instanceof Si)for(let w of y.children)p(w);else y.lines>o&&(u>o||!u)?(g(),a.push(y)):y instanceof rn&&u&&(v=d[d.length-1])instanceof rn&&y.lines+v.lines<=32?(u+=y.lines,f+=y.length+1,d[d.length-1]=new rn(v.text.concat(y.text),v.length+1+y.length)):(u+y.lines>i&&g(),u+=y.lines,f+=y.length+1,d.push(y))}function g(){u!=0&&(a.push(d.length==1?d[0]:Si.from(d,f)),f=-1,u=d.length=0)}for(let y of e)p(y);return g(),a.length==1?a[0]:new Si(a,t)}}xt.empty=new rn([""],0);function FD(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Wf(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],u=i+a.length;u>=t&&(u>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=u+1}return e}function Jw(n,e,t){return Wf(n,[""],e,t)}class Ya{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 rn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof rn?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
150
+ `,this;e--}else if(i instanceof rn){let u=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,u.length>Math.max(0,e))return this.value=e==0?u:t>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=i.children[o+(t<0?-1:0)];e>u.length?(e-=u.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(u),this.offsets.push(t>0?1:(u instanceof rn?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class cC{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Ya(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}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 r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),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!=""}}class uC{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(xt.prototype[Symbol.iterator]=function(){return this.iter()},Ya.prototype[Symbol.iterator]=cC.prototype[Symbol.iterator]=uC.prototype[Symbol.iterator]=function(){return this});class jD{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Tl(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Sn(n,e,t=!0,r=!0){return LD(n,e,t,r)}function _D(n){return n>=56320&&n<57344}function zD(n){return n>=55296&&n<56320}function sr(n,e){let t=n.charCodeAt(e);if(!zD(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return _D(r)?(t-55296<<10)+(r-56320)+65536:t}function by(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ki(n){return n<65536?1:2}const jg=/\r\n?|\n/;var Yn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Yn||(Yn={}));class Mi{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 r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){_g(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new Mi(e)}composeDesc(e){return this.empty?e:e.empty?this:fC(this,e)}mapDesc(e,t=!1){return e.empty?this:zg(this,e,t)}mapPos(e,t=-1,r=Yn.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],u=this.sections[o++],f=i+a;if(u<0){if(f>e)return s+(e-i);s+=a}else{if(r!=Yn.Simple&&f>=e&&(r==Yn.TrackDel&&i<e&&f>e||r==Yn.TrackBefore&&i<e||r==Yn.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!a)return e==i||t<0?s:s+u;s+=u}i=f}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Mi(e)}static create(e){return new Mi(e)}}class pn extends Mi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return _g(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return zg(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let u=i>>1;for(;r.length<u;)r.push(xt.empty);r.push(o?e.slice(s,s+o):xt.empty)}s+=o}return new pn(t,r)}compose(e){return this.empty?e:e.empty?this:fC(this,e,!0)}map(e,t=!1){return e.empty?this:zg(this,e,t,!0)}iterChanges(e,t=!1){_g(this,e,t)}get desc(){return Mi.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new uc(this);e:for(let o=0,a=0;;){let u=o==e.length?1e9:e[o++];for(;a<u||a==u&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,u-a);_n(i,d,-1);let p=s.ins==-1?-1:s.off==0?s.ins:0;_n(t,d,p),p>0&&As(r,t,s.text),s.forward(d),a+=d}let f=e[o++];for(;a<f;){if(s.done)break e;let d=Math.min(s.len,f-a);_n(t,d,-1),_n(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new pn(t,r),filtered:Mi.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,a=null;function u(d=!1){if(!d&&!i.length)return;o<t&&_n(i,t-o,-1);let p=new pn(i,s);a=a?a.compose(p.map(a)):p,i=[],s=[],o=0}function f(d){if(Array.isArray(d))for(let p of d)f(p);else if(d instanceof pn){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);u(),a=a?a.compose(d.map(a)):d}else{let{from:p,to:g=p,insert:y}=d;if(p>g||p<0||g>t)throw new RangeError(`Invalid change range ${p} to ${g} (in doc of length ${t})`);let v=y?typeof y=="string"?xt.of(y.split(r||jg)):y:xt.empty,w=v.length;if(p==g&&w==0)return;p<o&&u(),p>o&&_n(i,p-o,-1),_n(i,g-p,w),As(s,i,v),o=g}}return f(e),u(!a),a}static empty(e){return new pn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(xt.empty);r[i]=xt.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new pn(t,r)}static createSet(e,t){return new pn(e,t)}}function _n(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function As(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(xt.empty);n.push(t)}}function _g(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],u=n.sections[o++];if(u<0)i+=a,s+=a;else{let f=i,d=s,p=xt.empty;for(;f+=a,d+=u,u&&r&&(p=p.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],u=n.sections[o++];e(i,f,s,d,p),i=f,s=d}}}function zg(n,e,t,r=!1){let i=[],s=r?[]:null,o=new uc(n),a=new uc(e);for(let u=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let f=Math.min(o.len,a.len);_n(i,f,-1),o.forward(f),a.forward(f)}else if(a.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let f=a.len;for(_n(i,a.ins,-1);f;){let d=Math.min(o.len,f);o.ins>=0&&u<o.i&&o.len<=d&&(_n(i,0,o.ins),s&&As(s,i,o.text),u=o.i),o.forward(d),f-=d}a.next()}else if(o.ins>=0){let f=0,d=o.len;for(;d;)if(a.ins==-1){let p=Math.min(d,a.len);f+=p,d-=p,a.forward(p)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;_n(i,f,u<o.i?o.ins:0),s&&u<o.i&&As(s,i,o.text),u=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return s?pn.createSet(i,s):Mi.create(i);throw new Error("Mismatched change set lengths")}}}function fC(n,e,t=!1){let r=[],i=t?[]:null,s=new uc(n),o=new uc(e);for(let a=!1;;){if(s.done&&o.done)return i?pn.createSet(r,i):Mi.create(r);if(s.ins==0)_n(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)_n(r,0,o.ins,a),i&&As(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(s.len2,o.len),f=r.length;if(s.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;_n(r,u,d,a),i&&d&&As(i,r,o.text)}else o.ins==-1?(_n(r,s.off?0:s.len,u,a),i&&As(i,r,s.textBit(u))):(_n(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&As(i,r,o.text));a=(s.ins>u||o.ins>=0&&o.len>u)&&(a||r.length>f),s.forward2(u),o.forward(u)}}}}class uc{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?xt.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?xt.empty:t[r].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)}}class vo{constructor(e,t,r){this.from=e,this.to=t,this.flags=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 bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new vo(r,i,this.flags)}extend(e,t=e,r=0){if(e<=this.anchor&&t>=this.anchor)return ue.range(e,t,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ue.range(this.anchor,i,void 0,void 0,r)}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 new RangeError("Invalid JSON representation for SelectionRange");return ue.range(e.anchor,e.head)}static create(e,t,r){return new vo(e,t,r)}}class ue{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ue.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ue([this.main],0)}addRange(e,t=!0){return ue.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,ue.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ue(e.ranges.map(t=>vo.fromJSON(t)),e.main)}static single(e,t=e){return new ue([ue.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return ue.normalized(e.slice(),t);r=s.to}return new ue(e,t)}static cursor(e,t=0,r,i){return vo.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i,s){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=t&&(s=t<e?1:-1),t<e?vo.create(t,e,48|o):vo.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,u=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?ue.range(u,a):ue.range(a,u))}}return new ue(e,t)}}function dC(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Sy=0;class Me{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=Sy++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Me(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:ky),!!e.static,e.enables)}of(e){return new Hf([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hf(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hf(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function ky(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class Hf{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=Sy++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,u=!1,f=!1,d=[];for(let p of this.dependencies)p=="doc"?u=!0:p=="selection"?f=!0:(((t=e[p.id])!==null&&t!==void 0?t:1)&1)==0&&d.push(e[p.id]);return{create(p){return p.values[o]=r(p),1},update(p,g){if(u&&g.docChanged||f&&(g.docChanged||g.selection)||Vg(p,d)){let y=r(p);if(a?!Zw(y,p.values[o],i):!i(y,p.values[o]))return p.values[o]=y,1}return 0},reconfigure:(p,g)=>{let y,v=g.config.address[s];if(v!=null){let w=dd(g,v);if(this.dependencies.every(S=>S instanceof Me?g.facet(S)===p.facet(S):S instanceof Vn?g.field(S,!1)==p.field(S,!1):!0)||(a?Zw(y=r(p),w,i):i(y=r(p),w)))return p.values[o]=w,0}else y=r(p);return p.values[o]=y,1}}}}function Zw(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function Vg(n,e){let t=!1;for(let r of e)Ga(n,r)&1&&(t=!0);return t}function VD(n,e,t){let r=t.map(u=>n[u.id]),i=t.map(u=>u.type),s=r.filter(u=>!(u&1)),o=n[e.id]>>1;function a(u){let f=[];for(let d=0;d<r.length;d++){let p=dd(u,r[d]);if(i[d]==2)for(let g of p)f.push(g);else f.push(p)}return e.combine(f)}return{create(u){for(let f of r)Ga(u,f);return u.values[o]=a(u),1},update(u,f){if(!Vg(u,s))return 0;let d=a(u);return e.compare(d,u.values[o])?0:(u.values[o]=d,1)},reconfigure(u,f){let d=Vg(u,r),p=f.config.facets[e.id],g=f.facet(e);if(p&&!d&&ky(t,p))return u.values[o]=g,0;let y=a(u);return e.compare(y,g)?(u.values[o]=g,0):(u.values[o]=y,1)}}}const of=Me.define({static:!0});class Vn{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new Vn(Sy++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(of).find(r=>r.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(of),o=i.facet(of),a;return(a=s.find(u=>u.field==this))&&a!=o.find(u=>u.field==this)?(r.values[t]=a.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,of.of({field:this,create:e})]}get extension(){return this}}const mo={lowest:4,low:3,default:2,high:1,highest:0};function Pa(n){return e=>new hC(e,n)}const Ks={highest:Pa(mo.highest),high:Pa(mo.high),default:Pa(mo.default),low:Pa(mo.low),lowest:Pa(mo.lowest)};class hC{constructor(e,t){this.inner=e,this.prec=t}}class hh{of(e){return new Wg(this,e)}reconfigure(e){return hh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Wg{constructor(e,t){this.compartment=e,this.inner=t}}class fd{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let g of WD(e,t,o))g instanceof Vn?i.push(g):(s[g.facet.id]||(s[g.facet.id]=[])).push(g);let a=Object.create(null),u=[],f=[];for(let g of i)a[g.id]=f.length<<1,f.push(y=>g.slot(y));let d=r==null?void 0:r.config.facets;for(let g in s){let y=s[g],v=y[0].facet,w=d&&d[g]||[];if(y.every(S=>S.type==0))if(a[v.id]=u.length<<1|1,ky(w,y))u.push(r.facet(v));else{let S=v.combine(y.map(C=>C.value));u.push(r&&v.compare(S,r.facet(v))?r.facet(v):S)}else{for(let S of y)S.type==0?(a[S.id]=u.length<<1|1,u.push(S.value)):(a[S.id]=f.length<<1,f.push(C=>S.dynamicSlot(C)));a[v.id]=f.length<<1,f.push(S=>VD(S,v,y))}}let p=f.map(g=>g(a));return new fd(e,o,p,a,u,s)}}function WD(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let u=i.get(o);if(u!=null){if(u<=a)return;let f=r[u].indexOf(o);f>-1&&r[u].splice(f,1),o instanceof Wg&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let f of o)s(f,a);else if(o instanceof Wg){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(o.compartment)||o.inner;t.set(o.compartment,f),s(f,a)}else if(o instanceof hC)s(o.inner,o.prec);else if(o instanceof Vn)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Hf)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,mo.default);else{let f=o.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(f,a)}}return s(n,mo.default),r.reduce((o,a)=>o.concat(a))}function Ga(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function dd(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const pC=Me.define(),Hg=Me.define({combine:n=>n.some(e=>e),static:!0}),mC=Me.define({combine:n=>n.length?n[0]:void 0,static:!0}),gC=Me.define(),yC=Me.define(),vC=Me.define(),xC=Me.define({combine:n=>n.length?n[0]:!1});class rs{constructor(e,t){this.type=e,this.value=t}static define(){return new HD}}class HD{of(e){return new rs(this,e)}}class $D{constructor(e){this.map=e}of(e){return new lt(this,e)}}class lt{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new lt(this.type,t)}is(e){return this.type==e}static define(e={}){return new $D(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}lt.reconfigure=lt.define();lt.appendConfig=lt.define();class gn{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&dC(r,t.newLength),s.some(a=>a.type==gn.time)||(this.annotations=s.concat(gn.time.of(Date.now())))}static create(e,t,r,i,s,o){return new gn(e,t,r,i,s,o)}get newDoc(){return this._doc||(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(e){let t=this.annotation(gn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}gn.time=rs.define();gn.userEvent=rs.define();gn.addToHistory=rs.define();gn.remote=rs.define();function UD(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function wC(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=pn.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:lt.mapEffects(n.effects,i).concat(lt.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function $g(n,e,t){let r=e.selection,i=yl(e.annotations);return e.userEvent&&(i=i.concat(gn.userEvent.of(e.userEvent))),{changes:e.changes instanceof pn?e.changes:pn.of(e.changes||[],t,n.facet(mC)),selection:r&&(r instanceof ue?r:ue.single(r.anchor,r.head)),effects:yl(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function bC(n,e,t){let r=$g(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=wC(r,$g(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=gn.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return KD(t?qD(i):i)}function qD(n){let e=n.startState,t=!0;for(let i of e.facet(gC)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:UD(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=pn.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=gn.create(e,i,n.selection&&n.selection.map(s),lt.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(yC);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof gn?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof gn?n=s[0]:n=bC(e,yl(s),!1)}return n}function KD(n){let e=n.startState,t=e.facet(vC),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=wC(r,$g(e,s,n.changes.newLength),!0))}return r==n?n:gn.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const YD=[];function yl(n){return n==null?YD:Array.isArray(n)?n:[n]}var $t=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})($t||($t={}));const GD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ug;try{Ug=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function QD(n){if(Ug)return Ug.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||GD.test(t)))return!0}return!1}function XD(n){return e=>{if(!/\S/.test(e))return $t.Space;if(QD(e))return $t.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return $t.Word;return $t.Other}}class yt{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Ga(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Ga(this,r),dd(this,r)}update(...e){return bC(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let a of e.effects)a.is(hh.reconfigure)?(t&&(i=new Map,t.compartments.forEach((u,f)=>i.set(f,u)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(lt.reconfigure)?(t=null,r=a.value):a.is(lt.appendConfig)&&(t=null,r=yl(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=fd.resolve(r,i,this),s=new yt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(u,f)=>f.reconfigure(u,this),null).values);let o=e.startState.facet(Hg)?e.newSelection:e.newSelection.asSingle();new yt(t,e.newDoc,o,s,(a,u)=>u.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ue.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=yl(r.effects);for(let a=1;a<t.ranges.length;a++){let u=e(t.ranges[a]),f=this.changes(u.changes),d=f.map(i);for(let g=0;g<a;g++)s[g]=s[g].map(d);let p=i.mapDesc(f,!0);s.push(u.range.map(p)),i=i.compose(d),o=lt.mapEffects(o,d).concat(lt.mapEffects(yl(u.effects),p))}return{changes:i,selection:ue.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof pn?e:pn.of(e,this.doc.length,this.facet(yt.lineSeparator))}toText(e){return xt.of(e.split(this.facet(yt.lineSeparator)||jg))}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:(Ga(this,t),dd(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Vn&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(u=>o.spec.fromJSON(a,u)))}}return yt.create({doc:e.doc,selection:ue.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=fd.resolve(e.extensions||[],new Map),r=e.doc instanceof xt?e.doc:xt.of((e.doc||"").split(t.staticFacet(yt.lineSeparator)||jg)),i=e.selection?e.selection instanceof ue?e.selection:ue.single(e.selection.anchor,e.selection.head):ue.single(0);return dC(i,r.length),t.staticFacet(Hg)||(i=i.asSingle()),new yt(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(yt.tabSize)}get lineBreak(){return this.facet(yt.lineSeparator)||`
151
+ `}get readOnly(){return this.facet(xC)}phrase(e,...t){for(let r of this.facet(yt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(pC))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return XD(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let u=Sn(t,o,!1);if(s(t.slice(u,o))!=$t.Word)break;o=u}for(;a<i;){let u=Sn(t,a);if(s(t.slice(a,u))!=$t.Word)break;a=u}return o==a?null:ue.range(o+r,a+r)}}yt.allowMultipleSelections=Hg;yt.tabSize=Me.define({combine:n=>n.length?n[0]:4});yt.lineSeparator=mC;yt.readOnly=xC;yt.phrases=Me.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});yt.languageData=pC;yt.changeFilter=gC;yt.transactionFilter=yC;yt.transactionExtender=vC;hh.reconfigure=lt.define();function Ii(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Fs{eq(e){return this==e}range(e,t=e){return qg.create(e,t,this)}}Fs.prototype.startSide=Fs.prototype.endSide=0;Fs.prototype.point=!1;Fs.prototype.mapMode=Yn.TrackDel;function Cy(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let qg=class SC{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new SC(e,t,r)}};function Kg(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Ey{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let u=o+a>>1,f=s[u]-e||(r?this.value[u].endSide:this.value[u].startSide)-t;if(u==o)return f>=0?o:a;f>=0?a=u:o=u+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let u=0;u<this.value.length;u++){let f=this.value[u],d=this.from[u]+e,p=this.to[u]+e,g,y;if(d==p){let v=t.mapPos(d,f.startSide,f.mapMode);if(v==null||(g=y=v,f.startSide!=f.endSide&&(y=t.mapPos(d,f.endSide),y<g)))continue}else if(g=t.mapPos(d,f.startSide),y=t.mapPos(p,f.endSide),g>y||g==y&&f.startSide>0&&f.endSide<=0)continue;(y-g||f.endSide-f.startSide)<0||(o<0&&(o=g),f.point&&(a=Math.max(a,y-g)),r.push(f),i.push(g-o),s.push(y-o))}return{mapped:r.length?new Ey(i,s,r,a):null,pos:o}}}class mt{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new mt(e,t,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(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Kg)),this.isEmpty)return t.length?mt.of(t):this;let a=new kC(this,null,-1).goto(0),u=0,f=[],d=new es;for(;a.value||u<t.length;)if(u<t.length&&(a.from-t[u].from||a.startSide-t[u].value.startSide)>=0){let p=t[u++];d.addInner(p.from,p.to,p.value)||f.push(p)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(u==t.length||this.chunkEnd(a.chunkIndex)<t[u].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||f.push(qg.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!f.length?mt.empty:this.nextLayer.update({add:f,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],u=this.chunk[o],f=e.touchesRange(a,a+u.length);if(f===!1)i=Math.max(i,u.maxPoint),t.push(u),r.push(e.mapPos(a));else if(f===!0){let{mapped:d,pos:p}=u.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(p))}}let s=this.nextLayer.map(e);return t.length==0?s:new mt(r,t,s||mt.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return fc.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return fc.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=s),a=t.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=s),u=eb(o,a,r),f=new Ia(o,u,s),d=new Ia(a,u,s);r.iterGaps((p,g,y)=>tb(f,p,d,g,y,i)),r.empty&&r.length==0&&tb(f,0,d,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&t.indexOf(d)<0),o=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=eb(s,o),u=new Ia(s,a,0).goto(r),f=new Ia(o,a,0).goto(r);for(;;){if(u.to!=f.to||!Yg(u.active,f.active)||u.point&&(!f.point||!Cy(u.point,f.point)))return!1;if(u.to>i)return!0;u.next(),f.next()}}static spans(e,t,r,i,s=-1){let o=new Ia(e,null,s).goto(t),a=t,u=o.openStart;for(;;){let f=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),p=o.pointFrom<t?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,u);i.point(a,f,o.point,d,p,o.pointRank),u=Math.min(o.openEnd(f),d.length)}else f>a&&(i.span(a,f,o.active,u),u=o.openEnd(f));if(o.to>r)return u+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new es;for(let i of e instanceof qg?[e]:t?JD(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return mt.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=mt.empty;i=i.nextLayer)t=new mt(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}mt.empty=new mt([],[],null,-1);function JD(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(Kg(e,r)>0)return n.slice().sort(Kg);e=r}return n}mt.empty.nextLayer=mt.empty;class es{finishChunk(e){this.chunks.push(new Ey(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,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new es)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new 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=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.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 r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(mt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function eb(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!(t!=null&&t.touchesRange(a,a+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class kC{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}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,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}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],r=e+t.from[this.rangeIndex];if(this.from=r,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}}class fc{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new kC(o,t,r,s));return i.length==1?i[0]:new fc(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)Wm(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)Wm(this.heap,r);(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(),Wm(this.heap,0)}}}function Wm(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class Ia{constructor(e,t,r){this.minPoint=r,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=fc.from(e,t,r)}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){lf(this.active,e),lf(this.activeTo,e),lf(this.activeRank,e),this.minActive=nb(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;af(this.active,t,r),af(this.activeTo,t,i),af(this.activeRank,t,s),e&&af(e,t,this.cursor.from),this.minActive=nb(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&lf(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function tb(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,a=r,u=r-e,f=!!s.boundChange;for(let d=!1;;){let p=n.to+u-t.to,g=p||n.endSide-t.endSide,y=g<0?n.to+u:t.to,v=Math.min(y,o);if(n.point||t.point?(n.point&&t.point&&Cy(n.point,t.point)&&Yg(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(a,v,n.point,t.point),d=!1):(d&&s.boundChange(a),v>a&&!Yg(n.active,t.active)&&s.compareRange(a,v,n.active,t.active),f&&v<o&&(p||n.openEnd(y)!=t.openEnd(y))&&(d=!0)),y>o)break;a=y,g<=0&&n.next(),g>=0&&t.next()}}function Yg(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Cy(n[t],e[t]))return!1;return!0}function lf(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function af(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function nb(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function Wl(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Sn(n,i));return r}function Gg(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=Sn(n,i)}return r===!0?-1:n.length}const Qg="ͼ",rb=typeof Symbol>"u"?"__"+Qg:Symbol.for(Qg),Xg=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ib=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class js{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,u,f){let d=[],p=/^@(\w+)\b/.exec(o[0]),g=p&&p[1]=="keyframes";if(p&&a==null)return u.push(o[0]+";");for(let y in a){let v=a[y];if(/&/.test(y))s(y.split(/,\s*/).map(w=>o.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),v,u);else if(v&&typeof v=="object"){if(!p)throw new RangeError("The value of a property ("+y+") should be a primitive value.");s(i(y),v,d,g)}else v!=null&&d.push(y.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+v+";")}(d.length||g)&&u.push((r&&!p&&!f?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
152
+ `)}static newName(){let e=ib[rb]||1;return ib[rb]=e+1,Qg+e.toString(36)}static mount(e,t,r){let i=e[Xg],s=r&&r.nonce;i?s&&i.setNonce(s):i=new ZD(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let sb=new Map;class ZD{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=sb.get(r);if(s)return e[Xg]=s;this.sheet=new i.CSSStyleSheet,sb.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Xg]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],u=this.modules.indexOf(a);if(u<s&&u>-1&&(this.modules.splice(u,1),s--,u=-1),u==-1){if(this.modules.splice(s++,0,a),r)for(let f=0;f<a.rules.length;f++)r.insertRule(a.rules[f],i++)}else{for(;s<u;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
153
+ `;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var _s={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:"'"},dc={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),tN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Mn=0;Mn<10;Mn++)_s[48+Mn]=_s[96+Mn]=String(Mn);for(var Mn=1;Mn<=24;Mn++)_s[Mn+111]="F"+Mn;for(var Mn=65;Mn<=90;Mn++)_s[Mn]=String.fromCharCode(Mn+32),dc[Mn]=String.fromCharCode(Mn);for(var Hm in _s)dc.hasOwnProperty(Hm)||(dc[Hm]=_s[Hm]);function nN(n){var e=eN&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||tN&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?dc:_s)[n.keyCode]||n.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 Ot(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)CC(n,arguments[e]);return n}function CC(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)CC(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let Kn=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Jg=typeof document<"u"?document:{documentElement:{style:{}}};const Zg=/Edge\/(\d+)/.exec(Kn.userAgent),EC=/MSIE \d/.test(Kn.userAgent),e0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kn.userAgent),ph=!!(EC||e0||Zg),ob=!ph&&/gecko\/(\d+)/i.test(Kn.userAgent),$m=!ph&&/Chrome\/(\d+)/.exec(Kn.userAgent),lb="webkitFontSmoothing"in Jg.documentElement.style,t0=!ph&&/Apple Computer/.test(Kn.vendor),ab=t0&&(/Mobile\/\w+/.test(Kn.userAgent)||Kn.maxTouchPoints>2);var Ae={mac:ab||/Mac/.test(Kn.platform),windows:/Win/.test(Kn.platform),linux:/Linux|X11/.test(Kn.platform),ie:ph,ie_version:EC?Jg.documentMode||6:e0?+e0[1]:Zg?+Zg[1]:0,gecko:ob,gecko_version:ob?+(/Firefox\/(\d+)/.exec(Kn.userAgent)||[0,0])[1]:0,chrome:!!$m,chrome_version:$m?+$m[1]:0,ios:ab,android:/Android\b/.test(Kn.userAgent),webkit:lb,webkit_version:lb?+(/\bAppleWebKit\/(\d+)/.exec(Kn.userAgent)||[0,0])[1]:0,safari:t0,safari_version:t0?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Kn.userAgent)||[0,0])[1]:0,tabSize:Jg.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Ry(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const hd=Object.create(null);function Ty(n,e,t){if(n==e)return!0;n||(n=hd),e||(e=hd);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function rN(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function cb(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function iN(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}class Di{eq(e){return!1}updateDOM(e,t,r){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,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var An=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(An||(An={}));class Ge extends Fs{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Lc(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Mo(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=RC(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Mo(e,r,i,t,e.widget||null,!0)}static line(e){return new Bc(e)}static set(e,t=!1){return mt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ge.none=mt.empty;class Lc extends Ge{constructor(e){let{start:t,end:r}=RC(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Ry(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||hd}eq(e){return this==e||e instanceof Lc&&this.tagName==e.tagName&&Ty(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Lc.prototype.point=!1;class Bc extends Ge{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Bc&&this.spec.class==e.spec.class&&Ty(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Bc.prototype.mapMode=Yn.TrackBefore;Bc.prototype.point=!0;class Mo extends Ge{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?Yn.TrackBefore:Yn.TrackAfter:Yn.TrackDel}get type(){return this.startSide!=this.endSide?An.WidgetRange:this.startSide<=0?An.WidgetBefore:An.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Mo&&sN(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Mo.prototype.point=!0;function RC(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function sN(n,e){return n==e||!!(n&&e&&n.compare(e))}function vl(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class hc extends Fs{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.rank=r}eq(e){return e==this||e instanceof hc&&this.tagName==e.tagName&&Ty(this.attributes,e.attributes)}static create(e){return new hc(e.tagName,e.attributes||hd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return mt.of(e,t)}}hc.prototype.startSide=hc.prototype.endSide=-1;function pc(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function n0(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Qa(n,e){if(!e.anchorNode)return!1;try{return n0(n,e.anchorNode)}catch{return!1}}function Xa(n){return n.nodeType==3?gc(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ja(n,e,t,r){return t?ub(n,e,t,r,-1)||ub(n,e,t,r,1):!1}function zs(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function pd(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function ub(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:ts(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=zs(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?ts(n):0}else return!1}}function ts(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function mc(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function oN(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function TC(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function lN(n,e,t,r,i,s,o,a){let u=n.ownerDocument,f=u.defaultView||window;for(let d=n,p=!1;d&&!p;)if(d.nodeType==1){let g,y=d==u.body,v=1,w=1;if(y)g=oN(f);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(p=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let R=d.getBoundingClientRect();({scaleX:v,scaleY:w}=TC(d,R)),g={left:R.left,right:R.left+d.clientWidth*v,top:R.top,bottom:R.top+d.clientHeight*w}}let S=0,C=0;if(i=="nearest")e.top<g.top+o?(C=e.top-(g.top+o),t>0&&e.bottom>g.bottom+C&&(C=e.bottom-g.bottom+o)):e.bottom>g.bottom-o&&(C=e.bottom-g.bottom+o,t<0&&e.top-C<g.top&&(C=e.top-(g.top+o)));else{let R=e.bottom-e.top,T=g.bottom-g.top;C=(i=="center"&&R<=T?e.top+R/2-T/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-T+o)-g.top}if(r=="nearest"?e.left<g.left+s?(S=e.left-(g.left+s),t>0&&e.right>g.right+S&&(S=e.right-g.right+s)):e.right>g.right-s&&(S=e.right-g.right+s,t<0&&e.left<g.left+S&&(S=e.left-(g.left+s))):S=(r=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:r=="start"==a?e.left-s:e.right-(g.right-g.left)+s)-g.left,S||C)if(y)f.scrollBy(S,C);else{let R=0,T=0;if(C){let M=d.scrollTop;d.scrollTop+=C/w,T=(d.scrollTop-M)*w}if(S){let M=d.scrollLeft;d.scrollLeft+=S/v,R=(d.scrollLeft-M)*v}e={left:e.left-R,top:e.top-T,right:e.right-R,bottom:e.bottom-T},R&&Math.abs(R-S)<1&&(r="nearest"),T&&Math.abs(T-C)<1&&(i="nearest")}if(y)break;(e.top<g.top||e.bottom>g.bottom||e.left<g.left||e.right>g.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function OC(n,e=!0){let t=n.ownerDocument,r=null,i=null;for(let s=n.parentNode;s&&!(s==t.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class aN{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:r}=e;this.set(t,Math.min(e.anchorOffset,t?ts(t):0),r,Math.min(e.focusOffset,r?ts(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let ho=null;Ae.safari&&Ae.safari_version>=26&&(ho=!1);function MC(n){if(n.setActive)return n.setActive();if(ho)return n.focus(ho);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(ho==null?{get preventScroll(){return ho={preventScroll:!0},!0}}:void 0),!ho){ho=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let fb;function gc(n,e,t=e){let r=fb||(fb=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function xl(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function cN(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function uN(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,ts(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=ts(t))}else{if(t==n)return!0;r=zs(t),t=t.parentNode}}function AC(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function PC(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=ts(t)}else if(t.parentNode&&!pd(t))r=zs(t),t=t.parentNode;else return null}}function IC(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!pd(t))r=zs(t)+1,t=t.parentNode;else return null}}class ri{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new ri(e.parentNode,zs(e),t)}static after(e,t){return new ri(e.parentNode,zs(e)+1,t)}}var At=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(At||(At={}));const Ao=At.LTR,Oy=At.RTL;function DC(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const fN=DC("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dN=DC("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),r0=Object.create(null),gi=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);r0[e]=t,r0[t]=-e}function NC(n){return n<=247?fN[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?dN[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const hN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Ei{get dir(){return this.level%2?Oy:Ao}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function LC(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!LC(r.inner,i.inner))return!1}return!0}const Mt=[];function pN(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,u=s?256:i;for(let f=o,d=u,p=u;f<a;f++){let g=NC(n.charCodeAt(f));g==512?g=d:g==8&&p==4&&(g=16),Mt[f]=g==4?2:g,g&7&&(p=g),d=g}for(let f=o,d=u,p=u;f<a;f++){let g=Mt[f];if(g==128)f<a-1&&d==Mt[f+1]&&d&24?g=Mt[f]=d:Mt[f]=256;else if(g==64){let y=f+1;for(;y<a&&Mt[y]==64;)y++;let v=f&&d==8||y<t&&Mt[y]==8?p==1?1:8:256;for(let w=f;w<y;w++)Mt[w]=v;f=y-1}else g==8&&p==1&&(Mt[f]=1);d=g,g&7&&(p=g)}}}function mN(n,e,t,r,i){let s=i==1?2:1;for(let o=0,a=0,u=0;o<=r.length;o++){let f=o?r[o-1].to:e,d=o<r.length?r[o].from:t;for(let p=f,g,y,v;p<d;p++)if(y=r0[g=n.charCodeAt(p)])if(y<0){for(let w=a-3;w>=0;w-=3)if(gi[w+1]==-y){let S=gi[w+2],C=S&2?i:S&4?S&1?s:i:0;C&&(Mt[p]=Mt[gi[w]]=C),a=w;break}}else{if(gi.length==189)break;gi[a++]=p,gi[a++]=g,gi[a++]=u}else if((v=Mt[p])==2||v==1){let w=v==i;u=w?0:1;for(let S=a-3;S>=0;S-=3){let C=gi[S+2];if(C&2)break;if(w)gi[S+2]|=2;else{if(C&4)break;gi[S+2]|=4}}}}}function gN(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,a=i<t.length?t[i].from:e;for(let u=o;u<a;){let f=Mt[u];if(f==256){let d=u+1;for(;;)if(d==a){if(i==t.length)break;d=t[i++].to,a=i<t.length?t[i].from:e}else if(Mt[d]==256)d++;else break;let p=s==1,g=(d<e?Mt[d]:r)==1,y=p==g?p?1:2:r;for(let v=d,w=i,S=w?t[w-1].to:n;v>u;)v==S&&(v=t[--w].from,S=w?t[w-1].to:n),Mt[--v]=y;u=d}else s=f,u++}}}function i0(n,e,t,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let u=e,f=0;u<t;){let d=!0,p=!1;if(f==s.length||u<s[f].from){let w=Mt[u];w!=a&&(d=!1,p=w==16)}let g=!d&&a==1?[]:null,y=d?r:r+1,v=u;e:for(;;)if(f<s.length&&v==s[f].from){if(p)break e;let w=s[f];if(!d)for(let S=w.to,C=f+1;;){if(S==t)break e;if(C<s.length&&s[C].from==S)S=s[C++].to;else{if(Mt[S]==a)break e;break}}if(f++,g)g.push(w);else{w.from>u&&o.push(new Ei(u,w.from,y));let S=w.direction==Ao!=!(y%2);s0(n,S?r+1:r,i,w.inner,w.from,w.to,o),u=w.to}v=w.to}else{if(v==t||(d?Mt[v]!=a:Mt[v]==a))break;v++}g?i0(n,u,v,r+1,i,g,o):u<v&&o.push(new Ei(u,v,y)),u=v}else for(let u=t,f=s.length;u>e;){let d=!0,p=!1;if(!f||u>s[f-1].to){let w=Mt[u-1];w!=a&&(d=!1,p=w==16)}let g=!d&&a==1?[]:null,y=d?r:r+1,v=u;e:for(;;)if(f&&v==s[f-1].to){if(p)break e;let w=s[--f];if(!d)for(let S=w.from,C=f;;){if(S==e)break e;if(C&&s[C-1].to==S)S=s[--C].from;else{if(Mt[S-1]==a)break e;break}}if(g)g.push(w);else{w.to<u&&o.push(new Ei(w.to,u,y));let S=w.direction==Ao!=!(y%2);s0(n,S?r+1:r,i,w.inner,w.from,w.to,o),u=w.from}v=w.from}else{if(v==e||(d?Mt[v-1]!=a:Mt[v-1]==a))break;v--}g?i0(n,v,u,r+1,i,g,o):v<u&&o.push(new Ei(v,u,y)),u=v}}function s0(n,e,t,r,i,s,o){let a=e%2?2:1;pN(n,i,s,r,a),mN(n,i,s,r,a),gN(i,s,r,a),i0(n,i,s,e,t,r,o)}function yN(n,e,t){if(!n)return[new Ei(0,0,e==Oy?1:0)];if(e==Ao&&!t.length&&!hN.test(n))return BC(n.length);if(t.length)for(;n.length>Mt.length;)Mt[Mt.length]=256;let r=[],i=e==Ao?0:1;return s0(n,i,i,t,0,n.length,r),r}function BC(n){return[new Ei(0,n,0)]}let FC="";function vN(n,e,t,r,i){var s;let o=r.head-n.from,a=Ei.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),u=e[a],f=u.side(i,t);if(o==f){let g=a+=i?1:-1;if(g<0||g>=e.length)return null;u=e[a=g],o=u.side(!i,t),f=u.side(i,t)}let d=Sn(n.text,o,u.forward(i,t));(d<u.from||d>u.to)&&(d=f),FC=n.text.slice(Math.min(o,d),Math.max(o,d));let p=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return p&&d==f&&p.level+(i?0:1)<u.level?ue.cursor(p.side(!i,t)+n.from,p.forward(i,t)?1:-1,p.level):ue.cursor(d+n.from,u.forward(i,t)?-1:1,u.level)}function xN(n,e,t){for(let r=e;r<t;r++){let i=NC(n.charCodeAt(r));if(i==1)return Ao;if(i==2||i==4)return Oy}return Ao}const jC=Me.define(),_C=Me.define(),zC=Me.define(),VC=Me.define(),o0=Me.define(),WC=Me.define(),HC=Me.define(),My=Me.define(),Ay=Me.define(),$C=Me.define({combine:n=>n.some(e=>e)}),UC=Me.define({combine:n=>n.some(e=>e)}),qC=Me.define();class wl{constructor(e,t,r,i,s,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new wl(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new wl(ue.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const cf=lt.define({map:(n,e)=>n.map(e)}),KC=lt.define();function ar(n,e,t){let r=n.facet(VC);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Ki=Me.define({combine:n=>n.length?n[0]:!0});let wN=0;const ul=Me.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class en{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(ul.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(ul.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new en(wN++,e,r,i,a=>{let u=[];return o&&u.push(mh.of(f=>{let d=f.plugin(a);return d?o(d):Ge.none})),s&&u.push(s(a)),u})}static fromClass(e,t){return en.define((r,i)=>new e(r,i),t)}}class Um{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.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(ar(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){ar(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){ar(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const YC=Me.define(),Py=Me.define(),mh=Me.define(),GC=Me.define(),Iy=Me.define(),Fc=Me.define(),QC=Me.define();function db(n,e){let t=n.state.facet(QC);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return mt.spans(r,e.from,e.to,{point(){},span(s,o,a,u){let f=s-e.from,d=o-e.from,p=i;for(let g=a.length-1;g>=0;g--,u--){let y=a[g].spec.bidiIsolate,v;if(y==null&&(y=xN(e.text,f,d)),u>0&&p.length&&(v=p[p.length-1]).to==f&&v.direction==y)v.to=d,p=v.inner;else{let w={from:f,to:d,direction:y,inner:[]};p.push(w),p=w.inner}}}}),i}const XC=Me.define();function Dy(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(XC)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const _a=Me.define();class Fr{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new Fr(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,u=s<t.length?t[s]:1e9,f=Math.min(a,u);if(f==1e9)break;let d=f+o,p=f,g=d;for(;;)if(s<t.length&&t[s]<=p){let y=t[s+1];s+=2,p=Math.max(p,y);for(let v=i;v<e.length&&e[v].fromB<=p;v++)o=e[v].toA-e[v].toB;g=Math.max(g,y+o)}else if(i<e.length&&e[i].fromB<=p){let y=e[i++];p=Math.max(p,y.toB),g=Math.max(g,y.toA),o=y.toA-y.toB}else break;r.push(new Fr(d,g,f,p))}return r}}class md{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=pn.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,u)=>i.push(new Fr(s,o,a,u))),this.changedRanges=i}static create(e,t,r){return new md(e,t,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}}const bN=[];class Zt{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return bN}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 t=this.domAttrs;t&&rN(this.dom,t)}}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 r=t;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let r=zs(this.dom),i=this.length?e>0:t>0;return new ri(this.parent.dom,r+(i?1:0),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 yh)return e;return null}static get(e){return e.cmTile}}class gh extends Zt{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,r=null,i,s=(e==null?void 0:e.node)==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;i&&i!=a.dom;)i=hb(i);else t.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=hb(i);this.length=o}}function hb(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class yh extends gh{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=Zt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,i=t.pop()}else{let o=r.children[i++];if(o instanceof Gi)t.push(i),r=o,i=0;else{let a=s+o.length,u=e(o,s);if(u!==void 0)return u;s=a+o.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,o=-1;if(this.blockTiles((a,u)=>{let f=u+a.length;if(e>=u&&e<=f){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(u<e||e==f&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-u),(f>e||e==u&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-u)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Gi extends gh{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(e,t){let r=new Gi(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Ol extends gh{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new Ol(t||document.createElement("div"),e);return(!t||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,r){let i=null,s=-1,o=null,a=-1;function u(d,p){for(let g=0,y=0;g<d.children.length&&y<=p;g++){let v=d.children[g],w=y+v.length;w>=p&&(v.isComposite()?u(v,p-y):(!o||o.isHidden&&(t>0||r&&kN(o,v)))&&(w>p||v.flags&32)?(o=v,a=p-y):(y<p||v.flags&16&&!v.isHidden)&&(i=v,s=p-y)),y=w}}u(this,e);let f=(t<0?i:o)||i||o;return f?{tile:f,offset:f==i?s:a}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):SN(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new ri(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let u of o.children){if(a)return new ri(u.dom,0);u==r.tile&&(a=!0)}}return new ri(this.dom,0)}}function SN(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Xa(e);return t[t.length-1]||null}function kN(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class lr extends gh{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new lr(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class xo extends Zt{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){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?Ae.chrome||Ae.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let a=gc(this.dom,i,s).getClientRects();if(!a.length)return null;let u=a[(o?o<0:t>=0)?0:a.length-1];return Ae.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(a,f=>f.width)||u),o?mc(u,o<0):u||null}static of(e,t){let r=new xo(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class Po extends Zt{constructor(e,t,r,i){super(e,t,i),this.widget=r}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,r){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(r)return mc(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let u=a?s.length-1:0;o=s[u],!(e>0?u==0:u==s.length-1||o.top<o.bottom);u+=a?-1:1);return mc(o,!a)}}get overrideDOMText(){if(!this.length)return xt.empty;let{root:e}=this;if(!e)return xt.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(e,t,r,i,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new Po(s,r,e,i)}}class gd extends Zt{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 xt.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class CN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let u=i.children[s],f=u.breakAfter;(t>0?u.length<=e:u.length<e)&&(!r||r.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!f,s++,e-=u.length):(a.push({tile:i,index:s}),i=u,s=0,r&&u.isComposite()&&r.enter(u))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let u=Math.min(e,i.length-s);r&&r.skip(i,s,s+u),e-=u,s+=u}else break;return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class EN{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class RN{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,i){var s;this.flushBuffer();let o=this.ensureMarks(t,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let u=o.children[o.children.length-1]=new xo(a.dom,a.text+e);u.parent=o}else o.append(i||xo.of(e,(s=this.cache.find(xo))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?qm(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let a=t.marks.length-1;a>=0;a--){let u=t.marks[a],f=i.lastChild;if(f instanceof lr&&f.mark.eq(u.mark))f.dom!=u.dom&&f.setDOM(qm(u.dom)),i=f;else{if(this.cache.reused.get(u)){let p=Zt.get(u.dom);p&&p.setDOM(qm(u.dom))}let d=lr.of(u.mark,u.dom);i.append(d),i=d}this.cache.reused.set(u,2)}let s=Zt.get(e.text);s&&this.cache.reused.set(s,2);let o=new xo(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(t,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).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){var r;e||(e=JC);let i=Ol.start(e,t||((r=this.cache.find(Ol))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}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){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=i.lastChild)&&a instanceof lr&&a.mark.eq(o))i=a,t--;else{let u=lr.of(o,(r=this.cache.find(lr,f=>f.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(u),i=u,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!pb(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Ae.ios&&pb(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Km,0,32)||new Po(Km.toDOM(),0,Km,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,r=new EN(e.from,e.to,e.value,t),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let i=t.lastChild;if(r.from<this.pos&&i instanceof Gi&&i.wrapper.eq(r.wrapper))t=i;else{let s=Gi.of(r.wrapper,(e=this.cache.find(Gi,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}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),r=this.cache.find(gd,void 0,1);return r&&(r.flags=t),r||new gd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class TN{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:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const yd=[Po,Ol,xo,lr,gd,Gi,yh];for(let n=0;n<yd.length;n++)yd[n].bucket=n;class ON{constructor(e){this.view=e,this.buckets=yd.map(()=>[]),this.index=yd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let u=(a+o)%s.length,f=s[u];if((!t||t(f))&&!this.reused.has(f))return s.splice(u,1),u<o&&this.index[i]--,this.reused.set(f,r),f}return null}findWidget(e,t,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Po(a.dom,t,e,a.flags&-498|r))}}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}}class MN{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new ON(e),this.text=new TN(e.state.doc),this.builder=new RN(this.cache,new yh(e,e.contentDOM),mt.iter(r)),this.cache.reused.set(t,2),this.old=new CN(t),this.reuseWalker={skip:(o,a,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,u=a?a.fromA:this.old.root.length;if(u>i){let f=u-i;this.preserve(f,!o,!a),i=u,s+=f}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=IN(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-a);else{let f=u>0||a<o.length?Po.of(o.widget,this.view,u-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);f.flags&256?(f.flags&=-2,this.builder.addBlockWidget(f)):(this.builder.ensureLine(null),this.builder.addInlineWidget(f,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&u==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,u),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof gd)this.cache.add(o);else if(o instanceof lr)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof lr&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof lr&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,i=this.builder,s=0,o=mt.spans(this.decorations,e,t,{point:(a,u,f,d,p,g)=>{if(f instanceof Mo){if(this.disallowBlockEffectsFor[g]){if(f.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,p>d.length)i.continueWidget(u-a);else{let y=f.widget||(f.block?Ml.block:Ml.inline),v=AN(f),w=this.cache.findWidget(y,u-a,v)||Po.of(y,this.view,u-a,v);f.block?(f.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(w)):(i.ensureLine(r),i.addInlineWidget(w,d,p))}r=null}else r=PN(r,f);u>a&&this.text.skip(u-a)},span:(a,u,f,d)=>{for(let p=a;p<u;){let g=this.text.next(Math.min(512,u-p));g==null?(i.addLineStartIfNotCovered(r),i.addBreak(),p++):(i.ensureLine(r),i.addText(g,f,p==a?d:f.length),p+=g.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Zt.get(i);if(i==this.view.contentDOM)break;s instanceof lr?t.push(s):s!=null&&s.isLine()?r=s:s instanceof Gi||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Ol(i,JC):r||t.push(lr.of(new Lc({tagName:i.nodeName.toLowerCase(),attributes:iN(i)}),i)))}return{line:r,marks:t}}}function pb(n,e){let t=r=>{for(let i of r.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(n)}function AN(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const JC={class:"cm-line"};function PN(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&Ry(t,n),r&&(n.class+=" "+r)),n}function IN(n){let e=[];for(let t=n.parents.length;t>1;t--){let r=t==n.parents.length?n.tile:n.parents[t].tile;r instanceof lr&&e.push(r.mark)}return e}function qm(n){let e=Zt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Ml extends Di{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}}Ml.inline=new Ml("span");Ml.block=new Ml("div");const Km=new class extends Di{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class mb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ge.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 yh(e,e.contentDOM),this.updateInner([new Fr(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:p})=>p<this.minWidthFrom||d>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 i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!VN(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?NN(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:p}=this.hasComposition;r=new Fr(d,p,e.changes.mapPos(d,-1),e.changes.mapPos(p,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Ae.ie||Ae.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let u=FN(o,this.decorations,e.changes);u.length&&(r=Fr.extendWithRanges(r,u));let f=_N(a,this.blockWrappers,e.changes);return f.length&&(r=Fr.extendWithRanges(r,f)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new MN(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Zt.get(t.text)&&a.cache.reused.set(Zt.get(t.text),2),this.tile=a.run(e,t),l0(o,a.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 s=Ae.chrome||Ae.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Ym&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(KC)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(Ki)||r.tabIndex>-1)&&Qa(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,f,d;if(u.empty?d=f=this.inlineDOMNearPos(u.anchor,u.assoc||1):(d=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),f=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),Ae.gecko&&u.empty&&!this.hasComposition&&DN(f)){let g=document.createTextNode("");this.view.observer.ignore(()=>f.node.insertBefore(g,f.node.childNodes[f.offset]||null)),f=d=new ri(g,0),a=!0}let p=this.view.observer.selectionRange;(a||!p.focusNode||(!Ja(f.node,f.offset,p.anchorNode,p.anchorOffset)||!Ja(d.node,d.offset,p.focusNode,p.focusOffset))&&!this.suppressWidgetCursorChange(p,u))&&(this.view.observer.ignore(()=>{Ae.android&&Ae.chrome&&r.contains(p.focusNode)&&zN(p.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let g=pc(this.view.root);if(g)if(u.empty){if(Ae.gecko){let y=LN(f.node,f.offset);if(y&&y!=3){let v=(y==1?PC:IC)(f.node,f.offset);v&&(f=new ri(v.node,v.offset))}}g.collapse(f.node,f.offset),u.bidiLevel!=null&&g.caretBidiLevel!==void 0&&(g.caretBidiLevel=u.bidiLevel)}else if(g.extend){g.collapse(f.node,f.offset);try{g.extend(d.node,d.offset)}catch{}}else{let y=document.createRange();u.anchor>u.head&&([f,d]=[d,f]),y.setEnd(d.node,d.offset),y.setStart(f.node,f.offset),g.removeAllRanges(),g.addRange(y)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(f,d)),this.impreciseAnchor=f.precise?null:new ri(p.anchorNode,p.anchorOffset),this.impreciseHead=d.precise?null:new ri(p.focusNode,p.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ja(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,r=pc(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let u=this.coordsAt(t.head,-1),f=this.coordsAt(t.head,1);if(!u||!f||u.bottom>f.top)return;let d=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(d.node,d.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=t.from&&r.collapse(i,s)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[t];else{let o=ts(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Zt.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let u=r.children[o];if(u.dom==s)return a;a+=u.length+u.breakAfter}}else return r.isText()?e==r.dom?i+t:i+(t?r.length:0):i}domAtPos(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(i,t)}inlineDOMNearPos(e,t){let r,i=-1,s=!1,o,a=-1,u=!1;return this.tile.blockTiles((f,d)=>{if(f.isWidget()){if(f.flags&32&&d>=e)return!0;f.flags&16&&(s=!0)}else{let p=d+f.length;if(d<=e&&(r=f,i=e-d,s=p<e),p>=e&&!o&&(o=f,a=e-d,u=d>e),d>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:u&&r&&(o=null),r&&t<0||!o?r.domIn(i,t):o.domIn(a,t))}coordsAt(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Ym?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let u=i(a,o);if(u)return u}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Sn(s.text,o);if(a==o)return null;let u=gc(s.dom,o,a).getClientRects();for(let f=0;f<u.length;f++){let d=u[f];if(f==u.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,u=this.view.textDirection==At.LTR,f=0,d=(p,g,y)=>{for(let v=0;v<p.children.length&&!(g>i);v++){let w=p.children[v],S=g+w.length,C=w.dom.getBoundingClientRect(),{height:R}=C;if(y&&!v&&(f+=C.top-y.top),w instanceof Gi)S>r&&d(w,g,C);else if(g>=r&&(f>0&&t.push(-f),t.push(R+f),f=0,o)){let T=w.dom.lastChild,M=T?Xa(T):[];if(M.length){let A=M[M.length-1],D=u?A.right-C.left:C.right-A.left;D>a&&(a=D,this.minWidth=s,this.minWidthFrom=g,this.minWidthTo=S)}}y&&v==p.children.length-1&&(f+=y.bottom-C.bottom),g=S+w.breakAfter}};return d(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?At.RTL:At.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,u;for(let f of o.children){if(!f.isText()||/[^ -~]/.test(f.text))return;let d=Xa(f.dom);if(d.length!=1)return;a+=d[0].width,u=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:u}}});if(e)return e;let t=document.createElement("div"),r,i,s;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 o=Xa(t.firstChild)[0];r=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Ge.replace({widget:new Ym(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Ge.set(e)}updateDeco(){let e=1,t=this.view.state.facet(mh).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Iy).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(mt.join(i))),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(GC).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){var t;if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(qC))try{if(d(this.view,e.range,e))return!0}catch(p){ar(this.view.state,p,"scroll handler")}let{range:r}=e,i=this.coordsAt(r.head,(t=r.assoc)!==null&&t!==void 0?t:r.empty?0:r.head>r.anchor?-1:1),s;if(!i)return;!r.empty&&(s=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let o=Dy(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(lN(this.view.scrollDOM,a,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,f),-f),this.view.textDirection==At.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(r.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){l0(this.tile)}}function l0(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)l0(r,e)}}function DN(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function ZC(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=PC(t.focusNode,t.focusOffset),i=IC(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=Zt.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let u=Zt.get(r.node);!u||u.isText()&&u.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function NN(n,e,t){let r=ZC(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(r.from,r.to)!=a)return null;let u=e.invertedDesc;return{range:new Fr(u.mapPos(s),u.mapPos(o),s,o),text:i}}function LN(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let BN=class{constructor(){this.changes=[]}compareRange(e,t){vl(e,t,this.changes)}comparePoint(e,t){vl(e,t,this.changes)}boundChange(e){vl(e,e,this.changes)}};function FN(n,e,t){let r=new BN;return mt.compare(n,e,t,r),r.changes}class jN{constructor(){this.changes=[]}compareRange(e,t){vl(e,t,this.changes)}comparePoint(){}boundChange(e){vl(e,e,this.changes)}}function _N(n,e,t){let r=new jN;return mt.compare(n,e,t,r),r.changes}function zN(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function VN(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class Ym extends Di{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 WN(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return ue.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Sn(i.text,s,!1):a=Sn(i.text,s);let u=r(i.text.slice(o,a));for(;o>0;){let f=Sn(i.text,o,!1);if(r(i.text.slice(f,o))!=u)break;o=f}for(;a<i.length;){let f=Sn(i.text,a);if(r(i.text.slice(a,f))!=u)break;a=f}return ue.range(o+i.from,a+i.from)}function HN(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,u=Math.floor((i-t.top-(n.defaultLineHeight-a)*.5)/a);s+=u*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Gg(o,s,n.state.tabSize)}function a0(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==An.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function $N(n,e,t,r){let i=a0(n,e.head,e.assoc||-1),s=!r||i.type!=An.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(i.from),u=n.posAtCoords({x:t==(a==At.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(u!=null)return ue.cursor(u,t?-1:1)}return ue.cursor(t?i.to:i.from,t?-1:1)}function gb(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let a=e,u=null;;){let f=vN(i,s,o,a,t),d=FC;if(!f){if(i.number==(t?n.state.doc.lines:1))return a;d=`
154
+ `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),f=n.visualLineSide(i,!t)}if(u){if(!u(d))return a}else{if(!r)return f;u=r(d)}a=f}}function UN(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==$t.Space&&(i=o),i==o}}function qN(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return ue.cursor(i,e.assoc);let o=e.goalColumn,a,u=n.contentDOM.getBoundingClientRect(),f=n.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=n.documentTop;if(f)o==null&&(o=f.left-u.left),a=s<0?f.top:f.bottom;else{let v=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(u.right-u.left,n.defaultCharacterWidth*(i-v.from))),a=(s<0?v.top:v.bottom)+d}let p=u.left+o,g=n.viewState.heightOracle.textHeight>>1,y=r??g;for(let v=0;;v+=g){let w=a+(y+v)*s,S=c0(n,{x:p,y:w},!1,s);if(t?w>u.bottom:w<u.top)return ue.cursor(S.pos,S.assoc);let C=n.coordsAtPos(S.pos,S.assoc),R=C?(C.top+C.bottom)/2:0;if(!C||(t?R>a:R<a))return ue.cursor(S.pos,S.assoc,void 0,o)}}function Za(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let u=r||t||(e-s<o-e?-1:1);e=u<0?s:o,r=u}});if(!r)return e}}function eE(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Za(n,i.from,0);o!=i.from&&(s=ue.cursor(o,-1))}else{let o=Za(n,i.from,-1),a=Za(n,i.to,1);(o!=i.from||a!=i.to)&&(s=ue.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?ue.create(t,e.mainIndex):e}function Gm(n,e,t){let r=Za(n.state.facet(Fc).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:ue.cursor(r,r<t.from?1:-1)}class Ci{constructor(e,t){this.pos=e,this.assoc=t}}function c0(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,u=a-s,f;for(;;){if(u<0)return new Ci(0,1);if(u>n.viewState.docHeight)return new Ci(n.state.doc.length,-1);if(f=n.elementAtHeight(u),r==null)break;if(f.type==An.Text){if(r<0?f.to<n.viewport.from:f.from>n.viewport.to)break;let g=n.docView.coordsAt(r<0?f.from:f.to,r>0?-1:1);if(g&&(r<0?g.top<=u+s:g.bottom>=u+s))break}let p=n.viewState.heightOracle.textHeight/2;u=r>0?f.bottom+p:f.top-p}if(n.viewport.from>=f.to||n.viewport.to<=f.from){if(t)return null;if(f.type==An.Text){let p=HN(n,i,f,o,a);return new Ci(p,p==f.from?1:-1)}}if(f.type!=An.Text)return u<(f.top+f.bottom)/2?new Ci(f.from,1):new Ci(f.to,-1);let d=n.docView.lineAt(f.from,2);return(!d||d.length!=f.length)&&(d=n.docView.lineAt(f.from,-2)),new KN(n,o,a,n.textDirectionAt(f.from)).scanTile(d,f.from)}class KN{constructor(e,t,r,i){this.view=e,this.x=t,this.y=r,this.baseDir=i,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:r,spans:i}=this.bidiSpansAt(e);return i[Ei.find(i,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Ei.find(i,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<t)}scan(e,t,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),u,f,d=-1,p=1e9,g;e:for(;i<s;){let v=s-i,w=i+s>>1;t:if(o.has(w)){let C=i+Math.floor(Math.random()*v);for(let R=0;R<v;R++){if(!o.has(C)){w=C;break t}C++,C==s&&(C=i)}break e}o.add(w);let S=t(w);if(S)for(let C=0;C<S.length;C++){let R=S[C],T=0;if(!(R.width==0&&S.length>1)){if(R.bottom<this.y)(!u||u.bottom<R.bottom)&&(u=R),T=1;else if(R.top>this.y)(!f||f.top>R.top)&&(f=R),T=-1;else{let M=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,A=Math.abs(M);A<p&&(d=w,p=A,g=R),M&&(T=M<0==(this.baseDir==At.LTR)?-1:1)}T==-1&&(!a||this.baseDirAt(e[w],1))?s=w:T==1&&(!a||this.baseDirAt(e[w+1],-1))&&(i=w+1)}}}if(!g){let v=u&&(!f||this.y-u.bottom<f.top-this.y)?u:f;return this.y=(v.top+v.bottom)/2,this.scan(e,t,!0)}if(p&&!r){let{top:v,bottom:w}=g;if(u&&u.bottom>(v+v+w)/3)return this.y=u.bottom-1,this.scan(e,t,!0);if(f&&f.top<(v+w+w)/3)return this.y=f.top+1,this.scan(e,t,!0)}let y=(a?this.dirAt(e[d],1):this.baseDir)==At.LTR;return{i:d,after:this.x>(g.left+g.right)/2==y}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Sn(e.text,s))r.push(t+s);r.push(t+e.length);let i=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return gc(e.dom,o,a).getClientRects()});return i.after?new Ci(r[i.i+1],-1):new Ci(r[i.i],1)}scanTile(e,t){if(!e.length)return new Ci(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,u=t;a<e.children.length;a++)r.push(u+=e.children[a].length);let i=this.scan(r,a=>{let u=e.children[a];return u.flags&48?null:(u.dom.nodeType==1?u.dom:gc(u.dom,0,u.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new Ci(r[i.i+1],-1):new Ci(o,1)}}const ol="￿";class YN{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(yt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ol}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=Zt.get(i),a=i.nextSibling;if(a==t){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let u=Zt.get(a);(o&&u?o.breakAfter:(o?o.breakAfter:pd(i))||pd(a)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!QN(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==e&&u.pos>this.text.length&&(u.pos-=o-1);r=s+o}}readNode(e){let t=Zt.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GN(e,r.node,r.offset)?t:0))}}function GN(n,e,t){for(;;){if(!e||t<ts(e))return!1;if(e==n)return!0;t=zs(e)+1,e=e.parentNode}}function QN(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=Zt.get(n);if(!(r!=null&&r.isWidget()))return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class yb{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class XN{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=tE(e.docView.tile,t,r,0))){let u=s||o?[]:ZN(e),f=new YN(u,e);f.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=f.text,this.newSel=e8(u,this.bounds.from)}else{let u=e.observer.selectionRange,f=s&&s.node==u.focusNode&&s.offset==u.focusOffset||!n0(e.contentDOM,u.focusNode)?a.main.head:e.docView.posFromDOM(u.focusNode,u.focusOffset),d=o&&o.node==u.anchorNode&&o.offset==u.anchorOffset||!n0(e.contentDOM,u.anchorNode)?a.main.anchor:e.docView.posFromDOM(u.anchorNode,u.anchorOffset),p=e.viewport;if((Ae.ios||Ae.chrome)&&a.main.empty&&f!=d&&(p.from>0||p.to<e.state.doc.length)){let g=Math.min(f,d),y=Math.max(f,d),v=p.from-g,w=p.to-y;(v==0||v==1||g==0)&&(w==0||w==-1||y==e.state.doc.length)&&(f=0,d=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(ue.range(d,f));else if(e.lineWrapping&&d==f&&!(a.main.empty&&a.main.head==f)&&e.inputState.lastTouchTime>Date.now()-100){let g=e.coordsAtPos(f,-1),y=0;g&&(y=e.inputState.lastTouchY<=g.bottom?-1:1),this.newSel=ue.create([ue.cursor(f,y)])}else this.newSel=ue.single(d,f)}}}function tE(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let u=0,f=r,d=r;u<n.children.length;u++){let p=n.children[u],g=f+p.length;if(f<e&&g>t)return tE(p,e,t,f);if(g>=e&&i==-1&&(i=u,s=f),f>t&&p.dom.parentNode==n.dom){o=u,a=d;break}d=g,f=g+p.breakAfter}return{from:s,to:a<0?r+n.length:a,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function nE(n,e){let t,{newSel:r}=e,{state:i}=n,s=i.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:u}=e.bounds,f=s.from,d=null;(o===8||Ae.android&&e.text.length<u-a)&&(f=s.to,d="end");let p=i.doc.sliceString(a,u,ol),g,y;!s.empty&&s.from>=a&&s.to<=u&&(e.typeOver||p!=e.text)&&p.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&p.slice(s.to-a)==e.text.slice(g=e.text.length-(p.length-(s.to-a)))?t={from:s.from,to:s.to,insert:xt.of(e.text.slice(s.from-a,g).split(ol))}:(y=rE(p,e.text,f-a,d))&&(Ae.chrome&&o==13&&y.toB==y.from+2&&e.text.slice(y.from,y.toB)==ol+ol&&y.toB--,t={from:a+y.from,to:a+y.toA,insert:xt.of(e.text.slice(y.from,y.toB).split(ol))})}else r&&(!n.hasFocus&&i.facet(Ki)||vd(r,s))&&(r=null);if(!t&&!r)return!1;if((Ae.mac||Ae.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=ue.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:xt.of([t.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&n.docView.lineHasWidget(s.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:i.toText(n.inputState.insertingText)}:Ae.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
155
+ `&&n.lineWrapping&&(r&&(r=ue.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:xt.of([" "])}),t)return Ny(n,t,r,o);if(r&&!vd(r,s)){let a=!1,u="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),u=n.inputState.lastSelectionOrigin,u=="select.pointer"&&(r=eE(i.facet(Fc).map(f=>f(n)),r))),n.dispatch({selection:r,scrollIntoView:a,userEvent:u}),!0}else return!1}function Ny(n,e,t,r=-1){if(Ae.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(Ae.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&xl(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&xl(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&xl(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=JN(n,e,t));return n.state.facet(WC).some(u=>u(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function JN(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let u=e.from<s.from?-1:1,f=u<0?s.from:s.to,d=Za(i.facet(Fc).map(p=>p(n)),f,u);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:ue.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let u=s.from<e.from?i.sliceDoc(s.from,e.from):"",f=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(u+e.insert.sliceString(0,void 0,n.state.lineBreak)+f))}else{let u=i.changes(e),f=t&&t.main.to<=u.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),p,g=t&&ZC(n,t.main.head);if(g){let v=e.insert.length-(e.to-e.from);p={from:g.from,to:g.to-v}}else p=n.state.doc.lineAt(s.head);let y=s.to-e.to;r=i.changeByRange(v=>{if(v.from==s.from&&v.to==s.to)return{changes:u,range:f||v.map(u)};let w=v.to-y,S=w-d.length;if(n.state.sliceDoc(S,w)!=d||w>=p.from&&S<=p.to)return{range:v};let C=i.changes({from:S,to:w,insert:e.insert}),R=v.to-s.to;return{changes:C,range:f?ue.range(Math.max(0,f.anchor+R),Math.max(0,f.head+R)):v.map(C)}})}else r={changes:u,selection:f&&i.selection.replaceRange(f)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function rE(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let u=Math.max(0,s-Math.min(o,a));t-=o+u-s}if(o<s&&n.length<e.length){let u=t<=s&&t>=o?s-t:0;s-=u,a=s+(a-o),o=s}else if(a<s){let u=t<=s&&t>=a?s-t:0;s-=u,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function ZN(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new yb(t,r)),(i!=t||s!=r)&&e.push(new yb(i,s))),e}function e8(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?ue.single(t+e,r+e):null}function vd(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class t8{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,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.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,Ae.safari&&e.contentDOM.addEventListener("input",()=>null),Ae.gecko&&g8(e.contentDOM.ownerDocument)}handleEvent(e){!c8(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=n8(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,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&&sE.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ae.android&&Ae.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Ae.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=iE.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||r8.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,xl(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Ae.safari&&!Ae.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 vb(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){ar(t.state,i)}}}function n8(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let u=s[a];u&&t(a).handlers.push(vb(r.value,u))}if(o)for(let a in o){let u=o[a];u&&t(a).observers.push(vb(r.value,u))}}for(let r in ai)t(r).handlers.push(ai[r]);for(let r in fr)t(r).observers.push(fr[r]);return e}const iE=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],r8="dthko",sE=[16,17,18,20,91,92,224,225],uf=6;function ff(n){return Math.max(0,n)*.7+8}function i8(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class s8{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=OC(e.contentDOM),this.atoms=e.state.facet(Fc).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(yt.allowMultipleSelections)&&o8(e,t),this.dragging=a8(e,t)&&aE(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&&i8(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let u=Dy(this.view);e.clientX-u.left<=i+uf?t=-ff(i-e.clientX):e.clientX+u.right>=o-uf&&(t=ff(e.clientX-o)),e.clientY-u.top<=s+uf?r=-ff(s-e.clientY):e.clientY+u.bottom>=a-uf&&(r=ff(e.clientY-a)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&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,r=eE(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function o8(n,e){let t=n.state.facet(jC);return t.length?t[0](e):Ae.mac?e.metaKey:e.ctrlKey}function l8(n,e){let t=n.state.facet(_C);return t.length?t[0](e):Ae.mac?!e.altKey:!e.ctrlKey}function a8(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=pc(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function c8(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Zt.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const ai=Object.create(null),fr=Object.create(null),oE=Ae.ie&&Ae.ie_version<15||Ae.ios&&Ae.webkit_version<604;function u8(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),lE(n,t.value)},50)}function vh(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function lE(n,e){e=vh(n.state,My,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(u0!=null&&t.selection.ranges.every(u=>u.empty)&&u0==s.toString()){let u=-1;r=t.changeByRange(f=>{let d=t.doc.lineAt(f.from);if(d.from==u)return{range:f};u=d.from;let p=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:p},range:ue.cursor(f.from+p.length)}})}else o?r=t.changeByRange(u=>{let f=s.line(i++);return{changes:{from:u.from,to:u.to,insert:f.text},range:ue.cursor(u.from+f.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}fr.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};fr.wheel=fr.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};ai.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);fr.touchstart=(n,e)=>{let t=n.inputState,r=e.targetTouches[0];t.lastTouchTime=Date.now(),r&&(t.lastTouchX=r.clientX,t.lastTouchY=r.clientY),t.setSelectionOrigin("select.pointer")};fr.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ai.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(zC))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=d8(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new s8(n,e,t,r)),r&&n.observer.ignore(()=>{MC(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function xb(n,e,t,r){if(r==1)return ue.cursor(e,t);if(r==2)return WN(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,ue.range(o,a)}}const f8=Ae.ie&&Ae.ie_version<=11;let wb=null,bb=0,Sb=0;function aE(n){if(!f8)return n.detail;let e=wb,t=Sb;return wb=n,Sb=Date.now(),bb=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(bb+1)%3:1}function d8(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=aE(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let u=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),f,d=xb(n,u.pos,u.assoc,r);if(t.pos!=u.pos&&!o){let p=xb(n,t.pos,t.assoc,r),g=Math.min(p.from,d.from),y=Math.max(p.to,d.to);d=g<d.from?ue.range(g,y,d.assoc):ue.range(y,g,d.assoc)}return o?i.replaceRange(i.main.extend(d.from,d.to,d.assoc)):a&&r==1&&i.ranges.length>1&&(f=h8(i,u.pos))?f:a?i.addRange(d):ue.create([d])}}}function h8(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return ue.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}ai.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=ue.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",vh(n.state,Ay,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ai.dragend=n=>(n.inputState.draggedContent=null,!1);function kb(n,e,t,r){if(t=vh(n.state,My,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&l8(n,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},u=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:u,selection:{anchor:u.mapPos(i,-1),head:u.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}ai.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&kb(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return kb(n,e,r,!0),!0}return!1};ai.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=oE?null:e.clipboardData;return t?(lE(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(u8(n),!1)};function p8(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),n.focus()},50)}function m8(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:vh(n,Ay,e.join(n.lineBreak)),ranges:t,linewise:r}}let u0=null;ai.copy=ai.cut=(n,e)=>{if(!Qa(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:r,linewise:i}=m8(n.state);if(!t&&!i)return!1;u0=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=oE?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(p8(n,t),!1)};const cE=rs.define();function uE(n,e){let t=[];for(let r of n.facet(HC)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:cE.of(!0)}):null}function fE(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=uE(n.state,e);t?n.dispatch(t):n.update([])}},10)}fr.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),fE(n)};fr.blur=n=>{n.observer.clearSelectionRange(),fE(n)};fr.compositionstart=fr.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};fr.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Ae.chrome&&Ae.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};fr.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};ai.beforeinput=(n,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],u=n.posAtDOM(a.startContainer,a.startOffset),f=n.posAtDOM(a.endContainer,a.endOffset);return Ny(n,{from:u,to:f,insert:n.state.toText(s)},null),!0}}let i;if(Ae.chrome&&Ae.android&&(i=iE.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Ae.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Ae.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>fr.compositionend(n,e),20),!1};const Cb=new Set;function g8(n){Cb.has(n)||(Cb.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Eb=["pre-wrap","normal","pre-line","break-spaces"];let Al=!1;function Rb(){Al=!1}class y8{constructor(e){this.lineWrapping=e,this.doc=xt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}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 Eb.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let a=Eb.indexOf(e)>-1,u=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,u){this.heightSamples={};for(let f=0;f<o.length;f++){let d=o[f];d<0?f++:this.heightSamples[Math.floor(d*10)]=!0}}return u}}class v8{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class ni{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?An.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 Mo?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ni(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Lt=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(Lt||(Lt={}));const $f=.001;class Qn{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}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)>$f&&(Al=!0),this.height=e)}replace(e,t,r){return Qn.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:u,toA:f,fromB:d,toB:p}=i[a],g=s.lineAt(u,Lt.ByPosNoHeight,r.setDoc(t),0,0),y=g.to>=f?g:s.lineAt(f,Lt.ByPosNoHeight,r,0,0);for(p+=y.to-f,f=y.to;a>0&&g.from<=i[a-1].toA;)u=i[a-1].fromA,d=i[a-1].fromB,a--,u<g.from&&(g=s.lineAt(u,Lt.ByPosNoHeight,r,0,0));d+=g.from-u,u=g.from;let v=Ly.build(r.setDoc(o),e,d,p);s=xd(s,s.replace(u,f,v))}return s.updateHeight(r,0)}static empty(){return new br(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new w8(Qn.of(e.slice(0,t)),o,Qn.of(e.slice(r)))}}function xd(n,e){return n==e?n:(n.constructor!=e.constructor&&(Al=!0),e)}Qn.prototype.size=1;const x8=Ge.replace({});class dE extends Qn{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new ni(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new ni(i,0,r,this.spaceAbove,x8):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,Lt.ByPos,r,i,s))}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,r=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class br extends dE{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new ni(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof br||i instanceof On&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof On?i=new br(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Qn.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(r||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:""})`}}class On extends Qn{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let u=Math.min(this.height,e.lineHeight*s);o=u/s,this.length>s+1&&(a=(this.height-u)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:u}=this.heightMetrics(t,i);if(t.lineWrapping){let f=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=t.doc.lineAt(f),p=a+d.length*u,g=Math.max(r,e-p/2);return new ni(d.from,d.length,g,p,0)}else{let f=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:d,length:p}=t.doc.line(s+f);return new ni(d,p,r+a*f,a,0)}}lineAt(e,t,r,i,s){if(t==Lt.ByHeight)return this.blockAt(e,r,i,s);if(t==Lt.ByPosNoHeight){let{from:y,to:v}=r.doc.lineAt(e);return new ni(y,v-y,0,0,0)}let{firstLine:o,perLine:a,perChar:u}=this.heightMetrics(r,s),f=r.doc.lineAt(e),d=a+f.length*u,p=f.number-o,g=i+a*p+u*(f.from-s-p);return new ni(f.from,f.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:u,perChar:f}=this.heightMetrics(r,s);for(let d=e,p=i;d<=t;){let g=r.doc.lineAt(d);if(d==e){let v=g.number-a;p+=u*v+f*(e-s-v)}let y=u+f*g.length;o(new ni(g.from,g.length,p,y,0)),p+=y,d=g.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof On?r[r.length-1]=new On(s.length+i):r.push(null,new On(i-1))}if(e>0){let s=r[0];s instanceof On?r[0]=new On(e+s.length):r.unshift(new On(e-1),null)}return Qn.of(r)}decomposeLeft(e,t){t.push(new On(e-1),null)}decomposeRight(e,t){t.push(null,new On(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),u=-1;for(i.from>t&&o.push(new On(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let d=e.doc.lineAt(a).length;o.length&&o.push(null);let p=i.heights[i.index++],g=0;p<0&&(g=-p,p=i.heights[i.index++]),u==-1?u=p:Math.abs(p-u)>=$f&&(u=-2);let y=new br(d,p,g);y.outdated=!1,o.push(y),a+=d+1}a<=s&&o.push(null,new On(s-a).updateHeight(e,a));let f=Qn.of(o);return(u<0||Math.abs(f.height-this.height)>=$f||Math.abs(u-this.heightMetrics(e,t).perLine)>=$f)&&(Al=!0),xd(this,f)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class w8 extends Qn{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,u=t==Lt.ByHeight?e<o:e<a,f=u?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,a);if(this.break||(u?f.to<a:f.from>a))return f;let d=t==Lt.ByPosNoHeight?Lt.ByPosNoHeight:Lt.ByPos;return u?f.join(this.right.lineAt(a,d,r,o,a)):this.left.lineAt(a,d,r,i,s).join(f)}forEachLine(e,t,r,i,s,o){let a=i+this.left.height,u=s+this.left.length+this.break;if(this.break)e<u&&this.left.forEachLine(e,t,r,i,s,o),t>=u&&this.right.forEachLine(e,t,r,a,u,o);else{let f=this.lineAt(u,Lt.ByPos,r,i,s);e<f.from&&this.left.forEachLine(e,f.from-1,r,i,s,o),f.to>=e&&f.from<=t&&o(f),t>f.to&&this.right.forEachLine(f.to+1,t,r,a,u,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Tb(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Tb(s,a)}return Qn.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Qn.of(this.break?[e,null,t]:[e,t]):(this.left=xd(this.left,e),this.right=xd(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,r=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,u=null;return i&&i.from<=t+s.length&&i.more?u=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=a+o.length&&i.more?u=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),u?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Tb(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof On&&(r=n[e+1])instanceof On&&n.splice(e-1,3,new On(t.length+1+r.length))}const b8=5;class Ly{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 r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof br?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new br(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new dE(o,i,r)):(o||s||i>=b8)&&this.addLineDeco(i,s,o)}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 br(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new On(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof br)return e;let t=new br(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=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof br)&&!this.isCovered?this.nodes.push(new br(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof br&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new Ly(r,e);return mt.spans(t,r,i,s,0),s.finish(r)}}function S8(n,e,t){let r=new k8;return mt.compare(n,e,t,r,0),r.changes}class k8{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&vl(e,t,this.changes,5)}}function C8(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),u=Math.min(i.innerHeight,t.bottom);for(let f=n.parentNode;f&&f!=r.body;)if(f.nodeType==1){let d=f,p=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let g=d.getBoundingClientRect();s=Math.max(s,g.left),o=Math.min(o,g.right),a=Math.max(a,g.top),u=Math.min(f==n.parentNode?i.innerHeight:u,g.bottom)}f=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(f.nodeType==11)f=f.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,u)-(t.top+e)}}function E8(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function R8(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Qm{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return Ge.replace({widget:new T8(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class T8 extends Di{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}}class Ob{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=Mb,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=At.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=t.facet(Py).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new y8(r),this.stateDeco=Ab(t),this.heightMap=Qn.empty().applyChanges(this.stateDeco,xt.empty,this.heightOracle.setDoc(t.doc),[new Fr(0,0,0,t.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ge.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new df(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Mb:new By(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(za(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=Ab(this.state);let i=e.changedRanges,s=Fr.extendWithRanges(i,S8(r,this.stateDeco,e?e.changes:pn.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Rb(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Al)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<u.from||t.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,t));let f=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,e.flags|=this.updateForViewport(),(f||!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(UC)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?At.RTL:At.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let f=0,d=0;if(a.width&&a.height){let{scaleX:A,scaleY:D}=TC(t,a);(A>.005&&Math.abs(this.scaleX-A)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=A,this.scaleY=D,f|=16,o=u=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=g)&&(this.paddingTop=p,this.paddingBottom=g,f|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,f|=16);let y=OC(this.view.contentDOM,!1).y;y!=this.scrollParent&&(this.scrollParent=y,this.scrollAnchorHeight=-1,this.scrollOffset=0);let v=this.getScrollOffset();this.scrollOffset!=v&&(this.scrollAnchorHeight=-1,this.scrollOffset=v),this.scrolledToBottom=AC(this.scrollParent||e.win);let w=(this.printing?R8:C8)(t,this.paddingTop),S=w.top-this.pixelViewport.top,C=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let R=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(R!=this.inView&&(this.inView=R,R&&(u=!0)),!this.inView&&!this.scrollTarget&&!E8(e.dom))return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,f|=16),u){let A=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(A)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:D,charWidth:P,textHeight:z}=e.docView.measureTextSize();o=D>0&&i.refresh(s,D,P,z,Math.max(5,T/P),A),o&&(e.docView.minWidth=0,f|=16)}S>0&&C>0?d=Math.max(S,C):S<0&&C<0&&(d=Math.min(S,C)),Rb();for(let D of this.viewports){let P=D.from==this.viewport.from?A:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?Qn.empty().applyChanges(this.stateDeco,xt.empty,this.heightOracle,[new Fr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new v8(D.from,P))}Al&&(f|=2)}let M=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return M&&(f&2&&(f|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),f|=this.updateForViewport()),(f&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),f}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,u=new df(i.lineAt(o-r*1e3,Lt.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Lt.ByHeight,s,0,0).to);if(t){let{head:f}=t.range;if(f<u.from||f>u.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=i.lineAt(f,Lt.ByPos,s,0,0),g;t.y=="center"?g=(p.top+p.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&f<u.from?g=p.top:g=p.bottom-d,u=new df(i.lineAt(g-1e3/2,Lt.ByHeight,s,0,0).from,i.lineAt(g+d+1e3/2,Lt.ByHeight,s,0,0).to)}}return u}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new df(this.heightMap.lineAt(r,Lt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Lt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Lt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Lt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new Qm(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=At.LTR&&!r)return[];let a=[],u=(d,p,g,y)=>{if(p-d<s)return;let v=this.state.selection.main,w=[v.from];v.empty||w.push(v.to);for(let C of w)if(C>d&&C<p){u(d,C-10,g,y),u(C+10,p,g,y);return}let S=M8(e,C=>C.from>=g.from&&C.to<=g.to&&Math.abs(C.from-d)<s&&Math.abs(C.to-p)<s&&!w.some(R=>C.from<R&&C.to>R));if(!S){if(p<g.to&&t&&r&&t.visibleRanges.some(T=>T.from<=p&&T.to>=p)){let T=t.moveToLineBoundary(ue.cursor(p),!1,!0).head;T>d&&(p=T)}let C=this.gapSize(g,d,p,y),R=r||C<2e6?C:2e6;S=new Qm(d,p,C,R)}a.push(S)},f=d=>{if(d.length<o||d.type!=An.Text)return;let p=O8(d.from,d.to,this.stateDeco);if(p.total<o)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,y,v;if(r){let w=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,C;if(g!=null){let R=pf(p,g),T=((this.visibleBottom-this.visibleTop)/2+w)/d.height;S=R-T,C=R+T}else S=(this.visibleTop-d.top-w)/d.height,C=(this.visibleBottom-d.top+w)/d.height;y=hf(p,S),v=hf(p,C)}else{let w=p.total*this.heightOracle.charWidth,S=i*this.heightOracle.charWidth,C=0;if(w>2e6)for(let D of e)D.from>=d.from&&D.from<d.to&&D.size!=D.displaySize&&D.from*this.heightOracle.charWidth+C<this.pixelViewport.left&&(C=D.size-D.displaySize);let R=this.pixelViewport.left+C,T=this.pixelViewport.right+C,M,A;if(g!=null){let D=pf(p,g),P=((T-R)/2+S)/w;M=D-P,A=D+P}else M=(R-S)/w,A=(T+S)/w;y=hf(p,M),v=hf(p,A)}y>d.from&&u(d.from,y,d,p),v<d.to&&u(v,d.to,d,p)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(f):f(d);return a}gapSize(e,t,r,i){let s=pf(i,r)-pf(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){Qm.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ge.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];mt.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||za(this.heightMap.lineAt(e,Lt.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)||za(this.heightMap.lineAt(this.scaler.fromDOM(e),Lt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}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 za(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}}class df{constructor(e,t){this.from=e,this.to=t}}function O8(n,e,t){let r=[],i=n,s=0;return mt.spans(t,n,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function hf({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function pf(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function M8(n,e){for(let t of n)if(e(t))return t}const Mb={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function Ab(n){let e=n.facet(mh).filter(r=>typeof r!="function"),t=n.facet(Iy).filter(r=>typeof r!="function");return t.length&&e.push(mt.join(t)),e}class By{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:u})=>{let f=t.lineAt(a,Lt.ByPos,e,0,0).top,d=t.lineAt(u,Lt.ByPos,e,0,0).bottom;return i+=d-f,{from:a,to:u,top:f,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof By?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function za(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new ni(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>za(i,e)):n._content)}const mf=Me.define({combine:n=>n.join(" ")}),f0=Me.define({combine:n=>n.indexOf(!0)>-1}),d0=js.newName(),hE=js.newName(),pE=js.newName(),mE={"&light":"."+hE,"&dark":"."+pE};function h0(n,e,t){return new js(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const A8=h0("."+d0,{"&":{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":{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"},"&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:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"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"}},mE),P8={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xm=Ae.ie&&Ae.ie_version<=11;class I8{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new aN,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 r of t)this.queue.push(r);(Ae.ie&&Ae.ie_version<=11||Ae.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ae.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ae.chrome&&Ae.chrome_version<126)&&(this.editContext=new N8(e),e.state.facet(Ki)&&(e.contentDOM.editContext=this.editContext.editContext)),Xm&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.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(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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,r)=>t!=e[r]))){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:r}=this,i=this.selectionRange;if(r.state.facet(Ki)?r.root.activeElement!=this.dom:!Qa(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Ae.ie&&Ae.ie_version<=11||Ae.android&&Ae.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Ja(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=pc(e.root);if(!t)return!1;let r=Ae.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&D8(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=Qa(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&uN(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(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 r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.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,P8),Xm&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Xm&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&xl(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.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,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Qa(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new XN(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=nE(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!vd(this.view.state.selection,t.newSel.main))&&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 r=Pb(t,e.previousSibling||e.target.previousSibling,-1),i=Pb(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else 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(Ki)!=e.state.facet(Ki)&&(e.view.contentDOM.editContext=e.state.facet(Ki)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.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 Pb(n,e,t){for(;e;){let r=Zt.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function Ib(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Ja(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function D8(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Ib(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?Ib(n,t):null}class N8{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=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),u=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let f=u-a>r.text.length;a==this.from&&s<this.from?a=s:u==this.to&&s>this.to&&(u=s);let d=rE(e.state.sliceDoc(a,u),r.text,(f?i.from:i.to)-a,f?"end":null);if(!d){let g=ue.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));vd(g,i)||e.dispatch({selection:g,userEvent:"select"});return}let p={from:d.from+a,to:d.toA+a,insert:xt.of(r.text.slice(d.from,d.toB).split(`
156
+ `))};if((Ae.mac||Ae.android)&&p.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:a,to:u,insert:xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let g=this.to-this.from+(p.to-p.from+p.insert.length);Ny(e,p,ue.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from<p.to&&!p.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let u=e.coordsForChar(o);s=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let u=this.toEditorPos(s.rangeStart),f=this.toEditorPos(s.rangeEnd);if(u<f){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(Ge.mark({attributes:{style:d}}).range(u,f))}}}e.dispatch({effects:KC.of(Ge.set(i))})},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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=pc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,u,f)=>{if(r)return;let d=f.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(f)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+f.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),f.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.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,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}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>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.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])}}class Oe{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={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],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:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cN(e.parent)||document,this.viewState=new Ob(this,e.state||yt.create(e)),e.scrollTo&&e.scrollTo.is(cf)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ul).map(i=>new Um(i));for(let i of this.plugins)i.update(this);this.observer=new I8(this),this.inputState=new t8(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof gn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let g of e){if(g.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=g.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,u=null;e.some(g=>g.annotation(cE))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=uE(s,o),u||(a=1));let f=this.observer.delayedAndroidKey,d=null;if(f?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(yt.phrases)!=this.state.facet(yt.phrases))return this.setState(s);i=md.create(this,s,e),i.flags|=a;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(p&&(p=p.map(g.changes)),g.scrollIntoView){let{main:y}=g.state.selection,{x:v,y:w}=this.state.facet(Oe.cursorScrollMargin);p=new wl(y.empty?y:ue.cursor(y.head,y.head>y.anchor?-1:1),"nearest","nearest",w,v)}for(let y of g.effects)y.is(cf)&&(p=y.value.clip(this.state))}this.viewState.update(i,p),this.bidiCache=wd.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(_a)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(mf)!=i.state.facet(mf)&&(this.viewState.mustMeasureContent=!0),(t||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let g of this.state.facet(o0))try{g(i)}catch(y){ar(this.state,y,"update listener")}(u||d)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),d&&!nE(this,d)&&f.force&&xl(this.contentDOM,f.key,f.keyCode)})}setState(e){if(this.updateState!=0)throw new 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 r of this.plugins)r.destroy(this);this.viewState=new Ob(this,e),this.plugins=e.facet(ul).map(r=>new Um(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mb(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(ul),r=e.state.facet(ul);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new Um(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&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(r){ar(this.state,r,"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,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(AC(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let y=this.viewState.scrollAnchorAt(i);s=y.from,o=y.top}this.updateState=1;let u=this.viewState.measure();if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];u&4||([this.measureRequests,f]=[f,this.measureRequests]);let d=f.map(y=>{try{return y.read(this)}catch(v){return ar(this.state,v),Db}}),p=md.create(this,this.state,[]),g=!1;p.flags|=u,t?t.flags|=u:t=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),g=this.docView.update(p),g&&this.docViewUpdate());for(let y=0;y<f.length;y++)if(d[y]!=Db)try{let v=f[y];v.write&&v.write(d[y],this)}catch(v){ar(this.state,v)}if(g&&this.docView.updateSelection(!0),!p.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let v=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((v>1||v<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+v,r?r.scrollTop+=v:this.win.scrollBy(0,v),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(o0))a(t)}get themeClasses(){return d0+" "+(this.state.facet(f0)?pE:hE)+" "+this.state.facet(mf)}updateAttrs(){let e=Nb(this,YC,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ki)?"true":"false",class:"cm-content",style:`${Ae.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Nb(this,Py,t);let r=this.observer.ignore(()=>{let i=cb(this.contentDOM,this.contentAttrs,t),s=cb(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(Oe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(_a);let e=this.state.facet(Oe.cspNonce);js.mount(this.root,this.styleModules.concat(A8).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new 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(r=>r.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,r){return Gm(this,e,gb(this,e,t,r))}moveByGroup(e,t){return Gm(this,e,gb(this,e,t,r=>UN(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return ue.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return $N(this,e,t,r)}moveVertically(e,t,r){return Gm(this,e,qN(this,e,t,r))}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 r=c0(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),c0(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Ei.find(s,e-i.from,-1,t)];return mc(r,o.dir==At.LTR==t>0)}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($C)||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>L8)return BC(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||LC(s.isolates,r=db(this,e))))return s.order;r||(r=db(this,e));let i=yN(e.text,t,r);return this.bidiCache.push(new wd(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ae.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{MC(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.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var r,i,s,o;return cf.of(new wl(typeof e=="number"?ue.cursor(e):e,(r=t.y)!==null&&r!==void 0?r:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return cf.of(new wl(ue.cursor(r.from),"start","start",r.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 en.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return en.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=js.newName(),i=[mf.of(r),_a.of(h0(`.${r}`,e))];return t&&t.dark&&i.push(f0.of(!0)),i}static baseTheme(e){return Ks.lowest(_a.of(h0("."+d0,e,mE)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Zt.get(r)||Zt.get(e);return((t=i==null?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}Oe.styleModule=_a;Oe.inputHandler=WC;Oe.clipboardInputFilter=My;Oe.clipboardOutputFilter=Ay;Oe.scrollHandler=qC;Oe.focusChangeEffect=HC;Oe.perLineTextDirection=$C;Oe.exceptionSink=VC;Oe.updateListener=o0;Oe.editable=Ki;Oe.mouseSelectionStyle=zC;Oe.dragMovesSelection=_C;Oe.clickAddsSelectionRange=jC;Oe.decorations=mh;Oe.blockWrappers=GC;Oe.outerDecorations=Iy;Oe.atomicRanges=Fc;Oe.bidiIsolatedRanges=QC;Oe.cursorScrollMargin=Me.define({combine:n=>{let e=5,t=5;for(let r of n)typeof r=="number"?e=t=r:{x:e,y:t}=r;return{x:e,y:t}}});Oe.scrollMargins=XC;Oe.darkTheme=f0;Oe.cspNonce=Me.define({combine:n=>n.length?n[0]:""});Oe.contentAttributes=Py;Oe.editorAttributes=YC;Oe.lineWrapping=Oe.contentAttributes.of({class:"cm-lineWrapping"});Oe.announce=lt.define();const L8=4096,Db={};class wd{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:At.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new wd(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Nb(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&Ry(o,t)}return t}const B8=Ae.mac?"mac":Ae.windows?"win":Ae.linux?"linux":"key";function F8(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let u=0;u<t.length-1;++u){const f=t[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))i=!0;else if(/^(c|ctrl|control)$/i.test(f))s=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+f)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function gf(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const j8=Ks.default(Oe.domEventHandlers({keydown(n,e){return yE(gE(e.state),n,e,"editor")}})),yc=Me.define({enables:j8}),Lb=new WeakMap;function gE(n){let e=n.facet(yc),t=Lb.get(e);return t||Lb.set(e,t=V8(e.reduce((r,i)=>r.concat(i),[]))),t}function _8(n,e,t){return yE(gE(n.state),e,n,t)}let Os=null;const z8=4e3;function V8(n,e=B8){let t=Object.create(null),r=Object.create(null),i=(o,a)=>{let u=r[o];if(u==null)r[o]=a;else if(u!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,u,f,d)=>{var p,g;let y=t[o]||(t[o]=Object.create(null)),v=a.split(/ (?!$)/).map(C=>F8(C,e));for(let C=1;C<v.length;C++){let R=v.slice(0,C).join(" ");i(R,!0),y[R]||(y[R]={preventDefault:!0,stopPropagation:!1,run:[T=>{let M=Os={view:T,prefix:R,scope:o};return setTimeout(()=>{Os==M&&(Os=null)},z8),!0}]})}let w=v.join(" ");i(w,!1);let S=y[w]||(y[w]={preventDefault:!1,stopPropagation:!1,run:((g=(p=y._any)===null||p===void 0?void 0:p.run)===null||g===void 0?void 0:g.slice())||[]});u&&S.run.push(u),f&&(S.preventDefault=!0),d&&(S.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let f of a){let d=t[f]||(t[f]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=o;for(let g in d)d[g].run.push(y=>p(y,p0))}let u=o[e]||o.key;if(u)for(let f of a)s(f,u,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(f,"Shift-"+u,o.shift,o.preventDefault,o.stopPropagation)}return t}let p0=null;function yE(n,e,t,r){p0=e;let i=nN(e),s=sr(i,0),o=ki(s)==i.length&&i!=" ",a="",u=!1,f=!1,d=!1;Os&&Os.view==t&&Os.scope==r&&(a=Os.prefix+" ",sE.indexOf(e.keyCode)<0&&(f=!0,Os=null));let p=new Set,g=S=>{if(S){for(let C of S.run)if(!p.has(C)&&(p.add(C),C(t)))return S.stopPropagation&&(d=!0),!0;S.preventDefault&&(S.stopPropagation&&(d=!0),f=!0)}return!1},y=n[r],v,w;return y&&(g(y[a+gf(i,e,!o)])?u=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ae.windows&&e.ctrlKey&&e.altKey)&&!(Ae.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(v=_s[e.keyCode])&&v!=i?(g(y[a+gf(v,e,!0)])||e.shiftKey&&(w=dc[e.keyCode])!=i&&w!=v&&g(y[a+gf(w,e,!1)]))&&(u=!0):o&&e.shiftKey&&g(y[a+gf(i,e,!0)])&&(u=!0),!u&&g(y._any)&&(u=!0)),f&&(u=!0),u&&d&&e.stopPropagation(),p0=null,u}class ko{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(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(e,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=vE(e);return[new ko(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return W8(e,t,r)}}function vE(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==At.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Bb(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:s.left+1,y:o}),u=n.posAtCoords({x:s.right-1,y:o});return a==null||u==null?r:{from:Math.max(r.from,Math.min(a,u)),to:Math.min(r.to,Math.max(a,u))}}function W8(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==At.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),u=vE(n),f=o.querySelector(".cm-line"),d=f&&window.getComputedStyle(f),p=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),g=a.right-(d?parseInt(d.paddingRight):0),y=a0(n,r,1),v=a0(n,i,-1),w=y.type==An.Text?y:null,S=v.type==An.Text?v:null;if(w&&(n.lineWrapping||y.widgetLineBreaks)&&(w=Bb(n,r,1,w)),S&&(n.lineWrapping||v.widgetLineBreaks)&&(S=Bb(n,i,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return R(T(t.from,t.to,w));{let A=w?T(t.from,null,w):M(y,!1),D=S?T(null,t.to,S):M(v,!0),P=[];return(w||y).to<(S||v).from-(w&&S?1:0)||y.widgetLineBreaks>1&&A.bottom+n.defaultLineHeight/2<D.top?P.push(C(p,A.bottom,g,D.top)):A.bottom<D.top&&n.elementAtHeight((A.bottom+D.top)/2).type==An.Text&&(A.bottom=D.top=(A.bottom+D.top)/2),R(A).concat(P).concat(R(D))}function C(A,D,P,z){return new ko(e,A-u.left,D-u.top,Math.max(0,P-A),z-D)}function R({top:A,bottom:D,horizontal:P}){let z=[];for(let H=0;H<P.length;H+=2)z.push(C(P[H],A,P[H+1],D));return z}function T(A,D,P){let z=1e9,H=-1e9,$=[];function Z(X,_,ne,G,N){let W=n.coordsAtPos(X,X==P.to?-2:2),F=n.coordsAtPos(ne,ne==P.from?2:-2);!W||!F||(z=Math.min(W.top,F.top,z),H=Math.max(W.bottom,F.bottom,H),N==At.LTR?$.push(s&&_?p:W.left,s&&G?g:F.right):$.push(!s&&G?p:F.left,!s&&_?g:W.right))}let j=A??P.from,B=D??P.to;for(let X of n.visibleRanges)if(X.to>j&&X.from<B)for(let _=Math.max(X.from,j),ne=Math.min(X.to,B);;){let G=n.state.doc.lineAt(_);for(let N of n.bidiSpans(G)){let W=N.from+G.from,F=N.to+G.from;if(W>=ne)break;F>_&&Z(Math.max(W,_),A==null&&W<=j,Math.min(F,ne),D==null&&F>=B,N.dir)}if(_=G.to+1,_>=ne)break}return $.length==0&&Z(j,A==null,B,D==null,n.textDirection),{top:z,bottom:H,horizontal:$}}function M(A,D){let P=a.top+(D?A.top:A.bottom);return{top:P,bottom:P,horizontal:[]}}}function H8(n,e){return n.constructor==e.constructor&&n.eq(e)}class $8{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(Uf)!=e.state.facet(Uf)&&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,r=e.facet(Uf);for(;t<r.length&&r[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((t,r)=>!H8(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,Ae.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Uf=Me.define();function xE(n){return[en.define(e=>new $8(e,n)),Uf.of(n)]}const Pl=Me.define({combine(n){return Ii(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function U8(n={}){return[Pl.of(n),q8,K8,Y8,UC.of(!0)]}function wE(n){return n.startState.facet(Pl)!=n.state.facet(Pl)}const q8=xE({above:!0,markers(n){let{state:e}=n,t=e.facet(Pl),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor&&!(s&&Ae.ios&&t.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:ue.cursor(i.head,i.assoc);for(let u of ko.forRange(n,o,a))r.push(u)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=wE(n);return t&&Fb(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){Fb(e.state,n)},class:"cm-cursorLayer"});function Fb(n,e){e.style.animationDuration=n.facet(Pl).cursorBlinkRate+"ms"}const K8=xE({above:!1,markers(n){let e=[],{main:t,ranges:r}=n.state.selection;for(let i of r)if(!i.empty)for(let s of ko.forRange(n,"cm-selectionBackground",i))e.push(s);if(Ae.ios&&!t.empty&&n.state.facet(Pl).iosSelectionHandles){for(let i of ko.forRange(n,"cm-selectionHandle cm-selectionHandle-start",ue.cursor(t.from,1)))e.push(i);for(let i of ko.forRange(n,"cm-selectionHandle cm-selectionHandle-end",ue.cursor(t.to,1)))e.push(i)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||wE(n)},class:"cm-selectionLayer"}),Y8=Ks.highest(Oe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),bE=lt.define({map(n,e){return n==null?null:e.mapPos(n)}}),Va=Vn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(bE)?r.value:t,n)}}),G8=en.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Va);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Va)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Va),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Va)!=n&&this.view.dispatch({effects:bE.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Q8(){return[Va,G8]}function jb(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function X8(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class J8{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,u,f,d)=>i(d,f,f+a[0].length,a,u);else if(typeof r=="function")this.addMatch=(a,u,f,d)=>{let p=r(a,u,f);p&&d(f,f+a[0].length,p)};else if(r)this.addMatch=(a,u,f,d)=>d(f,f+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new es,r=t.add.bind(t);for(let{from:i,to:s}of X8(e,this.maxLength))jb(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,u)=>{u>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(u,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let u=e.state.doc.lineAt(o),f=u.to<a?e.state.doc.lineAt(a):u,d=Math.max(s.from,u.from),p=Math.min(s.to,f.to);if(this.boundary){for(;o>u.from;o--)if(this.boundary.test(u.text[o-1-u.from])){d=o;break}for(;a<f.to;a++)if(this.boundary.test(f.text[a-f.from])){p=a;break}}let g=[],y,v=(w,S,C)=>g.push(C.range(w,S));if(u==f)for(this.regexp.lastIndex=d-u.from;(y=this.regexp.exec(u.text))&&y.index<p-u.from;)this.addMatch(y,e,y.index+u.from,v);else jb(e.state.doc,this.regexp,d,p,(w,S)=>this.addMatch(S,e,w,v));t=t.update({filterFrom:d,filterTo:p,filter:(w,S)=>w<d||S>p,add:g})}}return t}}const m0=/x/.unicode!=null?"gu":"g",Z8=new RegExp(`[\0-\b
157
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,m0),eL={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"};let Jm=null;function tL(){var n;if(Jm==null&&typeof document<"u"&&document.body){let e=document.body.style;Jm=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Jm||!1}const qf=Me.define({combine(n){let e=Ii(n,{render:null,specialChars:Z8,addSpecialChars:null});return(e.replaceTabs=!tL())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,m0)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,m0)),e}});function nL(n={}){return[qf.of(n),rL()]}let _b=null;function rL(){return _b||(_b=en.fromClass(class{constructor(n){this.view=n,this.decorations=Ge.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(qf)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new J8({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=sr(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,u=Wl(o.text,a,r-o.from);return Ge.replace({widget:new lL((a-u%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Ge.replace({widget:new oL(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(qf);n.startState.facet(qf)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const iL="•";function sL(n){return n>=32?iL:n==10?"␤":String.fromCharCode(9216+n)}class oL extends Di{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=sL(this.code),r=e.state.phrase("Control character")+" "+(eL[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class lL extends Di{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 aL(){return uL}const cL=Ge.line({class:"cm-activeLine"}),uL=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(cL.range(i.from)),e=i.from)}return Ge.set(t)}},{decorations:n=>n.decorations});class fL extends Di{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?Xa(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=mc(t[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function dL(n){let e=en.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Ge.set([Ge.widget({widget:new fL(n),side:1}).range(0)]):Ge.none}get decorations(){return this.view.state.doc.length?Ge.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,Oe.contentAttributes.of({"aria-placeholder":n})]:e}const g0=2e3;function hL(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>g0||t.off>g0||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let u=r;u<=i;u++){let f=n.doc.line(u);f.length<=a&&s.push(ue.range(f.from+o,f.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let u=r;u<=i;u++){let f=n.doc.line(u),d=Gg(f.text,o,n.tabSize,!0);if(d<0)s.push(ue.cursor(f.to));else{let p=Gg(f.text,a,n.tabSize);s.push(ue.range(f.from+d,f.from+p))}}}return s}function pL(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function zb(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>g0?-1:i==r.length?pL(n,e.clientX):Wl(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function mL(n,e){let t=zb(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=zb(n,i);if(!a)return r;let u=hL(n.state,t,a);return u.length?o?ue.create(u.concat(r.ranges)):ue.create(u):r}}:null}function gL(n){let e=(t=>t.altKey&&t.button==0);return Oe.mouseSelectionStyle.of((t,r)=>e(r)?mL(t,r):null)}const yL={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},vL={style:"cursor: crosshair"};function xL(n={}){let[e,t]=yL[n.key||"Alt"],r=en.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,Oe.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?vL:null})]}const yf="-10000px";class SE{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(u=>u);if(i===this.input){for(let u of this.tooltipViews)u.update&&u.update(e);return!1}let o=[],a=t?[]:null;for(let u=0;u<s.length;u++){let f=s[u],d=-1;if(f){for(let p=0;p<this.tooltips.length;p++){let g=this.tooltips[p];g&&g.create==f.create&&(d=p)}if(d<0)o[u]=this.createTooltipView(f,u?o[u-1]:null),a&&(a[u]=!!f.above);else{let p=o[u]=this.tooltipViews[d];a&&(a[u]=t[d]),p.update&&p.update(e)}}}for(let u of this.tooltipViews)o.indexOf(u)<0&&(this.removeTooltipView(u),(r=u.destroy)===null||r===void 0||r.call(u));return t&&(a.forEach((u,f)=>t[f]=u),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function wL(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Zm=Me.define({combine:n=>{var e,t,r;return{position:Ae.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||wL}}}),Vb=new WeakMap,Fy=en.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Zm);this.position=e.position,this.parent=e.parent,this.classes=n.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 SE(n,jy,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(Zm);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=yf,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Ae.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Dy(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Zm).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let u=this.manager.tooltips[a],f=this.manager.tooltipViews[a],{dom:d}=f,p=n.pos[a],g=n.size[a];if(!p||u.clip!==!1&&(p.bottom<=Math.max(t.top,r.top)||p.top>=Math.min(t.bottom,r.bottom)||p.right<Math.max(t.left,r.left)-.1||p.left>Math.min(t.right,r.right)+.1)){d.style.top=yf;continue}let y=u.arrow?f.dom.querySelector(".cm-tooltip-arrow"):null,v=y?7:0,w=g.right-g.left,S=(e=Vb.get(f))!==null&&e!==void 0?e:g.bottom-g.top,C=f.offset||SL,R=this.view.textDirection==At.LTR,T=g.width>r.right-r.left?R?r.left:r.right-g.width:R?Math.max(r.left,Math.min(p.left-(y?14:0)+C.x,r.right-w)):Math.min(Math.max(r.left,p.left-w+(y?14:0)-C.x),r.right-w),M=this.above[a];!u.strictSide&&(M?p.top-S-v-C.y<r.top:p.bottom+S+v+C.y>r.bottom)&&M==r.bottom-p.bottom>p.top-r.top&&(M=this.above[a]=!M);let A=(M?p.top-r.top:r.bottom-p.bottom)-v;if(A<S&&f.resize!==!1){if(A<this.view.defaultLineHeight){d.style.top=yf;continue}Vb.set(f,S),d.style.height=(S=A)/s+"px"}else d.style.height&&(d.style.height="");let D=M?p.top-S-v-C.y:p.bottom+v+C.y,P=T+w;if(f.overlap!==!0)for(let z of o)z.left<P&&z.right>T&&z.top<D+S&&z.bottom>D&&(D=M?z.top-S-2-v:z.bottom+v+2);if(this.position=="absolute"?(d.style.top=(D-n.parent.top)/s+"px",Wb(d,(T-n.parent.left)/i)):(d.style.top=D/s+"px",Wb(d,T/i)),y){let z=p.left+(R?C.x:-C.x)-(T+14-7);y.style.left=z/i+"px"}f.overlap!==!0&&o.push({left:T,top:D,right:P,bottom:D+S}),d.classList.toggle("cm-tooltip-above",M),d.classList.toggle("cm-tooltip-below",!M),f.positioned&&f.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=yf}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Wb(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const bL=Oe.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"}}}),SL={x:0,y:0},jy=Me.define({enables:[Fy,bL]}),bd=Me.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class xh{static create(e){return new xh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new SE(e,bd,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}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===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)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")}}const kL=jy.compute([bd],n=>{let e=n.facet(bd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:xh.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),kE=Me.define();class CL{constructor(e,t,r,i,s,o){this.view=e,this.source=t,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,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,r=e.docView.tile.nearest(t.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let o=e.coordsAtPos(i);if(!o||t.y<o.top||t.y>o.bottom||t.x<o.left-e.defaultCharacterWidth||t.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(f=>f.from<=i&&f.to>=i),u=a&&a.dir==At.RTL?-1:1;s=t.x<o.left?-u:u}this.activateHover(e,i,s)}activateHover(e,t,r,i){let s=this.source(e,t,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let u=Array.isArray(a)?a:[a];i&&this.locked.set(u,i),e.dispatch({effects:this.setHover.of(u)})}};if(s&&"then"in s){let a=this.pending={pos:t};s.then(u=>{this.pending==a&&(this.pending=null,o(u))},u=>ar(e.state,u,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(Fy),t=e?e.manager.tooltips.findIndex(r=>r.create==xh.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;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:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!EL(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!RL(this.view,o,a,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:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.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)}}const vf=4;function EL(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=t-vf&&e.clientX<=r+vf&&e.clientY>=i-vf&&e.clientY<=s+vf}function RL(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),a=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let u=n.posAtCoords({x:r,y:i},!1);return u>=e&&u<=t}function TL(n,e={}){let t=lt.define(),r=new WeakMap,i=Vn.define({create(){return[]},update(o,a){let u=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:u&&u(a)?o=[]:e.hideOn&&(o=o.filter(f=>!e.hideOn(a,f)))),a.docChanged&&o.length){let f=[];for(let d of o){let p=a.changes.mapPos(d.pos,-1,Yn.TrackDel);if(p!=null){let g=Object.assign(Object.create(null),d);g.pos=p,g.end!=null&&(g.end=a.changes.mapPos(g.end)),f.push(g)}}o=f}for(let f of a.effects)f.is(t)&&(o=f.value,u=void 0),(f.is(ML)&&!f.value||f.value==i)&&(o=[]);return o.length&&u&&r.set(o,u),o},provide:o=>bd.from(o)});const s=en.define(o=>new CL(o,n,i,r,t,e.hoverTime||300));return{active:i,extension:[i,s,kE.of(s),kL]}}function OL(n,e,t,r={}){var i;let s=n.state.facet(kE).map(o=>n.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(n,e,t,(i=r.until)!==null&&i!==void 0?i:(()=>!1))}function CE(n,e){let t=n.plugin(Fy);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const ML=lt.define(),Hb=Me.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function _y(n,e){let t=n.plugin(EE),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const EE=en.fromClass(class{constructor(n){this.input=n.state.facet(vc),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Hb);this.top=new xf(n,!0,e.topContainer),this.bottom=new xf(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Hb);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new xf(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new xf(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(vc);if(t!=this.input){let r=t.filter(u=>u),i=[],s=[],o=[],a=[];for(let u of r){let f=this.specs.indexOf(u),d;f<0?(d=u(n.view),a.push(d)):(d=this.panels[f],d.update&&d.update(n)),i.push(d),(d.top?s:o).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let u of a)u.dom.classList.add("cm-panel"),u.mount&&u.mount()}else for(let r of this.panels)r.update&&r.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class xf{constructor(e,t,r){this.view=e,this.top=t,this.container=r,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(),this.dom=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",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=$b(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=$b(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 $b(n){let e=n.nextSibling;return n.remove(),e}const vc=Me.define({enables:EE});function AL(n,e){let t,r=new Promise(o=>t=o),i=o=>PL(o,e,t);n.state.field(eg,!1)?n.dispatch({effects:RE.of(i)}):n.dispatch({effects:lt.appendConfig.of(eg.init(()=>[i]))});let s=TE.of(i);return{close:s,result:r.then(o=>((n.win.queueMicrotask||(u=>n.win.setTimeout(u,10)))(()=>{n.state.field(eg).indexOf(i)>-1&&n.dispatch({effects:s})}),o))}}const eg=Vn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(RE)?n=[t.value].concat(n):t.is(TE)&&(n=n.filter(r=>r!=t.value));return n},provide:n=>vc.computeN([n],e=>e.field(n))}),RE=lt.define(),TE=lt.define();function PL(n,e,t){let r=e.content?e.content(n,()=>o(null)):null;if(!r){if(r=Ot("form"),e.input){let a=Ot("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(Ot("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Ot("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let u=i[a];u.addEventListener("keydown",f=>{f.keyCode==27?(f.preventDefault(),o(null)):f.keyCode==13&&(f.preventDefault(),o(u))}),u.addEventListener("submit",f=>{f.preventDefault(),o(u)})}let s=Ot("div",r,Ot("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&n.focus(),t(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class ns extends Fs{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ns.prototype.elementClass="";ns.prototype.toDOM=void 0;ns.prototype.mapMode=Yn.TrackBefore;ns.prototype.startSide=ns.prototype.endSide=-1;ns.prototype.point=!0;const Kf=Me.define(),IL=Me.define(),DL={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>mt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ec=Me.define();function NL(n){return[OE(),ec.of({...DL,...n})]}const Ub=Me.define({combine:n=>n.some(e=>e)});function OE(n){return[LL]}const LL=en.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(ec).map(e=>new Kb(n,e)),this.fixed=!n.state.facet(Ub);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.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(Ub)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=mt.iter(this.view.state.facet(Kf),this.view.viewport.from),r=[],i=this.gutters.map(s=>new BL(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==An.Text&&o){y0(t,r,a.from);for(let u of i)u.line(this.view,a,r);o=!1}else if(a.widget)for(let u of i)u.widget(this.view,a)}else if(s.type==An.Text){y0(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(ec),t=n.state.facet(ec),r=n.docChanged||n.heightChanged||n.viewportChanged||!mt.eq(n.startState.facet(Kf),n.state.facet(Kf),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new Kb(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==At.LTR?{left:r,right:i}:{right:r,left:i}})});function qb(n){return Array.isArray(n)?n:[n]}function y0(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class BL{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=mt.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new ME(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];y0(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(IL)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Kb{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 r in t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let u=s.getBoundingClientRect();o=(u.top+u.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=qb(t.markers(e)),t.initialSpacer&&(this.spacer=new ME(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=qb(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!mt.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class ME{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),FL(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,u=s<t.length?t[s++]:null,f=!1;if(u){let d=u.elementClass;d&&(r+=" "+d);for(let p=o;p<this.markers.length;p++)if(this.markers[p].compare(u)){a=p,f=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(i);let p=i.nextSibling;i.remove(),i=p}}if(!u)break;u.toDOM&&(f?i=i.nextSibling:this.dom.insertBefore(u.toDOM(e),i)),f&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function FL(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const jL=Me.define(),_L=Me.define(),fl=Me.define({combine(n){return Ii(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(a,u,f)=>s(a,u,f)||o(a,u,f):o}return r}})}});class tg extends ns{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function ng(n,e){return n.state.facet(fl).formatNumber(e,n.state)}const zL=ec.compute([fl],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(jL)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new tg(ng(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(_L)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(fl)!=e.state.facet(fl),initialSpacer(e){return new tg(ng(e,Yb(e.state.doc.lines)))},updateSpacer(e,t){let r=ng(t.view,Yb(t.view.state.doc.lines));return r==e.number?e:new tg(r)},domEventHandlers:n.facet(fl).domEventHandlers,side:"before"}));function VL(n={}){return[fl.of(n),OE(),zL]}function Yb(n){let e=9;for(;e<n;)e=e*10+9;return e}const WL=new class extends ns{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},HL=Kf.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(WL.range(i)))}return mt.of(e)});function $L(){return HL}const AE=1024;let UL=0;class rg{constructor(e,t){this.from=e,this.to=t}}class dt{constructor(e={}){this.id=UL++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=dr.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}dt.closedBy=new dt({deserialize:n=>n.split(" ")});dt.openedBy=new dt({deserialize:n=>n.split(" ")});dt.group=new dt({deserialize:n=>n.split(" ")});dt.isolate=new dt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});dt.contextHash=new dt({perNode:!0});dt.lookAhead=new dt({perNode:!0});dt.mounted=new dt({perNode:!0});class tc{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[dt.mounted.id]}}const qL=Object.create(null);class dr{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):qL,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new dr(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[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(dt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(dt.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}}dr.none=new dr("",Object.create(null),0,8);class zy{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],u=o[0];u.combine&&u.id in i&&(a=u.combine(i[u.id],a)),i[u.id]=a}}t.push(i?new dr(r.name,i,r.id,r.flags):r)}return new zy(t)}}const wf=new WeakMap,Gb=new WeakMap;var Jt;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Jt||(Jt={}));class ln{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=tc.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}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 x0(this.topNode,e)}cursorAt(e,t=0,r=0){let i=wf.get(this)||this.topNode,s=new x0(i);return s.moveTo(e,t),wf.set(this,s._tree),s}get topNode(){return new zr(this,0,0,null)}resolve(e,t=0){let r=xc(wf.get(this)||this.topNode,e,t,!1);return wf.set(this,r),r}resolveInner(e,t=0){let r=xc(Gb.get(this)||this.topNode,e,t,!0);return Gb.set(this,r),r}resolveStack(e,t=0){return GL(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Jt.IncludeAnonymous)>0;for(let u=this.cursor(o|Jt.IncludeAnonymous);;){let f=!1;if(u.from<=s&&u.to>=i&&(!a&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;f=!0}for(;f&&r&&(a||!u.type.isAnonymous)&&r(u),!u.nextSibling();){if(!u.parent())return;f=!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(e={}){return this.children.length<=8?this:Hy(dr.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new ln(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new ln(dr.none,t,r,i)))}static build(e){return QL(e)}}ln.empty=new ln(dr.none,[],[],0);class Vy{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 Vy(this.buffer,this.index)}}class Vs{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return dr.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],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,a=-1;for(let u=e;u!=t&&!(PE(s,i,o[u+1],o[u+2])&&(a=u,r>0));u=o[u+3]);return a}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,u=0;a<t;){s[u++]=i[a++],s[u++]=i[a++]-r;let f=s[u++]=i[a++]-r;s[u++]=i[a++]-e,o=Math.max(o,f)}return new Vs(s,o,this.set)}}function PE(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function xc(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof zr&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:Jt.IgnoreOverlays;if(r)for(let o=n,a=o.parent;a;o=a,a=o.parent)o instanceof zr&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=a);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class IE{cursor(e=0){return new x0(this,e)}getChild(e,t=null,r=null){let i=Qb(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return Qb(this,e,t,r)}resolve(e,t=0){return xc(this,e,t,!1)}resolveInner(e,t=0){return xc(this,e,t,!0)}matchContext(e){return v0(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class zr extends IE{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){for(let o=this;;){for(let{children:a,positions:u}=o._tree,f=t>0?a.length:-1;e!=f;e+=t){let d=a[e],p=u[e]+o.from,g;if(!(!(s&Jt.EnterBracketed&&d instanceof ln&&(g=tc.get(d))&&!g.overlay&&g.bracketed&&r>=p&&r<=p+d.length)&&!PE(i,r,p,p+d.length))){if(d instanceof Vs){if(s&Jt.ExcludeBuffers)continue;let y=d.findChild(0,d.buffer.length,t,r-p,i);if(y>-1)return new Ps(new KL(o,d,e,p),null,y)}else if(s&Jt.IncludeAnonymous||!d.type.isAnonymous||Wy(d)){let y;if(!(s&Jt.IgnoreMounts)&&(y=tc.get(d))&&!y.overlay)return new zr(y.tree,p,e,o);let v=new zr(d,p,e,o);return s&Jt.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(t<0?d.children.length-1:0,t,r,i,s)}}}if(s&Jt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<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(e,t,r=0){let i;if(!(r&Jt.IgnoreOverlays)&&(i=tc.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Jt.EnterBracketed&&i.bracketed;for(let{from:a,to:u}of i.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?u>=s:u>s))return new zr(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,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 Qb(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function v0(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class KL{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class Ps extends IE{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,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new Ps(this.context,this,s)}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(e,t,r=0){if(r&Jt.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Ps(this.context,this,s)}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:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ps(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ps(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new ln(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function DE(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof zr&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new YL(i,t)}class YL{constructor(e,t){this.heads=e,this.node=t}get next(){return DE(this.heads)}}function GL(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof zr?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=tc.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new zr(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(xc(a,e,t,!1))}}return i?DE(i):r}class x0{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&~Jt.EnterBracketed,e instanceof zr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.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:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof zr?(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,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,r=this.mode){return this.buffer?r&Jt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Jt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Jt.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,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Jt.IncludeAnonymous||a instanceof Vs||!a.type.isAnonymous||Wy(a))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,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new Ps(this.buffer,t,this.stack[i]);return this.bufferNode=new Ps(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return v0(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return v0(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Wy(n){return n.children.some(e=>e instanceof Vs||!e.type.isAnonymous||Wy(e))}function QL(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=AE,reused:s=[],minRepeatType:o=r.types.length}=n,a=Array.isArray(t)?new Vy(t,t.length):t,u=r.types,f=0,d=0;function p(A,D,P,z,H,$){let{id:Z,start:j,end:B,size:X}=a,_=d,ne=f;if(X<0)if(a.next(),X==-1){let I=s[Z];P.push(I),z.push(j-A);return}else if(X==-3){f=Z;return}else if(X==-4){d=Z;return}else throw new RangeError(`Unrecognized record size: ${X}`);let G=u[Z],N,W,F=j-A;if(B-j<=i&&(W=S(a.pos-D,H))){let I=new Uint16Array(W.size-W.skip),U=a.pos-W.size,q=I.length;for(;a.pos>U;)q=C(W.start,I,q);N=new Vs(I,B-W.start,r),F=W.start-A}else{let I=a.pos-X;a.next();let U=[],q=[],Q=Z>=o?Z:-1,oe=0,ie=B;for(;a.pos>I;)Q>=0&&a.id==Q&&a.size>=0?(a.end<=ie-i&&(v(U,q,j,oe,a.end,ie,Q,_,ne),oe=U.length,ie=a.end),a.next()):$>2500?g(j,I,U,q):p(j,I,U,q,Q,$+1);if(Q>=0&&oe>0&&oe<U.length&&v(U,q,j,oe,j,ie,Q,_,ne),U.reverse(),q.reverse(),Q>-1&&oe>0){let de=y(G,ne);N=Hy(G,U,q,0,U.length,0,B-j,de,de)}else N=w(G,U,q,B-j,_-B,ne)}P.push(N),z.push(F)}function g(A,D,P,z){let H=[],$=0,Z=-1;for(;a.pos>D;){let{id:j,start:B,end:X,size:_}=a;if(_>4)a.next();else{if(Z>-1&&B<Z)break;Z<0&&(Z=X-i),H.push(j,B,X),$++,a.next()}}if($){let j=new Uint16Array($*4),B=H[H.length-2];for(let X=H.length-3,_=0;X>=0;X-=3)j[_++]=H[X],j[_++]=H[X+1]-B,j[_++]=H[X+2]-B,j[_++]=_;P.push(new Vs(j,H[2]-B,r)),z.push(B-A)}}function y(A,D){return(P,z,H)=>{let $=0,Z=P.length-1,j,B;if(Z>=0&&(j=P[Z])instanceof ln){if(!Z&&j.type==A&&j.length==H)return j;(B=j.prop(dt.lookAhead))&&($=z[Z]+j.length+B)}return w(A,P,z,H,$,D)}}function v(A,D,P,z,H,$,Z,j,B){let X=[],_=[];for(;A.length>z;)X.push(A.pop()),_.push(D.pop()+P-H);A.push(w(r.types[Z],X,_,$-H,j-$,B)),D.push(H-P)}function w(A,D,P,z,H,$,Z){if($){let j=[dt.contextHash,$];Z=Z?[j].concat(Z):[j]}if(H>25){let j=[dt.lookAhead,H];Z=Z?[j].concat(Z):[j]}return new ln(A,D,P,z,Z)}function S(A,D){let P=a.fork(),z=0,H=0,$=0,Z=P.end-i,j={size:0,start:0,skip:0};e:for(let B=P.pos-A;P.pos>B;){let X=P.size;if(P.id==D&&X>=0){j.size=z,j.start=H,j.skip=$,$+=4,z+=4,P.next();continue}let _=P.pos-X;if(X<0||_<B||P.start<Z)break;let ne=P.id>=o?4:0,G=P.start;for(P.next();P.pos>_;){if(P.size<0)if(P.size==-3||P.size==-4)ne+=4;else break e;else P.id>=o&&(ne+=4);P.next()}H=G,z+=X,$+=ne}return(D<0||z==A)&&(j.size=z,j.start=H,j.skip=$),j.size>4?j:void 0}function C(A,D,P){let{id:z,start:H,end:$,size:Z}=a;if(a.next(),Z>=0&&z<o){let j=P;if(Z>4){let B=a.pos-(Z-4);for(;a.pos>B;)P=C(A,D,P)}D[--P]=j,D[--P]=$-A,D[--P]=H-A,D[--P]=z}else Z==-3?f=z:Z==-4&&(d=z);return P}let R=[],T=[];for(;a.pos>0;)p(n.start||0,n.bufferStart||0,R,T,-1,0);let M=(e=n.length)!==null&&e!==void 0?e:R.length?T[0]+R[0].length:0;return new ln(u[n.topID],R.reverse(),T.reverse(),M)}const Xb=new WeakMap;function Yf(n,e){if(!n.isAnonymous||e instanceof Vs||e.type!=n)return 1;let t=Xb.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof ln)){t=1;break}t+=Yf(n,r)}Xb.set(e,t)}return t}function Hy(n,e,t,r,i,s,o,a,u){let f=0;for(let v=r;v<i;v++)f+=Yf(n,e[v]);let d=Math.ceil(f*1.5/8),p=[],g=[];function y(v,w,S,C,R){for(let T=S;T<C;){let M=T,A=w[T],D=Yf(n,v[T]);for(T++;T<C;T++){let P=Yf(n,v[T]);if(D+P>=d)break;D+=P}if(T==M+1){if(D>d){let P=v[M];y(P.children,P.positions,0,P.children.length,w[M]+R);continue}p.push(v[M])}else{let P=w[T-1]+v[T-1].length-A;p.push(Hy(n,v,w,M,T,A,P,null,u))}g.push(A+R-s)}}return y(e,t,r,i,0),(a||u)(p,g,o)}class Co{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new Co(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,u=0,f=0;;a++){let d=a<t.length?t[a]:null,p=d?d.fromA:1e9;if(p-u>=r)for(;o&&o.from<p;){let g=o;if(u>=g.from||p<=g.to||f){let y=Math.max(g.from,u)-f,v=Math.min(g.to,p)-f;g=y>=v?null:new Co(y,v,g.tree,g.offset+f,a>0,!!d)}if(g&&i.push(g),o.to>p)break;o=s<e.length?e[s++]:null}if(!d)break;u=d.toA,f=d.toA-d.toB}return i}}class NE{startParse(e,t,r){return typeof e=="string"&&(e=new XL(e)),r=r?r.length?r.map(i=>new rg(i.from,i.to)):[new rg(0,0)]:[new rg(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}}class XL{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new dt({perNode:!0});let JL=0;class Lr{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=JL++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof Lr&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new Lr(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new Sd(e);return r=>r.modified.indexOf(t)>-1?r:Sd.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let ZL=0;class Sd{constructor(e){this.name=e,this.instances=[],this.id=ZL++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&e6(t,a.modified));if(r)return r;let i=[],s=new Lr(e.name,i,e,t);for(let a of t)a.instances.push(s);let o=t6(t);for(let a of e.set)if(!a.modified.length)for(let u of o)i.push(Sd.get(a,u));return s}}function e6(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function t6(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function LE(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let p=0;;){if(a=="..."&&p>0&&p+3==i.length){o=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!g)throw new RangeError("Invalid path: "+i);if(s.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),p+=g[0].length,p==i.length)break;let y=i[p++];if(p==i.length&&y=="!"){o=0;break}if(y!="/")throw new RangeError("Invalid path: "+i);a=i.slice(p)}let u=s.length-1,f=s[u];if(!f)throw new RangeError("Invalid path: "+i);let d=new wc(r,o,u>0?s.slice(0,u):null);e[f]=d.sort(e[f])}}return BE.add(e)}const BE=new dt({combine(n,e){let t,r,i;for(;n||e;){if(!n||e&&n.depth>=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new wc(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class wc{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}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}}wc.empty=new wc([],2,null);function FE(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let u of a.set){let f=t[u.id];if(f){o=o?o+" "+f:f;break}}return o},scope:r}}function n6(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function r6(n,e,t,r=0,i=n.length){let s=new i6(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class i6{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,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,r,i,s){let{type:o,from:a,to:u}=e;if(a>=r||u<=t)return;o.isTop&&(s=this.highlighters.filter(y=>!y.scope||y.scope(o)));let f=i,d=s6(e)||wc.empty,p=n6(s,d.tags);if(p&&(f&&(f+=" "),f+=p,d.mode==1&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(t,a),f),d.opaque)return;let g=e.tree&&e.tree.prop(dt.mounted);if(g&&g.overlay){let y=e.node.enter(g.overlay[0].from+a,1),v=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,C=a;;S++){let R=S<g.overlay.length?g.overlay[S]:null,T=R?R.from+a:u,M=Math.max(t,C),A=Math.min(r,T);if(M<A&&w)for(;e.from<A&&(this.highlightRange(e,M,A,i,s),this.startSpan(Math.min(A,e.to),f),!(e.to>=T||!e.nextSibling())););if(!R||T>r)break;C=R.to+a,C>t&&(this.highlightRange(y.cursor(),Math.max(t,R.from+a),Math.min(r,C),"",v),this.startSpan(Math.min(r,C),f))}w&&e.parent()}else if(e.firstChild()){g&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),f)}while(e.nextSibling());e.parent()}}}function s6(n){let e=n.type.prop(BE);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const Ee=Lr.define,bf=Ee(),Rs=Ee(),Jb=Ee(Rs),Zb=Ee(Rs),Ts=Ee(),Sf=Ee(Ts),ig=Ee(Ts),wi=Ee(),ao=Ee(wi),yi=Ee(),vi=Ee(),w0=Ee(),Da=Ee(w0),kf=Ee(),ge={comment:bf,lineComment:Ee(bf),blockComment:Ee(bf),docComment:Ee(bf),name:Rs,variableName:Ee(Rs),typeName:Jb,tagName:Ee(Jb),propertyName:Zb,attributeName:Ee(Zb),className:Ee(Rs),labelName:Ee(Rs),namespace:Ee(Rs),macroName:Ee(Rs),literal:Ts,string:Sf,docString:Ee(Sf),character:Ee(Sf),attributeValue:Ee(Sf),number:ig,integer:Ee(ig),float:Ee(ig),bool:Ee(Ts),regexp:Ee(Ts),escape:Ee(Ts),color:Ee(Ts),url:Ee(Ts),keyword:yi,self:Ee(yi),null:Ee(yi),atom:Ee(yi),unit:Ee(yi),modifier:Ee(yi),operatorKeyword:Ee(yi),controlKeyword:Ee(yi),definitionKeyword:Ee(yi),moduleKeyword:Ee(yi),operator:vi,derefOperator:Ee(vi),arithmeticOperator:Ee(vi),logicOperator:Ee(vi),bitwiseOperator:Ee(vi),compareOperator:Ee(vi),updateOperator:Ee(vi),definitionOperator:Ee(vi),typeOperator:Ee(vi),controlOperator:Ee(vi),punctuation:w0,separator:Ee(w0),bracket:Da,angleBracket:Ee(Da),squareBracket:Ee(Da),paren:Ee(Da),brace:Ee(Da),content:wi,heading:ao,heading1:Ee(ao),heading2:Ee(ao),heading3:Ee(ao),heading4:Ee(ao),heading5:Ee(ao),heading6:Ee(ao),contentSeparator:Ee(wi),list:Ee(wi),quote:Ee(wi),emphasis:Ee(wi),strong:Ee(wi),link:Ee(wi),monospace:Ee(wi),strikethrough:Ee(wi),inserted:Ee(),deleted:Ee(),changed:Ee(),invalid:Ee(),meta:kf,documentMeta:Ee(kf),annotation:Ee(kf),processingInstruction:Ee(kf),definition:Lr.defineModifier("definition"),constant:Lr.defineModifier("constant"),function:Lr.defineModifier("function"),standard:Lr.defineModifier("standard"),local:Lr.defineModifier("local"),special:Lr.defineModifier("special")};for(let n in ge){let e=ge[n];e instanceof Lr&&(e.name=n)}FE([{tag:ge.link,class:"tok-link"},{tag:ge.heading,class:"tok-heading"},{tag:ge.emphasis,class:"tok-emphasis"},{tag:ge.strong,class:"tok-strong"},{tag:ge.keyword,class:"tok-keyword"},{tag:ge.atom,class:"tok-atom"},{tag:ge.bool,class:"tok-bool"},{tag:ge.url,class:"tok-url"},{tag:ge.labelName,class:"tok-labelName"},{tag:ge.inserted,class:"tok-inserted"},{tag:ge.deleted,class:"tok-deleted"},{tag:ge.literal,class:"tok-literal"},{tag:ge.string,class:"tok-string"},{tag:ge.number,class:"tok-number"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],class:"tok-string2"},{tag:ge.variableName,class:"tok-variableName"},{tag:ge.local(ge.variableName),class:"tok-variableName tok-local"},{tag:ge.definition(ge.variableName),class:"tok-variableName tok-definition"},{tag:ge.special(ge.variableName),class:"tok-variableName2"},{tag:ge.definition(ge.propertyName),class:"tok-propertyName tok-definition"},{tag:ge.typeName,class:"tok-typeName"},{tag:ge.namespace,class:"tok-namespace"},{tag:ge.className,class:"tok-className"},{tag:ge.macroName,class:"tok-macroName"},{tag:ge.propertyName,class:"tok-propertyName"},{tag:ge.operator,class:"tok-operator"},{tag:ge.comment,class:"tok-comment"},{tag:ge.meta,class:"tok-meta"},{tag:ge.invalid,class:"tok-invalid"},{tag:ge.punctuation,class:"tok-punctuation"}]);var sg;const dl=new dt;function o6(n){return Me.define({combine:n?e=>e.concat(n):void 0})}const l6=new dt;class ii{constructor(e,t,r=[],i=""){this.data=e,this.name=i,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return kn(this)}}),this.parser=t,this.extension=[Ws.of(this),yt.languageData.of((s,o,a)=>{let u=e2(s,o,a),f=u.type.prop(dl);if(!f)return[];let d=s.facet(f),p=u.type.prop(l6);if(p){let g=u.resolve(o-u.from,a);for(let y of p)if(y.test(g,s)){let v=s.facet(y.facet);return y.type=="replace"?v:v.concat(d)}}return d})].concat(r)}isActiveAt(e,t,r=-1){return e2(e,t,r).type.prop(dl)==this.data}findRegions(e){let t=e.facet(Ws);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(dl)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(dt.mounted);if(a){if(a.tree.prop(dl)==this.data){if(a.overlay)for(let u of a.overlay)r.push({from:u.from+o,to:u.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let u=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>u)return}}for(let u=0;u<s.children.length;u++){let f=s.children[u];f instanceof ln&&i(f,s.positions[u]+o)}};return i(kn(e),0),r}get allowsNesting(){return!0}}ii.setState=lt.define();function e2(n,e,t){let r=n.facet(Ws),i=kn(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Jt.ExcludeBuffers|Jt.EnterBracketed))s.type.isTop&&(i=s);return i}class kd extends ii{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=o6(e.languageData);return new kd(t,e.parser.configure({props:[dl.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new kd(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kn(n){let e=n.field(ii.state,!1);return e?e.tree:ln.empty}class a6{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 r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let Na=null;class Cd{constructor(e,t,r=[],i,s,o,a,u){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new Cd(e,t,[],ln.empty,0,r,[],null)}startParse(){return this.parser.startParse(new a6(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ln.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Co.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,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(Co.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Na;Na=this;try{return e()}finally{Na=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=t2(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let u=[];if(e.iterChangedRanges((f,d,p,g)=>u.push({fromA:f,toA:d,fromB:p,toB:g})),r=Co.applyChanges(r,u),i=ln.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let f of this.skipped){let d=e.mapPos(f.from,1),p=e.mapPos(f.to,-1);d<p&&a.push({from:d,to:p})}}}return new Cd(this.parser,t,r,i,s,o,a,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 r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=t2(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends NE{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let u=Na;if(u){for(let f of i)u.tempSkipped.push(f);e&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,e]):e)}return this.parsedPos=o,new ln(dr.none,[],[],o-s)},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 Na}}function t2(n,e,t){return Co.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Il{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new Il(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=Cd.create(e.facet(Ws).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new Il(r)}}ii.state=Vn.define({create:Il.init,update(n,e){for(let t of e.effects)if(t.is(ii.setState))return t.value;return e.startState.facet(Ws)!=e.state.facet(Ws)?Il.init(e.state):n.apply(e)}});let jE=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(jE=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const og=typeof navigator<"u"&&(!((sg=navigator.scheduling)===null||sg===void 0)&&sg.isInputPending)?()=>navigator.scheduling.isInputPending():null,c6=en.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(ii.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(ii.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=jE(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:r,viewport:{to:i}}=this.view,s=r.field(ii.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!og?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,u=s.context.work(()=>og&&og()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(u||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ii.setState.of(new Il(s.context))})),this.chunkBudget>0&&!(u&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ar(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ws=Me.define({combine(n){return n.length?n[0]:null},enables:n=>[ii.state,c6,Oe.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class u6{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const f6=Me.define(),$y=Me.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ed(n){let e=n.facet($y);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function bc(n,e){let t="",r=n.tabSize,i=n.facet($y)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Uy(n,e){n instanceof yt&&(n=new wh(n));for(let r of n.state.facet(f6)){let i=r(n,e);if(i!==void 0)return i}let t=kn(n.state);return t.length>=e?d6(n,t,e):null}class wh{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ed(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Wl(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const _E=new dt;function d6(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return zE(r,n,t)}function zE(n,e,t){for(let r=n;r;r=r.next){let i=p6(r.node);if(i)return i(qy.create(e,t,r))}return 0}function h6(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function p6(n){let e=n.type.prop(_E);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(dt.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>v6(o,!0,1,void 0,s&&!h6(o)?i.from:void 0)}return n.parent==null?m6:null}function m6(){return 0}class qy extends wh{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new qy(e,t,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 r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(g6(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return zE(this.context.next,this.base,this.pos)}}function g6(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function y6(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let u=e.childAfter(a);if(!u||u==r)return null;if(!u.type.isSkipped){if(u.from>=o)return null;let f=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+f}}a=u.to}}function v6(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,u=y6(n);return u?a?n.column(u.from):n.column(u.to):n.baseIndent+(a?0:n.unit*t)}function x6({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const w6=200;function b6(){return yt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+w6)return n;let s=t.sliceString(i.from,r);if(!e.some(f=>f.test(s)))return n;let{state:o}=n,a=-1,u=[];for(let{head:f}of o.selection.ranges){let d=o.doc.lineAt(f);if(d.from==a)continue;a=d.from;let p=Uy(o,d.from);if(p==null)continue;let g=/^\s*/.exec(d.text)[0],y=bc(o,p);g!=y&&u.push({from:d.from,to:d.from+g.length,insert:y})}return u.length?[n,{changes:u,sequential:!0}]:n})}const S6=Me.define(),VE=new dt;function k6(n,e,t){let r=kn(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let u=a.type.prop(VE);if(u&&(a.to<r.length-50||r.length==n.doc.length||!C6(a))){let f=u(a,n);f&&f.from<=t&&f.from>=e&&f.to>t&&(s=f)}}return s}function C6(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Rd(n,e,t){for(let r of n.facet(S6)){let i=r(n,e,t);if(i)return i}return k6(n,e,t)}function WE(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const bh=lt.define({map:WE}),jc=lt.define({map:WE});function HE(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const Io=Vn.define({create(){return Ge.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=n2(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(bh)&&!E6(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(qE),i=r?Ge.replace({widget:new I6(r(e.state,t.value))}):r2;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(jc)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=n2(n,e.selection.main.head)),n},provide:n=>Oe.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(r2.range(r,i))}return Ge.set(e,!0)}});function n2(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function Td(n,e,t){var r;let i=null;return(r=n.field(Io,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function E6(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function $E(n,e){return n.field(Io,!1)?e:e.concat(lt.appendConfig.of(KE()))}const R6=n=>{for(let e of HE(n)){let t=Rd(n.state,e.from,e.to);if(t)return n.dispatch({effects:$E(n.state,[bh.of(t),UE(n,t)])}),!0}return!1},T6=n=>{if(!n.state.field(Io,!1))return!1;let e=[];for(let t of HE(n)){let r=Td(n.state,t.from,t.to);r&&e.push(jc.of(r),UE(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function UE(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return Oe.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const O6=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=Rd(e,i.from,i.to);s&&t.push(bh.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:$E(n.state,t)}),!!t.length},M6=n=>{let e=n.state.field(Io,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(jc.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},A6=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:R6},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:T6},{key:"Ctrl-Alt-[",run:O6},{key:"Ctrl-Alt-]",run:M6}],P6={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},qE=Me.define({combine(n){return Ii(n,P6)}});function KE(n){return[Io,L6]}function YE(n,e){let{state:t}=n,r=t.facet(qE),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),u=Td(n.state,a.from,a.to);u&&n.dispatch({effects:jc.of(u)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const r2=Ge.replace({widget:new class extends Di{toDOM(n){return YE(n,null)}}});class I6 extends Di{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return YE(e,this.value)}}const D6={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class lg extends ns{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 N6(n={}){let e={...D6,...n},t=new lg(e,!0),r=new lg(e,!1),i=en.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ws)!=o.state.facet(Ws)||o.startState.field(Io,!1)!=o.state.field(Io,!1)||kn(o.startState)!=kn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new es;for(let u of o.viewportLineBlocks){let f=Td(o.state,u.from,u.to)?r:Rd(o.state,u.from,u.to)?t:null;f&&a.add(u.from,u.from,f)}return a.finish()}}),{domEventHandlers:s}=e;return[i,NL({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||mt.empty},initialSpacer(){return new lg(e,!1)},domEventHandlers:{...s,click:(o,a,u)=>{if(s.click&&s.click(o,a,u))return!0;let f=Td(o.state,a.from,a.to);if(f)return o.dispatch({effects:jc.of(f)}),!0;let d=Rd(o.state,a.from,a.to);return d?(o.dispatch({effects:bh.of(d)}),!0):!1}}}),KE()]}const L6=Oe.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"}});class Sh{constructor(e,t){this.specs=e;let r;function i(a){let u=js.newName();return(r||(r=Object.create(null)))["."+u]=a,u}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof ii?a=>a.prop(dl)==o.data:o?a=>a==o:void 0,this.style=FE(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new js(r):null,this.themeType=t.themeType}static define(e,t){return new Sh(e,t||{})}}const b0=Me.define(),GE=Me.define({combine(n){return n.length?[n[0]]:null}});function ag(n){let e=n.facet(b0);return e.length?e:n.facet(GE)}function B6(n,e){let t=[j6],r;return n instanceof Sh&&(n.module&&t.push(Oe.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(GE.of(n)):r?t.push(b0.computeN([Oe.darkTheme],i=>i.facet(Oe.darkTheme)==(r=="dark")?[n]:[])):t.push(b0.of(n)),t}class F6{constructor(e){this.markCache=Object.create(null),this.tree=kn(e.state),this.decorations=this.buildDeco(e,ag(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=kn(e.state),r=ag(e.state),i=r!=ag(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Ge.none;let r=new es;for(let{from:i,to:s}of e.visibleRanges)r6(this.tree,t,(o,a,u)=>{r.add(o,a,this.markCache[u]||(this.markCache[u]=Ge.mark({class:u})))},i,s);return r.finish()}}const j6=Ks.high(en.fromClass(F6,{decorations:n=>n.decorations})),_6=Sh.define([{tag:ge.meta,color:"#404740"},{tag:ge.link,textDecoration:"underline"},{tag:ge.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ge.emphasis,fontStyle:"italic"},{tag:ge.strong,fontWeight:"bold"},{tag:ge.strikethrough,textDecoration:"line-through"},{tag:ge.keyword,color:"#708"},{tag:[ge.atom,ge.bool,ge.url,ge.contentSeparator,ge.labelName],color:"#219"},{tag:[ge.literal,ge.inserted],color:"#164"},{tag:[ge.string,ge.deleted],color:"#a11"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],color:"#e40"},{tag:ge.definition(ge.variableName),color:"#00f"},{tag:ge.local(ge.variableName),color:"#30a"},{tag:[ge.typeName,ge.namespace],color:"#085"},{tag:ge.className,color:"#167"},{tag:[ge.special(ge.variableName),ge.macroName],color:"#256"},{tag:ge.definition(ge.propertyName),color:"#00c"},{tag:ge.comment,color:"#940"},{tag:ge.invalid,color:"#f00"}]),z6=Oe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),QE=1e4,XE="()[]{}",JE=Me.define({combine(n){return Ii(n,{afterCursor:!0,brackets:XE,maxScanDistance:QE,renderMatch:H6})}}),V6=Ge.mark({class:"cm-matchingBracket"}),W6=Ge.mark({class:"cm-nonmatchingBracket"});function H6(n){let e=[],t=n.matched?V6:W6;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function i2(n){let e=[],t=n.facet(JE);for(let r of n.selection.ranges){if(!r.empty)continue;let i=Ri(n,r.head,-1,t)||r.head>0&&Ri(n,r.head-1,1,t)||t.afterCursor&&(Ri(n,r.head,1,t)||r.head<n.doc.length&&Ri(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return Ge.set(e,!0)}const $6=en.fromClass(class{constructor(n){this.paused=!1,this.decorations=i2(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=i2(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),U6=[$6,z6];function q6(n={}){return[JE.of(n),U6]}const K6=new dt;function S0(n,e,t){let r=n.prop(e<0?dt.openedBy:dt.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function k0(n){let e=n.type.prop(K6);return e?e(n.node):n}function Ri(n,e,t,r={}){let i=r.maxScanDistance||QE,s=r.brackets||XE,o=kn(n),a=o.resolveInner(e,t);for(let u=a;u;u=u.parent){let f=S0(u.type,t,s);if(f&&u.from<u.to){let d=k0(u);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return Y6(n,e,t,u,d,f,s)}}return G6(n,e,t,o,a.type,i,s)}function Y6(n,e,t,r,i,s,o){let a=r.parent,u={from:i.from,to:i.to},f=0,d=a==null?void 0:a.cursor();if(d&&(t<0?d.childBefore(r.from):d.childAfter(r.to)))do if(t<0?d.to<=r.from:d.from>=r.to){if(f==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let p=k0(d);return{start:u,end:p?{from:p.from,to:p.to}:void 0,matched:!0}}else if(S0(d.type,t,o))f++;else if(S0(d.type,-t,o)){if(f==0){let p=k0(d);return{start:u,end:p&&p.from<p.to?{from:p.from,to:p.to}:void 0,matched:!1}}f--}}while(t<0?d.prevSibling():d.nextSibling());return{start:u,matched:!1}}function G6(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),u=o.indexOf(a);if(u<0||u%2==0!=t>0)return null;let f={from:t<0?e-1:e,to:t>0?e+1:e},d=n.doc.iterRange(e,t>0?n.doc.length:0),p=0;for(let g=0;!d.next().done&&g<=s;){let y=d.value;t<0&&(g+=y.length);let v=e+g*t;for(let w=t>0?0:y.length-1,S=t>0?y.length:-1;w!=S;w+=t){let C=o.indexOf(y[w]);if(!(C<0||r.resolveInner(v+w,1).type!=i))if(C%2==0==t>0)p++;else{if(p==1)return{start:f,end:{from:v+w,to:v+w+1},matched:C>>1==u>>1};p--}}t>0&&(g+=y.length)}return d.done?{start:f,matched:!1}:null}const Q6=Object.create(null),s2=[dr.none],o2=[],l2=Object.create(null),X6=Object.create(null);for(let[n,e]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"]])X6[n]=J6(Q6,e);function cg(n,e){o2.indexOf(n)>-1||(o2.push(n),console.warn(e))}function J6(n,e){let t=[];for(let a of e.split(" ")){let u=[];for(let f of a.split(".")){let d=n[f]||ge[f];d?typeof d=="function"?u.length?u=u.map(d):cg(f,`Modifier ${f} used at start of tag`):u.length?cg(f,`Tag ${f} used as modifier`):u=Array.isArray(d)?d:[d]:cg(f,`Unknown highlighting tag ${f}`)}for(let f of u)t.push(f)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=l2[i];if(s)return s.id;let o=l2[i]=dr.define({id:s2.length,name:r,props:[LE({[r]:t})]});return s2.push(o),o.id}At.RTL,At.LTR;var a2={};class Od{constructor(e,t,r,i,s,o,a,u,f,d=0,p){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=u,this.curContext=f,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let i=e.parser.context;return new Od(e,[],t,r,r,0,[],0,i?new c2(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){var t;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){i<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let u=this.stack.length-(r-1)*3-(e&262144?6:0),f=u?this.stack[u-2]:this.p.ranges[0].from;i<s.minRepeatTerm&&f==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-f;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(f==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=f,this.p.lastBigReductionSize=d));let p=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-p;if(i<s.minRepeatTerm||e&131072){let y=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,f,y,g+4,!0)}if(e&262144)this.state=this.stack[u];else{let y=this.stack[u-3];this.state=s.getGoto(y,i,!0)}for(;this.stack.length>u;)this.stack.pop();this.reduceContext(i,f)}storeNode(e,t,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==r)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let u=o;u>0&&this.buffer[u-2]>r;u-=4)if(this.buffer[u-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,t,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=i;let a=o.stateFlag(s,1);!a&&(i>r||t<=o.maxNode)&&(this.reducePos=i),this.pushState(s,a?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,i,4)}else this.pos=i,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,i,4)}apply(e,t,r,i){e&65536?this.reduce(e):this.shift(e,t,r,i)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(r,i,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 e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Od(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Z6(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}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 i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,u)=>u&1&&a==o)||i.push(t[s],o)}t=i}let r=[];for(let i=0;i<t.length&&r.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,i=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}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=[],r=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let u=o&65535,f=this.stack.length-a*3;if(f>=0&&e.getGoto(this.stack[f],u,!1)>=0)return a<<19|65536|u}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(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 c2(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()}}class c2{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Z6{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Md{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Md(e,t,t-e.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 Md(this.stack,this.pos,this.index)}}function Cf(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let r=0,i=0;r<n.length;){let s=0;for(;;){let o=n.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let u=o-32;if(u>=46&&(u-=46,a=!0),s+=u,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class Gf{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const u2=new Gf;class e9{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=u2,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 r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}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,r,i;if(t>=0&&t<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}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.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=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=u2,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 r="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return r}}class bl{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;n9(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}bl.prototype.contextual=bl.prototype.fallback=bl.prototype.extend=!1;bl.prototype.fallback=bl.prototype.extend=!1;class t9{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function n9(n,e,t,r,i,s){let o=0,a=1<<r,{dialect:u}=t.p.parser;e:for(;(a&n[o])!=0;){let f=n[o+1];for(let y=o+3;y<f;y+=2)if((n[y+1]&a)>0){let v=n[y];if(u.allows(v)&&(e.token.value==-1||e.token.value==v||r9(v,e.token.value,i,s))){e.acceptToken(v);break}}let d=e.next,p=0,g=n[o+2];if(e.next<0&&g>p&&n[f+g*3-3]==65535){o=n[f+g*3-1];continue e}for(;p<g;){let y=p+g>>1,v=f+y+(y<<1),w=n[v],S=n[v+1]||65536;if(d<w)g=y;else if(d>=S)p=y+1;else{o=n[v+2],e.advance();continue e}}break}}function f2(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function r9(n,e,t,r){let i=f2(t,r,e);return i<0||f2(t,r,n)<i}const xr=typeof process<"u"&&a2&&/\bparse\b/.test(a2.LOG);let ug=null;function d2(n,e,t){let r=n.cursor(Jt.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(n.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:n.length}}class i9{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?d2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?d2(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 r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[t]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ln){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let u=s.prop(dt.lookAhead);if(!u||a+u<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class s9{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Gf)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,u=0;for(let f=0;f<s.length;f++){if((1<<f&o)==0)continue;let d=s[f],p=this.tokens[f];if(!(r&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=o||p.context!=a)&&(this.updateCachedToken(p,d,e),p.mask=o,p.context=a),p.lookAhead>p.end+25&&(u=Math.max(p.lookAhead,u)),p.value!=0)){let g=t;if(p.extended>-1&&(t=this.addActions(e,p.extended,p.end,t)),t=this.addActions(e,p.value,p.end,t),!d.extend&&(r=p,t>g))break}}for(;this.actions.length>t;)this.actions.pop();return u&&e.setLookAhead(u),!r&&e.pos==this.stream.end&&(r=new Gf,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Gf,{pos:r,p:i}=e;return t.start=r,t.end=Math.min(r+1,i.stream.end),t.value=r==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,r){let i=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=r,i}addActions(e,t,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let u=0;u<2;u++)for(let f=o.stateSlot(s,u?2:1);;f+=3){if(a[f]==65535)if(a[f+1]==1)f=qi(a,f+2);else{i==0&&a[f+1]==2&&(i=this.putAction(qi(a,f+2),t,r,i));break}a[f]==t&&(i=this.putAction(qi(a,f+1),t,r,i))}return i}}class o9{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,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 e9(t,i),this.tokens=new s9(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[Od.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new i9(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let u=this.tokens.getMainToken(a);s.push(u.value,u.end)}}break}}if(!r.length){let o=i&&a9(i);if(o)return xr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw xr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return xr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,u)=>u.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let u=o+1;u<r.length;u++){let f=r[u];if(a.sameState(f)||a.buffer.length>500&&f.buffer.length>500)if((a.score-f.score||a.buffer.length-f.buffer.length)>0)r.splice(u--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let i=e.pos,{parser:s}=this,o=xr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let f=e.curContext&&e.curContext.tracker.strict,d=f?e.curContext.hash:0;for(let p=this.fragments.nodeAt(i);p;){let g=this.parser.nodeSet.types[p.type.id]==p.type?s.getGoto(e.state,p.type.id):-1;if(g>-1&&p.length&&(!f||(p.prop(dt.contextHash)||0)==d))return e.useNode(p,g),xr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(p.type.id)})`),!0;if(!(p instanceof ln)||p.children.length==0||p.positions[0]>0)break;let y=p.children[0];if(y instanceof ln&&p.positions[0]==0)p=y;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),xr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let u=this.tokens.getActions(e);for(let f=0;f<u.length;){let d=u[f++],p=u[f++],g=u[f++],y=f==u.length||!r,v=y?e:e.split(),w=this.tokens.mainToken;if(v.apply(d,p,w?w.start:v.pos,g),xr&&console.log(o+this.stackID(v)+` (via ${(d&65536)==0?"shift":`reduce of ${s.getName(d&65535)}`} for ${s.getName(p)} @ ${i}${v==e?"":", split"})`),y)return!0;v.pos>i?t.push(v):r.push(v)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return h2(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],u=t[o<<1],f=t[(o<<1)+1],d=xr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),xr&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let p=a.split(),g=d;for(let y=0;y<10&&p.forceReduce()&&(xr&&console.log(g+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));y++)xr&&(g=this.stackID(p)+" -> ");for(let y of a.recoverByInsert(u))xr&&console.log(d+this.stackID(y)+" (via recover-insert)"),this.advanceFully(y,r);this.stream.end>a.pos?(f==a.pos&&(f++,u=0),a.recoverByDelete(u,f),xr&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(u)})`),h2(a,r)):(!i||i.score<p.score)&&(i=p)}return i}stackToTree(e){return e.close(),ln.build({buffer:Md.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=(ug||(ug=new WeakMap)).get(e);return t||ug.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function h2(n,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==n.pos&&r.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class l9{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class Ad extends NE{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,u,f){i[a].push([u,u.deserialize(String(f))])}if(e.nodeProps)for(let a of e.nodeProps){let u=a[0];typeof u=="string"&&(u=dt[u]);for(let f=1;f<a.length;){let d=a[f++];if(d>=0)s(d,u,a[f++]);else{let p=a[f+-d];for(let g=-d;g>0;g--)s(a[f++],u,p);f++}}}this.nodeSet=new zy(t.map((a,u)=>dr.define({name:u>=this.minRepeatTerm?void 0:a,id:u,props:i[u],top:r.indexOf(u)>-1,error:u==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(u)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=AE;let o=Cf(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(p2),this.states=Cf(e.states,Uint32Array),this.data=Cf(e.stateData),this.goto=Cf(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new bl(o,a):a),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,r){let i=new o9(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}getGoto(e,t,r=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,u=i[s++];if(a&&r)return u;for(let f=s+(o>>1);s<f;s++)if(i[s]==e)return u;if(a)return-1}}hasAction(e,t){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=qi(r,s+2)];else{if(r[s+1]==2)return qi(r,s+2);break}if(o==t||o==0)return qi(r,s+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,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),i=r?t(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=qi(this.data,s+2);else break;i=t(qi(this.data,s+1))}return i}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=qi(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(Ad.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=p2(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}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),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new l9(e,r,i)}static deserialize(e){return new Ad(e)}}function qi(n,e){return n[e]|n[e+1]<<16}function a9(n){let e=null;for(let t of n){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function p2(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}class ZE{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=kn(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),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(tR(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function m2(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function c9(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=m2(e)+m2(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function eR(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:c9(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function u9(n,e){return t=>{for(let r=kn(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(n.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class g2{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Eo(n){return n.selection.main.from}function tR(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const nR=rs.define();function f9(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return{...n.changeByRange(a=>{if(a!=i&&t!=r&&n.sliceDoc(a.from+s,a.from+o)!=n.sliceDoc(t,r))return{range:a};let u=n.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:u},range:ue.cursor(a.from+s+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const y2=new WeakMap;function d9(n){if(!Array.isArray(n))return n;let e=y2.get(n);return e||y2.set(n,e=eR(n)),e}const Pd=lt.define(),Sc=lt.define();class h9{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 r=sr(e,t),i=ki(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(sr(o==s?s.toLowerCase():o,0)),t+=i}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:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let R=sr(e,0),T=ki(R),M=T==e.length?0:-100;if(R!=t[0])if(R==r[0])M+=-200;else return null;return this.ret(M,[0,T])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=t.length,f=0;if(a<0){for(let R=0,T=Math.min(e.length,200);R<T&&f<u;){let M=sr(e,R);(M==t[f]||M==r[f])&&(i[f++]=R),R+=ki(M)}if(f<u)return null}let d=0,p=0,g=!1,y=0,v=-1,w=-1,S=/[a-z]/.test(e),C=!0;for(let R=0,T=Math.min(e.length,200),M=0;R<T&&p<u;){let A=sr(e,R);a<0&&(d<u&&A==t[d]&&(s[d++]=R),y<u&&(A==t[y]||A==r[y]?(y==0&&(v=R),w=R+1,y++):y=0));let D,P=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(D=by(A))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0;(!R||P==1&&S||M==0&&P!=0)&&(t[p]==A||r[p]==A&&(g=!0)?o[p++]=R:o.length&&(C=!1)),M=P,R+=ki(A)}return p==u&&o[0]==0&&C?this.result(-100+(g?-200:0),o,e):y==u&&v==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):y==u?this.ret(-900-e.length,[v,w]):p==u?this.result(-100+(g?-200:0)+-700+(C?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let a=o+(this.astral?ki(sr(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class p9{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),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const bn=Me.define({combine(n){return Ii(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:m9,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)=>r=>v2(e(r),t(r)),optionClass:(e,t)=>r=>v2(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function v2(n,e){return n?e?n+" "+e:n:e}function m9(n,e,t,r,i,s){let o=n.textDirection==At.RTL,a=o,u=!1,f="top",d,p,g=e.left-i.left,y=i.right-e.right,v=r.right-r.left,w=r.bottom-r.top;if(a&&g<Math.min(v,y)?a=!1:!a&&y<Math.min(v,g)&&(a=!0),v<=(a?g:y))d=Math.max(i.top,Math.min(t.top,i.bottom-w))-e.top,p=Math.min(400,a?g:y);else{u=!0,p=Math.min(400,(o?e.right:i.right-e.left)-30);let R=i.bottom-e.bottom;R>=w||R>e.top?d=t.bottom-e.top:(f="bottom",d=e.bottom-t.top)}let S=(e.bottom-e.top)/s.offsetHeight,C=(e.right-e.left)/s.offsetWidth;return{style:`${f}: ${d/S}px; max-width: ${p/C}px`,class:"cm-completionInfo-"+(u?o?"left-narrow":"right-narrow":a?"left":"right")}}const Ky=lt.define();function g9(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,u=0;for(let f=0;f<s.length;){let d=s[f++],p=s[f++];d>u&&o.appendChild(document.createTextNode(a.slice(u,d)));let g=o.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(a.slice(d,p))),g.className="cm-completionMatchedText",u=p}return u<a.length&&o.appendChild(document.createTextNode(a.slice(u))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function fg(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.ceil((n-e)/t);return{from:n-r*t,to:n-(r-1)*t}}class y9{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(bn);this.optionContent=g9(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=fg(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",u=>{let{options:f}=e.state.field(t).open;for(let d=u.target,p;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(p=/-(\d+)$/.exec(d.id))&&+p[1]<f.length){this.applyCompletion(e,f[+p[1]]),u.preventDefault();return}if(u.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&u.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&u.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(e.dispatch({effects:Ky.of(d)}),u.preventDefault())}}),this.dom.addEventListener("focusout",u=>{let f=e.state.field(this.stateField,!1);f&&f.tooltip&&e.state.facet(bn).closeOnBlur&&u.relatedTarget!=e.contentDOM&&e.dispatch({effects:Sc.of(null)})}),this.showOptions(s,i.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){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=fg(s.length,o,e.state.facet(bn).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);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=fg(t.options.length,t.selected,this.view.state.facet(bn).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>ar(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&x9(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(bn).positionInfo(this.view,t,i,r,s,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,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:u}=e[o],{section:f}=a;if(f){let g=typeof f=="string"?f:f.name;if(g!=s&&(o>r.from||r.from==0))if(s=g,typeof f!="string"&&f.header)i.appendChild(f.header(f));else{let y=i.appendChild(document.createElement("completion-section"));y.textContent=g}}const d=i.appendChild(document.createElement("li"));d.id=t+"-"+o,d.setAttribute("role","option");let p=this.optionClass(a);p&&(d.className=p);for(let g of this.optionContent){let y=g(a,this.view.state,this.view,u);y&&d.appendChild(y)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function v9(n,e){return t=>new y9(t,n,e)}function x9(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function x2(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function w9(n,e){let t=[],r=null,i=null,s=d=>{t.push(d);let{section:p}=d.completion;if(p){r||(r=[]);let g=typeof p=="string"?p:p.name;r.some(y=>y.name==g)||r.push(typeof p=="string"?{name:g}:p)}},o=e.facet(bn);for(let d of n)if(d.hasResult()){let p=d.result.getMatch;if(d.result.filter===!1)for(let g of d.result.options)s(new g2(g,d.source,p?p(g):[],1e9-t.length));else{let g=e.sliceDoc(d.from,d.to),y,v=o.filterStrict?new p9(g):new h9(g);for(let w of d.result.options)if(y=v.match(w.label)){let S=w.displayLabel?p?p(w,y.matched):[]:y.matched,C=y.score+(w.boost||0);if(s(new g2(w,d.source,S,C)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:R}=w.section;i||(i=Object.create(null)),i[R]=Math.max(C,i[R]||-1e9)}}}}if(r){let d=Object.create(null),p=0,g=(y,v)=>(y.rank==="dynamic"&&v.rank==="dynamic"?i[v.name]-i[y.name]:0)||(typeof y.rank=="number"?y.rank:1e9)-(typeof v.rank=="number"?v.rank:1e9)||(y.name<v.name?-1:1);for(let y of r.sort(g))p-=1e5,d[y.name]=p;for(let y of t){let{section:v}=y.completion;v&&(y.score+=d[typeof v=="string"?v:v.name])}}let a=[],u=null,f=o.compareCompletions;for(let d of t.sort((p,g)=>g.score-p.score||f(p.completion,g.completion))){let p=d.completion;!u||u.label!=p.label||u.detail!=p.detail||u.type!=null&&p.type!=null&&u.type!=p.type||u.apply!=p.apply||u.boost!=p.boost?a.push(d):x2(d.completion)>x2(u)&&(a[a.length-1]=d),u=d.completion}return a}class hl{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new hl(this.options,w2(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(f=>f.isPending))return i.setDisabled();let a=w9(e,t);if(!a.length)return i&&e.some(f=>f.isPending)?i.setDisabled():null;let u=t.facet(bn).selectOnOpen?0:-1;if(i&&i.selected!=u&&i.selected!=-1){let f=i.options[i.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==f){u=d;break}}return new hl(a,w2(r,u),{pos:e.reduce((f,d)=>d.hasResult()?Math.min(f,d.from):f,1e8),create:R9,above:s.aboveCursor},i?i.timestamp:Date.now(),u,!1)}map(e){return new hl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new hl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Id{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Id(C9,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(bn),s=(r.override||t.languageDataAt("autocomplete",Eo(t)).map(d9)).map(u=>(this.active.find(d=>d.source==u)||new jr(u,this.active.some(d=>d.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((u,f)=>u==this.active[f])&&(s=this.active);let o=this.open,a=e.effects.some(u=>u.is(Yy));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(u=>u.hasResult()&&e.changes.touchesRange(u.from,u.to))||!b9(s,this.active)||a?o=hl.build(s,t,this.id,o,r,a):o&&o.disabled&&!s.some(u=>u.isPending)&&(o=null),!o&&s.every(u=>!u.isPending)&&s.some(u=>u.hasResult())&&(s=s.map(u=>u.hasResult()?new jr(u.source,0):u));for(let u of e.effects)u.is(Ky)&&(o=o&&o.setSelected(u.value,this.id));return s==this.active&&o==this.open?this:new Id(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?S9:k9}}function b9(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const S9={"aria-autocomplete":"list"},k9={};function w2(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const C9=[];function rR(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(nR);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class jr{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=rR(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new jr(i.source,0)),r&4&&i.state==0&&(i=new jr(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(Pd))i=new jr(i.source,1,s.value);else if(s.is(Sc))i=new jr(i.source,0);else if(s.is(Yy))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Eo(e.state))}}class Sl extends jr{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Eo(e.state);if(a>o||!i||t&2&&(Eo(e.startState)==this.from||a<this.limit))return new jr(this.source,t&4?1:0);let u=e.changes.mapPos(this.limit);return E9(i.validFor,e.state,s,o)?new Sl(this.source,this.explicit,u,i,s,o):i.update&&(i=i.update(i,s,o,new ZE(e.state,a,!1)))?new Sl(this.source,this.explicit,u,i,i.from,(r=i.to)!==null&&r!==void 0?r:Eo(e.state)):new jr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Sl(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new jr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function E9(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):tR(n,!0).test(i)}const Yy=lt.define({map(n,e){return n.map(t=>t.map(e))}}),or=Vn.define({create(){return Id.start()},update(n,e){return n.update(e)},provide:n=>[jy.from(n,e=>e.tooltip),Oe.contentAttributes.from(n,e=>e.attrs)]});function Gy(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(or).active.find(i=>i.source==e.source);return r instanceof Sl?(typeof t=="string"?n.dispatch({...f9(n.state,t,r.from,r.to),annotations:nR.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const R9=v9(or,Gy);function Ef(n,e="option"){return t=>{let r=t.state.field(or,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(bn).interactionDelay)return!1;let i=1,s;e=="page"&&(s=CE(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Ky.of(a)}),!0}}const T9=n=>{let e=n.state.field(or,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(bn).interactionDelay?!1:Gy(n,e.open.options[e.open.selected])},dg=n=>n.state.field(or,!1)?(n.dispatch({effects:Pd.of(!0)}),!0):!1,O9=n=>{let e=n.state.field(or,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Sc.of(null)}),!0)};class M9{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const A9=50,P9=1e3,I9=en.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(or).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(or),t=n.state.facet(bn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(or)==e)return;let r=n.transactions.some(s=>{let o=rR(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>A9&&Date.now()-o.time>P9){for(let a of o.context.abortListeners)try{a()}catch(u){ar(this.view.state,u)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(Pd)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(or);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(bn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Eo(e),r=new ZE(e,t,n.explicit,this.view),i=new M9(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Sc.of(null)}),ar(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(bn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(bn),r=this.view.state.field(or);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=Eo(s.updates.length?s.updates[0].startState:this.view.state),u=Math.min(a,s.done.from+(s.active.explicit?0:1)),f=new Sl(s.active.source,s.active.explicit,u,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:a);for(let d of s.updates)f=f.update(d,t);if(f.hasResult()){e.push(f);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new jr(s.active.source,0);for(let u of s.updates)a=a.update(u,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Yy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(or,!1);if(e&&e.tooltip&&this.view.state.facet(bn).closeOnBlur){let t=e.open&&CE(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Sc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Pd.of(!1)}),20),this.composing=0}}}),D9=typeof navigator=="object"&&/Win/.test(navigator.platform),N9=Ks.highest(Oe.domEventHandlers({keydown(n,e){let t=e.state.field(or,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(D9&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&Gy(e,r),!1}})),L9=Oe.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"}}}),kc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},wo=lt.define({map(n,e){let t=e.mapPos(n,-1,Yn.TrackAfter);return t??void 0}}),Qy=new class extends Fs{};Qy.startSide=1;Qy.endSide=-1;const iR=Vn.define({create(){return mt.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(wo)&&(n=n.update({add:[Qy.range(t.value,t.value+1)]}));return n}});function B9(){return[j9,iR]}const hg="()[]{}<>«»»«[]{}";function sR(n){for(let e=0;e<hg.length;e+=2)if(hg.charCodeAt(e)==n)return hg.charAt(e+1);return by(n<128?n:n+1)}function oR(n,e){return n.languageDataAt("closeBrackets",e)[0]||kc}const F9=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),j9=Oe.inputHandler.of((n,e,t,r)=>{if((F9?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&ki(sr(r,0))==1||e!=i.from||t!=i.to)return!1;let s=V9(n.state,r);return s?(n.dispatch(s),!0):!1}),_9=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=oR(n,n.selection.main.head).brackets||kc.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let a=W9(n.doc,o.head);for(let u of r)if(u==a&&kh(n.doc,o.head)==sR(sr(u,0)))return{changes:{from:o.head-u.length,to:o.head+u.length},range:ue.cursor(o.head-u.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},z9=[{key:"Backspace",run:_9}];function V9(n,e){let t=oR(n,n.selection.main.head),r=t.brackets||kc.brackets;for(let i of r){let s=sR(sr(i,0));if(e==i)return s==i?U9(n,i,r.indexOf(i+i+i)>-1,t):H9(n,i,s,t.before||kc.before);if(e==s&&lR(n,n.selection.main.from))return $9(n,i,s)}return null}function lR(n,e){let t=!1;return n.field(iR).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function kh(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ki(sr(t,0)))}function W9(n,e){let t=n.sliceString(e-2,e);return ki(sr(t,0))==t.length?t:t.slice(1)}function H9(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:wo.of(o.to+e.length),range:ue.range(o.anchor+e.length,o.head+e.length)};let a=kh(n.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:wo.of(o.head+e.length),range:ue.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function $9(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&kh(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:ue.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function U9(n,e,t,r){let i=r.stringPrefixes||kc.stringPrefixes,s=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:wo.of(a.to+e.length),range:ue.range(a.anchor+e.length,a.head+e.length)};let u=a.head,f=kh(n.doc,u),d;if(f==e){if(b2(n,u))return{changes:{insert:e+e,from:u},effects:wo.of(u+e.length),range:ue.cursor(u+e.length)};if(lR(n,u)){let g=t&&n.sliceDoc(u,u+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:u,to:u+g.length,insert:g},range:ue.cursor(u+g.length)}}}else{if(t&&n.sliceDoc(u-2*e.length,u)==e+e&&(d=S2(n,u-2*e.length,i))>-1&&b2(n,d))return{changes:{insert:e+e+e+e,from:u},effects:wo.of(u+e.length),range:ue.cursor(u+e.length)};if(n.charCategorizer(u)(f)!=$t.Word&&S2(n,u,i)>-1&&!q9(n,u,e,i))return{changes:{insert:e+e,from:u},effects:wo.of(u+e.length),range:ue.cursor(u+e.length)}}return{range:s=a}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function b2(n,e){let t=kn(n).resolveInner(e+1);return t.parent&&t.from==e}function q9(n,e,t,r){let i=kn(n).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),u=a.indexOf(t);if(!u||u>-1&&r.indexOf(a.slice(0,u))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>t.length+u;){if(n.sliceDoc(d.to-t.length,d.to)==t)return!1;d=d.firstChild}return!0}let f=i.to==e&&i.parent;if(!f)break;i=f}return!1}function S2(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=$t.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=$t.Word)return s}return-1}function K9(n={}){return[N9,or,bn.of(n),I9,Y9,L9]}const aR=[{key:"Ctrl-Space",run:dg},{mac:"Alt-`",run:dg},{mac:"Alt-i",run:dg},{key:"Escape",run:O9},{key:"ArrowDown",run:Ef(!0)},{key:"ArrowUp",run:Ef(!1)},{key:"PageDown",run:Ef(!0,"page")},{key:"PageUp",run:Ef(!1,"page")},{key:"Enter",run:T9}],Y9=Ks.highest(yc.computeN([bn],n=>n.facet(bn).defaultKeymap?[aR]:[])),G9=36,k2=1,Q9=2,il=3,pg=4,X9=5,J9=6,Z9=7,eB=8,tB=9,nB=10,rB=11,iB=12,sB=13,oB=14,lB=15,aB=16,cB=17,C2=18,uB=19,cR=20,uR=21,E2=22,fB=23,dB=24;function C0(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function hB(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function po(n,e,t){for(let r=!1;;){if(n.next<0)return;if(n.next==e&&!r){n.advance();return}r=t&&!r&&n.next==92,n.advance()}}function pB(n,e){e:for(;;){if(n.next<0)return;if(n.next==36){n.advance();for(let t=0;t<e.length;t++){if(n.next!=e.charCodeAt(t))continue e;n.advance()}if(n.next==36){n.advance();return}}else n.advance()}}function mB(n,e){let t="[{<(".indexOf(String.fromCharCode(e)),r=t<0?e:"]}>)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==r&&n.peek(1)==39){n.advance(2);return}n.advance()}}function E0(n,e){for(;!(n.next!=95&&!C0(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function gB(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),po(n,e,!1)}else E0(n)}function R2(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function T2(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function O2(n){for(;!(n.next<0||n.next==10);)n.advance()}function co(n,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==n)return!0;return!1}const mg=` \r
158
+ `;function fR(n,e,t){let r=Object.create(null);r.true=r.false=X9,r.null=r.unknown=J9;for(let i of n.split(" "))i&&(r[i]=cR);for(let i of e.split(" "))i&&(r[i]=uR);for(let i of(t||"").split(" "))i&&(r[i]=dB);return r}const yB="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 ",vB="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 ",R0={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:fR(vB,yB)};function xB(n,e,t,r){let i={};for(let s in R0)i[s]=(n.hasOwnProperty(s)?n:R0)[s];return e&&(i.words=fR(e,t||"",r)),i}function dR(n){return new t9(e=>{var t;let{next:r}=e;if(e.advance(),co(r,mg)){for(;co(e.next,mg);)e.advance();e.acceptToken(G9)}else if(r==36&&n.doubleDollarQuotedStrings){let i=E0(e,"");e.next==36&&(e.advance(),pB(e,i),e.acceptToken(il))}else if(r==39||r==34&&n.doubleQuotedStrings)po(e,r,n.backslashEscapes),e.acceptToken(il);else if(r==35&&n.hashComments||r==47&&e.next==47&&n.slashComments)O2(e),e.acceptToken(k2);else if(r==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))O2(e),e.acceptToken(k2);else if(r==47&&e.next==42){e.advance();for(let i=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(i--,e.advance(),!i)break}else s==47&&e.next==42&&(i++,e.advance())}e.acceptToken(Q9)}else if((r==101||r==69)&&e.next==39)e.advance(),po(e,39,!0),e.acceptToken(il);else if((r==110||r==78)&&e.next==39&&n.charSetCasts)e.advance(),po(e,39,n.backslashEscapes),e.acceptToken(il);else if(r==95&&n.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),po(e,39,n.backslashEscapes),e.acceptToken(il);break}if(!C0(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!co(e.peek(1),mg)){let i=e.peek(1);e.advance(2),mB(e,i),e.acceptToken(il)}else if(co(r,n.identifierQuotes)){const i=r==91?93:r;po(e,i,!1),e.acceptToken(uB)}else if(r==40)e.acceptToken(Z9);else if(r==41)e.acceptToken(eB);else if(r==123)e.acceptToken(tB);else if(r==125)e.acceptToken(nB);else if(r==91)e.acceptToken(rB);else if(r==93)e.acceptToken(iB);else if(r==59)e.acceptToken(sB);else if(n.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),R2(e),e.acceptToken(E2);else if((r==98||r==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),n.treatBitsAsBytes?(po(e,i,n.backslashEscapes),e.acceptToken(fB)):(R2(e,i),e.acceptToken(E2))}else if(r==48&&(e.next==120||e.next==88)||(r==120||r==88)&&e.next==39){let i=e.next==39;for(e.advance();hB(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(pg)}else if(r==46&&e.next>=48&&e.next<=57)T2(e,!0),e.acceptToken(pg);else if(r==46)e.acceptToken(oB);else if(r>=48&&r<=57)T2(e,!1),e.acceptToken(pg);else if(co(r,n.operatorChars)){for(;co(e.next,n.operatorChars);)e.advance();e.acceptToken(lB)}else if(co(r,n.specialVar))e.next==r&&e.advance(),gB(e),e.acceptToken(cB);else if(r==58||r==44)e.acceptToken(aB);else if(C0(r)){let i=E0(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?C2:(t=n.words[i.toLowerCase()])!==null&&t!==void 0?t:C2)}})}const hR=dR(R0),wB=Ad.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,hR],topRules:{Script:[0,25]},tokenPrec:0});function T0(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Cc(n,e){let t=n.sliceString(e.from,e.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return r?r[2]:t}function Dd(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function bB(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let r=e.firstChild;r;r=r.nextSibling)Dd(r)&&t.push(Cc(n,r));return t}return[Cc(n,e)]}function M2(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let r=T0(e);if(!Dd(r))return t;t.unshift(Cc(n,r)),e=T0(r)}}function SB(n,e){let t=kn(n).resolveInner(e,-1),r=CB(n.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?n.doc.sliceString(t.from,t.from+1):null,parents:M2(n.doc,T0(t)),aliases:r}:t.name=="."?{from:e,quoted:null,parents:M2(n.doc,t),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}const kB=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function CB(n,e){let t;for(let i=e;!t;i=i.parent){if(!i)return null;i.name=="Statement"&&(t=i)}let r=null;for(let i=t.firstChild,s=!1,o=null;i;i=i.nextSibling){let a=i.name=="Keyword"?n.sliceString(i.from,i.to).toLowerCase():null,u=null;if(!s)s=a=="from";else if(a=="as"&&o&&Dd(i.nextSibling))u=Cc(n,i.nextSibling);else{if(a&&kB.has(a))break;o&&Dd(i)&&(u=Cc(n,i))}u&&(r||(r=Object.create(null)),r[u]=bB(n,o)),o=/Identifier$/.test(i.name)?i:null}return r}function EB(n,e,t){return t.map(r=>({...r,label:r.label[0]==n?r.label:n+r.label+e,apply:void 0}))}const RB=/^\w*$/,TB=/^[`'"\[]?\w*[`'"\]]?$/;function A2(n){return n.self&&typeof n.self.label=="string"}class Xy{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),r=t[e];return r||(e&&!this.list.some(i=>i.label==e)&&this.list.push(P2(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new Xy(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(r=>r.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"?P2(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):A2(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let r=e[t],i=null,s=t.replace(/\\?\./g,a=>a=="."?"\0":a).split("\0"),o=this;A2(r)&&(i=r.self,r=r.children);for(let a=0;a<s.length;a++)i&&a==s.length-1&&o.addCompletion(i),o=o.child(s[a].replace(/\\\./g,"."));o.addNamespace(r)}}}function P2(n,e,t,r){return new RegExp("^[a-z_][a-z_\\d]*$",r?"i":"").test(n)?{label:n,type:e}:{label:n,type:e,apply:t+n+pR(t)}}function pR(n){return n==="["?"]":n}function OB(n,e,t,r,i,s){var o;let a=((o=s==null?void 0:s.spec.identifierQuotes)===null||o===void 0?void 0:o[0])||'"',u=new Xy(a,!!(s!=null&&s.spec.caseInsensitiveIdentifiers)),f=i?u.child(i):null;return u.addNamespace(n),e&&(f||u).addCompletions(e),t&&u.addCompletions(t),f&&u.addCompletions(f.list),r&&u.addCompletions((f||u).child(r).list),d=>{let{parents:p,from:g,quoted:y,empty:v,aliases:w}=SB(d.state,d.pos);if(v&&!d.explicit)return null;w&&p.length==1&&(p=w[p[0]]||p);let S=u;for(let R of p){for(;!S.children||!S.children[R];)if(S==u&&f)S=f;else if(S==f&&r)S=S.child(r);else return null;let T=S.maybeChild(R);if(!T)return null;S=T}let C=S.list;if(S==u&&w&&(C=C.concat(Object.keys(w).map(R=>({label:R,type:"constant"})))),y){let R=y[0],T=pR(R),M=d.state.sliceDoc(d.pos,d.pos+1)==T;return{from:g,to:M?d.pos+1:void 0,options:EB(R,T,C),validFor:TB}}else return{from:g,options:C,validFor:RB}}}function MB(n){return n==uR?"type":n==cR?"keyword":"variable"}function AB(n,e,t){let r=Object.keys(n).map(i=>t(e?i.toUpperCase():i,MB(n[i])));return u9(["QuotedIdentifier","String","LineComment","BlockComment","."],eR(r))}let PB=wB.configure({props:[_E.add({Statement:x6()}),VE.add({Statement(n,e){return{from:Math.min(n.from+100,e.doc.lineAt(n.from).to),to:n.to}},BlockComment(n){return{from:n.from+2,to:n.to-2}}}),LE({Keyword:ge.keyword,Type:ge.typeName,Builtin:ge.standard(ge.name),Bits:ge.number,Bytes:ge.string,Bool:ge.bool,Null:ge.null,Number:ge.number,String:ge.string,Identifier:ge.name,QuotedIdentifier:ge.special(ge.string),SpecialVar:ge.special(ge.name),LineComment:ge.lineComment,BlockComment:ge.blockComment,Operator:ge.operator,"Semi Punctuation":ge.punctuation,"( )":ge.paren,"{ }":ge.brace,"[ ]":ge.squareBracket})]});class Nd{constructor(e,t,r){this.dialect=e,this.language=t,this.spec=r}get extension(){return this.language.extension}configureLanguage(e,t){return new Nd(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=xB(e,e.keywords,e.types,e.builtin),r=kd.define({name:"sql",parser:PB.configure({tokenizers:[{from:hR,to:dR(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new Nd(t,r,e)}}function IB(n,e){return{label:n,type:e,boost:-1}}function DB(n,e=!1,t){return AB(n.dialect.words,e,t||IB)}function NB(n){return n.schema?OB(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||Jy):()=>null}function LB(n){return n.schema?(n.dialect||Jy).language.data.of({autocomplete:NB(n)}):[]}function BB(n={}){let e=n.dialect||Jy;return new u6(e.language,[LB(n),e.language.data.of({autocomplete:DB(e,n.upperCaseKeywords,n.keywordCompletion)})])}const Jy=Nd.define({}),FB=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=ev(n.state,t.from);return r.line?jB(n):r.block?zB(n):!1};function Zy(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const jB=Zy(HB,0),_B=Zy(mR,0),zB=Zy((n,e)=>mR(n,e,WB(e)),0);function ev(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const La=50;function VB(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-La,r),o=n.sliceDoc(i,i+La),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(o)[0].length,f=s.length-a;if(s.slice(f-e.length,f)==e&&o.slice(u,u+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+u,margin:u&&1}};let d,p;i-r<=2*La?d=p=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+La),p=n.sliceDoc(i-La,i));let g=/^\s*/.exec(d)[0].length,y=/\s*$/.exec(p)[0].length,v=p.length-y-t.length;return d.slice(g,g+e.length)==e&&p.slice(v,v+t.length)==t?{open:{pos:r+g+e.length,margin:/\s/.test(d.charAt(g+e.length))?1:0},close:{pos:i-y-t.length,margin:/\s/.test(p.charAt(v-1))?1:0}}:null}function WB(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function mR(n,e,t=e.selection.ranges){let r=t.map(s=>ev(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>VB(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let u=r[o],{open:f,close:d}=a;s.push({from:f.pos-u.open.length,to:f.pos+f.margin},{from:d.pos-d.margin,to:d.pos+u.close.length})}return{changes:s}}return null}function HB(n,e,t=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of t){let a=r.length,u=1e9,f;for(let d=s;d<=o;){let p=e.doc.lineAt(d);if(f==null&&(f=ev(e,p.from).line,!f))continue e;if(p.from>i&&(s==o||o>p.from)){i=p.from;let g=/^\s*/.exec(p.text)[0].length,y=g==p.length,v=p.text.slice(g,g+f.length)==f?g:-1;g<p.text.length&&g<u&&(u=g),r.push({line:p,comment:v,token:f,indent:g,empty:y,single:!1})}d=p.to+1}if(u<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=u);r.length==a+1&&(r[a].single=!0)}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:f,empty:d,single:p}of r)(p||!d)&&s.push({from:a.from+f,insert:u+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:u}of r)if(a>=0){let f=o.from+a,d=f+u.length;o.text[d-o.from]==" "&&d++,s.push({from:f,to:d})}return{changes:s}}return null}const O0=rs.define(),$B=rs.define(),UB=Me.define(),gR=Me.define({combine(n){return Ii(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),yR=Vn.define({create(){return Ti.empty},update(n,e){let t=e.state.facet(gR),r=e.annotation(O0);if(r){let u=cr.fromTransaction(e,r.selection),f=r.side,d=f==0?n.undone:n.done;return u?d=Ld(d,d.length,t.minDepth,u):d=wR(d,e.startState.selection),new Ti(f==0?r.rest:d,f==0?d:r.rest)}let i=e.annotation($B);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(gn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=cr.fromTransaction(e),o=e.annotation(gn.time),a=e.annotation(gn.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Ti(n.done.map(cr.fromJSON),n.undone.map(cr.fromJSON))}});function qB(n={}){return[yR,gR.of(n),Oe.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?vR:e.inputType=="historyRedo"?M0:null;return r?(e.preventDefault(),r(t)):!1}})]}function Ch(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(yR,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const vR=Ch(0,!1),M0=Ch(1,!1),KB=Ch(0,!0),YB=Ch(1,!0);class cr{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new cr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new cr(e.changes&&pn.fromJSON(e.changes),[],e.mapped&&Mi.fromJSON(e.mapped),e.startSelection&&ue.fromJSON(e.startSelection),e.selectionsAfter.map(ue.fromJSON))}static fromTransaction(e,t){let r=_r;for(let i of e.startState.facet(UB)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new cr(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,_r)}static selection(e){return new cr(void 0,_r,void 0,void 0,e)}}function Ld(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function GB(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let u=0;u<t.length;){let f=t[u++],d=t[u++];a>=f&&o<=d&&(r=!0)}}),r}function QB(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function xR(n,e){return n.length?e.length?n.concat(e):n:e}const _r=[],XB=200;function wR(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-XB));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),Ld(n,n.length-1,1e9,t.setSelAfter(r)))}else return[cr.selection([e])]}function JB(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function gg(n,e){if(!n.length)return n;let t=n.length,r=_r;for(;t;){let i=ZB(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[cr.selection(r)]:_r}function ZB(n,e,t){let r=xR(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):_r,t);if(!n.changes)return cr.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new cr(i,lt.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const e7=/^(input\.type|delete)($|\.)/;class Ti{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Ti(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||e7.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,GB(a.changes,e.changes))||r=="input.type.compose")?o=Ld(o,o.length-1,i.minDepth,new cr(e.changes.compose(a.changes),xR(lt.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,_r)):o=Ld(o,o.length,i.minDepth,e),new Ti(o,_r,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:_r;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&QB(s[s.length-1],e)?this:new Ti(wR(this.done,e),this.undone,t,r)}addMapping(e){return new Ti(gg(this.done,e),gg(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):t.selection);if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:O0.of({side:e,rest:JB(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?_r:i.slice(0,i.length-1);return s.mapped&&(a=gg(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:O0.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ti.empty=new Ti(_r,_r);const t7=[{key:"Mod-z",run:vR,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:M0,preventDefault:!0},{linux:"Ctrl-Shift-z",run:M0,preventDefault:!0},{key:"Mod-u",run:KB,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:YB,preventDefault:!0}];function Hl(n,e){return ue.create(n.ranges.map(e),n.mainIndex)}function ci(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ui({state:n,dispatch:e},t){let r=Hl(n.selection,t);return r.eq(n.selection,!0)?!1:(e(ci(n,r)),!0)}function Eh(n,e){return ue.cursor(e?n.to:n.from)}function bR(n,e){return ui(n,t=>t.empty?n.moveByChar(t,e):Eh(t,e))}function Wn(n){return n.textDirectionAt(n.state.selection.main.head)==At.LTR}const SR=n=>bR(n,!Wn(n)),kR=n=>bR(n,Wn(n));function CR(n,e){return ui(n,t=>t.empty?n.moveByGroup(t,e):Eh(t,e))}const n7=n=>CR(n,!Wn(n)),r7=n=>CR(n,Wn(n));function i7(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Rh(n,e,t){let r=kn(n).resolveInner(e.head),i=t?dt.closedBy:dt.openedBy;for(let u=e.head;;){let f=t?r.childAfter(u):r.childBefore(u);if(!f)break;i7(n,f,i)?r=f:u=t?f.to:f.from}let s=r.type.prop(i),o,a;return s&&(o=t?Ri(n,r.from,1):Ri(n,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,ue.cursor(a,t?-1:1)}const s7=n=>ui(n,e=>Rh(n.state,e,!Wn(n))),o7=n=>ui(n,e=>Rh(n.state,e,Wn(n)));function ER(n,e){return ui(n,t=>{if(!t.empty)return Eh(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const RR=n=>ER(n,!1),TR=n=>ER(n,!0);function OR(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(Oe.scrollMargins)){let o=s(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function MR(n,e){let t=OR(n),{state:r}=n,i=Hl(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):Eh(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),u=a.top+t.marginTop,f=a.bottom-t.marginBottom;o&&o.top>u&&o.bottom<f&&(s=Oe.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-u}))}return n.dispatch(ci(r,i),{effects:s}),!0}const I2=n=>MR(n,!1),A0=n=>MR(n,!0);function Ys(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=ue.cursor(r.from+s))}return i}const l7=n=>ui(n,e=>Ys(n,e,!0)),a7=n=>ui(n,e=>Ys(n,e,!1)),c7=n=>ui(n,e=>Ys(n,e,!Wn(n))),u7=n=>ui(n,e=>Ys(n,e,Wn(n))),f7=n=>ui(n,e=>ue.cursor(n.lineBlockAt(e.head).from,1)),d7=n=>ui(n,e=>ue.cursor(n.lineBlockAt(e.head).to,-1));function h7(n,e,t){let r=!1,i=Hl(n.selection,s=>{let o=Ri(n,s.head,-1)||Ri(n,s.head,1)||s.head>0&&Ri(n,s.head-1,1)||s.head<n.doc.length&&Ri(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return ue.cursor(a)});return r?(e(ci(n,i)),!0):!1}const p7=({state:n,dispatch:e})=>h7(n,e);function $r(n,e){let t=Hl(n.state.selection,r=>{let i=e(r);return ue.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return t.eq(n.state.selection)?!1:(n.dispatch(ci(n.state,t)),!0)}function AR(n,e){return $r(n,t=>n.moveByChar(t,e))}const PR=n=>AR(n,!Wn(n)),IR=n=>AR(n,Wn(n));function DR(n,e){return $r(n,t=>n.moveByGroup(t,e))}const m7=n=>DR(n,!Wn(n)),g7=n=>DR(n,Wn(n)),y7=n=>$r(n,e=>Rh(n.state,e,!Wn(n))),v7=n=>$r(n,e=>Rh(n.state,e,Wn(n)));function NR(n,e){return $r(n,t=>n.moveVertically(t,e))}const LR=n=>NR(n,!1),BR=n=>NR(n,!0);function FR(n,e){return $r(n,t=>n.moveVertically(t,e,OR(n).height))}const D2=n=>FR(n,!1),N2=n=>FR(n,!0),x7=n=>$r(n,e=>Ys(n,e,!0)),w7=n=>$r(n,e=>Ys(n,e,!1)),b7=n=>$r(n,e=>Ys(n,e,!Wn(n))),S7=n=>$r(n,e=>Ys(n,e,Wn(n))),k7=n=>$r(n,e=>ue.cursor(n.lineBlockAt(e.head).from)),C7=n=>$r(n,e=>ue.cursor(n.lineBlockAt(e.head).to)),L2=({state:n,dispatch:e})=>(e(ci(n,{anchor:0})),!0),B2=({state:n,dispatch:e})=>(e(ci(n,{anchor:n.doc.length})),!0),F2=({state:n,dispatch:e})=>(e(ci(n,{anchor:n.selection.main.anchor,head:0})),!0),j2=({state:n,dispatch:e})=>(e(ci(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),E7=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),R7=({state:n,dispatch:e})=>{let t=Th(n).map(({from:r,to:i})=>ue.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:ue.create(t),userEvent:"select"})),!0},T7=({state:n,dispatch:e})=>{let t=Hl(n.selection,r=>{let i=kn(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return ue.range(a.to,a.from)}return r});return t.eq(n.selection)?!1:(e(ci(n,t)),!0)};function jR(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let a=s;;){let u=n.moveVertically(a,e);if(u.head<o.from||u.head>o.to){i.some(f=>f.head==u.head)||i.push(u);break}else{if(u.head==a.head)break;a=u}}}return i.length==r.ranges.length?!1:(n.dispatch(ci(t,ue.create(i,i.length-1))),!0)}const O7=n=>jR(n,!1),M7=n=>jR(n,!0),A7=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=ue.create([t.main]):t.main.empty||(r=ue.create([ue.cursor(t.main.head)])),r?(e(ci(n,r)),!0):!1};function _c(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let u=e(s);u<o?(t="delete.backward",u=Rf(n,u,!1)):u>o&&(t="delete.forward",u=Rf(n,u,!0)),o=Math.min(o,u),a=Math.max(a,u)}else o=Rf(n,o,!1),a=Rf(n,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:ue.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?Oe.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Rf(n,e,t){if(n instanceof Oe)for(let r of n.state.facet(Oe.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const _R=(n,e,t)=>_c(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),a,u;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let f=Wl(a,s.tabSize),d=f%Ed(s)||Ed(s);for(let p=0;p<d&&a[a.length-1-p]==" ";p++)i--;u=i}else u=Sn(o.text,i-o.from,e,e)+o.from,u==i&&o.number!=(e?s.doc.lines:1)?u+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(u-o.from,i-o.from))&&(u=Sn(o.text,u-o.from,!1,!1)+o.from);return u}),P0=n=>_R(n,!1,!0),zR=n=>_R(n,!0,!1),VR=(n,e)=>_c(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let u=Sn(s.text,r-s.from,e)+s.from,f=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),d=o(f);if(a!=null&&d!=a)break;(f!=" "||r!=t.head)&&(a=d),r=u}return r}),WR=n=>VR(n,!1),P7=n=>VR(n,!0),I7=n=>_c(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),D7=n=>_c(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),N7=n=>_c(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),L7=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:xt.of(["",""])},range:ue.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},B7=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:Sn(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Sn(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:ue.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Th(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function HR(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Th(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let u of s.ranges)i.push(ue.range(Math.min(n.doc.length,u.anchor+a),Math.min(n.doc.length,u.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let u of s.ranges)i.push(ue.range(u.anchor-a,u.head-a))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:ue.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const F7=({state:n,dispatch:e})=>HR(n,e,!1),j7=({state:n,dispatch:e})=>HR(n,e,!0);function $R(n,e,t){if(n.readOnly)return!1;let r=[];for(let s of Th(n))t?r.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):r.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let i=n.changes(r);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const _7=({state:n,dispatch:e})=>$R(n,e,!1),z7=({state:n,dispatch:e})=>$R(n,e,!0),V7=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Th(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Hl(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function W7(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=kn(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(dt.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const _2=UR(!1),H7=UR(!0);function UR(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),u=!n&&s==o&&W7(e,s);n&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let f=new wh(e,{simulateBreak:s,simulateDoubleBreak:!!u}),d=Uy(f,s);for(d==null&&(d=Wl(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;u?{from:s,to:o}=u:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let p=["",bc(e,d)];return u&&p.push(bc(e,f.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:xt.of(p)},range:ue.cursor(s+1+p[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function tv(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=n.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,i,r),t=a.number),o=a.to+1}let s=n.changes(i);return{changes:i,range:ue.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const $7=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new wh(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=tv(n,(s,o,a)=>{let u=Uy(r,s.from);if(u==null)return;/\S/.test(s.text)||(u=0);let f=/^\s*/.exec(s.text)[0],d=bc(n,u);(f!=d||a.from<s.from+f.length)&&(t[s.from]=u,o.push({from:s.from,to:s.from+f.length,insert:d}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},U7=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(tv(n,(t,r)=>{r.push({from:t.from,insert:n.facet($y)})}),{userEvent:"input.indent"})),!0),q7=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(tv(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Wl(i,n.tabSize),o=0,a=bc(n,Math.max(0,s-Ed(n)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),K7=n=>(n.setTabFocusMode(),!0),Y7=[{key:"Ctrl-b",run:SR,shift:PR,preventDefault:!0},{key:"Ctrl-f",run:kR,shift:IR},{key:"Ctrl-p",run:RR,shift:LR},{key:"Ctrl-n",run:TR,shift:BR},{key:"Ctrl-a",run:f7,shift:k7},{key:"Ctrl-e",run:d7,shift:C7},{key:"Ctrl-d",run:zR},{key:"Ctrl-h",run:P0},{key:"Ctrl-k",run:I7},{key:"Ctrl-Alt-h",run:WR},{key:"Ctrl-o",run:L7},{key:"Ctrl-t",run:B7},{key:"Ctrl-v",run:A0}],G7=[{key:"ArrowLeft",run:SR,shift:PR,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:n7,shift:m7,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:c7,shift:b7,preventDefault:!0},{key:"ArrowRight",run:kR,shift:IR,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:r7,shift:g7,preventDefault:!0},{mac:"Cmd-ArrowRight",run:u7,shift:S7,preventDefault:!0},{key:"ArrowUp",run:RR,shift:LR,preventDefault:!0},{mac:"Cmd-ArrowUp",run:L2,shift:F2},{mac:"Ctrl-ArrowUp",run:I2,shift:D2},{key:"ArrowDown",run:TR,shift:BR,preventDefault:!0},{mac:"Cmd-ArrowDown",run:B2,shift:j2},{mac:"Ctrl-ArrowDown",run:A0,shift:N2},{key:"PageUp",run:I2,shift:D2},{key:"PageDown",run:A0,shift:N2},{key:"Home",run:a7,shift:w7,preventDefault:!0},{key:"Mod-Home",run:L2,shift:F2},{key:"End",run:l7,shift:x7,preventDefault:!0},{key:"Mod-End",run:B2,shift:j2},{key:"Enter",run:_2,shift:_2},{key:"Mod-a",run:E7},{key:"Backspace",run:P0,shift:P0,preventDefault:!0},{key:"Delete",run:zR,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:WR,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:P7,preventDefault:!0},{mac:"Mod-Backspace",run:D7,preventDefault:!0},{mac:"Mod-Delete",run:N7,preventDefault:!0}].concat(Y7.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),qR=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:s7,shift:y7},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:o7,shift:v7},{key:"Alt-ArrowUp",run:F7},{key:"Shift-Alt-ArrowUp",run:_7},{key:"Alt-ArrowDown",run:j7},{key:"Shift-Alt-ArrowDown",run:z7},{key:"Mod-Alt-ArrowUp",run:O7},{key:"Mod-Alt-ArrowDown",run:M7},{key:"Escape",run:A7},{key:"Mod-Enter",run:H7},{key:"Alt-l",mac:"Ctrl-l",run:R7},{key:"Mod-i",run:T7,preventDefault:!0},{key:"Mod-[",run:q7},{key:"Mod-]",run:U7},{key:"Mod-Alt-\\",run:$7},{key:"Shift-Mod-k",run:V7},{key:"Shift-Mod-\\",run:p7},{key:"Mod-/",run:FB},{key:"Alt-A",run:_B},{key:"Ctrl-m",mac:"Shift-Alt-m",run:K7}].concat(G7),z2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Dl{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(z2(a)):z2,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 sr(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=by(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=ki(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r,a=!0;;s++){let u=i.charCodeAt(s),f=this.match(u,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(f)return this.value=f,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==u?o++:a=!1}}}match(e,t,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let u=this.matches[a],f=!1;this.query.charCodeAt(u.index)==e&&(u.index==this.query.length-1?o={from:u.from,to:i,precise:s&&u.precise}:(u.index++,f=!0)),f?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:r&&s}:this.matches.push({from:t,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Dl.prototype[Symbol.iterator]=function(){return this});const KR={from:-1,to:-1,match:/.*/.exec(""),precise:!0},nv="gm"+(/x/.unicode==null?"":"u");class YR{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=KR,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new GR(e,t,r,i,s);this.re=new RegExp(t,nv+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=Bd(e,i),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 r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=Bd(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,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}}}const yg=new WeakMap;class kl{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=yg.get(e);if(!i||i.from>=r||i.to<=t){let a=new kl(t,e.sliceString(t,r));return yg.set(e,a),a}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),yg.set(e,new kl(o,s)),new kl(t,s.slice(t-o,r-o))}}class GR{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=KR,this.matchPos=Bd(e,i),this.re=new RegExp(t,nv+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=kl.get(e,i,this.chunkEnd(i+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 r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,precise:!0,match:t},this.matchPos=Bd(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=kl.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(YR.prototype[Symbol.iterator]=GR.prototype[Symbol.iterator]=function(){return this});function Q7(n){try{return new RegExp(n,nv),!0}catch{return!1}}function Bd(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}const X7=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:r,result:i}=AL(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){n.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,u,f,d,p]=o,g=d?+d.slice(1):0,y=f?+f:a.number;if(f&&p){let S=y/100;u&&(S=S*(u=="-"?-1:1)+a.number/e.doc.lines),y=Math.round(e.doc.lines*S)}else f&&u&&(y=y*(u=="-"?-1:1)+a.number);let v=e.doc.line(Math.max(1,Math.min(e.doc.lines,y))),w=ue.cursor(v.from+Math.max(0,Math.min(g,v.length)));n.dispatch({effects:[r,Oe.scrollIntoView(w.from,{y:"center"})],selection:w})}),!0},J7={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Z7=Me.define({combine(n){return Ii(n,J7,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function eF(n){return[sF,iF]}const tF=Ge.mark({class:"cm-selectionMatch"}),nF=Ge.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function V2(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=$t.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=$t.Word)}function rF(n,e,t,r){return n(e.sliceDoc(t,t+1))==$t.Word&&n(e.sliceDoc(r-1,r))==$t.Word}const iF=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Z7),{state:t}=n,r=t.selection;if(r.ranges.length>1)return Ge.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Ge.none;let u=t.wordAt(i.head);if(!u)return Ge.none;o=t.charCategorizer(i.head),s=t.sliceDoc(u.from,u.to)}else{let u=i.to-i.from;if(u<e.minSelectionLength||u>200)return Ge.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(V2(o,t,i.from,i.to)&&rF(o,t,i.from,i.to)))return Ge.none}else if(s=t.sliceDoc(i.from,i.to),!s)return Ge.none}let a=[];for(let u of n.visibleRanges){let f=new Dl(t.doc,s,u.from,u.to);for(;!f.next().done;){let{from:d,to:p}=f.value;if((!o||V2(o,t,d,p))&&(i.empty&&d<=i.from&&p>=i.to?a.push(nF.range(d,p)):(d>=i.to||p<=i.from)&&a.push(tF.range(d,p)),a.length>e.maxMatches))return Ge.none}}return Ge.set(a)}},{decorations:n=>n.decorations}),sF=Oe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),oF=({state:n,dispatch:e})=>{let{selection:t}=n,r=ue.create(t.ranges.map(i=>n.wordAt(i.head)||ue.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function lF(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new Dl(n.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Dl(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(u=>u.from==a.value.from))continue;if(s){let u=n.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}const aF=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return oF({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=lF(n,r);return i?(e(n.update({selection:n.selection.addRange(ue.range(i.from,i.to),!1),effects:Oe.scrollIntoView(i.to)})),!0):!1},$l=Me.define({combine(n){return Ii(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new SF(e),scrollToMatch:e=>Oe.scrollIntoView(e)})}});class QR{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||Q7(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,(t,r)=>r=="n"?`
159
+ `:r=="r"?"\r":r=="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 pF(this):new fF(this)}getCursor(e,t=0,r){let i=e.doc?e:yt.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?al(this,i,t,r):ll(this,i,t,r)}}class XR{constructor(e){this.spec=e}}function cF(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function ll(n,e,t,r){let i;return n.wholeWord&&(i=uF(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=cF(n.test,e,i)),new Dl(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function uF(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(Fd(i,t-s))!=$t.Word||e(jd(i,t-s))!=$t.Word)&&(e(jd(i,r-s))!=$t.Word||e(Fd(i,r-s))!=$t.Word))}class fF extends XR{constructor(e){super(e)}nextMatch(e,t,r){let i=ll(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=ll(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=ll(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=ll(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=ll(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function dF(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function al(n,e,t,r){let i;return n.wholeWord&&(i=hF(e.charCategorizer(e.selection.main.head))),n.test&&(i=dF(n.test,e,i)),new YR(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function Fd(n,e){return n.slice(Sn(n,e,!1),e)}function jd(n,e){return n.slice(e,Sn(n,e))}function hF(n){return(e,t,r)=>!r[0].length||(n(Fd(r.input,r.index))!=$t.Word||n(jd(r.input,r.index))!=$t.Word)&&(n(jd(r.input,r.index+r[0].length))!=$t.Word||n(Fd(r.input,r.index+r[0].length))!=$t.Word)}class pF extends XR{nextMatch(e,t,r){let i=al(this.spec,e,r,e.doc.length).next();return i.done&&(i=al(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=al(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=al(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=al(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ec=lt.define(),rv=lt.define(),Ns=Vn.define({create(n){return new vg(I0(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ec)?n=new vg(t.value.create(),n.panel):t.is(rv)&&(n=new vg(n.query,t.value?iv:null));return n},provide:n=>vc.from(n,e=>e.panel)});class vg{constructor(e,t){this.query=e,this.panel=t}}const mF=Ge.mark({class:"cm-searchMatch"}),gF=Ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yF=en.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ns))}update(n){let e=n.state.field(Ns);(e!=n.startState.field(Ns)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Ge.none;let{view:t}=this,r=new es;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:u}=s[i];for(;i<o-1&&u>s[i+1].from-500;)u=s[++i].to;n.highlight(t.state,a,u,(f,d)=>{let p=t.state.selection.ranges.some(g=>g.from==f&&g.to==d);r.add(f,d,p?gF:mF)})}return r.finish()}},{decorations:n=>n.decorations});function zc(n){return e=>{let t=e.state.field(Ns,!1);return t&&t.query.spec.valid?n(e,t):eT(e)}}const _d=zc((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=ue.single(r.from,r.to),s=n.state.facet($l);return n.dispatch({selection:i,effects:[sv(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),ZR(n),!0}),zd=zc((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=ue.single(i.from,i.to),o=n.state.facet($l);return n.dispatch({selection:s,effects:[sv(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),ZR(n),!0}),vF=zc((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:ue.create(t.map(r=>ue.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),xF=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let a=new Dl(n.doc,n.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(ue.range(a.value.from,a.value.to))}return e(n.update({selection:ue.create(s,o),userEvent:"select.search.matches"})),!0},W2=zc((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,a=[],u,f,d=[];o.precise?o.from==r&&o.to==i&&(f=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:f}),d.push(Oe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+"."))):o=e.nextMatch(t,o.from,o.to);let p=n.state.changes(a);return o&&(u=ue.single(o.from,o.to).map(p),d.push(sv(n,o)),d.push(t.facet($l).scrollToMatch(u.main,n))),n.dispatch({changes:p,selection:u,effects:d,userEvent:"input.replace"}),!0}),wF=zc((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let i of e.matchAll(n.state,1e9)){let{from:s,to:o,precise:a}=i;a&&t.push({from:s,to:o,insert:e.getReplacement(i)})}if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Oe.announce.of(r),userEvent:"input.replace.all"}),!0});function iv(n){return n.state.facet($l).createPanel(n)}function I0(n,e){var t,r,i,s,o;let a=n.selection.main,u=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!u)return e;let f=n.facet($l);return new QR({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:f.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:f.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:f.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:f.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:f.wholeWord})}function JR(n){let e=_y(n,iv);return e&&e.dom.querySelector("[main-field]")}function ZR(n){let e=JR(n);e&&e==n.root.activeElement&&e.select()}const eT=n=>{let e=n.state.field(Ns,!1);if(e&&e.panel){let t=JR(n);if(t&&t!=n.root.activeElement){let r=I0(n.state,e.query.spec);r.valid&&n.dispatch({effects:Ec.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[rv.of(!0),e?Ec.of(I0(n.state,e.query.spec)):lt.appendConfig.of(CF)]});return!0},tT=n=>{let e=n.state.field(Ns,!1);if(!e||!e.panel)return!1;let t=_y(n,iv);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:rv.of(!1)}),!0},bF=[{key:"Mod-f",run:eT,scope:"editor search-panel"},{key:"F3",run:_d,shift:zd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:_d,shift:zd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:xF},{key:"Mod-Alt-g",run:X7},{key:"Mod-d",run:aF,preventDefault:!0}];class SF{constructor(e){this.view=e;let t=this.query=e.state.field(Ns).query.spec;this.commit=this.commit.bind(this),this.searchField=Ot("input",{value:t.search,placeholder:wr(e,"Find"),"aria-label":wr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ot("input",{value:t.replace,placeholder:wr(e,"Replace"),"aria-label":wr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ot("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ot("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ot("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return Ot("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Ot("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>_d(e),[wr(e,"next")]),r("prev",()=>zd(e),[wr(e,"previous")]),r("select",()=>vF(e),[wr(e,"all")]),Ot("label",null,[this.caseField,wr(e,"match case")]),Ot("label",null,[this.reField,wr(e,"regexp")]),Ot("label",null,[this.wordField,wr(e,"by word")]),...e.state.readOnly?[]:[Ot("br"),this.replaceField,r("replace",()=>W2(e),[wr(e,"replace")]),r("replaceAll",()=>wF(e),[wr(e,"replace all")])],Ot("button",{name:"close",onclick:()=>tT(e),"aria-label":wr(e,"close"),type:"button"},["×"])])}commit(){let e=new QR({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:Ec.of(e)}))}keydown(e){_8(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?zd:_d)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),W2(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Ec)&&!r.value.eq(this.query)&&this.setQuery(r.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($l).top}}function wr(n,e){return n.state.phrase(e)}const Tf=30,Of=/[\s\.,:;?!]/;function sv(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-Tf),o=Math.min(i,t+Tf),a=n.state.sliceDoc(s,o);if(s!=r.from){for(let u=0;u<Tf;u++)if(!Of.test(a[u+1])&&Of.test(a[u])){a=a.slice(u);break}}if(o!=i){for(let u=a.length-1;u>a.length-Tf;u--)if(!Of.test(a[u-1])&&Of.test(a[u])){a=a.slice(0,u);break}}return Oe.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${r.number}.`)}const kF=Oe.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"}}),CF=[Ns,Ks.low(yF),kF];class H2{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class go{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(Rc).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((y,v)=>y.from-v.from||y.to-v.to),o=new es,a=[],u=0,f=r.doc.iter(),d=0,p=r.doc.length;for(let y=0;;){let v=y==s.length?null:s[y];if(!v&&!a.length)break;let w,S;if(a.length)w=u,S=a.reduce((T,M)=>Math.min(T,M.to),v&&v.from>w?v.from:1e8);else{if(w=v.from,w>p)break;S=v.to,a.push(v),y++}for(;y<s.length;){let T=s[y];if(T.from==w&&(T.to>T.from||T.to==w))a.push(T),y++,S=Math.min(T.to,S);else{S=Math.min(T.from,S);break}}S=Math.min(S,p);let C=!1;if(a.some(T=>T.from==w&&(T.to==S||S==p))&&(C=w==S,!C&&S-w<10)){let T=w-(d+f.value.length);T>0&&(f.next(T),d=w);for(let M=w;;){if(M>=S){C=!0;break}if(!f.lineBreak&&d+f.value.length>M)break;M=d+f.value.length,d+=f.value.length,f.next()}}let R=FF(a);if(C)o.add(w,w,Ge.widget({widget:new DF(R),diagnostics:a.slice()}));else{let T=a.reduce((M,A)=>A.markClass?M+" "+A.markClass:M,"");o.add(w,S,Ge.mark({class:"cm-lintRange cm-lintRange-"+R+T,diagnostics:a.slice(),inclusiveEnd:a.some(M=>M.to>S)}))}if(u=S,u==p)break;for(let T=0;T<a.length;T++)a[T].to<=u&&a.splice(T--,1)}let g=o.finish();return new go(g,t,Hs(g))}}function Hs(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new H2(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new H2(r.from,s,r.diagnostic)}}),r}function EF(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(Rc).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(nT))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function RF(n,e){return n.field(Cr,!1)?e:e.concat(lt.appendConfig.of(jF))}const nT=lt.define(),ov=lt.define(),rT=lt.define(),Cr=Vn.define({create(){return new go(Ge.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=Hs(t,n.selected.diagnostic,s)||Hs(t,null,s)}!t.size&&i&&e.state.facet(Rc).autoPanel&&(i=null),n=new go(t,i,r)}for(let t of e.effects)if(t.is(nT)){let r=e.state.facet(Rc).autoPanel?t.value.length?Tc.open:null:n.panel;n=go.init(t.value,r,e.state)}else t.is(ov)?n=new go(n.diagnostics,t.value?Tc.open:null,n.selected):t.is(rT)&&(n=new go(n.diagnostics,n.panel,t.value));return n},provide:n=>[vc.from(n,e=>e.panel),Oe.decorations.from(n,e=>e.diagnostics)]}),TF=Ge.mark({class:"cm-lintRange cm-lintRange-active"});function OF(n,e,t){let{diagnostics:r}=n.state.field(Cr),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(u,f,{spec:d})=>{if(e>=u&&e<=f&&(u==f||(e>u||t>0)&&(e<f||t<0)))return i=d.diagnostics,s=u,o=f,!1});let a=n.state.facet(Rc).tooltipFilter;return i&&a&&(i=a(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:MF(n,i)}}}:null}function MF(n,e){return Ot("ul",{class:"cm-tooltip-lint"},e.map(t=>sT(n,t,!1)))}const AF=n=>{let e=n.state.field(Cr,!1);(!e||!e.panel)&&n.dispatch({effects:RF(n.state,[ov.of(!0)])});let t=_y(n,Tc.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},$2=n=>{let e=n.state.field(Cr,!1);return!e||!e.panel?!1:(n.dispatch({effects:ov.of(!1)}),!0)},PF=n=>{let e=n.state.field(Cr,!1);if(!e)return!1;let t=n.state.selection.main,r=Hs(e.diagnostics,null,t.to+1);return!r&&(r=Hs(e.diagnostics,null,0),!r||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),OL(n,r.from,1,{tooltip:oT,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},IF=[{key:"Mod-Shift-m",run:AF,preventDefault:!0},{key:"F8",run:PF}],Rc=Me.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Ii(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:U2,tooltipFilter:U2,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,i,s)=>e(r,i,s)||t(r,i,s):e:t,autoPanel:(e,t)=>e||t})}}});function U2(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function iT(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function sT(n,e,t){var r;let i=t?iT(e.actions):[];return Ot("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ot("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,u=y=>{if(y.preventDefault(),a)return;a=!0;let v=Hs(n.state.field(Cr).diagnostics,e);v&&s.apply(n,v.from,v.to)},{name:f}=s,d=i[o]?f.indexOf(i[o]):-1,p=d<0?f:[f.slice(0,d),Ot("u",f.slice(d,d+1)),f.slice(d+1)],g=s.markClass?" "+s.markClass:"";return Ot("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${f}${d<0?"":` (access key "${i[o]})"`}.`},p)}),e.source&&Ot("div",{class:"cm-diagnosticSource"},e.source))}class DF extends Di{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ot("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class q2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=sT(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Tc{constructor(e){this.view=e,this.items=[];let t=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)$2(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=iT(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let u=Hs(this.view.state.field(Cr).diagnostics,s);u&&s.actions[a].apply(e,u.from,u.to)}}else return;i.preventDefault()}},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=Ot("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=Ot("div",{class:"cm-panel-lint"},this.list,Ot("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>$2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Cr).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(Cr),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,u,{spec:f})=>{for(let d of f.diagnostics){if(o.has(d))continue;o.add(d);let p=-1,g;for(let y=r;y<this.items.length;y++)if(this.items[y].diagnostic==d){p=y;break}p<0?(g=new q2(this.view,d),this.items.splice(r,0,g),i=!0):(g=this.items[p],p>r&&(this.items.splice(r,p-r),i=!0)),t&&g.diagnostic==t.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),s=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new q2(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:u})=>{let f=u.height/this.list.offsetHeight;a.top<u.top?this.list.scrollTop-=(u.top-a.top)/f:a.bottom>u.bottom&&(this.list.scrollTop+=(a.bottom-u.bottom)/f)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Cr),r=Hs(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:rT.of(r)})}static open(e){return new Tc(e)}}function NF(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Mf(n){return NF(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const LF=Oe.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:Mf("#f11")},".cm-lintRange-warning":{backgroundImage:Mf("orange")},".cm-lintRange-info":{backgroundImage:Mf("#999")},".cm-lintRange-hint":{backgroundImage:Mf("#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 BF(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function FF(n){let e="hint",t=1;for(let r of n){let i=BF(r.severity);i>t&&(t=i,e=r.severity)}return e}const oT=TL(OF,{hideOn:EF}),jF=[Cr,Oe.decorations.compute([Cr],n=>{let{selected:e,panel:t}=n.field(Cr);return!e||!t||e.from==e.to?Ge.none:Ge.set([TF.range(e.from,e.to)])}),oT,LF],_F=[VL(),$L(),nL(),qB(),N6(),U8(),Q8(),yt.allowMultipleSelections.of(!0),b6(),B6(_6,{fallback:!0}),q6(),B9(),K9(),gL(),xL(),aL(),eF(),yc.of([...z9,...qR,...bF,...t7,...A6,...aR,...IF])],zF=b.forwardRef(function({value:e,onChange:t,onRunShortcut:r,disabled:i=!1,readOnly:s=!1,placeholder:o="Enter SQL statement..."},a){const u=b.useRef(null),f=b.useRef(null),d=b.useRef(r),p=b.useRef(i);return b.useEffect(()=>{d.current=r,p.current=i},[r,i]),b.useImperativeHandle(a,()=>({getSelectedSql:()=>{const g=f.current;if(!g)return"";const{from:y,to:v}=g.state.selection.main;return y!==v?g.state.sliceDoc(y,v):g.state.doc.toString()}}),[]),b.useEffect(()=>{if(!u.current)return;const g=Ks.highest(yc.of([{key:"Mod-Enter",run:()=>(!p.current&&d.current&&d.current(),!0)}])),y=[_F,BB(),yc.of(qR),dL(o),g,Oe.theme({"&":{fontSize:"14px",fontFamily:"ui-monospace, monospace"},".cm-content":{padding:"12px",minHeight:"120px"},".cm-focused":{outline:"none"},".cm-scroller":{overflow:"auto"}})];s?(y.push(yt.readOnly.of(!0)),y.push(Oe.editable.of(!1))):t&&y.push(Oe.updateListener.of(S=>{S.docChanged&&t(S.state.doc.toString())}));const v=yt.create({doc:e,extensions:y}),w=new Oe({state:v,parent:u.current});return f.current=w,()=>{w.destroy(),f.current=null}},[s,o,t]),b.useEffect(()=>{const g=f.current;if(!g)return;const y=g.state.doc.toString();y!==e&&g.dispatch({changes:{from:0,to:y.length,insert:e}})},[e]),E.jsx("div",{ref:u,className:"border border-border rounded-lg bg-background overflow-hidden"})});let K2=(function(n){return n.disabled="data-disabled",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const VF={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Wa={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},WF={disabled:!1,...Wa},Oh={valid(n){return n===null?null:n?{[K2.valid]:""}:{[K2.invalid]:""}}},HF={invalid:void 0,name:void 0,validityData:{state:VF,errors:[],error:"",value:"",initialValue:null},setValidityData:Ht,disabled:void 0,touched:Wa.touched,setTouched:Ht,dirty:Wa.dirty,setDirty:Ht,filled:Wa.filled,setFilled:Ht,focused:Wa.focused,setFocused:Ht,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:WF,markedDirtyRef:{current:!1},registerFieldControl:Ht,validation:{getValidationProps:(n=un)=>n,getInputValidationProps:(n=un)=>n,inputRef:{current:null},commit:async()=>{}}},$F=b.createContext(HF);function Vc(n=!0){const e=b.useContext($F);if(e.setValidityData===Ht&&!n)throw new Error(Pn(28));return e}const UF=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ht,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function lT(){return b.useContext(UF)}const qF=b.createContext({controlId:void 0,registerControlId:Ht,labelId:void 0,setLabelId:Ht,messageIds:[],setMessageIds:Ht,getDescriptionProps:n=>n});function Mh(){return b.useContext(qF)}function KF(n,e,t,r=!0,i){const[s,o]=b.useState(),a=cc(i?`${i}-label`:void 0),u=n??e??s;return Se(()=>{const f=n||e||!r?void 0:YF(t.current,a);s!==f&&o(f)}),u}function YF(n,e){const t=GF(n);if(t)return!t.id&&e&&(t.id=e),t.id||void 0}function GF(n){if(!n)return;const e=n.parentElement;if(e&&e.tagName==="LABEL")return e;const t=n.id;if(t){const i=n.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=n.labels;return r&&r[0]}function lv(n={}){const{id:e,implicit:t=!1,controlRef:r}=n,{controlId:i,registerControlId:s}=Mh(),o=cc(e),a=t?i:void 0,u=Xn(()=>Symbol("labelable-control")),f=b.useRef(!1),d=b.useRef(e!=null),p=Fe(()=>{!f.current||s===Ht||(f.current=!1,s(u.current,void 0))});return Se(()=>{if(s===Ht)return;let g;if(t){const y=r==null?void 0:r.current;ut(y)&&y.closest("label")!=null?g=e??null:g=a??o}else if(e!=null)d.current=!0,g=e;else if(d.current)g=o;else{p();return}if(g===void 0){p();return}f.current=!0,s(u.current,g)},[e,r,a,s,t,o,u,p]),b.useEffect(()=>p,[p]),i??o}function Vd({controlled:n,default:e,name:t,state:r="value"}){const{current:i}=b.useRef(n!==void 0),[s,o]=b.useState(e),a=i?n:s,u=b.useCallback(f=>{i||o(f)},[]);return[a,u]}function av(n,e,t,r,i=!0){const{registerFieldControl:s}=Vc(),o=b.useRef(null);o.current||(o.current=Symbol()),Se(()=>{const a=o.current;return!a||!i?void 0:(s(a,{controlRef:n,getValue:r,id:e,value:t}),()=>{s(a,void 0)})},[n,i,r,e,s,t])}const QF=b.forwardRef(function(e,t){const{render:r,className:i,id:s,name:o,value:a,disabled:u=!1,onValueChange:f,defaultValue:d,autoFocus:p=!1,style:g,...y}=e,{state:v,name:w,disabled:S,setTouched:C,setDirty:R,validityData:T,setFocused:M,setFilled:A,validationMode:D,validation:P}=Vc(),z=S||u,H=w??o,$={...v,disabled:z},{labelId:Z}=Mh(),j=lv({id:s});Se(()=>{var F;const W=a!=null;(F=P.inputRef.current)!=null&&F.value||W&&a!==""?A(!0):W&&a===""&&A(!1)},[P.inputRef,A,a]);const B=b.useRef(null);Se(()=>{p&&B.current===cn(ot(B.current))&&M(!0)},[p,M]);const[X]=Vd({controlled:a,default:d,name:"FieldControl",state:"value"}),_=a!==void 0,ne=_?X:void 0,G=Fe(()=>{var W;return(W=P.inputRef.current)==null?void 0:W.value});return av(P.inputRef,j,ne,G),qt("input",e,{ref:[t,B],state:$,props:[{id:j,disabled:z,name:H,ref:P.inputRef,"aria-labelledby":Z,autoFocus:p,..._?{value:ne}:{defaultValue:d},onChange(W){const F=W.currentTarget.value;f==null||f(F,gt(Do,W.nativeEvent)),R(F!==T.initialValue),A(F!=="")},onFocus(){M(!0)},onBlur(W){C(!0),M(!1),D==="onBlur"&&P.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(C(!0),P.commit(W.currentTarget.value))}},P.getInputValidationProps(),y],stateAttributesMapping:Oh})}),XF=b.createContext({disabled:!1});function JF(){return b.useContext(XF)}const ZF=b.createContext(void 0);function ej(n=!0){const e=b.useContext(ZF);if(e===void 0&&!n)throw new Error(Pn(3));return e}const tj=b.forwardRef(function(e,t){return E.jsx(QF,{ref:t,...e})});function bo({className:n,size:e="default",unstyled:t=!1,...r}){return E.jsx("span",{className:yn(!t&&"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]",n)||void 0,"data-size":e,"data-slot":"input-control",children:E.jsx(tj,{className:yn("h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",e==="sm"&&"h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5",e==="lg"&&"h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5",r.type==="search"&&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",r.type==="file"&&"text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"),"data-slot":"input",size:typeof e=="number"?e:void 0,...r})})}function nj(n){if(!n)return null;for(const e of n.elements){const t=e.tagName;if(t==="BUTTON"||t==="INPUT"){const r=e;if(r.type==="submit")return r}}return null}let Y2=(function(n){return n.checked="data-checked",n.unchecked="data-unchecked",n.indeterminate="data-indeterminate",n.disabled="data-disabled",n.readonly="data-readonly",n.required="data-required",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});function aT(n){return b.useMemo(()=>({checked(e){return n.indeterminate?{}:e?{[Y2.checked]:""}:{[Y2.unchecked]:""}},...Oh}),[n.indeterminate])}const rj=b.createContext(void 0);function ij(n=!1){const e=b.useContext(rj);if(e===void 0&&!n)throw new Error(Pn(16));return e}function sj(n){const{focusableWhenDisabled:e,disabled:t,composite:r=!1,tabIndex:i=0,isNativeButton:s}=n,o=r&&e!==!1,a=r&&e===!1;return{props:b.useMemo(()=>{const f={onKeyDown(d){t&&e&&d.key!=="Tab"&&d.preventDefault()}};return r||(f.tabIndex=i,!s&&t&&(f.tabIndex=e?i:-1)),(s&&(e||o)||!s&&t)&&(f["aria-disabled"]=t),s&&(!e||a)&&(f.disabled=t),f},[r,t,e,o,a,s,i])}}function Ah(n={}){const{disabled:e=!1,focusableWhenDisabled:t,tabIndex:r=0,native:i=!0,composite:s}=n,o=b.useRef(null),a=ij(!0),u=s??a!==void 0,{props:f}=sj({focusableWhenDisabled:t,disabled:e,composite:u,tabIndex:r,isNativeButton:i}),d=b.useCallback(()=>{const y=o.current;xg(y)&&u&&e&&f.disabled===void 0&&y.disabled&&(y.disabled=!1)},[e,f.disabled,u]);Se(d,[d]);const p=b.useCallback((y={})=>{const{onClick:v,onMouseDown:w,onKeyUp:S,onKeyDown:C,onPointerDown:R,...T}=y;return li({onClick(M){if(e){M.preventDefault();return}v==null||v(M)},onMouseDown(M){e||w==null||w(M)},onKeyDown(M){if(e||(sd(M),C==null||C(M),M.baseUIHandlerPrevented))return;const A=M.target===M.currentTarget,D=M.currentTarget,P=xg(D),z=!i&&oj(D),H=A&&(i?P:!z),$=M.key==="Enter",Z=M.key===" ",j=D.getAttribute("role"),B=(j==null?void 0:j.startsWith("menuitem"))||j==="option"||j==="gridcell";if(A&&u&&Z){if(M.defaultPrevented&&B)return;M.preventDefault(),z||i&&P?(D.click(),M.preventBaseUIHandler()):H&&(v==null||v(M),M.preventBaseUIHandler());return}H&&(!i&&(Z||$)&&M.preventDefault(),!i&&$&&(v==null||v(M)))},onKeyUp(M){if(!e){if(sd(M),S==null||S(M),M.target===M.currentTarget&&i&&u&&xg(M.currentTarget)&&M.key===" "){M.preventDefault();return}M.baseUIHandlerPrevented||M.target===M.currentTarget&&!i&&!u&&M.key===" "&&(v==null||v(M))}},onPointerDown(M){if(e){M.preventDefault();return}R==null||R(M)}},i?{type:"button"}:{role:"button"},f,T)},[e,f,u,i]),g=Fe(y=>{o.current=y,d()});return{getButtonProps:p,buttonRef:g}}function xg(n){return Bt(n)&&n.tagName==="BUTTON"}function oj(n){return!!((n==null?void 0:n.tagName)==="A"&&(n!=null&&n.href))}const cT=b.createContext(void 0);function lj(){const n=b.useContext(cT);if(n===void 0)throw new Error(Pn(14));return n}function cv(n,e){const t=b.useRef(n),r=Fe(e);Se(()=>{t.current!==n&&r(t.current)},[n,r]),Se(()=>{t.current=n},[n])}const aj="data-parent",cj=b.forwardRef(function(e,t){const{checked:r,className:i,defaultChecked:s=!1,"aria-labelledby":o,disabled:a=!1,form:u,id:f,indeterminate:d=!1,inputRef:p,name:g,onCheckedChange:y,parent:v=!1,readOnly:w=!1,render:S,required:C=!1,uncheckedValue:R,value:T,nativeButton:M=!1,style:A,...D}=e,{clearErrors:P}=lT(),{disabled:z,name:H,setDirty:$,setFilled:Z,setFocused:j,setTouched:B,state:X,validationMode:_,validityData:ne,shouldValidateOnChange:G,validation:N}=Vc(),W=JF(),{labelId:F,controlId:I,registerControlId:U,getDescriptionProps:q}=Mh(),Q=ej(),oe=Q==null?void 0:Q.parent,ie=oe&&Q.allValues,de=z||W.disabled||(Q==null?void 0:Q.disabled)||a,J=H??g,ae=T??J,pe=cc(),Re=cc();let ce=I;ie?ce=v?Re:`${oe.id}-${ae}`:f&&(ce=f);let ye={};ie&&(v?ye=Q.parent.getParentProps():ae&&(ye=Q.parent.getChildProps(ae)));const{checked:be=r,indeterminate:je=d,onCheckedChange:Ne,...ke}=ye,Ie=Q==null?void 0:Q.value,Ce=Q==null?void 0:Q.setValue,Ke=Q==null?void 0:Q.defaultValue,He=b.useRef(null),Je=Xn(()=>Symbol("checkbox-control")),$e=b.useRef(!1),{getButtonProps:we,buttonRef:Y}=Ah({disabled:de,native:M}),se=(Q==null?void 0:Q.validation)??N,[le,ve]=Vd({controlled:ae&&Ie&&!v?Ie.includes(ae):be,default:ae&&Ke&&!v?Ke.includes(ae):s,name:"Checkbox",state:"checked"});Se(()=>{U!==Ht&&($e.current=!0,U(Je.current,ce))},[ce,U,Je]),b.useEffect(()=>{const et=Je.current;return()=>{!$e.current||U===Ht||($e.current=!1,U(et,void 0))}},[U,Je]),av(He,pe,le,void 0,!Q);const Le=b.useRef(null),Ve=To(p,Le,se.inputRef),Ue=KF(o,F,Le,!M,ce??void 0);Se(()=>{Le.current&&(Le.current.indeterminate=je,le&&Z(!0))},[le,je,Z]),cv(le,()=>{Q&&!v||(P(J),Z(le),$(le!==ne.initialValue),G()?se.commit(le):se.commit(le,!0))});const it=li({checked:le,disabled:de,form:u,name:v?void 0:J,id:M?void 0:ce??void 0,required:C,ref:Ve,style:J?XS:rh,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(et){if(et.nativeEvent.defaultPrevented)return;if(w){et.preventDefault();return}const kt=et.currentTarget.checked,St=gt(Do,et.nativeEvent);if(Ne==null||Ne(kt,St),y==null||y(kt,St),!St.isCanceled&&(ve(kt),ae&&Ie&&Ce&&!v&&!ie)){const qe=kt?[...Ie,ae]:Ie.filter(at=>at!==ae);Ce(qe,St)}},onFocus(){var et;(et=He.current)==null||et.focus()}},T!==void 0?{value:(Q?le&&T:T)||""}:un,q,Q?se.getValidationProps:se.getInputValidationProps),ht=ie?!!be:le,st=ie&&je||d;b.useEffect(()=>{if(!oe||!ae)return;const et=oe.disabledStatesRef.current;return et.set(ae,de),()=>{et.delete(ae)}},[oe,de,ae]);const Pt=b.useMemo(()=>({...X,checked:ht,disabled:de,readOnly:w,required:C,indeterminate:st}),[X,ht,de,w,C,st]),zt=aT(Pt),It=qt("span",e,{state:Pt,ref:[Y,He,t,Q==null?void 0:Q.registerControlRef],props:[{id:M?ce??void 0:pe,role:"checkbox","aria-checked":je?"mixed":le,"aria-readonly":w||void 0,"aria-required":C||void 0,"aria-labelledby":Ue,[aj]:v?"":void 0,onFocus(){j(!0)},onBlur(){const et=Le.current;et&&(B(!0),j(!1),_==="onBlur"&&se.commit(Q?Ie:et.checked))},onKeyDown(et){var Kt;if(et.key!=="Enter"||(et.preventBaseUIHandler(),et.defaultPrevented))return;const kt=((Kt=Le.current)==null?void 0:Kt.form)??null,St=et.currentTarget,qe=et.nativeEvent,at=et.preventDefault,Vt=qe.preventDefault;let wt=!1;et.preventDefault=()=>{wt=!0,at.call(et)},qe.preventDefault=()=>{wt=!0,Vt.call(qe)},Vt.call(qe),Et(St).queueMicrotask(()=>{var Dt;et.preventDefault=at,qe.preventDefault=Vt,wt||(Dt=nj(kt))==null||Dt.click()})},onClick(et){if(w||de)return;et.preventDefault();const kt=Le.current;kt&&kt.dispatchEvent(new(Et(kt)).PointerEvent("click",{bubbles:!0,shiftKey:et.shiftKey,ctrlKey:et.ctrlKey,altKey:et.altKey,metaKey:et.metaKey}))}},q,se.getValidationProps,D,ke,we],stateAttributesMapping:zt});return E.jsxs(cT.Provider,{value:Pt,children:[It,!le&&!Q&&J&&!v&&R!==void 0&&E.jsx("input",{type:"hidden",form:u,name:J,value:R}),E.jsx("input",{...it,suppressHydrationWarning:!0})]})}),uj=b.forwardRef(function(e,t){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,u=lj(),f=u.checked||u.indeterminate,{mounted:d,transitionStatus:p,setMounted:g}=Dc(f),y=b.useRef(null),v={...u,transitionStatus:p};qs({open:f,ref:y,onComplete(){f||g(!1)}});const S={...aT(u),...Nc,...Oh},C=o||d,R=qt("span",e,{ref:[t,y],state:v,stateAttributesMapping:S,props:a});return C?R:null});function fj({className:n,...e}){return E.jsx(cj,{className:yn("peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow 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-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:aria-invalid:ring-destructive/40",n),"data-slot":"checkbox",...e,children:E.jsx(uj,{className:"grid place-content-center text-current","data-slot":"checkbox-indicator",children:e.checked==="indeterminate"?E.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:E.jsx("path",{d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})}):E.jsx("svg",{fill:"currentcolor",height:"9",viewBox:"0 0 9 9",width:"9",children:E.jsx("path",{d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})})})})}function dj({parameters:n,values:e,onChange:t}){const r=(i,s)=>{t({...e,[i]:s})};return E.jsx("div",{className:"space-y-4",children:n.map(i=>E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("label",{className:"text-sm font-medium text-foreground",children:[i.name,i.required?E.jsx("span",{className:"text-destructive ml-0.5",children:"*"}):E.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional)"})]}),E.jsx(hj,{parameter:i,value:e[i.name],onChange:s=>r(i.name,s)}),i.description&&E.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]},i.name))})}function hj({parameter:n,value:e,onChange:t}){const{type:r,name:i}=n;if(r==="boolean"){const[s,o]=b.useState(e===!0||e==="true");return b.useEffect(()=>{o(e===!0||e==="true")},[e]),E.jsx("div",{className:"flex items-center h-10",children:E.jsx(fj,{checked:s,onCheckedChange:a=>{o(a),t(a)}})})}return r==="integer"?E.jsx(bo,{type:"number",step:1,value:e??"",onChange:s=>{const o=s.target.value;t(o===""?void 0:parseInt(o,10))},placeholder:`Enter ${i}`}):r==="float"||r==="number"?E.jsx(bo,{type:"number",step:"any",value:e??"",onChange:s=>{const o=s.target.value;t(o===""?void 0:parseFloat(o))},placeholder:`Enter ${i}`}):r==="array"?E.jsx(bo,{type:"text",value:Array.isArray(e)?e.join(", "):"",onChange:s=>{const o=s.target.value;t(o?o.split(",").map(a=>a.trim()):void 0)},placeholder:"Enter comma-separated values"}):E.jsx(bo,{type:"text",value:e??"",onChange:s=>t(s.target.value||void 0),placeholder:`Enter ${i}`})}function pj(n){return qt(n.defaultTagName??"div",n,n)}const G2=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Q2=Kk,mj=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return Q2(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(f=>{const d=t==null?void 0:t[f],p=s==null?void 0:s[f];if(d===null)return null;const g=G2(d)||G2(p);return i[f][g]}),a=t&&Object.entries(t).reduce((f,d)=>{let[p,g]=d;return g===void 0||(f[p]=g),f},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((f,d)=>{let{class:p,className:g,...y}=d;return Object.entries(y).every(v=>{let[w,S]=v;return Array.isArray(S)?S.includes({...s,...a}[w]):{...s,...a}[w]===S})?[...f,p,g]:f},[]);return Q2(n,o,u,t==null?void 0:t.class,t==null?void 0:t.className)},uT=mj("[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{size:"default",variant:"default"},variants:{size:{default:"h-9 px-[calc(--spacing(3)-1px)] sm:h-8",icon:"size-9 sm:size-8","icon-lg":"size-10 sm:size-9","icon-sm":"size-8 sm:size-7","icon-xl":"size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5","icon-xs":"size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",lg:"h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",sm:"h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",xl:"h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",xs:"h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"},variant:{default:"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",destructive:"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none","destructive-outline":"border-border bg-transparent bg-clip-padding text-destructive-foreground shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4",ghost:"border-transparent hover:bg-accent data-pressed:bg-accent",link:"border-transparent underline-offset-4 hover:underline",outline:"border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"}}});function gj({className:n,variant:e,size:t,render:r,...i}){const s=r?void 0:"button",o={className:yn(uT({className:n,size:t,variant:e})),"data-slot":"button",type:s};return pj({defaultTagName:"button",props:li(o,i),render:r})}function yj({className:n,...e}){return E.jsx(iC,{"aria-label":"Loading",className:yn("animate-spin",n),role:"status",...e})}function X2({onClick:n,disabled:e=!1,loading:t=!1}){const r=b.useRef(n),i=b.useRef(e),s=b.useRef(t);b.useEffect(()=>{r.current=n,i.current=e,s.current=t},[n,e,t]),b.useEffect(()=>{const u=f=>{(f.metaKey||f.ctrlKey)&&f.key==="Enter"&&!(f.target.closest(".cm-editor")!==null)&&!i.current&&!s.current&&(f.preventDefault(),r.current())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]);const a=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?"⌘":"Ctrl";return E.jsx(gj,{onClick:n,disabled:e||t,children:t?E.jsxs(E.Fragment,{children:[E.jsx(yj,{className:"size-4"}),"Running..."]}):E.jsxs(E.Fragment,{children:[E.jsx(AD,{className:"size-4"}),"Run",E.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:[a,"+Enter"]})]})})}function vj(n,e,t){const r=new Array(n);return new Proxy(r,{get(i,s,o){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const u=+s;if(Number.isInteger(u)&&u>=0&&u<n){let f=i[u];if(!f){const d=e[u*2];f=i[u]={index:u,key:t(u),start:d,size:e[u*2+1],end:d+e[u*2+1],lane:0}}return f}}if(s==="length")return n}return Reflect.get(i,s,o)}})}function sl(n,e,t){let r=t.initialDeps??[],i,s=!0;function o(){const a=n();return(a.length!==r.length||a.some((f,d)=>r[d]!==f))&&(r=a,i=e(...a),t!=null&&t.onChange&&!(s&&t.skipInitialOnChange)&&t.onChange(i),s=!1),i}return o.updateDeps=a=>{r=a},o}function J2(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const xj=(n,e)=>Math.abs(n-e)<1.01,wj=(n,e,t)=>{let r;return function(...i){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,i),t)}};let Ba;const Z2=()=>{if(Ba!==void 0)return Ba;if(typeof navigator>"u")return Ba=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ba=!0;const n=navigator.maxTouchPoints;return Ba=navigator.platform==="MacIntel"&&n!==void 0&&n>0},eS=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},bj=n=>n,Sj=n=>{const e=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1)-e+1,i=new Array(r);for(let s=0;s<r;s++)i[s]=e+s;return i},kj=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const i=o=>{const{width:a,height:u}=o;e({width:Math.round(a),height:Math.round(u)})};if(i(eS(t)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(o=>{const a=()=>{const u=o[0];if(u!=null&&u.borderBoxSize){const f=u.borderBoxSize[0];if(f){i({width:f.inlineSize,height:f.blockSize});return}}i(eS(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(t,{box:"border-box"}),()=>{s.unobserve(t)}},Wd={passive:!0},Cj=typeof window>"u"?!0:"onscrollend"in window,Ej=(n,e,t)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;const s=n.options.useScrollendEvent&&Cj;let o=0;const a=s?null:wj(i,()=>e(o,!1),n.options.isScrollingResetDelay),u=p=>()=>{o=t(r),a==null||a(),e(o,p)},f=u(!0),d=u(!1);return r.addEventListener("scroll",f,Wd),s&&r.addEventListener("scrollend",d,Wd),()=>{r.removeEventListener("scroll",f),s&&r.removeEventListener("scrollend",d)}},Rj=(n,e)=>Ej(n,e,t=>{const{horizontal:r,isRtl:i}=n.options;return r?t.scrollLeft*(i&&-1||1):t.scrollTop}),Tj=(n,e,t)=>{if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},Oj=(n,{adjustments:e=0,behavior:t},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:n+e,behavior:t})},Mj=Oj;class Aj{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=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.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,r,i;return((i=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[f,d]of this.elementsCache)if(d===a){this.elementsCache.delete(f);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),t=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=t=>{const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:bj,rangeExtractor:Sj,onChange:()=>{},measureElement:Tj,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const i in t){const s=t[i];s!==void 0&&(r[i]=s)}this.options=r},this.notify=t=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,t)},this.maybeNotify=sl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,s=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!Z2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",s,Wd),i.addEventListener("touchend",o,Wd),this.unsubs.push(()=>{i.removeEventListener("touchstart",s),i.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),r=this.getMaxScrollOffset();if(t<0||t>r)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},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.getFurthestMeasurement=(t,r)=>{const i=new Map,s=new Map;for(let o=r-1;o>=0;o--){const a=t[o];if(i.has(a.lane))continue;const u=s.get(a.lane);if(u==null||a.end>u.end?s.set(a.lane,a):a.end<u.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=sl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,r,i,s,o,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=sl(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:u},f)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),a===1){const v=this.options.gap,w=t*2;let S=this._flatMeasurements;if(!S||S.length<w){const T=new Float64Array(w);S&&p>0&&T.set(S.subarray(0,p*2)),S=T,this._flatMeasurements=S}let C;if(p===0)C=r+i;else{const T=p-1;C=S[T*2]+S[T*2+1]+v}for(let T=p;T<t;T++){const M=s(T),A=d.get(M),D=typeof A=="number"?A:this.options.estimateSize(T);S[T*2]=C,S[T*2+1]=D,C+=D+v}const R=vj(t,S,s);return this.measurementsCache=R,R}const g=this.measurementsCache.slice(0,p),y=new Array(a).fill(void 0);for(let v=0;v<p;v++){const w=g[v];w&&(y[w.lane]=v)}for(let v=p;v<t;v++){const w=s(v),S=this.laneAssignments.get(v);let C,R;const T=u==="estimate"||d.has(w);if(S!==void 0&&this.options.lanes>1){C=S;const P=y[C],z=P!==void 0?g[P]:void 0;R=z?z.end+this.options.gap:r+i}else{const P=this.options.lanes===1?g[v-1]:this.getFurthestMeasurement(g,v);R=P?P.end+this.options.gap:r+i,C=P?P.lane:v%this.options.lanes,this.options.lanes>1&&T&&this.laneAssignments.set(v,C)}const M=d.get(w),A=typeof M=="number"?M:this.options.estimateSize(v),D=R+A;g[v]={index:v,start:R,size:A,end:D,key:w,lane:C},y[C]=v}return this.measurementsCache=g,g},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,i,s)=>this.range=t.length>0&&r>0?Pj({measurements:t,outerSize:r,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sl(()=>{let t=null,r=null;const i=this.calculateRange();return i&&(t=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,i,s,o)=>s===null||o===null?[]:t({startIndex:s,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,i=t.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return t>=o&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const r=this.indexFromElement(t),i=this.options.getItemKey(r),s=this.elementsCache.get(i);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,r)=>{var i;if(t<0||t>=this.options.count)return;let s,o,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(t),o=u[t*2],s=u[t*2+1];else{const p=this.measurementsCache[t];if(!p)return;a=p.key,o=p.start,s=p.size}const f=this.itemSizeCache.get(a)??s,d=r-f;d!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:a,start:o,size:s,end:o+s,lane:0},d,this):o<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward")&&(Z2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=d:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=sl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const i=[];for(let s=0,o=t.length;s<o;s++){const a=t[s],u=r[a];i.push(u)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,o=fT(0,r.length-1,s?a=>i[a*2]:a=>J2(r[a]).start,t);return J2(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=t>=o+s?"end":"start"),r==="center"?t+=(i-s)/2:r==="end"&&(t-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(r==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(t,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:r="auto",behavior:i="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getOffsetForIndex(t,r);if(!s)return;const[o,a]=s,u=this.now();this.scrollState={index:t,align:a,behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,o=this._flatMeasurements;o!=null?i=o[s*2]+o[s*2+1]:i=((t=r[s])==null?void 0:t.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&s.some(a=>a===null);){const a=r[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&t.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return t},this._scrollToOffset=(t,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=t+(r??0),this.options.scrollToFn(t,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&xj(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,u=Math.abs(i-this.getScrollOffset()),f=this.scrollState.behavior==="smooth"&&u>a;this.scrollState.lastTargetOffset=i,f||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:f?"smooth":"auto"})}this.scheduleScrollReconcile()}}const fT=(n,e,t,r)=>{for(;n<=e;){const i=(n+e)/2|0,s=t(i);if(s<r)n=i+1;else if(s>r)e=i-1;else return i}return n>0?n-1:0};function Pj({measurements:n,outerSize:e,scrollOffset:t,lanes:r,flat:i}){const s=n.length-1,o=i?d=>i[d*2]:d=>n[d].start,a=i?d=>i[d*2]+i[d*2+1]:d=>n[d].end;if(n.length<=r)return{startIndex:0,endIndex:s};let u=fT(0,s,o,t),f=u;if(r===1)for(;f<s&&a(f)<t+e;)f++;else if(r>1){const d=Array(r).fill(0);for(;f<s&&d.some(g=>g<t+e);){const g=n[f];d[g.lane]=g.end,f++}const p=Array(r).fill(t+e);for(;u>=0&&p.some(g=>g>=t);){const g=n[u];p[g.lane]=g.start,u--}u=Math.max(0,u-u%r),f=Math.min(s,f+(r-1-f%r))}return{startIndex:u,endIndex:f}}const tS=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Ij({useFlushSync:n=!0,...e}){const t=b.useReducer(s=>s+1,0)[1],r={...e,onChange:(s,o)=>{var a;n&&o?Ai.flushSync(t):t(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=b.useState(()=>new Aj(r));return i.setOptions(r),tS(()=>i._didMount(),[]),tS(()=>i._willUpdate()),i}function Dj(n){return Ij({observeElementRect:kj,observeElementOffset:Rj,scrollToFn:Mj,...n})}const nS=36;function Nj(n){return n<1e3?`${Math.round(n)} ms`:`${(n/1e3).toFixed(2)} s`}function Lj(n,e){if(!e.trim())return n;const t=n.toLowerCase(),r=e.toLowerCase(),i=[];let s=0,o=t.indexOf(r);for(;o!==-1;)o>s&&i.push(n.substring(s,o)),i.push(E.jsx("mark",{className:"bg-amber-200/50 text-foreground",children:n.substring(o,o+r.length)},o)),s=o+r.length,o=t.indexOf(r,s);return s<n.length&&i.push(n.substring(s)),i}function Bj({result:n,error:e,isLoading:t,executedSql:r,executionTimeMs:i}){const s=b.useRef(null),[o,a]=b.useState(""),u=b.useMemo(()=>{if(!n||!o.trim())return(n==null?void 0:n.rows)??[];const d=o.toLowerCase();return n.rows.filter(p=>p.some(g=>g===null?!1:String(g).toLowerCase().includes(d)))},[n,o]),f=Dj({count:u.length,getScrollElement:()=>s.current,estimateSize:()=>nS,overscan:10});return t?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):e?E.jsx("div",{className:"border border-destructive/20 rounded-lg bg-destructive/10 p-4",children:E.jsx("p",{className:"text-destructive text-sm",children:e})}):n?n.rows.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:n.rowCount>0?`${n.rowCount} row${n.rowCount!==1?"s":""} affected`:"No results returned"})}):E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("input",{type:"text",placeholder:"Filter results...","aria-label":"Filter table results",value:o,onChange:d=>a(d.target.value),className:"text-sm px-3 py-1 border border-border rounded bg-card text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring w-64"}),E.jsx("div",{className:"text-sm text-muted-foreground",children:o.trim()&&u.length!==n.rowCount?`${u.length} of ${n.rowCount} row${n.rowCount!==1?"s":""}`:`${n.rowCount} row${n.rowCount!==1?"s":""}`})]}),E.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[E.jsxs("div",{className:"flex bg-muted/50 border-b border-border",children:[E.jsx("div",{className:"w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0"}),n.columns.map(d=>E.jsx("div",{className:"flex-1 min-w-[120px] px-3 py-2 text-sm font-medium text-foreground truncate",children:d},d))]}),E.jsx("div",{ref:s,className:"max-h-[400px] overflow-auto bg-card",children:E.jsx("div",{style:{height:`${f.getTotalSize()}px`,width:"100%",position:"relative"},children:f.getVirtualItems().map(d=>{const p=u[d.index];return E.jsxs("div",{className:"flex absolute w-full border-b border-border/50 last:border-b-0",style:{height:`${nS}px`,transform:`translateY(${d.start}px)`},children:[E.jsx("div",{className:"w-16 px-3 py-2 text-sm text-muted-foreground flex-shrink-0",children:d.index+1}),p.map((g,y)=>E.jsx("div",{className:"flex-1 min-w-[120px] px-3 py-2 text-sm text-foreground truncate font-mono",title:String(g??""),children:g===null?E.jsx("span",{className:"text-muted-foreground italic",children:"NULL"}):Lj(String(g),o)},y))]},d.index)})})})]}),r&&i!==void 0&&E.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[E.jsx("span",{children:r}),E.jsxs("span",{children:["Executed in ",Nj(i)]})]})]}):E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})})}function Fj({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function jj(n){return n.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function rS({tabs:n,activeTabId:e,onTabSelect:t,onTabClose:r,isLoading:i}){const s=b.useRef(null),[o,a]=b.useState(!1),[u,f]=b.useState(!1),d=b.useMemo(()=>n.find(y=>y.id===e),[n,e]),p=b.useCallback(()=>{const y=s.current;if(!y)return;const{scrollLeft:v,scrollWidth:w,clientWidth:S}=y;a(v>0),f(v+S<w-1)},[]);b.useEffect(()=>(p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)),[p,n]);const g=y=>{const v=s.current;if(!v)return;const w=150;v.scrollBy({left:y==="left"?-w:w,behavior:"smooth"})};return i&&n.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("div",{className:"text-muted-foreground",children:"Running query..."})}):n.length===0?E.jsx("div",{className:"border border-border rounded-lg bg-card p-8 text-center",children:E.jsx("p",{className:"text-muted-foreground text-sm",children:"Run a query to see results"})}):E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"relative flex items-center border-b border-border",children:[o&&E.jsx("button",{type:"button",onClick:()=>g("left"),className:"absolute left-0 z-10 flex items-center justify-center w-6 h-full bg-background hover:bg-muted cursor-pointer","aria-label":"Scroll tabs left",children:E.jsx(hD,{className:"w-4 h-4 text-muted-foreground"})}),E.jsx("div",{ref:s,onScroll:p,className:yn("flex items-center gap-1 overflow-hidden",o&&"pl-6",u&&"pr-6"),children:n.map(y=>E.jsxs("button",{type:"button",onClick:()=>t(y.id),className:yn("group flex items-center gap-1.5 px-3 py-1.5 text-sm whitespace-nowrap","border-b-2 -mb-px transition-colors cursor-pointer",y.id===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:[E.jsx("span",{children:jj(y.timestamp)}),y.error&&E.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-destructive","aria-label":"Error"}),E.jsx("span",{role:"button",tabIndex:0,"aria-label":"Close tab",onClick:v=>{v.stopPropagation(),r(y.id)},onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.stopPropagation(),r(y.id))},className:"opacity-0 group-hover:opacity-100 hover:bg-muted rounded p-0.5 transition-opacity",children:E.jsx(Fj,{className:"w-3 h-3"})})]},y.id))}),u&&E.jsx("button",{type:"button",onClick:()=>g("right"),className:"absolute right-0 z-10 flex items-center justify-center w-6 h-full bg-background hover:bg-muted cursor-pointer","aria-label":"Scroll tabs right",children:E.jsx(mD,{className:"w-4 h-4 text-muted-foreground"})})]}),d&&E.jsx(Bj,{result:d.result,error:d.error,isLoading:i,executedSql:d.executedSql,executionTimeMs:d.executionTimeMs})]})}const dT=b.createContext(null),hT=b.createContext(null);function Ni(){const n=b.useContext(dT);if(n===null)throw new Error(Pn(60));return n}function pT(){const n=b.useContext(hT);if(n===null)throw new Error(Pn(61));return n}const _j=(n,e)=>Object.is(n,e);function Nl(n,e,t){return n==null||e==null?Object.is(n,e):t(n,e)}function zj(n,e,t){return!n||n.length===0?!1:n.some(r=>r===void 0?!1:Nl(e,r,t))}function nc(n,e,t){return!n||n.length===0?-1:n.findIndex(r=>r===void 0?!1:Nl(r,e,t))}function Vj(n,e,t){return n.filter(r=>!Nl(e,r,t))}function D0(n){if(n==null)return"";if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}function mT(n){return n!=null&&n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"items"in n[0]}function Wj(n){if(!Array.isArray(n))return n!=null&&"null"in n;const e=n;if(mT(e)){for(const t of e)for(const r of t.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function gT(n,e){if(e&&n!=null)return e(n)??"";if(n&&typeof n=="object"){if("label"in n&&n.label!=null)return String(n.label);if("value"in n)return String(n.value)}return D0(n)}function cl(n,e){return e&&n!=null?e(n)??"":n&&typeof n=="object"&&"value"in n&&"label"in n?D0(n.value):D0(n)}function yT(n,e,t){function r(){return gT(n,t)}if(t&&n!=null)return t(n);if(n&&typeof n=="object"&&"label"in n&&n.label!=null)return n.label;if(e&&!Array.isArray(e))return e[n]??r();if(Array.isArray(e)){const i=e,s=mT(i)?i.flatMap(o=>o.items):i;if(n==null||typeof n!="object"){const o=s.find(a=>a.value===n);return o&&o.label!=null?o.label:r()}if("value"in n){const o=s.find(a=>a&&a.value===n.value);if(o&&o.label!=null)return o.label}}return r()}function Hj(n,e,t){return n.reduce((r,i,s)=>(s>0&&r.push(", "),r.push(E.jsx(b.Fragment,{children:yT(i,e,t)},s)),r),[])}const Ye={id:Te(n=>n.id),labelId:Te(n=>n.labelId),modal:Te(n=>n.modal),multiple:Te(n=>n.multiple),items:Te(n=>n.items),itemToStringLabel:Te(n=>n.itemToStringLabel),itemToStringValue:Te(n=>n.itemToStringValue),isItemEqualToValue:Te(n=>n.isItemEqualToValue),value:Te(n=>n.value),hasSelectedValue:Te(n=>{const{value:e,multiple:t,itemToStringValue:r}=n;return e==null?!1:t&&Array.isArray(e)?e.length>0:cl(e,r)!==""}),hasNullItemLabel:Te((n,e)=>e?Wj(n.items):!1),open:Te(n=>n.open),mounted:Te(n=>n.mounted),forceMount:Te(n=>n.forceMount),transitionStatus:Te(n=>n.transitionStatus),openMethod:Te(n=>n.openMethod),activeIndex:Te(n=>n.activeIndex),selectedIndex:Te(n=>n.selectedIndex),isActive:Te((n,e)=>n.activeIndex===e),isSelected:Te((n,e,t)=>{const r=n.isItemEqualToValue,i=n.value;return n.multiple?Array.isArray(i)&&i.some(s=>Nl(t,s,r)):n.selectedIndex===e&&n.selectedIndex!==null?!0:Nl(t,i,r)}),isSelectedByFocus:Te((n,e)=>n.selectedIndex===e),popupProps:Te(n=>n.popupProps),triggerProps:Te(n=>n.triggerProps),triggerElement:Te(n=>n.triggerElement),positionerElement:Te(n=>n.positionerElement),listElement:Te(n=>n.listElement),popupSide:Te(n=>n.popupSide),scrollUpArrowVisible:Te(n=>n.scrollUpArrowVisible),scrollDownArrowVisible:Te(n=>n.scrollDownArrowVisible),hasScrollArrows:Te(n=>n.hasScrollArrows)};function $j(n){const e=b.useRef(""),t=b.useCallback(i=>{i.defaultPrevented||(e.current=i.pointerType,n(i,i.pointerType))},[n]);return{onClick:b.useCallback(i=>{if(i.detail===0){n(i,"keyboard");return}"pointerType"in i?n(i,i.pointerType):n(i,e.current),e.current=""},[n]),onPointerDown:t}}function Uj(n,e){const t=Fe((s,o)=>{(typeof n=="function"?n():n)||e(o||(zS?"touch":""))}),{onClick:r,onPointerDown:i}=$j(t);return b.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function qj(n){const[e,t]=b.useState(null),r=Uj(n,t);return cv(n,i=>{i&&!n&&t(null)}),b.useMemo(()=>({openMethod:e,triggerProps:r}),[e,r])}function Ha(n,e=Number.MIN_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(n,t))}const ti=1;function uv(n,e){return Math.max(0,n-e)}function Hd(n,e){if(e<=0)return 0;const t=Ha(n,0,e),r=t,i=e-t,s=r<=ti,o=i<=ti;return s&&o?r<=i?0:e:s?0:o?e:t}function Kj(n){const{id:e,value:t,defaultValue:r=null,onValueChange:i,open:s,defaultOpen:o=!1,onOpenChange:a,name:u,form:f,autoComplete:d,disabled:p=!1,readOnly:g=!1,required:y=!1,modal:v=!0,actionsRef:w,inputRef:S,onOpenChangeComplete:C,items:R,multiple:T=!1,itemToStringLabel:M,itemToStringValue:A,isItemEqualToValue:D=_j,highlightItemOnHover:P=!0,children:z}=n,{clearErrors:H}=lT(),{setDirty:$,setTouched:Z,setFocused:j,shouldValidateOnChange:B,validityData:X,setFilled:_,name:ne,disabled:G,validation:N,validationMode:W}=Vc(),F=lv({id:e}),I=G||p,U=ne??u,[q,Q]=Vd({controlled:t,default:T?r??lw:r,name:"Select",state:"value"}),[oe,ie]=Vd({controlled:s,default:o,name:"Select",state:"open"}),de=b.useRef([]),J=b.useRef([]),ae=b.useRef(null),pe=b.useRef(null),Re=b.useRef(0),ce=b.useRef(null),ye=b.useRef([]),be=b.useRef(!1),je=b.useRef(!1),Ne=b.useRef(null),ke=b.useRef(null),Ie=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ce=b.useRef(!1),{mounted:Ke,setMounted:He,transitionStatus:Je}=Dc(oe),{openMethod:$e,triggerProps:we}=qj(oe),Y=Xn(()=>new Ak({id:F,labelId:void 0,modal:v,multiple:T,itemToStringLabel:M,itemToStringValue:A,isItemEqualToValue:D,value:q,open:oe,mounted:Ke,transitionStatus:Je,items:R,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,se=Ze(Y,Ye.activeIndex),le=Ze(Y,Ye.selectedIndex),ve=Ze(Y,Ye.triggerElement),Le=Ze(Y,Ye.positionerElement),Ve=Uk($e),Ue=$e??Ve,it=b.useMemo(()=>T&&Array.isArray(q)&&q.length===0?"":cl(q,A),[T,q,A]),ht=b.useMemo(()=>T&&Array.isArray(q)?q.map(tt=>cl(tt,A)):cl(q,A),[T,q,A]),st=sn(Y.state.triggerElement),Pt=Fe(()=>ht);av(st,F,q,Pt);const zt=b.useRef(q),It=T?Array.isArray(q)&&q.length>0:q!=null;Se(()=>{q!==zt.current&&Y.set("forceMount",!0)},[Y,q]),Se(()=>{_(It)},[It,_]),Se(function(){const Rt=ye.current;let Qt;if(T){const fn=Array.isArray(q)?q:[];if(fn.length===0)Qt=null;else{const qr=fn[fn.length-1],Kr=nc(Rt,qr,D);Qt=Kr===-1?null:Kr}}else{const fn=nc(Rt,q,D);Qt=fn===-1?null:fn}Qt===null&&(ke.current=null),!oe&&Y.set("selectedIndex",Qt)},[It,T,oe,q,ye,D,Y,ke]),cv(q,()=>{H(U),$(q!==X.initialValue),B()?N.commit(q):N.commit(q,!0)});const et=Fe((tt,Rt)=>{if(a==null||a(tt,Rt),!Rt.isCanceled&&(ie(tt),!tt&&(Rt.reason===nh||Rt.reason===Y0)&&(Z(!0),j(!1),W==="onBlur"&&N.commit(q)),!tt&&Y.state.activeIndex!==null)){const Qt=de.current[Y.state.activeIndex];queueMicrotask(()=>{Qt==null||Qt.setAttribute("tabindex","-1")})}}),kt=Fe(()=>{He(!1),Y.update({activeIndex:null,openMethod:null}),C==null||C(!1)});qs({enabled:!w,open:oe,ref:ae,onComplete(){oe||kt()}}),b.useImperativeHandle(w,()=>({unmount:kt}),[kt]);const St=Fe((tt,Rt)=>{i==null||i(tt,Rt),!Rt.isCanceled&&Q(tt)}),qe=Fe(()=>{const tt=Y.state.listElement||ae.current;if(!tt)return;const Rt=uv(tt.scrollHeight,tt.clientHeight),Qt=Hd(tt.scrollTop,Rt),fn=Qt>0,qr=Qt<Rt;Y.state.scrollUpArrowVisible!==fn&&Y.set("scrollUpArrowVisible",fn),Y.state.scrollDownArrowVisible!==qr&&Y.set("scrollDownArrowVisible",qr)}),at=Dk({open:oe,onOpenChange:et,elements:{reference:ve,floating:Le}}),Vt=YP(at,{enabled:!g&&!I,event:"mousedown"}),wt=vk(at),Kt=x5(at,{enabled:!g&&!I,listRef:de,activeIndex:se,selectedIndex:le,disabledIndices:lw,onNavigate(tt){tt===null&&!oe||Y.set("activeIndex",tt)},focusItemOnHover:P}),Dt=w5(at,{enabled:!g&&!I&&(oe||!T),listRef:J,activeIndex:se,selectedIndex:le,onMatch(tt){oe?Y.set("activeIndex",tt):St(ye.current[tt],gt("none"))},onTyping(tt){be.current=tt}}),In=b.useMemo(()=>{const tt=li(Dt.reference,Kt.reference,wt.reference,Vt.reference,we);return F&&(tt.id=F),tt},[Vt.reference,Dt.reference,Kt.reference,wt.reference,we,F]),Cn=b.useMemo(()=>li(Pk,Dt.floating,Kt.floating,wt.floating),[Dt.floating,Kt.floating,wt.floating]),En=Kt.item??un;BS(()=>{Y.update({popupProps:Cn,triggerProps:In})}),Se(()=>{Y.update({id:F,modal:v,multiple:T,value:q,open:oe,mounted:Ke,transitionStatus:Je,popupProps:Cn,triggerProps:In,items:R,itemToStringLabel:M,itemToStringValue:A,isItemEqualToValue:D,openMethod:Ue})},[Y,F,v,T,q,oe,Ke,Je,Cn,In,R,M,A,D,Ue]);const hr=b.useMemo(()=>({store:Y,name:U,required:y,disabled:I,readOnly:g,multiple:T,highlightItemOnHover:P,setValue:St,setOpen:et,listRef:de,popupRef:ae,scrollHandlerRef:pe,handleScrollArrowVisibility:qe,scrollArrowsMountedCountRef:Re,itemProps:En,events:at.context.events,valueRef:ce,valuesRef:ye,labelsRef:J,typingRef:be,selectionRef:Ie,firstItemTextRef:Ne,selectedItemTextRef:ke,validation:N,onOpenChangeComplete:C,keyboardActiveRef:je,alignItemWithTriggerActiveRef:Ce,initialValueRef:zt}),[Y,U,y,I,g,T,P,St,et,En,at.context.events,N,C,qe]),Ur=To(S,N.inputRef),pr=T&&Array.isArray(q)&&q.length>0,Dn=T?void 0:U,Nn=b.useMemo(()=>!T||!Array.isArray(q)||!U?null:q.map(tt=>{const Rt=cl(tt,A);return E.jsx("input",{type:"hidden",form:f,name:U,value:Rt},Rt)}),[T,q,f,U,A]);return E.jsx(dT.Provider,{value:hr,children:E.jsxs(hT.Provider,{value:at,children:[z,E.jsx("input",{...N.getInputValidationProps({onFocus(){var tt;(tt=Y.state.triggerElement)==null||tt.focus({focusVisible:!0})},onChange(tt){var qr;if(tt.nativeEvent.defaultPrevented||I||g){(qr=tt.preventBaseUIHandler)==null||qr.call(tt);return}const Rt=tt.currentTarget.value,Qt=gt(Do,tt.nativeEvent);function fn(){if(T)return;const Kr=ye.current.find(Or=>cl(Or,A).toLowerCase()===Rt.toLowerCase()||gT(Or,M).toLowerCase()===Rt.toLowerCase());Kr!=null&&($(Kr!==X.initialValue),St(Kr,Qt),B()&&N.commit(Kr))}Y.set("forceMount",!0),queueMicrotask(fn)}}),id:F&&Dn==null?`${F}-hidden-input`:void 0,form:f,name:Dn,autoComplete:d,value:it,disabled:I,required:y&&!pr,readOnly:g,ref:Ur,style:U?XS:rh,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Nn]})})}function Yj(n,e){return n??e}function Gj(n){const e=n.getBoundingClientRect(),t=Et(n),r=t.getComputedStyle(n,"::before"),i=t.getComputedStyle(n,"::after");if(!(r.content!=="none"||i.content!=="none"))return e;const o=parseFloat(r.width)||0,a=parseFloat(r.height)||0,u=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d=Math.max(e.width,o,u),p=Math.max(e.height,a,f),g=d-e.width,y=p-e.height;return{left:e.left-g/2,right:e.right+g/2,top:e.top-y/2,bottom:e.bottom+y/2}}const Af=2,Qj=400,Xj={...D5,...Oh,popupSide:n=>n?{"data-popup-side":n}:null,value:()=>null},Jj=b.forwardRef(function(e,t){var be;const{render:r,className:i,id:s,disabled:o=!1,nativeButton:a=!0,style:u,...f}=e,{setTouched:d,setFocused:p,validationMode:g,state:y,disabled:v}=Vc(),{labelId:w}=Mh(),{store:S,setOpen:C,selectionRef:R,validation:T,readOnly:M,required:A,alignItemWithTriggerActiveRef:D,disabled:P,keyboardActiveRef:z}=Ni(),H=v||P||o,$=Ze(S,Ye.open),Z=Ze(S,Ye.mounted),j=Ze(S,Ye.value),B=Ze(S,Ye.triggerProps),X=Ze(S,Ye.positionerElement),_=Ze(S,Ye.listElement),ne=Ze(S,Ye.popupSide),G=Ze(S,Ye.id),N=Ze(S,Ye.labelId),W=Ze(S,Ye.hasSelectedValue),F=Z&&X?ne:null,I=s??G,U=Yj(w,N);lv({id:I});const q=sn(X),Q=b.useRef(null),{getButtonProps:oe,buttonRef:ie}=Ah({disabled:H,native:a}),de=Fe(je=>{S.set("triggerElement",je)}),J=To(t,Q,ie,de),ae=Gn(),pe=Gn(),Re=Gn();b.useEffect(()=>{if($)return Re.start(Qj,()=>{R.current.allowUnselectedMouseUp=!0,R.current.allowSelectedMouseUp=!0}),()=>{Re.clear()};R.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},pe.clear()},[$,R,pe,Re]);const ce=li(B,{id:I,role:"combobox","aria-expanded":$?"true":"false","aria-haspopup":"listbox","aria-controls":$?(_==null?void 0:_.id)??((be=ed(X))==null?void 0:be.id):void 0,"aria-labelledby":U,"aria-readonly":M||void 0,"aria-required":A||void 0,tabIndex:H?-1:0,ref:J,onFocus(je){p(!0),$&&D.current&&C(!1,gt(Do,je.nativeEvent)),ae.start(0,()=>{S.set("forceMount",!0)})},onBlur(je){We(X,je.relatedTarget)||(d(!0),p(!1),g==="onBlur"&&T.commit(j))},onPointerMove(){z.current=!1},onKeyDown(){z.current=!0},onMouseDown(je){if($)return;const Ne=ot(je.currentTarget);function ke(Ie){if(!Q.current)return;const Ce=Ie.target;if(We(Q.current,Ce)||We(q.current,Ce)||Ce===Q.current)return;const Ke=Gj(Q.current);Ie.clientX>=Ke.left-Af&&Ie.clientX<=Ke.right+Af&&Ie.clientY>=Ke.top-Af&&Ie.clientY<=Ke.bottom+Af||C(!1,gt(NA,Ie))}pe.start(0,()=>{Ne.addEventListener("mouseup",ke,{once:!0})})}},T.getValidationProps,f,oe);ce.role="combobox";const ye={...y,open:$,disabled:H,value:j,readOnly:M,popupSide:F,placeholder:!W};return qt("button",e,{ref:[t,Q],state:ye,stateAttributesMapping:Xj,props:ce})}),Zj={value:()=>null},e_=b.forwardRef(function(e,t){const{className:r,render:i,children:s,placeholder:o,style:a,...u}=e,{store:f,valueRef:d}=Ni(),p=Ze(f,Ye.value),g=Ze(f,Ye.items),y=Ze(f,Ye.itemToStringLabel),v=Ze(f,Ye.hasSelectedValue),w=!v&&o!=null&&s==null,S=Ze(f,Ye.hasNullItemLabel,w),C={value:p,placeholder:!v};let R=null;return typeof s=="function"?R=s(p):s!=null?R=s:!v&&o!=null&&!S?R=o:Array.isArray(p)?R=Hj(p,g,y):R=yT(p,g,y),qt("span",e,{state:C,ref:[t,d],props:[{children:R},u],stateAttributesMapping:Zj})}),t_=b.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,{store:a}=Ni(),f={open:Ze(a,Ye.open)};return qt("span",e,{state:f,ref:t,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:Lk})}),n_=b.createContext(void 0),r_=b.forwardRef(function(e,t){const{store:r}=Ni(),i=Ze(r,Ye.mounted),s=Ze(r,Ye.forceMount);return i||s?E.jsx(n_.Provider,{value:!0,children:E.jsx(zP,{ref:t,...e})}):null}),vT=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function i_(){return b.useContext(vT)}function s_(n){const{children:e,elementsRef:t,labelsRef:r,onMapChange:i}=n,s=Fe(i),o=b.useRef(0),a=Xn(l_).current,u=Xn(o_).current,[f,d]=b.useState(0),p=b.useRef(f),g=Fe((C,R)=>{u.set(C,R??null),p.current+=1,d(p.current)}),y=Fe(C=>{u.delete(C),p.current+=1,d(p.current)}),v=b.useMemo(()=>{const C=new Map;return Array.from(u.keys()).filter(T=>T.isConnected).sort(a_).forEach((T,M)=>{const A=u.get(T)??{};C.set(T,{...A,index:M})}),C},[u,f]);Se(()=>{if(typeof MutationObserver!="function"||v.size===0)return;const C=new MutationObserver(R=>{const T=new Set,M=A=>T.has(A)?T.delete(A):T.add(A);R.forEach(A=>{A.removedNodes.forEach(M),A.addedNodes.forEach(M)}),T.size===0&&(p.current+=1,d(p.current))});return v.forEach((R,T)=>{T.parentElement&&C.observe(T.parentElement,{childList:!0})}),()=>{C.disconnect()}},[v]),Se(()=>{p.current===f&&(t.current.length!==v.size&&(t.current.length=v.size),r&&r.current.length!==v.size&&(r.current.length=v.size),o.current=v.size),s(v)},[s,v,t,r,f]),Se(()=>()=>{t.current=[]},[t]),Se(()=>()=>{r&&(r.current=[])},[r]);const w=Fe(C=>(a.add(C),()=>{a.delete(C)}));Se(()=>{a.forEach(C=>C(v))},[a,v]);const S=b.useMemo(()=>({register:g,unregister:y,subscribeMapChange:w,elementsRef:t,labelsRef:r,nextIndexRef:o}),[g,y,w,t,r,o]);return E.jsx(vT.Provider,{value:S,children:e})}function o_(){return new Map}function l_(){return new Set}function a_(n,e){const t=n.compareDocumentPosition(e);return t&Node.DOCUMENT_POSITION_FOLLOWING||t&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:t&Node.DOCUMENT_POSITION_PRECEDING||t&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xT=b.createContext(void 0);function fv(){const n=b.useContext(xT);if(!n)throw new Error(Pn(59));return n}const c_=b.forwardRef(function(e,t){const{cutout:r,...i}=e;let s;if(r){const o=r.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return E.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});function $d(n,e){n&&Object.assign(n.style,e)}const wT={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};let iS={},sS={},oS="";function u_(n){if(typeof document>"u")return!1;const e=ot(n);return Et(e).innerWidth-e.documentElement.clientWidth>0}function f_(n){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const t=ot(n),r=t.documentElement,i=t.body,s=$s(r)?r:i,o=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const u=s.offsetWidth;s.style.overflowY="hidden";const f=s.offsetWidth;return s.style.overflowY=o,r.style.scrollbarGutter=a,u===f}function d_(n){const e=ot(n),t=e.documentElement,r=e.body,i=$s(t)?t:r,s={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,s)}}function h_(n){var y;const e=ot(n),t=e.documentElement,r=e.body,i=Et(t);let s=0,o=0,a=!1;const u=bi.create();if(H0&&(((y=i.visualViewport)==null?void 0:y.scale)??1)!==1)return()=>{};function f(){const v=i.getComputedStyle(t),w=i.getComputedStyle(r),R=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=t.scrollTop,o=t.scrollLeft,iS={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},oS=t.style.scrollBehavior,sS={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const T=t.scrollHeight>t.clientHeight,M=t.scrollWidth>t.clientWidth,A=v.overflowY==="scroll"||w.overflowY==="scroll",D=v.overflowX==="scroll"||w.overflowX==="scroll",P=Math.max(0,i.innerWidth-r.clientWidth),z=Math.max(0,i.innerHeight-r.clientHeight),H=parseFloat(w.marginTop)+parseFloat(w.marginBottom),$=parseFloat(w.marginLeft)+parseFloat(w.marginRight),Z=$s(t)?t:r;if(a=f_(n),a){t.style.scrollbarGutter=R,Z.style.overflowY="hidden",Z.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(T||A)&&(t.style.overflowY="scroll"),(M||D)&&(t.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:H||z?`calc(100dvh - ${H+z}px)`:"100dvh",width:$||P?`calc(100vw - ${$+P}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=o,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function d(){Object.assign(t.style,iS),Object.assign(r.style,sS),a||(t.scrollTop=s,t.scrollLeft=o,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=oS)}function p(){d(),u.request(f)}f();const g=rt(i,"resize",p);return()=>{u.cancel(),d(),typeof i.removeEventListener=="function"&&g()}}class p_{constructor(){pt(this,"lockCount",0);pt(this,"restore",null);pt(this,"timeoutLock",Er.create());pt(this,"timeoutUnlock",Er.create());pt(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});pt(this,"unlock",()=>{var e;this.lockCount===0&&this.restore&&((e=this.restore)==null||e.call(this),this.restore=null)})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;const r=ot(e).documentElement,i=Et(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Ht;return}const s=zS||!u_(e);this.restore=s?d_(e):h_(e)}}const m_=new p_;function g_(n=!0,e=null){Se(()=>{if(n)return m_.acquire(e)},[n,e])}const y_=20;function v_(n,e,t,r){const[i,s]=b.useState(!1);Se(()=>{if(!n||!e||t==null){s(!1);return}const o=ot(t).documentElement.clientWidth,a=t.offsetWidth;s(o>0&&a>0&&a>=o-y_)},[n,e,t]),g_(n&&(!e||i),r)}const x_={position:"fixed"},w_=b.forwardRef(function(e,t){const{anchor:r,positionMethod:i="absolute",className:s,render:o,side:a="bottom",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:p="clipping-ancestors",collisionPadding:g,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w,alignItemWithTrigger:S=!0,collisionAvoidance:C=BP,style:R,...T}=e,{store:M,listRef:A,labelsRef:D,alignItemWithTriggerActiveRef:P,selectedItemTextRef:z,valuesRef:H,initialValueRef:$,popupRef:Z,setValue:j}=Ni(),B=pT(),X=Ze(M,Ye.open),_=Ze(M,Ye.mounted),ne=Ze(M,Ye.modal),G=Ze(M,Ye.value),N=Ze(M,Ye.openMethod),W=Ze(M,Ye.positionerElement),F=Ze(M,Ye.triggerElement),I=Ze(M,Ye.isItemEqualToValue),U=Ze(M,Ye.transitionStatus),q=b.useRef(null),Q=b.useRef(null),[oe,ie]=b.useState(S),de=_&&oe&&N!=="touch";!_&&oe!==S&&ie(S),Se(()=>{_||(Ye.scrollUpArrowVisible(M.state)&&M.set("scrollUpArrowVisible",!1),Ye.scrollDownArrowVisible(M.state)&&M.set("scrollDownArrowVisible",!1))},[M,_]),b.useImperativeHandle(P,()=>de),v_((de||ne)&&X,N==="touch",W,F);const J=Hk({anchor:r,floatingRootContext:B,positionMethod:i,mounted:_,side:a,sideOffset:f,align:u,alignOffset:d,arrowPadding:y,collisionBoundary:p,collisionPadding:g,sticky:v,disableAnchorTracking:w??de,collisionAvoidance:C,keepMounted:!0}),ae=de?"none":J.side,pe=de?x_:J.positionerStyles,Re={open:X,side:ae,align:J.align,anchorHidden:J.anchorHidden};Se(()=>{M.set("popupSide",J.side)},[M,J.side]);const ce=Fe(ke=>{M.set("positionerElement",ke)}),ye=$k(e,Re,{styles:pe,transitionStatus:U,props:T,refs:[t,ce],hidden:!_,inert:!X}),be=b.useRef(0),je=Fe(ke=>{if(ke.size===0&&be.current===0||H.current.length===0)return;const Ie=be.current;if(be.current=ke.size,ke.size===Ie)return;const Ce=gt(Do);if(Ie!==0&&!M.state.multiple&&G!==null&&nc(H.current,G,I)===-1){const He=$.current,$e=He!=null&&nc(H.current,He,I)!==-1?He:null;j($e,Ce),$e===null&&(M.set("selectedIndex",null),z.current=null)}if(Ie!==0&&M.state.multiple&&Array.isArray(G)){const Ke=Je=>nc(H.current,Je,I)!==-1,He=G.filter(Je=>Ke(Je));(He.length!==G.length||He.some(Je=>!zj(G,Je,I)))&&(j(He,Ce),He.length===0&&(M.set("selectedIndex",null),z.current=null))}if(X&&de){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ke={height:""};$d(W,Ke),$d(Z.current,Ke)}}),Ne=b.useMemo(()=>({...J,side:ae,alignItemWithTriggerActive:de,setControlledAlignItemWithTrigger:ie,scrollUpArrowRef:q,scrollDownArrowRef:Q}),[J,ae,de,ie]);return E.jsx(s_,{elementsRef:A,labelsRef:D,onMapChange:je,children:E.jsxs(xT.Provider,{value:Ne,children:[_&&ne&&E.jsx(c_,{inert:yy(!X),cutout:F}),ye]})})}),Pf="base-ui-disable-scrollbar",N0={className:Pf,getElement(n){return E.jsx("style",{nonce:n,href:Pf,precedence:"base-ui:low",children:`.${Pf}{scrollbar-width:none}.${Pf}::-webkit-scrollbar{display:none}`})}},b_=b.createContext(void 0);function S_(n){return b.useContext(b_)}const k_="ArrowUp",C_="ArrowDown",E_="ArrowLeft",R_="ArrowRight",T_="Home",O_="End",M_=new Set([E_,R_]),A_=new Set([k_,C_]),P_=new Set([...M_,...A_]),I_=new Set([...P_,T_,O_]),D_=b.createContext(void 0),N_={disableStyleElements:!1};function L_(){return b.useContext(D_)??N_}const B_={...py,...Nc},F_=b.forwardRef(function(e,t){const{render:r,className:i,style:s,finalFocus:o,...a}=e,{store:u,popupRef:f,onOpenChangeComplete:d,setOpen:p,valueRef:g,firstItemTextRef:y,selectedItemTextRef:v,keyboardActiveRef:w,multiple:S,handleScrollArrowVisibility:C,scrollHandlerRef:R,listRef:T,highlightItemOnHover:M}=Ni(),{side:A,align:D,alignItemWithTriggerActive:P,isPositioned:z,setControlledAlignItemWithTrigger:H,scrollDownArrowRef:$,scrollUpArrowRef:Z}=fv(),j=S_()!=null,B=pT(),X=my(),{nonce:_,disableStyleElements:ne}=L_(),G=Ze(u,Ye.id),N=Ze(u,Ye.open),W=Ze(u,Ye.mounted),F=Ze(u,Ye.popupProps),I=Ze(u,Ye.transitionStatus),U=Ze(u,Ye.triggerElement),q=Ze(u,Ye.positionerElement),Q=Ze(u,Ye.listElement),oe=b.useRef(!1),ie=b.useRef(!1),de=b.useRef({}),J=Ls(),ae=Fe(ye=>{if(!q||!f.current||!ie.current)return;if(oe.current||!P){C();return}const be=q.style.top==="0px",je=q.style.bottom==="0px";if(!be&&!je){C();return}const Ne=aS(q),ke=$a(q.getBoundingClientRect().height,"y",Ne),Ie=ot(q),Ce=getComputedStyle(q),Ke=parseFloat(Ce.marginTop),He=parseFloat(Ce.marginBottom),Je=lS(getComputedStyle(f.current)),$e=Math.min(Ie.documentElement.clientHeight-Ke-He,Je),we=ye.scrollTop,Y=If(ye);let se=0,le=null,ve=!1,Le=!1;const Ve=st=>{q.style.height=`${st}px`},Ue=(st,Pt)=>{const zt=Ha(st,0,$e-ke);zt>0&&Ve(ke+zt),ye.scrollTop=Pt,$e-(ke+zt)<=ti&&(oe.current=!0),C()},it=be?Y-we:we,ht=Math.min(ke+it,$e);if(se=ht,it<=ti){Ue(it,be?Y:0);return}if($e-ht>ti)be?Le=!0:le=0;else if(ve=!0,je&&we<Y){const st=ke+it-$e;le=we-(it-st)}if(se=Math.ceil(se),se!==0&&Ve(se),Le||le!=null){const st=If(ye),Pt=Le?st:Ha(le,0,st);Math.abs(ye.scrollTop-Pt)>ti&&(ye.scrollTop=Pt)}(ve||se>=$e-ti)&&(oe.current=!0),C()});b.useImperativeHandle(R,()=>ae,[ae]),qs({open:N,ref:f,onComplete(){N&&(d==null||d(!0))}});const pe={open:N,transitionStatus:I,side:A,align:D};Se(()=>{!q||!f.current||Object.keys(de.current).length||(de.current={top:q.style.top||"0",left:q.style.left||"0",right:q.style.right,height:q.style.height,bottom:q.style.bottom,minHeight:q.style.minHeight,maxHeight:q.style.maxHeight,marginTop:q.style.marginTop,marginBottom:q.style.marginBottom})},[f,q]),Se(()=>{N||P||(ie.current=!1,oe.current=!1,$d(q,de.current))},[N,P,q,f]),Se(()=>{var je,Ne;const ye=f.current;if(!N||!U||!q||!ye||P&&!z||u.state.transitionStatus==="ending")return;if(!P){ie.current=!0,J.request(C),ye.style.removeProperty("--transform-origin");return}const be=j_(ye);ye.style.removeProperty("--transform-origin");try{let ke=v.current;ke!=null&&ke.isConnected||(ke=!Ye.hasSelectedValue(u.state)&&((je=y.current)!=null&&je.isConnected)?y.current:null);const Ie=g.current,Ce=getComputedStyle(q),Ke=getComputedStyle(ye),He=ot(U),Je=Et(q),$e=aS(U),we=Df(U.getBoundingClientRect(),$e),Y=Df(q.getBoundingClientRect(),$e),se=we.height,le=Q||ye,ve=le.scrollHeight,Le=parseFloat(Ke.borderBottomWidth),Ve=parseFloat(Ce.marginTop)||10,Ue=parseFloat(Ce.marginBottom)||10,it=parseFloat(Ce.minHeight)||100,ht=lS(Ke),st=5,Pt=5,zt=20,It=He.documentElement.clientHeight-Ve-Ue,et=He.documentElement.clientWidth,kt=It-we.bottom+se;let St,qe=X==="rtl"?we.right-Y.width:we.left,at=0;if(ke&&Ie){const Dn=Df(Ie.getBoundingClientRect(),$e);St=Df(ke.getBoundingClientRect(),$e),qe=Y.left+(X==="rtl"?Dn.right-St.right:Dn.left-St.left);const Nn=Dn.top-we.top+Dn.height/2;at=St.top-Y.top+St.height/2-Nn}const Vt=kt+at+Ue+Le;let wt=Math.min(It,Vt);const Kt=It-Ve-Ue,Dt=Vt-wt,In=et-Pt;q.style.left=`${Ha(qe,st,In-Y.width)}px`,q.style.height=`${wt}px`,q.style.maxHeight="auto",q.style.marginTop=`${Ve}px`,q.style.marginBottom=`${Ue}px`,ye.style.height="100%";const Cn=If(le),En=Dt>=Cn-ti;En&&(wt=Math.min(It,Y.height)-(Dt-Cn));const hr=we.top<zt||we.bottom>It-zt||Math.ceil(wt)+ti<Math.min(ve,it),Ur=(((Ne=Je.visualViewport)==null?void 0:Ne.scale)??1)!==1&&H0;if(hr||Ur){ie.current=!0,$d(q,de.current),H(!1);return}const pr=Math.max(it,wt);if(En){const Dn=Math.max(0,It-Vt);q.style.top=Y.height>=Kt?"0":`${Dn}px`,q.style.height=`${wt}px`,le.scrollTop=If(le)}else q.style.bottom="0",le.scrollTop=Dt;if(St){const Dn=Y.top,Nn=Y.height,tt=St.top+St.height/2,Rt=Nn>0?(tt-Dn)/Nn*100:50,Qt=Ha(Rt,0,100);ye.style.setProperty("--transform-origin",`50% ${Qt}%`)}(pr===It||wt>=ht)&&(oe.current=!0),C(),M&&u.state.selectedIndex===null&&u.state.activeIndex===null&&T.current[0]!=null&&u.set("activeIndex",0),ie.current=!0}finally{be()}},[u,N,q,U,g,y,v,f,C,P,H,J,$,Z,Q,T,M,X,z]),b.useEffect(()=>{if(!P||!q||!N)return;const ye=Et(q);function be(je){p(!1,gt(FA,je))}return rt(ye,"resize",be)},[p,P,q,N]);const Re={...Q?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${G}-list`},onKeyDown(ye){w.current=!0,j&&I_.has(ye.key)&&ye.stopPropagation()},onMouseMove(){w.current=!1},onScroll(ye){Q||ae(ye.currentTarget)},...P&&{style:Q?{height:"100%"}:wT}},ce=qt("div",e,{ref:[t,f],state:pe,stateAttributesMapping:B_,props:[F,Re,gy(I),{className:!Q&&P?N0.className:void 0},a]});return E.jsxs(b.Fragment,{children:[!ne&&N0.getElement(_),E.jsx(KP,{context:B,modal:!1,disabled:!W,returnFocus:o,restoreFocus:!0,children:ce})]})});function lS(n){const e=n.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}function If(n){return uv(n.scrollHeight,n.clientHeight)}function aS(n){return Ek.getScale(n)}function $a(n,e,t){return n/t[e]}function Df(n,e){return oc({x:$a(n.x,"x",e),y:$a(n.y,"y",e),width:$a(n.width,"x",e),height:$a(n.height,"y",e)})}const cS=[["transform","none"],["scale","1"],["translate","0 0"]];function j_(n){const{style:e}=n,t={};for(const[r,i]of cS)t[r]=e.getPropertyValue(r),e.setProperty(r,i,"important");return()=>{for(const[r]of cS){const i=t[r];i?e.setProperty(r,i):e.removeProperty(r)}}}const __=b.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,{store:a,scrollHandlerRef:u}=Ni(),{alignItemWithTriggerActive:f}=fv(),d=Ze(a,Ye.hasScrollArrows),p=Ze(a,Ye.openMethod),g=Ze(a,Ye.multiple),v={id:`${Ze(a,Ye.id)}-list`,role:"listbox","aria-multiselectable":g||void 0,onScroll(S){var C;(C=u.current)==null||C.call(u,S.currentTarget)},...f&&{style:wT},className:d&&p!=="touch"?N0.className:void 0},w=Fe(S=>{a.set("listElement",S)});return qt("div",e,{ref:[t,w],props:[v,o]})});let bT=(function(n){return n[n.None=0]="None",n[n.GuessFromOrder=1]="GuessFromOrder",n})({});function z_(n={}){const{label:e,metadata:t,textRef:r,indexGuessBehavior:i,index:s}=n,{register:o,unregister:a,subscribeMapChange:u,elementsRef:f,labelsRef:d,nextIndexRef:p}=i_(),g=b.useRef(-1),[y,v]=b.useState(s??(i===bT.GuessFromOrder?()=>{if(g.current===-1){const C=p.current;p.current+=1,g.current=C}return g.current}:-1)),w=b.useRef(null),S=b.useCallback(C=>{var R;if(w.current=C,y!==-1&&C!==null&&(f.current[y]=C,d)){const T=e!==void 0;d.current[y]=T?e:((R=r==null?void 0:r.current)==null?void 0:R.textContent)??C.textContent}},[y,f,d,e,r]);return Se(()=>{if(s!=null)return;const C=w.current;if(C)return o(C,t),()=>{a(C)}},[s,o,a,t]),Se(()=>{if(s==null)return u(C=>{var T;const R=w.current?(T=C.get(w.current))==null?void 0:T.index:null;R!=null&&v(R)})},[s,u,v]),b.useMemo(()=>({ref:S,index:y}),[y,S])}const ST=b.createContext(void 0);function dv(){const n=b.useContext(ST);if(!n)throw new Error(Pn(57));return n}const V_=b.memo(b.forwardRef(function(e,t){const{render:r,className:i,style:s,value:o=null,label:a,disabled:u=!1,nativeButton:f=!1,...d}=e,p=b.useRef(null),g=z_({label:a,textRef:p,indexGuessBehavior:bT.GuessFromOrder}),{store:y,itemProps:v,setOpen:w,setValue:S,selectionRef:C,typingRef:R,valuesRef:T,multiple:M,selectedItemTextRef:A}=Ni(),D=Ze(y,Ye.isActive,g.index),P=Ze(y,Ye.isSelected,g.index,o),z=Ze(y,Ye.isSelectedByFocus,g.index),H=Ze(y,Ye.isItemEqualToValue),$=g.index,Z=$!==-1,j=b.useRef(null);Se(()=>{if(!Z)return;const Q=T.current;return Q[$]=o,()=>{delete Q[$]}},[Z,$,o,T]),Se(()=>{if(!Z)return;const Q=y.state.value;let oe=Q;M&&Array.isArray(Q)&&Q.length>0&&(oe=Q[Q.length-1]),oe!==void 0&&Nl(o,oe,H)&&(y.set("selectedIndex",$),p.current&&(A.current=p.current))},[Z,$,M,H,y,o,A]);const B=b.useRef(null),X=b.useRef("mouse"),_=b.useRef(!1),{getButtonProps:ne,buttonRef:G}=Ah({disabled:u,focusableWhenDisabled:!0,native:f,composite:!0}),N={disabled:u,selected:P,highlighted:D};function W(Q){const oe=y.state.value;if(M){const ie=Array.isArray(oe)?oe:[],de=P?Vj(ie,o,H):[...ie,o];S(de,gt(km,Q))}else S(o,gt(km,Q)),w(!1,gt(km,Q))}function F(){C.current.dragY=0}const I={role:"option","aria-selected":P,tabIndex:D?0:-1,onKeyDown(Q){B.current=Q.key,y.set("activeIndex",$),Q.key===" "&&R.current&&Q.preventDefault()},onClick(Q){const oe=Q.type==="click"&&X.current!=="touch",ie=Q.nativeEvent.pointerType,de=oe&&$0(Q.nativeEvent)&&(ie!==void 0||D),J=oe&&!de&&!_.current;_.current=!1,!(Q.type==="keydown"&&B.current===null)&&(u||Q.type==="keydown"&&B.current===" "&&R.current||J||(B.current=null,W(Q.nativeEvent)))},onPointerEnter(Q){X.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const oe=C.current;oe.dragY+=Q.movementY,oe.dragY**2>=64&&(oe.allowUnselectedMouseUp=!0)}},onPointerDown(Q){X.current=Q.pointerType,_.current=!0,F()},onMouseUp(){var ie;if(F(),u||X.current==="touch"||_.current)return;const Q=!C.current.allowSelectedMouseUp&&P,oe=!C.current.allowUnselectedMouseUp&&!P;Q||oe||(_.current=!0,(ie=j.current)==null||ie.click(),_.current=!1)}},U=qt("div",e,{ref:[G,t,g.ref,j],state:N,props:[v,I,d,ne]}),q=b.useMemo(()=>({selected:P,index:$,textRef:p,selectedByFocus:z,hasRegistered:Z}),[P,$,p,z,Z]);return E.jsx(ST.Provider,{value:q,children:U})})),W_=b.forwardRef(function(e,t){const r=e.keepMounted??!1,{selected:i}=dv();return r||i?E.jsx(H_,{...e,ref:t}):null}),H_=b.memo(b.forwardRef((n,e)=>{const{render:t,className:r,style:i,keepMounted:s,...o}=n,{selected:a}=dv(),u=b.useRef(null),{transitionStatus:f,setMounted:d}=Dc(a),g=qt("span",n,{ref:[e,u],state:{selected:a,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Nc});return qs({open:a,ref:u,onComplete(){a||d(!1)}}),g})),$_=b.memo(b.forwardRef(function(e,t){const{index:r,textRef:i,selectedByFocus:s,hasRegistered:o}=dv(),{firstItemTextRef:a,selectedItemTextRef:u}=Ni(),{render:f,className:d,style:p,...g}=e,y=b.useCallback(w=>{w&&(o&&r===0&&(a.current=w),o&&s&&(u.current=w))},[a,u,r,s,o]);return qt("div",e,{ref:[y,t,i],props:g})})),kT=b.forwardRef(function(e,t){const{render:r,className:i,style:s,direction:o,keepMounted:a=!1,...u}=e,f=o==="up",{store:d,popupRef:p,listRef:g,handleScrollArrowVisibility:y,scrollArrowsMountedCountRef:v}=Ni(),{side:w,scrollDownArrowRef:S,scrollUpArrowRef:C}=fv(),R=f?Ye.scrollUpArrowVisible:Ye.scrollDownArrowVisible,T=Ze(d,R),M=Ze(d,Ye.openMethod),A=T&&M!=="touch",D=Gn(),P=f?C:S,{transitionStatus:z,setMounted:H}=Dc(A);Se(()=>(v.current+=1,d.state.hasScrollArrows||d.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&d.state.hasScrollArrows&&d.set("hasScrollArrows",!1)}),[d,v]),qs({open:A,ref:P,onComplete(){A||H(!1)}});const j=qt("div",e,{ref:[t,P],state:{direction:o,visible:A,side:w,transitionStatus:z},props:[{"aria-hidden":!0,children:f?"▲":"▼",style:{position:"absolute"},onMouseMove(X){if(X.movementX===0&&X.movementY===0||D.isStarted())return;d.set("activeIndex",null);function _(){var I;const ne=d.state.listElement??p.current;if(!ne)return;d.set("activeIndex",null),y();const G=uv(ne.scrollHeight,ne.clientHeight),N=Hd(ne.scrollTop,G),W=N===(f?0:G),F=g.current;if(N!==ne.scrollTop&&(ne.scrollTop=N),F.length===0&&d.set(f?"scrollUpArrowVisible":"scrollDownArrowVisible",!W),W){D.clear();return}if(F.length>0){const U=((I=P.current)==null?void 0:I.offsetHeight)||0;ne.scrollTop=U_(F,f,N,ne.clientHeight,U,G)}D.start(40,_)}D.start(40,_)},onMouseLeave(){D.clear()}},u]});return A||a?j:null});function U_(n,e,t,r,i,s){if(e){let d=0;const p=t+i-ti;for(let v=0;v<n.length;v+=1){const w=n[v];if(w&&w.offsetTop>=p){d=v;break}}const g=Math.max(0,d-1),y=n[g];return g<d&&y?Hd(y.offsetTop-i,s):0}let o=n.length-1;const a=t+r-i+ti;for(let d=0;d<n.length;d+=1){const p=n[d];if(p&&p.offsetTop+p.offsetHeight>a){o=Math.max(0,d-1);break}}const u=Math.min(n.length-1,o+1),f=n[u];return u>o&&f?Hd(f.offsetTop+f.offsetHeight-r+i,s):s}const q_=b.forwardRef(function(e,t){return E.jsx(kT,{...e,ref:t,direction:"down"})}),K_=b.forwardRef(function(e,t){return E.jsx(kT,{...e,ref:t,direction:"up"})}),uS=Kj;function fS({className:n,size:e="default",children:t,...r}){return E.jsxs(Jj,{className:yn("relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base shadow-xs outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none",e==="sm"&&"min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7",e==="lg"&&"min-h-10 sm:min-h-9",n),"data-slot":"select-trigger",...r,children:[t,E.jsx(t_,{"data-slot":"select-icon",children:E.jsx(xD,{className:"-me-1 size-4.5 opacity-80 sm:size-4"})})]})}function dS({className:n,...e}){return E.jsx(e_,{className:yn("flex-1 truncate data-placeholder:text-muted-foreground",n),"data-slot":"select-value",...e})}function hS({className:n,children:e,sideOffset:t=4,alignItemWithTrigger:r=!0,...i}){return E.jsx(r_,{children:E.jsx(w_,{alignItemWithTrigger:r,className:"z-50 select-none","data-slot":"select-positioner",sideOffset:t,children:E.jsxs(F_,{className:"origin-(--transform-origin) transition-[scale,opacity] has-data-[side=none]:scale-100 has-data-starting-style:scale-98 has-data-starting-style:opacity-0 has-data-[side=none]:transition-none","data-slot":"select-popup",...i,children:[E.jsx(K_,{className:"top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover","data-slot":"select-scroll-up-arrow",children:E.jsx(yD,{className:"relative size-4.5 sm:size-4"})}),E.jsx("span",{className:"relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border",children:E.jsx(__,{className:yn("max-h-(--available-height) min-w-(--anchor-width) overflow-y-auto p-1",n),"data-slot":"select-list",children:e})}),E.jsx(q_,{className:"bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover","data-slot":"select-scroll-down-arrow",children:E.jsx(fD,{className:"relative size-4.5 sm:size-4"})})]})})})}function $i({className:n,children:e,...t}){return E.jsxs(V_,{className:yn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",n),"data-slot":"select-item",...t,children:[E.jsx(W_,{className:"col-start-1",children:E.jsx("svg",{fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/1500/svg",children:E.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})}),E.jsx($_,{className:"col-start-2 min-w-0",children:e})]})}function Y_({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function G_({className:n="w-4 h-4"}){return E.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:E.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function Q_(){const{sourceId:n,toolName:e}=Yd(),[t,r]=lA(),[i,s]=b.useState(null),[o,a]=b.useState(!0),[u,f]=b.useState(null),d=b.useRef(null),[p,g]=b.useState(()=>t.get("sql")||""),[y,v]=b.useState({}),[w,S]=b.useState([]),[C,R]=b.useState(null),[T,M]=b.useState(!1),[A,D]=b.useState(!1),[P,z]=b.useState("table"),[H,$]=b.useState("%"),[Z,j]=b.useState(""),[B,X]=b.useState(""),[_,ne]=b.useState("names");b.useEffect(()=>{!n||!e||(a(!0),f(null),S([]),R(null),nC(n).then(J=>{const ae=J.tools.find(pe=>pe.name===e);s(ae||null),a(!1)}).catch(J=>{f(J),a(!1)}))},[n,e]);const N=b.useCallback(()=>i?i.name.startsWith("execute_sql")?"execute_sql":i.name.startsWith("search_objects")?"search_objects":"custom":"custom",[i])(),W=b.useCallback((J,ae)=>{if(!i)return J;const pe=i.parameters.find(Re=>Re.name===ae);if(pe){if(pe.type==="number"||pe.type==="integer"||pe.type==="float"){const Re=Number(J);return isNaN(Re)?void 0:Re}return pe.type==="boolean"?J==="true":J}},[i]);b.useEffect(()=>{if(!i||N!=="custom")return;const J={};t.forEach((ae,pe)=>{if(pe!=="sql"){const Re=W(String(ae),pe);Re!==void 0&&(J[pe]=Re)}}),Object.keys(J).length>0&&v(J)},[i,N,t,W]),b.useEffect(()=>{if(N!=="execute_sql")return;const J=setTimeout(()=>{r(ae=>{const pe=new URLSearchParams(ae);return p.trim()?pe.set("sql",p):pe.delete("sql"),pe},{replace:!0})},300);return()=>clearTimeout(J)},[p,N,r]),b.useEffect(()=>{if(N!=="custom")return;const J=setTimeout(()=>{r(ae=>{const pe=new URLSearchParams(ae);return Array.from(pe.keys()).forEach(Re=>{Re!=="sql"&&pe.delete(Re)}),Object.entries(y).forEach(([Re,ce])=>{ce!=null&&ce!==""&&pe.set(Re,String(ce))}),pe},{replace:!0})},300);return()=>clearTimeout(J)},[y,N,r]);const F=b.useCallback(()=>{if(!(i!=null&&i.statement))return"";let J=i.statement,ae=0;return J=J.replace(/\$(\d+)|\?/g,(pe,Re)=>{let ce;return Re?ce=i.parameters[parseInt(Re,10)-1]:(ce=i.parameters[ae],ae++),ce?`:${ce.name}`:":?"}),J},[i]),I=b.useCallback(()=>{let J=F();return Object.entries(y).forEach(([ae,pe])=>{if(pe!==void 0&&pe!==""){const Re=typeof pe=="string"?`'${pe.replace(/'/g,"''")}'`:String(pe);J=J.replace(new RegExp(`:${ae}\\b`,"g"),Re)}}),J},[F,y]),U=b.useCallback(()=>i?i.parameters.filter(J=>J.required).every(J=>y[J.name]!==void 0&&y[J.name]!==""):!1,[i,y]),q=b.useCallback(async()=>{var ae;if(!i||!e)return;M(!0);const J=performance.now();try{let pe,Re;N==="execute_sql"?(Re=((ae=d.current)==null?void 0:ae.getSelectedSql())??p,pe=await zm(e,{sql:Re})):(Re=I(),pe=await zm(e,y));const ye=performance.now()-J,be={id:crypto.randomUUID(),timestamp:new Date,result:pe,error:null,executedSql:Re,executionTimeMs:ye};S(je=>[be,...je]),R(be.id)}catch(pe){const Re={id:crypto.randomUUID(),timestamp:new Date,result:null,error:pe instanceof Error?pe.message:"Query failed",executedSql:N==="execute_sql"?p:I(),executionTimeMs:0};S(ce=>[Re,...ce]),R(Re.id)}finally{M(!1)}},[i,e,N,p,y,I]),Q=N==="execute_sql"?!p.trim():!U(),oe=b.useCallback(async()=>{const J=N==="execute_sql"?p:I();await navigator.clipboard.writeText(J),D(!0),setTimeout(()=>D(!1),2e3)},[N,p,I]),ie=b.useCallback(J=>{S(ae=>{const pe=ae.findIndex(ce=>ce.id===J),Re=ae.filter(ce=>ce.id!==J);if(J===C&&Re.length>0){const ce=Math.min(pe,Re.length-1);R(Re[ce].id)}else Re.length===0&&R(null);return Re})},[C]),de=b.useCallback(async()=>{if(!i||!e)return;M(!0);const J=performance.now();try{const ae={object_type:P,pattern:H||"%",detail_level:_};Z&&(ae.schema=Z),B&&(ae.table=B);const pe=await zm(e,ae),ce=performance.now()-J,ye={id:crypto.randomUUID(),timestamp:new Date,result:pe,error:null,executedSql:`search_objects(object_type=${P}, pattern=${H||"%"}, detail_level=${_})`,executionTimeMs:ce};S(be=>[ye,...be]),R(ye.id)}catch(ae){const pe={id:crypto.randomUUID(),timestamp:new Date,result:null,error:ae instanceof Error?ae.message:"Query failed",executedSql:`search_objects(object_type=${P}, pattern=${H||"%"})`,executionTimeMs:0};S(Re=>[pe,...Re]),R(pe.id)}finally{M(!1)}},[i,e,P,H,Z,B,_]);return!n||!e?E.jsx(Ua,{to:"/",replace:!0}):o?E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsx("div",{className:"text-muted-foreground",children:"Loading tool details..."})}):u?u.status===404?E.jsx(Ua,{to:"/404",replace:!0}):E.jsx("div",{className:"container mx-auto px-8 py-12",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Error"}),E.jsx("p",{className:"text-destructive/90",children:u.message})]})}):i?N==="search_objects"?E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&E.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[E.jsx(ud,{className:"w-3 h-3"}),"Read-Only"]})]}),E.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description}),E.jsxs("div",{className:"border border-border rounded-lg bg-card p-6 space-y-4",children:[E.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[E.jsxs("div",{className:"space-y-1.5",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"Object Type"}),E.jsxs(uS,{value:P,onValueChange:J=>J&&z(J),children:[E.jsx(fS,{className:"w-full",children:E.jsx(dS,{})}),E.jsxs(hS,{children:[E.jsx($i,{value:"schema",children:"Schema"}),E.jsx($i,{value:"table",children:"Table"}),E.jsx($i,{value:"column",children:"Column"}),E.jsx($i,{value:"procedure",children:"Procedure"}),E.jsx($i,{value:"function",children:"Function"}),E.jsx($i,{value:"index",children:"Index"})]})]})]}),E.jsxs("div",{className:"space-y-1.5",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"Detail Level"}),E.jsxs(uS,{value:_,onValueChange:J=>J&&ne(J),children:[E.jsx(fS,{className:"w-full",children:E.jsx(dS,{})}),E.jsxs(hS,{children:[E.jsx($i,{value:"names",children:"Names"}),E.jsx($i,{value:"summary",children:"Summary"}),E.jsx($i,{value:"full",children:"Full"})]})]})]})]}),E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Pattern",E.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional, default: %)"})]}),E.jsx(bo,{type:"text",value:H,onChange:J=>$(J.target.value),placeholder:"e.g., %user% or exact_name"})]}),E.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Schema",E.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional)"})]}),E.jsx(bo,{type:"text",value:Z,onChange:J=>j(J.target.value),placeholder:"e.g., public"})]}),(P==="column"||P==="index")&&E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Table",E.jsx("span",{className:"text-muted-foreground ml-1.5 font-normal",children:"(optional)"})]}),E.jsx(bo,{type:"text",value:B,onChange:J=>X(J.target.value),placeholder:"e.g., users"})]})]}),E.jsx(X2,{onClick:de,disabled:T,loading:T})]}),E.jsx(rS,{tabs:w,activeTabId:C,onTabSelect:R,onTabClose:ie,isLoading:T})]})}):E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("h1",{className:"text-3xl font-bold text-foreground font-mono",children:i.name}),i.readonly&&E.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[E.jsx(ud,{className:"w-3 h-3"}),"Read-Only"]})]}),E.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description})]}),N==="custom"&&i.parameters.length>0&&E.jsxs("div",{className:"space-y-2",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"Parameters"}),E.jsx("div",{className:"border border-border rounded-lg bg-card p-4",children:E.jsx(dj,{parameters:i.parameters,values:y,onChange:v})})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsx("label",{className:"text-sm font-medium text-foreground",children:"SQL Statement"}),E.jsx("button",{onClick:oe,className:"inline-flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded cursor-pointer transition-colors",title:"Copy SQL",children:A?E.jsxs(E.Fragment,{children:[E.jsx(G_,{className:"w-3.5 h-3.5"}),"Copied"]}):E.jsxs(E.Fragment,{children:[E.jsx(Y_,{className:"w-3.5 h-3.5"}),"Copy"]})})]}),E.jsx(zF,{ref:d,value:N==="execute_sql"?p:I(),onChange:N==="execute_sql"?g:void 0,onRunShortcut:q,disabled:Q||T,readOnly:N!=="execute_sql",placeholder:N==="execute_sql"?"SELECT * FROM table_name LIMIT 10;":void 0})]}),E.jsx(X2,{onClick:q,disabled:Q,loading:T}),E.jsx(rS,{tabs:w,activeTabId:C,onTabSelect:R,onTabClose:ie,isLoading:T})]})}):E.jsx(Ua,{to:"/404",replace:!0})}function X_(){return E.jsx("div",{className:"container mx-auto px-8 py-12 max-w-4xl",children:E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-4xl font-bold text-foreground mb-4",children:"404 - Page Not Found"}),E.jsx("p",{className:"text-xl text-muted-foreground",children:"The page you're looking for doesn't exist."})]}),E.jsxs("div",{className:"bg-muted rounded-lg p-6",children:[E.jsx("p",{className:"text-muted-foreground mb-4",children:"The URL you entered could not be found. This might be because:"}),E.jsxs("ul",{className:"space-y-2 text-muted-foreground list-disc list-inside",children:[E.jsx("li",{children:"The page was moved or deleted"}),E.jsx("li",{children:"You typed the URL incorrectly"}),E.jsx("li",{children:"The resource ID is invalid"})]})]}),E.jsx("div",{children:E.jsx(Xi,{to:"/",className:"inline-flex items-center px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"Go to Data Sources"})})]})})}const hv=b.createContext(void 0);function CT(){const n=b.useContext(hv);if(!n)throw new Error(Pn(73));return n}let pS=0;function ET(n){return pS+=1,`${n}-${Math.random().toString(36).slice(2,6)}-${pS}`}function wg(n,e){if(typeof n=="string")return{description:n};if(typeof n=="function"){const t=n(e);return typeof t=="string"?{description:t}:t}return n}function bg(n){const e=new Map;let t=0,r=0;return n.forEach((i,s)=>{const o=i.transitionStatus==="ending";e.set(i.id,{value:i,domIndex:s,visibleIndex:o?-1:t,offsetY:r}),r+=i.height||0,o||(t+=1)}),e}const Nf=n=>n.toastMetadata,xi={toasts:Te(n=>n.toasts),isEmpty:Te(n=>n.toasts.length===0),toast:Te(Nf,(n,e)=>{var t;return(t=n.get(e))==null?void 0:t.value}),toastIndex:Te(Nf,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.domIndex)??-1}),toastOffsetY:Te(Nf,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.offsetY)??0}),toastVisibleIndex:Te(Nf,(n,e)=>{var t;return((t=n.get(e))==null?void 0:t.visibleIndex)??-1}),hovering:Te(n=>n.hovering),focused:Te(n=>n.focused),expanded:Te(n=>n.hovering||n.focused),expandedOrOutOfFocus:Te(n=>n.hovering||n.focused||!n.isWindowFocused),prevFocusElement:Te(n=>n.prevFocusElement)};class J_ extends oy{constructor(t){super({...t,toastMetadata:bg(t.toasts)},{},xi);pt(this,"timers",new Map);pt(this,"areTimersPaused",!1);pt(this,"setViewport",t=>{this.set("viewport",t)});pt(this,"disposeEffect",()=>()=>{this.timers.forEach(t=>{var r;(r=t.timeout)==null||r.clear()}),this.timers.clear()});pt(this,"addToast",t=>{const{timeout:r,limit:i}=this.state,s=t.id||ET("toast");if(t.id){const d=xi.toast(this.state,t.id);if(d)if(d.transitionStatus==="ending")this.removeToast(t.id,{skipOnRemove:!0});else{const{id:p,transitionStatus:g,...y}=t;return this.updateToastInternal(t.id,y,{resetTimer:!0,markUpdated:!0}),t.id}}const o={...t,id:s,updateKey:0,transitionStatus:"starting"},a=[o,...this.state.toasts],u=a.filter(d=>d.transitionStatus!=="ending");if(u.length>i){const d=u.length-i,p=u.slice(-d),g=new Set(p.map(y=>y.id));this.setToasts(a.map(y=>{const v=g.has(y.id);return y.limited!==v?{...y,limited:v}:y}))}else this.setToasts(a.map(d=>d.limited?{...d,limited:!1}:d));const f=o.timeout??r;return o.type!=="loading"&&f>0&&this.scheduleTimer(s,f,()=>this.closeToast(s)),xi.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s});pt(this,"updateToast",(t,r)=>{this.updateToastInternal(t,r,{markUpdated:!0})});pt(this,"updateToastInternal",(t,r,i={})=>{var S,C;const{timeout:s,toasts:o}=this.state,a=xi.toast(this.state,t)??null;if(!a||a.transitionStatus==="ending")return;const u={...a,...r,...i.markUpdated&&{updateKey:(a.updateKey??0)+1}};this.setToasts(o.map(R=>R.id===t?u:R));const f=u.timeout??s,d=(a==null?void 0:a.timeout)??s,p=Object.hasOwn(r,"timeout"),g=u.transitionStatus!=="ending"&&u.type!=="loading"&&f>0,y=this.timers.has(t),v=d!==f,w=(a==null?void 0:a.type)==="loading";if(!g&&y){const R=this.timers.get(t);(S=R==null?void 0:R.timeout)==null||S.clear(),this.timers.delete(t);return}if(g&&(!y||v||p||w||i.resetTimer)){const R=this.timers.get(t);R&&((C=R.timeout)==null||C.clear(),this.timers.delete(t)),this.scheduleTimer(t,f,()=>this.closeToast(t)),xi.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}});pt(this,"closeToast",t=>{const r=t===void 0,{limit:i,toasts:s}=this.state;let o;if(r)o=s,this.timers.forEach(d=>{var p;(p=d.timeout)==null||p.clear()}),this.timers.clear();else{const d=xi.toast(this.state,t);if(!d)return;o=[d];const p=this.timers.get(t);p!=null&&p.timeout&&(p.timeout.clear(),this.timers.delete(t))}let a=0;const u=s.map(d=>{if(r||d.id===t)return{...d,transitionStatus:"ending",height:0};if(d.transitionStatus==="ending")return d;const p=a>=i;return a+=1,d.limited!==p?{...d,limited:p}:d}),f={toasts:u,toastMetadata:bg(u)};(r||s.length===1)&&(f.hovering=!1,f.focused=!1),this.update(f),o.forEach(d=>{var p;d.transitionStatus!=="ending"&&((p=d.onClose)==null||p.call(d))}),this.handleFocusManagement(t)});pt(this,"promiseToast",(t,r)=>{const i=wg(r.loading),s=this.addToast({...i,type:"loading"}),o=t.then(a=>{const u=wg(r.success,a);return this.updateToast(s,{...u,type:"success",timeout:u.timeout}),a}).catch(a=>{const u=wg(r.error,a);return this.updateToast(s,{...u,type:"error",timeout:u.timeout}),Promise.reject(a)});return{}.hasOwnProperty.call(r,"setPromise")&&r.setPromise(o),o});pt(this,"handleDocumentPointerDown",t=>{if(t.pointerType!=="touch")return;const r=on(t);We(this.state.viewport,r)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}setFocused(t){this.set("focused",t)}setHovering(t){this.set("hovering",t)}setIsWindowFocused(t){this.set("isWindowFocused",t)}setPrevFocusElement(t){this.set("prevFocusElement",t)}removeToast(t,r={}){var a;const i=xi.toastIndex(this.state,t);if(i===-1)return;const s=this.state.toasts[i];r.skipOnRemove||(a=s==null?void 0:s.onRemove)==null||a.call(s);const o=[...this.state.toasts];o.splice(i,1),this.setToasts(o)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{if(t.timeout){t.timeout.clear();const r=Date.now()-t.start,i=t.delay-r;t.remaining=i>0?i:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,r)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??(t.timeout=Er.create()),t.timeout.start(t.remaining,()=>{this.timers.delete(r),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){var t;(t=this.state.prevFocusElement)==null||t.focus({preventScroll:!0})}scheduleTimer(t,r,i){const s=Date.now(),o=!xi.expandedOrOutOfFocus(this.state),a=o?Er.create():void 0;a==null||a.start(r,()=>{this.timers.delete(t),i()}),this.timers.set(t,{timeout:a,start:o?s:0,delay:r,remaining:r,callback:i})}setToasts(t){const r={toasts:t,toastMetadata:bg(t)};t.length===0&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(t){var u,f;const r=cn(ot(this.state.viewport));if(!this.state.viewport||!We(this.state.viewport,r)||!Zf(r))return;if(t===void 0){this.restoreFocusToPrevElement();return}const i=xi.toasts(this.state),s=xi.toastIndex(this.state,t);let o=null,a=s+1;for(;a<i.length;){if(i[a].transitionStatus!=="ending"){o=i[a];break}a+=1}if(!o)for(a=s-1;a>=0;){if(i[a].transitionStatus!=="ending"){o=i[a];break}a-=1}o?(f=(u=o.ref)==null?void 0:u.current)==null||f.focus():this.restoreFocusToPrevElement()}}const Z_=function(e){const{children:t,timeout:r=5e3,limit:i=3,toastManager:s}=e,o=Xn(()=>new J_({timeout:r,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return Qd(o.disposeEffect),b.useEffect(function(){return s?s[" subscribe"](({action:f,options:d})=>{const p=d.id;f==="promise"&&d.promise?o.promiseToast(d.promise,d):f==="update"&&p?o.updateToast(p,d):f==="close"?o.closeToast(p):o.addToast(d)}):void 0},[o,s]),o.useSyncedValues({timeout:r,limit:i}),E.jsx(hv.Provider,{value:o,children:t})};let ez=(function(n){return n.frontmostHeight="--toast-frontmost-height",n})({});const tz=b.forwardRef(function(e,t){var G;const{render:r,className:i,style:s,children:o,...a}=e,u=CT(),f=Gn(),d=b.useRef(!1),p=b.useRef(!1),g=b.useRef(!1),y=u.useState("isEmpty"),v=u.useState("toasts"),w=u.useState("focused"),S=u.useState("expanded"),C=u.useState("prevFocusElement"),R=((G=v[0])==null?void 0:G.height)??0,T=b.useMemo(()=>v.some(N=>N.transitionStatus==="ending"),[v]),M=b.useMemo(()=>v.filter(N=>N.priority==="high"),[v]);b.useEffect(()=>{const N=u.state.viewport;if(!N)return;function W(I){y||I.key==="F6"&&on(I)!==N&&(I.preventDefault(),u.setPrevFocusElement(cn(ot(N))),N==null||N.focus({preventScroll:!0}),u.pauseTimers(),u.setFocused(!0))}const F=Et(N);return rt(F,"keydown",W)},[u,y]),b.useEffect(()=>{const N=u.state.viewport;if(!N||y)return;const W=Et(N);function F(U){on(U)===W&&(u.setIsWindowFocused(!1),u.pauseTimers())}function I(U){if(U.relatedTarget)return;const q=on(U),Q=cn(ot(N));(q===W||!We(N,q)||!Zf(Q))&&u.resumeTimers(),f.start(0,()=>u.setIsWindowFocused(!0))}return oi(rt(W,"blur",F,!0),rt(W,"focus",I,!0))},[u,f,y]),b.useEffect(()=>{const N=u.state.viewport;if(!N||y)return;const W=ot(N);return rt(W,"pointerdown",u.handleDocumentPointerDown,!0)},[y,u]);function A(N){var F,I,U;const W=u.state.viewport;W&&(d.current=!0,N.relatedTarget===W?(U=(I=(F=v[0])==null?void 0:F.ref)==null?void 0:I.current)==null||U.focus():u.restoreFocusToPrevElement())}function D(N){N.key==="Tab"&&N.shiftKey&&on(N.nativeEvent)===u.state.viewport&&(N.preventDefault(),u.restoreFocusToPrevElement(),u.resumeTimers())}function P(){const N=u.state.toasts.some(W=>W.transitionStatus==="ending");!u.state.isWindowFocused||N||g.current||!p.current||(u.resumeTimers(),u.setHovering(!1),p.current=!1)}b.useEffect(P,[T,u]);function z(){u.pauseTimers(),u.setHovering(!0),p.current=!1}function H(){T||g.current?p.current=!0:(u.resumeTimers(),u.setHovering(!1))}function $(N){N.pointerType==="touch"&&(g.current=!0)}function Z(N){N.pointerType==="touch"&&(g.current=!1,P())}function j(){if(d.current){d.current=!1;return}w||Zf(cn(ot(u.state.viewport)))&&(u.setFocused(!0),u.pauseTimers())}function B(N){!w||We(u.state.viewport,N.relatedTarget)||(u.setFocused(!1),u.resumeTimers())}const X={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:z,onMouseMove:z,onMouseLeave:H,onFocus:j,onBlur:B,onKeyDown:D,onClick:j,onPointerDown:$,onPointerUp:Z,onPointerCancel:Z},_={expanded:S},ne=qt("div",e,{ref:[t,u.setViewport],state:_,props:[X,{style:{[ez.frontmostHeight]:R?`${R}px`:void 0}},a,{children:E.jsxs(b.Fragment,{children:[!y&&C&&E.jsx(So,{onFocus:A}),o,!y&&C&&E.jsx(So,{onFocus:A})]})}]});return E.jsxs(b.Fragment,{children:[!y&&C&&E.jsx(So,{onFocus:A}),ne,!w&&M.length>0&&E.jsx("div",{style:rh,children:M.map(N=>E.jsxs("div",{role:"alert","aria-atomic":!0,children:[E.jsx("div",{children:N.title}),E.jsx("div",{children:N.description})]},N.id))})]})}),RT=b.createContext(void 0);function Ph(){const n=b.useContext(RT);if(!n)throw new Error(Pn(66));return n}let uo=(function(n){return n.index="--toast-index",n.offsetY="--toast-offset-y",n.height="--toast-height",n.swipeMovementX="--toast-swipe-movement-x",n.swipeMovementY="--toast-swipe-movement-y",n})({});function mS(n,e,t){switch(n){case"up":return-t;case"down":return t;case"left":return-e;case"right":return e;default:return 0}}function nz(n){const t=Et(n).getComputedStyle(n).transform;let r=0,i=0,s=1;if(t&&t!=="none"){const o=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const a=o[1].split(", ").map(parseFloat);a.length===6?(r=a[4],i=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],i=a[13],s=a[0])}}return{x:r,y:i,scale:s}}const rz={...Nc,swipeDirection(n){return n?{"data-swipe-direction":n}:null}},Fa=40,iz=10,Es=.5,sz=1,oz=`${NP},${LP}`,lz=b.forwardRef(function(e,t){var we;const{toast:r,render:i,className:s,swipeDirection:o=["down","right"],style:a,...u}=e,f=((we=r.positionerProps)==null?void 0:we.anchor)!==void 0;let d=[];f||(d=Array.isArray(o)?o:[o]);const p=d.length>0,g=CT(),[y,v]=b.useState(void 0),[w,S]=b.useState(!1),[C,R]=b.useState(!1),[T,M]=b.useState(!1),[A,D]=b.useState({x:0,y:0}),[P,z]=b.useState({x:0,y:0,scale:1}),[H,$]=b.useState(),[Z,j]=b.useState(),[B,X]=b.useState(null),_=b.useRef(null),ne=b.useRef({x:0,y:0}),G=b.useRef({x:0,y:0,scale:1}),N=b.useRef(void 0),W=b.useRef(0),F=b.useRef(!1),I=b.useRef({x:0,y:0}),U=b.useRef(!1),q=b.useRef({x:0,y:0}),Q=b.useRef(null),oe=b.useRef(null),ie=g.useState("toastIndex",r.id),de=g.useState("toastVisibleIndex",r.id),J=g.useState("toastOffsetY",r.id),ae=g.useState("focused"),pe=g.useState("expanded");qs({open:r.transitionStatus!=="ending",ref:_,onComplete(){r.transitionStatus==="ending"&&g.removeToast(r.id)}});const Re=Fe((Y=!1)=>{const se=_.current;if(!se)return;const le=se.style.height;se.style.height="auto";const ve=se.offsetHeight;se.style.height=le;function Le(){g.updateToastInternal(r.id,{ref:_,height:ve,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}Y?Ai.flushSync(Le):Le()});Se(Re,[Re]);function ce(Y){q.current=Y,D(Y)}Se(()=>()=>{var Y;(Y=oe.current)==null||Y.abort()},[]);function ye(Y,se){let le=Y,ve=se;return!d.includes("left")&&!d.includes("right")?le=Y>0?Y**Es:-(Math.abs(Y)**Es):(!d.includes("right")&&Y>0&&(le=Y**Es),!d.includes("left")&&Y<0&&(le=-(Math.abs(Y)**Es))),!d.includes("up")&&!d.includes("down")?ve=se>0?se**Es:-(Math.abs(se)**Es):(!d.includes("down")&&se>0&&(ve=se**Es),!d.includes("up")&&se<0&&(ve=-(Math.abs(se)**Es))),{x:le,y:ve}}const be=Fe(Y=>{var it;if(Y.pointerId!==Q.current)return;Q.current=null,(it=oe.current)==null||it.abort(),oe.current=null,S(!1),R(!1),X(null);const se=G.current;if(Y.type==="pointercancel"||F.current){ce({x:se.x,y:se.y}),v(void 0);return}let le=!1;const ve=q.current,Le=ve.x-se.x,Ve=ve.y-se.y;let Ue;for(const ht of d){switch(ht){case"right":Le>Fa&&(le=!0,Ue="right");break;case"left":Le<-Fa&&(le=!0,Ue="left");break;case"down":Ve>Fa&&(le=!0,Ue="down");break;case"up":Ve<-Fa&&(le=!0,Ue="up");break}if(le)break}le?(v(Ue),M(!0),g.closeToast(r.id)):(ce({x:se.x,y:se.y}),v(void 0))});function je(Y){var Le,Ve;if(Y.button!==0)return;Y.pointerType==="touch"&&g.pauseTimers();const se=on(Y.nativeEvent);if(se?se.closest(`button,a,input,textarea,[role="button"],${oz}`):!1)return;if(F.current=!1,N.current=void 0,W.current=0,Q.current=Y.pointerId,ne.current={x:Y.clientX,y:Y.clientY},I.current=ne.current,_.current){const Ue=nz(_.current);G.current=Ue,z(Ue),ce({x:Ue.x,y:Ue.y})}g.setHovering(!0),S(!0),R(!1),X(null),U.current=!0;const ve=_.current;if(ve){(Le=oe.current)==null||Le.abort();const Ue=new AbortController;oe.current=Ue;const it=ot(ve);it.addEventListener("pointerup",be,{signal:Ue.signal}),it.addEventListener("pointercancel",be,{signal:Ue.signal}),(Ve=ve.setPointerCapture)==null||Ve.call(ve,Y.pointerId)}}function Ne(Y){if(Y.pointerId!==Q.current)return;Y.preventDefault(),U.current&&(ne.current={x:Y.clientX,y:Y.clientY},U.current=!1);const{clientY:se,clientX:le,movementX:ve,movementY:Le}=Y;(Le<0&&se>I.current.y||Le>0&&se<I.current.y)&&(I.current={x:I.current.x,y:se}),(ve<0&&le>I.current.x||ve>0&&le<I.current.x)&&(I.current={x:le,y:I.current.y});const Ve=le-ne.current.x,Ue=se-ne.current.y,it=se-I.current.y,ht=le-I.current.x;if(!C&&Math.sqrt(Ve*Ve+Ue*Ue)>=sz&&(R(!0),B===null)){const kt=d.includes("left")||d.includes("right"),St=d.includes("up")||d.includes("down");if(kt&&St){const qe=Math.abs(Ve),at=Math.abs(Ue);X(qe>at?"horizontal":"vertical")}}let st;if(!N.current)B==="vertical"?Ue>0?st="down":Ue<0&&(st="up"):B==="horizontal"?Ve>0?st="right":Ve<0&&(st="left"):Math.abs(Ve)>=Math.abs(Ue)?st=Ve>0?"right":"left":st=Ue>0?"down":"up",st&&d.includes(st)&&(N.current=st,W.current=mS(st,Ve,Ue),v(st));else{const et=N.current,kt=mS(et,ht,it);kt>Fa?(F.current=!1,v(et)):!(d.includes("left")&&d.includes("right"))&&!(d.includes("up")&&d.includes("down"))&&W.current-kt>=iz&&(F.current=!0)}const Pt=ye(Ve,Ue);let zt=G.current.x,It=G.current.y;B==="horizontal"?(d.includes("left")||d.includes("right"))&&(zt+=Pt.x):(B==="vertical"||(d.includes("left")||d.includes("right"))&&(zt+=Pt.x),(d.includes("up")||d.includes("down"))&&(It+=Pt.y)),ce({x:zt,y:It})}function ke(Y){if(Y.key==="Escape"){if(!_.current||!We(_.current,cn(ot(_.current))))return;g.closeToast(r.id)}}b.useEffect(()=>{if(!p)return;const Y=_.current;if(!Y)return;function se(le){We(Y,on(le))&&le.preventDefault()}return rt(Y,"touchmove",se,{passive:!1})},[p]);function Ie(){if(!w&&A.x===P.x&&A.y===P.y&&!T)return{[uo.swipeMovementX]:"0px",[uo.swipeMovementY]:"0px"};const Y=A.x-P.x,se=A.y-P.y;return{transition:w?"none":void 0,transform:w?`translateX(${A.x}px) translateY(${A.y}px) scale(${P.scale})`:void 0,[uo.swipeMovementX]:`${Y}px`,[uo.swipeMovementY]:`${se}px`}}const Ce=r.priority==="high",Ke={role:Ce?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":H,"aria-describedby":Z,"aria-hidden":Ce&&!ae?!0:void 0,onPointerDown:p?je:void 0,onPointerMove:p?Ne:void 0,onPointerUp:p?be:void 0,onPointerCancel:p?be:void 0,onKeyDown:ke,inert:yy(r.limited),style:{...Ie(),[uo.index]:r.transitionStatus==="ending"?ie:de,[uo.offsetY]:`${J}px`,[uo.height]:r.height?`${r.height}px`:void 0}},He=b.useMemo(()=>({rootRef:_,toast:r,titleId:H,setTitleId:$,descriptionId:Z,setDescriptionId:j,swiping:w,swipeDirection:y,recalculateHeight:Re,index:ie,visibleIndex:de,expanded:pe}),[r,H,Z,w,y,Re,ie,de,pe]),Je={transitionStatus:r.transitionStatus,expanded:pe,limited:r.limited||!1,type:r.type,swiping:He.swiping,swipeDirection:He.swipeDirection},$e=qt("div",e,{ref:[t,He.rootRef],state:Je,stateAttributesMapping:rz,props:[Ke,u]});return E.jsx(RT.Provider,{value:He,children:$e})}),az=b.forwardRef(function(e,t){const{render:r,className:i,style:s,...o}=e,{visibleIndex:a,expanded:u,recalculateHeight:f}=Ph(),d=b.useRef(null);Se(()=>{const v=d.current;if(!v||(f(),typeof ResizeObserver!="function"||typeof MutationObserver!="function"))return;const w=new ResizeObserver(()=>f(!0)),S=new MutationObserver(()=>f(!0));return w.observe(v),S.observe(v,{childList:!0,subtree:!0,characterData:!0}),()=>{w.disconnect(),S.disconnect()}},[f]);const p=a>0;return qt("div",e,{ref:[t,d],state:{expanded:u,behind:p},props:o})}),cz=b.forwardRef(function(e,t){const{render:r,className:i,style:s,id:o,children:a,...u}=e,{toast:f,setDescriptionId:d}=Ph(),p=a??f.description,g=!!p,y=_l(o);Se(()=>{if(g)return d(y),()=>{d(void 0)}},[g,y,d]);const v={type:f.type},w=qt("p",e,{ref:t,state:v,props:{...u,id:y,children:p}});return g?w:null}),uz=b.forwardRef(function(e,t){const{render:r,className:i,style:s,id:o,children:a,...u}=e,{toast:f,setTitleId:d}=Ph(),p=a??f.title,g=!!p,y=_l(o);Se(()=>{if(g)return d(y),()=>{d(void 0)}},[g,y,d]);const v={type:f.type},w=qt("h2",e,{ref:t,state:v,props:{...u,id:y,children:p}});return g?w:null}),fz=b.forwardRef(function(e,t){var S;const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...u}=e,{toast:f}=Ph(),d=((S=f.actionProps)==null?void 0:S.children)??u.children,p=!!d,{getButtonProps:g,buttonRef:y}=Ah({disabled:o,native:a}),v={type:f.type},w=qt("button",e,{ref:[t,y],state:v,props:[u,f.actionProps,g,{children:d}]});return p?w:null}),dz=_k;function hz(){const n=b.useContext(hv);if(!n)throw new Error(Pn(73));const e=n.useState("toasts");return b.useMemo(()=>({toasts:e,add:n.addToast,close:n.closeToast,update:n.updateToast,promise:n.promiseToast}),[e,n])}function pz(){const n=new Set;function e(t){n.forEach(r=>r(t))}return{" subscribe":function(r){return n.add(r),()=>{n.delete(r)}},add(t){const r=t.id||ET("toast"),i={...t,id:r,transitionStatus:"starting"};return e({action:"add",options:i}),r},close(t){e({action:"close",options:{id:t}})},update(t,r){e({action:"update",options:{...r,id:t}})},promise(t,r){let i=t;return e({action:"promise",options:{...r,promise:t,setPromise(s){i=s}}}),i}}}const TT=pz(),mz={error:bD,info:ED,loading:iC,success:kD,warning:ID};function gz({children:n,position:e="bottom-right",...t}){return E.jsxs(Z_,{toastManager:TT,...t,children:[n,E.jsx(yz,{position:e})]})}function yz({position:n="bottom-right"}){const{toasts:e}=hz(),t=n.startsWith("top");return E.jsx(dz,{"data-slot":"toast-portal",children:E.jsx(tz,{className:yn("fixed z-50 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]","data-[position*=top]:top-(--toast-inset)","data-[position*=bottom]:bottom-(--toast-inset)","data-[position*=left]:left-(--toast-inset)","data-[position*=right]:right-(--toast-inset)","data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2"),"data-position":n,"data-slot":"toast-viewport",children:e.map(r=>{const i=r.type?mz[r.type]:null;return E.jsx(lz,{className:yn("absolute z-[calc(9999-var(--toast-index))] h-(--toast-calc-height) w-full select-none rounded-lg border bg-popover bg-clip-padding text-popover-foreground shadow-lg [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]","data-[position*=right]:right-0 data-[position*=right]:left-auto","data-[position*=left]:right-auto data-[position*=left]:left-0","data-[position*=center]:right-0 data-[position*=center]:left-0","data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top","data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom","after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full","data-[position*=top]:after:top-full","data-[position*=bottom]:after:bottom-full","[--toast-calc-height:var(--toast-frontmost-height,var(--toast-height))] [--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]","data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]","data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]","data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]","data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]","data-limited:opacity-0","data-expanded:h-(--toast-height)","data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]","data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]","data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]","data-ending-style:opacity-0","data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(100%+var(--toast-inset)))]","data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]","data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]","data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]","data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]"),"data-position":n,swipeDirection:n.includes("center")?[t?"up":"down"]:n.includes("left")?["left",t?"up":"down"]:["right",t?"up":"down"],toast:r,children:E.jsxs(az,{className:"pointer-events-auto flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3 text-sm transition-opacity duration-250 data-behind:pointer-events-none data-behind:opacity-0 data-expanded:opacity-100",children:[E.jsxs("div",{className:"flex gap-2",children:[i&&E.jsx("div",{className:"[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","data-slot":"toast-icon",children:E.jsx(i,{className:"in-data-[type=loading]:animate-spin in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80"})}),E.jsxs("div",{className:"flex flex-col gap-0.5",children:[E.jsx(uz,{className:"font-medium","data-slot":"toast-title"}),E.jsx(cz,{className:"text-muted-foreground","data-slot":"toast-description"})]})]}),r.actionProps&&E.jsx(fz,{className:uT({size:"xs"}),"data-slot":"toast-action",children:r.actionProps.children})]})},r.id)})})})}class vz extends b.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){if(this.state.error){const e=this.state.error,t=e instanceof mn;return E.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:E.jsx("div",{className:"max-w-md w-full",children:E.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-6",children:[E.jsx("h1",{className:"text-2xl font-bold text-destructive mb-4",children:"Something went wrong"}),E.jsx("p",{className:"text-destructive/90 mb-4",children:e.message}),t&&E.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Error code: ",e.status]}),E.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"Reload page"})]})})})}return this.props.children}}function xz(){const[n,e]=b.useState([]),[t,r]=b.useState(!0);return b.useEffect(()=>{wy().then(i=>{e(i),r(!1)}).catch(i=>{console.error("Failed to fetch sources:",i);const s=i instanceof mn?i.message:"Failed to load data sources";TT.add({title:s,type:"error"}),r(!1)})},[]),E.jsx(vz,{children:E.jsx(gz,{children:E.jsx(nA,{children:E.jsx(P4,{children:E.jsxs(fo,{path:"/",element:E.jsx(GI,{sources:n,isLoading:t}),children:[E.jsx(fo,{index:!0,element:E.jsx(QI,{})}),E.jsx(fo,{path:"requests",element:E.jsx(iD,{})}),E.jsx(fo,{path:"source/:sourceId",element:E.jsx(DD,{})}),E.jsx(fo,{path:"source/:sourceId/tool/:toolName",element:E.jsx(Q_,{})}),E.jsx(fo,{path:"*",element:E.jsx(X_,{})})]})})})})})}AM.createRoot(document.getElementById("root")).render(E.jsx(b.StrictMode,{children:E.jsx(xz,{})}));