@qodalis/console-module-data-explorer 0.0.0-stage → 1.0.0-beta.33

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,53 @@
1
+ /*! @qodalis/console-module-data-explorer 1.0.0-beta.33 */
2
+ var Qw=Object.defineProperty;var Uw=(r,e,t)=>e in r?Qw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Vc=(r,e,t)=>Uw(r,typeof e!="symbol"?e+"":e,t);const $w="modulepreload",Kw=function(r){return"/"+r},Jm={},Gw=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let a=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=a(t.map(d=>{if(d=Kw(d),d in Jm)return;Jm[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":$w,p||(v.as="script"),v.crossOrigin="",v.href=d,h&&v.setAttribute("nonce",h),document.head.appendChild(v),p)return new Promise((w,k)=>{v.addEventListener("load",w),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&o(u.reason);return e().catch(o)})};var Qc={exports:{}},Ws={},Uc={exports:{}},be={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Zm;function Xw(){if(Zm)return be;Zm=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function v(O){return O===null||typeof O!="object"?null:(O=g&&O[g]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function C(O,R,ue){this.props=O,this.context=R,this.refs=S,this.updater=ue||w}C.prototype.isReactComponent={},C.prototype.setState=function(O,R){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,R,"setState")},C.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function P(){}P.prototype=C.prototype;function D(O,R,ue){this.props=O,this.context=R,this.refs=S,this.updater=ue||w}var M=D.prototype=new P;M.constructor=D,k(M,C.prototype),M.isPureReactComponent=!0;var Q=Array.isArray,B=Object.prototype.hasOwnProperty,I={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function ie(O,R,ue){var ye,j={},ee=null,le=null;if(R!=null)for(ye in R.ref!==void 0&&(le=R.ref),R.key!==void 0&&(ee=""+R.key),R)B.call(R,ye)&&!H.hasOwnProperty(ye)&&(j[ye]=R[ye]);var ve=arguments.length-2;if(ve===1)j.children=ue;else if(1<ve){for(var Ee=Array(ve),zt=0;zt<ve;zt++)Ee[zt]=arguments[zt+2];j.children=Ee}if(O&&O.defaultProps)for(ye in ve=O.defaultProps,ve)j[ye]===void 0&&(j[ye]=ve[ye]);return{$$typeof:r,type:O,key:ee,ref:le,props:j,_owner:I.current}}function de(O,R){return{$$typeof:r,type:O.type,key:R,ref:O.ref,props:O.props,_owner:O._owner}}function Se(O){return typeof O=="object"&&O!==null&&O.$$typeof===r}function ge(O){var R={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(ue){return R[ue]})}var J=/\/+/g;function fe(O,R){return typeof O=="object"&&O!==null&&O.key!=null?ge(""+O.key):R.toString(36)}function he(O,R,ue,ye,j){var ee=typeof O;(ee==="undefined"||ee==="boolean")&&(O=null);var le=!1;if(O===null)le=!0;else switch(ee){case"string":case"number":le=!0;break;case"object":switch(O.$$typeof){case r:case e:le=!0}}if(le)return le=O,j=j(le),O=ye===""?"."+fe(le,0):ye,Q(j)?(ue="",O!=null&&(ue=O.replace(J,"$&/")+"/"),he(j,R,ue,"",function(zt){return zt})):j!=null&&(Se(j)&&(j=de(j,ue+(!j.key||le&&le.key===j.key?"":(""+j.key).replace(J,"$&/")+"/")+O)),R.push(j)),1;if(le=0,ye=ye===""?".":ye+":",Q(O))for(var ve=0;ve<O.length;ve++){ee=O[ve];var Ee=ye+fe(ee,ve);le+=he(ee,R,ue,Ee,j)}else if(Ee=v(O),typeof Ee=="function")for(O=Ee.call(O),ve=0;!(ee=O.next()).done;)ee=ee.value,Ee=ye+fe(ee,ve++),le+=he(ee,R,ue,Ee,j);else if(ee==="object")throw R=String(O),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.");return le}function xe(O,R,ue){if(O==null)return O;var ye=[],j=0;return he(O,ye,"","",function(ee){return R.call(ue,ee,j++)}),ye}function Ae(O){if(O._status===-1){var R=O._result;R=R(),R.then(function(ue){(O._status===0||O._status===-1)&&(O._status=1,O._result=ue)},function(ue){(O._status===0||O._status===-1)&&(O._status=2,O._result=ue)}),O._status===-1&&(O._status=0,O._result=R)}if(O._status===1)return O._result.default;throw O._result}var we={current:null},$={transition:null},z={ReactCurrentDispatcher:we,ReactCurrentBatchConfig:$,ReactCurrentOwner:I};function W(){throw Error("act(...) is not supported in production builds of React.")}return be.Children={map:xe,forEach:function(O,R,ue){xe(O,function(){R.apply(this,arguments)},ue)},count:function(O){var R=0;return xe(O,function(){R++}),R},toArray:function(O){return xe(O,function(R){return R})||[]},only:function(O){if(!Se(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},be.Component=C,be.Fragment=t,be.Profiler=i,be.PureComponent=D,be.StrictMode=n,be.Suspense=h,be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z,be.act=W,be.cloneElement=function(O,R,ue){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var ye=k({},O.props),j=O.key,ee=O.ref,le=O._owner;if(R!=null){if(R.ref!==void 0&&(ee=R.ref,le=I.current),R.key!==void 0&&(j=""+R.key),O.type&&O.type.defaultProps)var ve=O.type.defaultProps;for(Ee in R)B.call(R,Ee)&&!H.hasOwnProperty(Ee)&&(ye[Ee]=R[Ee]===void 0&&ve!==void 0?ve[Ee]:R[Ee])}var Ee=arguments.length-2;if(Ee===1)ye.children=ue;else if(1<Ee){ve=Array(Ee);for(var zt=0;zt<Ee;zt++)ve[zt]=arguments[zt+2];ye.children=ve}return{$$typeof:r,type:O.type,key:j,ref:ee,props:ye,_owner:le}},be.createContext=function(O){return O={$$typeof:a,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:o,_context:O},O.Consumer=O},be.createElement=ie,be.createFactory=function(O){var R=ie.bind(null,O);return R.type=O,R},be.createRef=function(){return{current:null}},be.forwardRef=function(O){return{$$typeof:u,render:O}},be.isValidElement=Se,be.lazy=function(O){return{$$typeof:p,_payload:{_status:-1,_result:O},_init:Ae}},be.memo=function(O,R){return{$$typeof:d,type:O,compare:R===void 0?null:R}},be.startTransition=function(O){var R=$.transition;$.transition={};try{O()}finally{$.transition=R}},be.unstable_act=W,be.useCallback=function(O,R){return we.current.useCallback(O,R)},be.useContext=function(O){return we.current.useContext(O)},be.useDebugValue=function(){},be.useDeferredValue=function(O){return we.current.useDeferredValue(O)},be.useEffect=function(O,R){return we.current.useEffect(O,R)},be.useId=function(){return we.current.useId()},be.useImperativeHandle=function(O,R,ue){return we.current.useImperativeHandle(O,R,ue)},be.useInsertionEffect=function(O,R){return we.current.useInsertionEffect(O,R)},be.useLayoutEffect=function(O,R){return we.current.useLayoutEffect(O,R)},be.useMemo=function(O,R){return we.current.useMemo(O,R)},be.useReducer=function(O,R,ue){return we.current.useReducer(O,R,ue)},be.useRef=function(O){return we.current.useRef(O)},be.useState=function(O){return we.current.useState(O)},be.useSyncExternalStore=function(O,R,ue){return we.current.useSyncExternalStore(O,R,ue)},be.useTransition=function(){return we.current.useTransition()},be.version="18.3.1",be}var eg;function _f(){return eg||(eg=1,Uc.exports=Xw()),Uc.exports}/**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var tg;function Yw(){if(tg)return Ws;tg=1;var r=_f(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(u,h,d){var p,g={},v=null,w=null;d!==void 0&&(v=""+d),h.key!==void 0&&(v=""+h.key),h.ref!==void 0&&(w=h.ref);for(p in h)n.call(h,p)&&!o.hasOwnProperty(p)&&(g[p]=h[p]);if(u&&u.defaultProps)for(p in h=u.defaultProps,h)g[p]===void 0&&(g[p]=h[p]);return{$$typeof:e,type:u,key:v,ref:w,props:g,_owner:i.current}}return Ws.Fragment=t,Ws.jsx=a,Ws.jsxs=a,Ws}var ng;function Jw(){return ng||(ng=1,Qc.exports=Yw()),Qc.exports}var E=Jw(),oe=_f(),Il={},$c={exports:{}},Lt={},Kc={exports:{}},Gc={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var rg;function Zw(){return rg||(rg=1,(function(r){function e($,z){var W=$.length;$.push(z);e:for(;0<W;){var O=W-1>>>1,R=$[O];if(0<i(R,z))$[O]=z,$[W]=R,W=O;else break e}}function t($){return $.length===0?null:$[0]}function n($){if($.length===0)return null;var z=$[0],W=$.pop();if(W!==z){$[0]=W;e:for(var O=0,R=$.length,ue=R>>>1;O<ue;){var ye=2*(O+1)-1,j=$[ye],ee=ye+1,le=$[ee];if(0>i(j,W))ee<R&&0>i(le,j)?($[O]=le,$[ee]=W,O=ee):($[O]=j,$[ye]=W,O=ye);else if(ee<R&&0>i(le,W))$[O]=le,$[ee]=W,O=ee;else break e}}return z}function i($,z){var W=$.sortIndex-z.sortIndex;return W!==0?W:$.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;r.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();r.unstable_now=function(){return a.now()-u}}var h=[],d=[],p=1,g=null,v=3,w=!1,k=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M($){for(var z=t(d);z!==null;){if(z.callback===null)n(d);else if(z.startTime<=$)n(d),z.sortIndex=z.expirationTime,e(h,z);else break;z=t(d)}}function Q($){if(S=!1,M($),!k)if(t(h)!==null)k=!0,Ae(B);else{var z=t(d);z!==null&&we(Q,z.startTime-$)}}function B($,z){k=!1,S&&(S=!1,P(ie),ie=-1),w=!0;var W=v;try{for(M(z),g=t(h);g!==null&&(!(g.expirationTime>z)||$&&!ge());){var O=g.callback;if(typeof O=="function"){g.callback=null,v=g.priorityLevel;var R=O(g.expirationTime<=z);z=r.unstable_now(),typeof R=="function"?g.callback=R:g===t(h)&&n(h),M(z)}else n(h);g=t(h)}if(g!==null)var ue=!0;else{var ye=t(d);ye!==null&&we(Q,ye.startTime-z),ue=!1}return ue}finally{g=null,v=W,w=!1}}var I=!1,H=null,ie=-1,de=5,Se=-1;function ge(){return!(r.unstable_now()-Se<de)}function J(){if(H!==null){var $=r.unstable_now();Se=$;var z=!0;try{z=H(!0,$)}finally{z?fe():(I=!1,H=null)}}else I=!1}var fe;if(typeof D=="function")fe=function(){D(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,xe=he.port2;he.port1.onmessage=J,fe=function(){xe.postMessage(null)}}else fe=function(){C(J,0)};function Ae($){H=$,I||(I=!0,fe())}function we($,z){ie=C(function(){$(r.unstable_now())},z)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_continueExecution=function(){k||w||(k=!0,Ae(B))},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):de=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return v},r.unstable_getFirstCallbackNode=function(){return t(h)},r.unstable_next=function($){switch(v){case 1:case 2:case 3:var z=3;break;default:z=v}var W=v;v=z;try{return $()}finally{v=W}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function($,z){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var W=v;v=$;try{return z()}finally{v=W}},r.unstable_scheduleCallback=function($,z,W){var O=r.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?O+W:O):W=O,$){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=W+R,$={id:p++,callback:z,priorityLevel:$,startTime:W,expirationTime:R,sortIndex:-1},W>O?($.sortIndex=W,e(d,$),t(h)===null&&$===t(d)&&(S?(P(ie),ie=-1):S=!0,we(Q,W-O))):($.sortIndex=R,e(h,$),k||w||(k=!0,Ae(B))),$},r.unstable_shouldYield=ge,r.unstable_wrapCallback=function($){var z=v;return function(){var W=v;v=z;try{return $.apply(this,arguments)}finally{v=W}}}})(Gc)),Gc}var ig;function ek(){return ig||(ig=1,Kc.exports=Zw()),Kc.exports}/**
27
+ * @license React
28
+ * react-dom.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var sg;function tk(){if(sg)return Lt;sg=1;var r=_f(),e=ek();function t(s){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+s,c=1;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function o(s,l){a(s,l),a(s+"Capture",l)}function a(s,l){for(i[s]=l,s=0;s<l.length;s++)n.add(l[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,d=/^[: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]*$/,p={},g={};function v(s){return h.call(g,s)?!0:h.call(p,s)?!1:d.test(s)?g[s]=!0:(p[s]=!0,!1)}function w(s,l,c,f){if(c!==null&&c.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return f?!1:c!==null?!c.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function k(s,l,c,f){if(l===null||typeof l>"u"||w(s,l,c,f))return!0;if(f)return!1;if(c!==null)switch(c.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function S(s,l,c,f,m,y,x){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=f,this.attributeNamespace=m,this.mustUseProperty=c,this.propertyName=s,this.type=l,this.sanitizeURL=y,this.removeEmptyString=x}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){C[s]=new S(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var l=s[0];C[l]=new S(l,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){C[s]=new S(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){C[s]=new S(s,2,!1,s,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(s){C[s]=new S(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){C[s]=new S(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){C[s]=new S(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){C[s]=new S(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){C[s]=new S(s,5,!1,s.toLowerCase(),null,!1,!1)});var P=/[\-:]([a-z])/g;function D(s){return s[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(s){var l=s.replace(P,D);C[l]=new S(l,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var l=s.replace(P,D);C[l]=new S(l,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var l=s.replace(P,D);C[l]=new S(l,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){C[s]=new S(s,1,!1,s.toLowerCase(),null,!1,!1)}),C.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){C[s]=new S(s,1,!1,s.toLowerCase(),null,!0,!0)});function M(s,l,c,f){var m=C.hasOwnProperty(l)?C[l]:null;(m!==null?m.type!==0:f||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(k(l,c,m,f)&&(c=null),f||m===null?v(l)&&(c===null?s.removeAttribute(l):s.setAttribute(l,""+c)):m.mustUseProperty?s[m.propertyName]=c===null?m.type===3?!1:"":c:(l=m.attributeName,f=m.attributeNamespace,c===null?s.removeAttribute(l):(m=m.type,c=m===3||m===4&&c===!0?"":""+c,f?s.setAttributeNS(f,l,c):s.setAttribute(l,c))))}var Q=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,B=Symbol.for("react.element"),I=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),ie=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),Se=Symbol.for("react.provider"),ge=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),fe=Symbol.for("react.suspense"),he=Symbol.for("react.suspense_list"),xe=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),we=Symbol.for("react.offscreen"),$=Symbol.iterator;function z(s){return s===null||typeof s!="object"?null:(s=$&&s[$]||s["@@iterator"],typeof s=="function"?s:null)}var W=Object.assign,O;function R(s){if(O===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);O=l&&l[1]||""}return`
35
+ `+O+s}var ue=!1;function ye(s,l){if(!s||ue)return"";ue=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(N){var f=N}Reflect.construct(s,[],l)}else{try{l.call()}catch(N){f=N}s.call(l.prototype)}else{try{throw Error()}catch(N){f=N}s()}}catch(N){if(N&&f&&typeof N.stack=="string"){for(var m=N.stack.split(`
36
+ `),y=f.stack.split(`
37
+ `),x=m.length-1,b=y.length-1;1<=x&&0<=b&&m[x]!==y[b];)b--;for(;1<=x&&0<=b;x--,b--)if(m[x]!==y[b]){if(x!==1||b!==1)do if(x--,b--,0>b||m[x]!==y[b]){var A=`
38
+ `+m[x].replace(" at new "," at ");return s.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",s.displayName)),A}while(1<=x&&0<=b);break}}}finally{ue=!1,Error.prepareStackTrace=c}return(s=s?s.displayName||s.name:"")?R(s):""}function j(s){switch(s.tag){case 5:return R(s.type);case 16:return R("Lazy");case 13:return R("Suspense");case 19:return R("SuspenseList");case 0:case 2:case 15:return s=ye(s.type,!1),s;case 11:return s=ye(s.type.render,!1),s;case 1:return s=ye(s.type,!0),s;default:return""}}function ee(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case H:return"Fragment";case I:return"Portal";case de:return"Profiler";case ie:return"StrictMode";case fe:return"Suspense";case he:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case ge:return(s.displayName||"Context")+".Consumer";case Se:return(s._context.displayName||"Context")+".Provider";case J:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case xe:return l=s.displayName||null,l!==null?l:ee(s.type)||"Memo";case Ae:l=s._payload,s=s._init;try{return ee(s(l))}catch{}}return null}function le(s){var l=s.type;switch(s.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=l.render,s=s.displayName||s.name||"",l.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ee(l);case 8:return l===ie?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function ve(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ee(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function zt(s){var l=Ee(s)?"checked":"value",c=Object.getOwnPropertyDescriptor(s.constructor.prototype,l),f=""+s[l];if(!s.hasOwnProperty(l)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,y=c.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(x){f=""+x,y.call(this,x)}}),Object.defineProperty(s,l,{enumerable:c.enumerable}),{getValue:function(){return f},setValue:function(x){f=""+x},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function _o(s){s._valueTracker||(s._valueTracker=zt(s))}function id(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var c=l.getValue(),f="";return s&&(f=Ee(s)?s.checked?"true":"false":s.value),s=f,s!==c?(l.setValue(s),!0):!1}function Oo(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ya(s,l){var c=l.checked;return W({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??s._wrapperState.initialChecked})}function sd(s,l){var c=l.defaultValue==null?"":l.defaultValue,f=l.checked!=null?l.checked:l.defaultChecked;c=ve(l.value!=null?l.value:c),s._wrapperState={initialChecked:f,initialValue:c,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function od(s,l){l=l.checked,l!=null&&M(s,"checked",l,!1)}function Ja(s,l){od(s,l);var c=ve(l.value),f=l.type;if(c!=null)f==="number"?(c===0&&s.value===""||s.value!=c)&&(s.value=""+c):s.value!==""+c&&(s.value=""+c);else if(f==="submit"||f==="reset"){s.removeAttribute("value");return}l.hasOwnProperty("value")?Za(s,l.type,c):l.hasOwnProperty("defaultValue")&&Za(s,l.type,ve(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(s.defaultChecked=!!l.defaultChecked)}function ld(s,l,c){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var f=l.type;if(!(f!=="submit"&&f!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+s._wrapperState.initialValue,c||l===s.value||(s.value=l),s.defaultValue=l}c=s.name,c!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,c!==""&&(s.name=c)}function Za(s,l,c){(l!=="number"||Oo(s.ownerDocument)!==s)&&(c==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+c&&(s.defaultValue=""+c))}var rs=Array.isArray;function si(s,l,c,f){if(s=s.options,l){l={};for(var m=0;m<c.length;m++)l["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=l.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&f&&(s[c].defaultSelected=!0)}else{for(c=""+ve(c),l=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,f&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function eu(s,l){if(l.dangerouslySetInnerHTML!=null)throw Error(t(91));return W({},l,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function ad(s,l){var c=l.value;if(c==null){if(c=l.children,l=l.defaultValue,c!=null){if(l!=null)throw Error(t(92));if(rs(c)){if(1<c.length)throw Error(t(93));c=c[0]}l=c}l==null&&(l=""),c=l}s._wrapperState={initialValue:ve(c)}}function ud(s,l){var c=ve(l.value),f=ve(l.defaultValue);c!=null&&(c=""+c,c!==s.value&&(s.value=c),l.defaultValue==null&&s.defaultValue!==c&&(s.defaultValue=c)),f!=null&&(s.defaultValue=""+f)}function cd(s){var l=s.textContent;l===s._wrapperState.initialValue&&l!==""&&l!==null&&(s.value=l)}function hd(s){switch(s){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 tu(s,l){return s==null||s==="http://www.w3.org/1999/xhtml"?hd(l):s==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Po,fd=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,c,f,m){MSApp.execUnsafeLocalFunction(function(){return s(l,c,f,m)})}:s})(function(s,l){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=l;else{for(Po=Po||document.createElement("div"),Po.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=Po.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;l.firstChild;)s.appendChild(l.firstChild)}});function is(s,l){if(l){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=l;return}}s.textContent=l}var ss={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},Gx=["Webkit","ms","Moz","O"];Object.keys(ss).forEach(function(s){Gx.forEach(function(l){l=l+s.charAt(0).toUpperCase()+s.substring(1),ss[l]=ss[s]})});function dd(s,l,c){return l==null||typeof l=="boolean"||l===""?"":c||typeof l!="number"||l===0||ss.hasOwnProperty(s)&&ss[s]?(""+l).trim():l+"px"}function pd(s,l){s=s.style;for(var c in l)if(l.hasOwnProperty(c)){var f=c.indexOf("--")===0,m=dd(c,l[c],f);c==="float"&&(c="cssFloat"),f?s.setProperty(c,m):s[c]=m}}var Xx=W({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 nu(s,l){if(l){if(Xx[s]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(t(137,s));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(t(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(t(61))}if(l.style!=null&&typeof l.style!="object")throw Error(t(62))}}function ru(s,l){if(s.indexOf("-")===-1)return typeof l.is=="string";switch(s){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 iu=null;function su(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ou=null,oi=null,li=null;function md(s){if(s=_s(s)){if(typeof ou!="function")throw Error(t(280));var l=s.stateNode;l&&(l=Jo(l),ou(s.stateNode,s.type,l))}}function gd(s){oi?li?li.push(s):li=[s]:oi=s}function yd(){if(oi){var s=oi,l=li;if(li=oi=null,md(s),l)for(s=0;s<l.length;s++)md(l[s])}}function vd(s,l){return s(l)}function xd(){}var lu=!1;function wd(s,l,c){if(lu)return s(l,c);lu=!0;try{return vd(s,l,c)}finally{lu=!1,(oi!==null||li!==null)&&(xd(),yd())}}function os(s,l){var c=s.stateNode;if(c===null)return null;var f=Jo(c);if(f===null)return null;c=f[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(t(231,l,typeof c));return c}var au=!1;if(u)try{var ls={};Object.defineProperty(ls,"passive",{get:function(){au=!0}}),window.addEventListener("test",ls,ls),window.removeEventListener("test",ls,ls)}catch{au=!1}function Yx(s,l,c,f,m,y,x,b,A){var N=Array.prototype.slice.call(arguments,3);try{l.apply(c,N)}catch(V){this.onError(V)}}var as=!1,To=null,Mo=!1,uu=null,Jx={onError:function(s){as=!0,To=s}};function Zx(s,l,c,f,m,y,x,b,A){as=!1,To=null,Yx.apply(Jx,arguments)}function e1(s,l,c,f,m,y,x,b,A){if(Zx.apply(this,arguments),as){if(as){var N=To;as=!1,To=null}else throw Error(t(198));Mo||(Mo=!0,uu=N)}}function Mr(s){var l=s,c=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(c=l.return),s=l.return;while(s)}return l.tag===3?c:null}function kd(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function Sd(s){if(Mr(s)!==s)throw Error(t(188))}function t1(s){var l=s.alternate;if(!l){if(l=Mr(s),l===null)throw Error(t(188));return l!==s?null:s}for(var c=s,f=l;;){var m=c.return;if(m===null)break;var y=m.alternate;if(y===null){if(f=m.return,f!==null){c=f;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===c)return Sd(m),s;if(y===f)return Sd(m),l;y=y.sibling}throw Error(t(188))}if(c.return!==f.return)c=m,f=y;else{for(var x=!1,b=m.child;b;){if(b===c){x=!0,c=m,f=y;break}if(b===f){x=!0,f=m,c=y;break}b=b.sibling}if(!x){for(b=y.child;b;){if(b===c){x=!0,c=y,f=m;break}if(b===f){x=!0,f=y,c=m;break}b=b.sibling}if(!x)throw Error(t(189))}}if(c.alternate!==f)throw Error(t(190))}if(c.tag!==3)throw Error(t(188));return c.stateNode.current===c?s:l}function bd(s){return s=t1(s),s!==null?Cd(s):null}function Cd(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var l=Cd(s);if(l!==null)return l;s=s.sibling}return null}var Ad=e.unstable_scheduleCallback,Ed=e.unstable_cancelCallback,n1=e.unstable_shouldYield,r1=e.unstable_requestPaint,Ke=e.unstable_now,i1=e.unstable_getCurrentPriorityLevel,cu=e.unstable_ImmediatePriority,_d=e.unstable_UserBlockingPriority,Lo=e.unstable_NormalPriority,s1=e.unstable_LowPriority,Od=e.unstable_IdlePriority,No=null,wn=null;function o1(s){if(wn&&typeof wn.onCommitFiberRoot=="function")try{wn.onCommitFiberRoot(No,s,void 0,(s.current.flags&128)===128)}catch{}}var ln=Math.clz32?Math.clz32:u1,l1=Math.log,a1=Math.LN2;function u1(s){return s>>>=0,s===0?32:31-(l1(s)/a1|0)|0}var Do=64,Ro=4194304;function us(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Bo(s,l){var c=s.pendingLanes;if(c===0)return 0;var f=0,m=s.suspendedLanes,y=s.pingedLanes,x=c&268435455;if(x!==0){var b=x&~m;b!==0?f=us(b):(y&=x,y!==0&&(f=us(y)))}else x=c&~m,x!==0?f=us(x):y!==0&&(f=us(y));if(f===0)return 0;if(l!==0&&l!==f&&(l&m)===0&&(m=f&-f,y=l&-l,m>=y||m===16&&(y&4194240)!==0))return l;if((f&4)!==0&&(f|=c&16),l=s.entangledLanes,l!==0)for(s=s.entanglements,l&=f;0<l;)c=31-ln(l),m=1<<c,f|=s[c],l&=~m;return f}function c1(s,l){switch(s){case 1:case 2:case 4:return l+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 l+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 h1(s,l){for(var c=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes;0<y;){var x=31-ln(y),b=1<<x,A=m[x];A===-1?((b&c)===0||(b&f)!==0)&&(m[x]=c1(b,l)):A<=l&&(s.expiredLanes|=b),y&=~b}}function hu(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Pd(){var s=Do;return Do<<=1,(Do&4194240)===0&&(Do=64),s}function fu(s){for(var l=[],c=0;31>c;c++)l.push(s);return l}function cs(s,l,c){s.pendingLanes|=l,l!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,l=31-ln(l),s[l]=c}function f1(s,l){var c=s.pendingLanes&~l;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=l,s.mutableReadLanes&=l,s.entangledLanes&=l,l=s.entanglements;var f=s.eventTimes;for(s=s.expirationTimes;0<c;){var m=31-ln(c),y=1<<m;l[m]=0,f[m]=-1,s[m]=-1,c&=~y}}function du(s,l){var c=s.entangledLanes|=l;for(s=s.entanglements;c;){var f=31-ln(c),m=1<<f;m&l|s[f]&l&&(s[f]|=l),c&=~m}}var Ne=0;function Td(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Md,pu,Ld,Nd,Dd,mu=!1,Io=[],Yn=null,Jn=null,Zn=null,hs=new Map,fs=new Map,er=[],d1="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 Rd(s,l){switch(s){case"focusin":case"focusout":Yn=null;break;case"dragenter":case"dragleave":Jn=null;break;case"mouseover":case"mouseout":Zn=null;break;case"pointerover":case"pointerout":hs.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":fs.delete(l.pointerId)}}function ds(s,l,c,f,m,y){return s===null||s.nativeEvent!==y?(s={blockedOn:l,domEventName:c,eventSystemFlags:f,nativeEvent:y,targetContainers:[m]},l!==null&&(l=_s(l),l!==null&&pu(l)),s):(s.eventSystemFlags|=f,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function p1(s,l,c,f,m){switch(l){case"focusin":return Yn=ds(Yn,s,l,c,f,m),!0;case"dragenter":return Jn=ds(Jn,s,l,c,f,m),!0;case"mouseover":return Zn=ds(Zn,s,l,c,f,m),!0;case"pointerover":var y=m.pointerId;return hs.set(y,ds(hs.get(y)||null,s,l,c,f,m)),!0;case"gotpointercapture":return y=m.pointerId,fs.set(y,ds(fs.get(y)||null,s,l,c,f,m)),!0}return!1}function Bd(s){var l=Lr(s.target);if(l!==null){var c=Mr(l);if(c!==null){if(l=c.tag,l===13){if(l=kd(c),l!==null){s.blockedOn=l,Dd(s.priority,function(){Ld(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function zo(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var c=yu(s.domEventName,s.eventSystemFlags,l[0],s.nativeEvent);if(c===null){c=s.nativeEvent;var f=new c.constructor(c.type,c);iu=f,c.target.dispatchEvent(f),iu=null}else return l=_s(c),l!==null&&pu(l),s.blockedOn=c,!1;l.shift()}return!0}function Id(s,l,c){zo(s)&&c.delete(l)}function m1(){mu=!1,Yn!==null&&zo(Yn)&&(Yn=null),Jn!==null&&zo(Jn)&&(Jn=null),Zn!==null&&zo(Zn)&&(Zn=null),hs.forEach(Id),fs.forEach(Id)}function ps(s,l){s.blockedOn===l&&(s.blockedOn=null,mu||(mu=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,m1)))}function ms(s){function l(m){return ps(m,s)}if(0<Io.length){ps(Io[0],s);for(var c=1;c<Io.length;c++){var f=Io[c];f.blockedOn===s&&(f.blockedOn=null)}}for(Yn!==null&&ps(Yn,s),Jn!==null&&ps(Jn,s),Zn!==null&&ps(Zn,s),hs.forEach(l),fs.forEach(l),c=0;c<er.length;c++)f=er[c],f.blockedOn===s&&(f.blockedOn=null);for(;0<er.length&&(c=er[0],c.blockedOn===null);)Bd(c),c.blockedOn===null&&er.shift()}var ai=Q.ReactCurrentBatchConfig,jo=!0;function g1(s,l,c,f){var m=Ne,y=ai.transition;ai.transition=null;try{Ne=1,gu(s,l,c,f)}finally{Ne=m,ai.transition=y}}function y1(s,l,c,f){var m=Ne,y=ai.transition;ai.transition=null;try{Ne=4,gu(s,l,c,f)}finally{Ne=m,ai.transition=y}}function gu(s,l,c,f){if(jo){var m=yu(s,l,c,f);if(m===null)Du(s,l,f,Fo,c),Rd(s,f);else if(p1(m,s,l,c,f))f.stopPropagation();else if(Rd(s,f),l&4&&-1<d1.indexOf(s)){for(;m!==null;){var y=_s(m);if(y!==null&&Md(y),y=yu(s,l,c,f),y===null&&Du(s,l,f,Fo,c),y===m)break;m=y}m!==null&&f.stopPropagation()}else Du(s,l,f,null,c)}}var Fo=null;function yu(s,l,c,f){if(Fo=null,s=su(f),s=Lr(s),s!==null)if(l=Mr(s),l===null)s=null;else if(c=l.tag,c===13){if(s=kd(l),s!==null)return s;s=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null);return Fo=s,null}function zd(s){switch(s){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(i1()){case cu:return 1;case _d:return 4;case Lo:case s1:return 16;case Od:return 536870912;default:return 16}default:return 16}}var tr=null,vu=null,Ho=null;function jd(){if(Ho)return Ho;var s,l=vu,c=l.length,f,m="value"in tr?tr.value:tr.textContent,y=m.length;for(s=0;s<c&&l[s]===m[s];s++);var x=c-s;for(f=1;f<=x&&l[c-f]===m[y-f];f++);return Ho=m.slice(s,1<f?1-f:void 0)}function Wo(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function qo(){return!0}function Fd(){return!1}function jt(s){function l(c,f,m,y,x){this._reactName=c,this._targetInst=m,this.type=f,this.nativeEvent=y,this.target=x,this.currentTarget=null;for(var b in s)s.hasOwnProperty(b)&&(c=s[b],this[b]=c?c(y):y[b]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?qo:Fd,this.isPropagationStopped=Fd,this}return W(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=qo)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=qo)},persist:function(){},isPersistent:qo}),l}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xu=jt(ui),gs=W({},ui,{view:0,detail:0}),v1=jt(gs),wu,ku,ys,Vo=W({},gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bu,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ys&&(ys&&s.type==="mousemove"?(wu=s.screenX-ys.screenX,ku=s.screenY-ys.screenY):ku=wu=0,ys=s),wu)},movementY:function(s){return"movementY"in s?s.movementY:ku}}),Hd=jt(Vo),x1=W({},Vo,{dataTransfer:0}),w1=jt(x1),k1=W({},gs,{relatedTarget:0}),Su=jt(k1),S1=W({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),b1=jt(S1),C1=W({},ui,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),A1=jt(C1),E1=W({},ui,{data:0}),Wd=jt(E1),_1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},O1={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"},P1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function T1(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=P1[s])?!!l[s]:!1}function bu(){return T1}var M1=W({},gs,{key:function(s){if(s.key){var l=_1[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Wo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?O1[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bu,charCode:function(s){return s.type==="keypress"?Wo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Wo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),L1=jt(M1),N1=W({},Vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qd=jt(N1),D1=W({},gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bu}),R1=jt(D1),B1=W({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),I1=jt(B1),z1=W({},Vo,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),j1=jt(z1),F1=[9,13,27,32],Cu=u&&"CompositionEvent"in window,vs=null;u&&"documentMode"in document&&(vs=document.documentMode);var H1=u&&"TextEvent"in window&&!vs,Vd=u&&(!Cu||vs&&8<vs&&11>=vs),Qd=" ",Ud=!1;function $d(s,l){switch(s){case"keyup":return F1.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kd(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ci=!1;function W1(s,l){switch(s){case"compositionend":return Kd(l);case"keypress":return l.which!==32?null:(Ud=!0,Qd);case"textInput":return s=l.data,s===Qd&&Ud?null:s;default:return null}}function q1(s,l){if(ci)return s==="compositionend"||!Cu&&$d(s,l)?(s=jd(),Ho=vu=tr=null,ci=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Vd&&l.locale!=="ko"?null:l.data;default:return null}}var V1={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 Gd(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!V1[s.type]:l==="textarea"}function Xd(s,l,c,f){gd(f),l=Go(l,"onChange"),0<l.length&&(c=new xu("onChange","change",null,c,f),s.push({event:c,listeners:l}))}var xs=null,ws=null;function Q1(s){pp(s,0)}function Qo(s){var l=mi(s);if(id(l))return s}function U1(s,l){if(s==="change")return l}var Yd=!1;if(u){var Au;if(u){var Eu="oninput"in document;if(!Eu){var Jd=document.createElement("div");Jd.setAttribute("oninput","return;"),Eu=typeof Jd.oninput=="function"}Au=Eu}else Au=!1;Yd=Au&&(!document.documentMode||9<document.documentMode)}function Zd(){xs&&(xs.detachEvent("onpropertychange",ep),ws=xs=null)}function ep(s){if(s.propertyName==="value"&&Qo(ws)){var l=[];Xd(l,ws,s,su(s)),wd(Q1,l)}}function $1(s,l,c){s==="focusin"?(Zd(),xs=l,ws=c,xs.attachEvent("onpropertychange",ep)):s==="focusout"&&Zd()}function K1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Qo(ws)}function G1(s,l){if(s==="click")return Qo(l)}function X1(s,l){if(s==="input"||s==="change")return Qo(l)}function Y1(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var an=typeof Object.is=="function"?Object.is:Y1;function ks(s,l){if(an(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var c=Object.keys(s),f=Object.keys(l);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var m=c[f];if(!h.call(l,m)||!an(s[m],l[m]))return!1}return!0}function tp(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function np(s,l){var c=tp(s);s=0;for(var f;c;){if(c.nodeType===3){if(f=s+c.textContent.length,s<=l&&f>=l)return{node:c,offset:l-s};s=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=tp(c)}}function rp(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?rp(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function ip(){for(var s=window,l=Oo();l instanceof s.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)s=l.contentWindow;else break;l=Oo(s.document)}return l}function _u(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}function J1(s){var l=ip(),c=s.focusedElem,f=s.selectionRange;if(l!==c&&c&&c.ownerDocument&&rp(c.ownerDocument.documentElement,c)){if(f!==null&&_u(c)){if(l=f.start,s=f.end,s===void 0&&(s=l),"selectionStart"in c)c.selectionStart=l,c.selectionEnd=Math.min(s,c.value.length);else if(s=(l=c.ownerDocument||document)&&l.defaultView||window,s.getSelection){s=s.getSelection();var m=c.textContent.length,y=Math.min(f.start,m);f=f.end===void 0?y:Math.min(f.end,m),!s.extend&&y>f&&(m=f,f=y,y=m),m=np(c,y);var x=np(c,f);m&&x&&(s.rangeCount!==1||s.anchorNode!==m.node||s.anchorOffset!==m.offset||s.focusNode!==x.node||s.focusOffset!==x.offset)&&(l=l.createRange(),l.setStart(m.node,m.offset),s.removeAllRanges(),y>f?(s.addRange(l),s.extend(x.node,x.offset)):(l.setEnd(x.node,x.offset),s.addRange(l)))}}for(l=[],s=c;s=s.parentNode;)s.nodeType===1&&l.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<l.length;c++)s=l[c],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Z1=u&&"documentMode"in document&&11>=document.documentMode,hi=null,Ou=null,Ss=null,Pu=!1;function sp(s,l,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Pu||hi==null||hi!==Oo(f)||(f=hi,"selectionStart"in f&&_u(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ss&&ks(Ss,f)||(Ss=f,f=Go(Ou,"onSelect"),0<f.length&&(l=new xu("onSelect","select",null,l,c),s.push({event:l,listeners:f}),l.target=hi)))}function Uo(s,l){var c={};return c[s.toLowerCase()]=l.toLowerCase(),c["Webkit"+s]="webkit"+l,c["Moz"+s]="moz"+l,c}var fi={animationend:Uo("Animation","AnimationEnd"),animationiteration:Uo("Animation","AnimationIteration"),animationstart:Uo("Animation","AnimationStart"),transitionend:Uo("Transition","TransitionEnd")},Tu={},op={};u&&(op=document.createElement("div").style,"AnimationEvent"in window||(delete fi.animationend.animation,delete fi.animationiteration.animation,delete fi.animationstart.animation),"TransitionEvent"in window||delete fi.transitionend.transition);function $o(s){if(Tu[s])return Tu[s];if(!fi[s])return s;var l=fi[s],c;for(c in l)if(l.hasOwnProperty(c)&&c in op)return Tu[s]=l[c];return s}var lp=$o("animationend"),ap=$o("animationiteration"),up=$o("animationstart"),cp=$o("transitionend"),hp=new Map,fp="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 nr(s,l){hp.set(s,l),o(l,[s])}for(var Mu=0;Mu<fp.length;Mu++){var Lu=fp[Mu],ew=Lu.toLowerCase(),tw=Lu[0].toUpperCase()+Lu.slice(1);nr(ew,"on"+tw)}nr(lp,"onAnimationEnd"),nr(ap,"onAnimationIteration"),nr(up,"onAnimationStart"),nr("dblclick","onDoubleClick"),nr("focusin","onFocus"),nr("focusout","onBlur"),nr(cp,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bs="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(" "),nw=new Set("cancel close invalid load scroll toggle".split(" ").concat(bs));function dp(s,l,c){var f=s.type||"unknown-event";s.currentTarget=c,e1(f,l,void 0,s),s.currentTarget=null}function pp(s,l){l=(l&4)!==0;for(var c=0;c<s.length;c++){var f=s[c],m=f.event;f=f.listeners;e:{var y=void 0;if(l)for(var x=f.length-1;0<=x;x--){var b=f[x],A=b.instance,N=b.currentTarget;if(b=b.listener,A!==y&&m.isPropagationStopped())break e;dp(m,b,N),y=A}else for(x=0;x<f.length;x++){if(b=f[x],A=b.instance,N=b.currentTarget,b=b.listener,A!==y&&m.isPropagationStopped())break e;dp(m,b,N),y=A}}}if(Mo)throw s=uu,Mo=!1,uu=null,s}function Fe(s,l){var c=l[Fu];c===void 0&&(c=l[Fu]=new Set);var f=s+"__bubble";c.has(f)||(mp(l,s,2,!1),c.add(f))}function Nu(s,l,c){var f=0;l&&(f|=4),mp(c,s,f,l)}var Ko="_reactListening"+Math.random().toString(36).slice(2);function Cs(s){if(!s[Ko]){s[Ko]=!0,n.forEach(function(c){c!=="selectionchange"&&(nw.has(c)||Nu(c,!1,s),Nu(c,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Ko]||(l[Ko]=!0,Nu("selectionchange",!1,l))}}function mp(s,l,c,f){switch(zd(l)){case 1:var m=g1;break;case 4:m=y1;break;default:m=gu}c=m.bind(null,l,c,s),m=void 0,!au||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),f?m!==void 0?s.addEventListener(l,c,{capture:!0,passive:m}):s.addEventListener(l,c,!0):m!==void 0?s.addEventListener(l,c,{passive:m}):s.addEventListener(l,c,!1)}function Du(s,l,c,f,m){var y=f;if((l&1)===0&&(l&2)===0&&f!==null)e:for(;;){if(f===null)return;var x=f.tag;if(x===3||x===4){var b=f.stateNode.containerInfo;if(b===m||b.nodeType===8&&b.parentNode===m)break;if(x===4)for(x=f.return;x!==null;){var A=x.tag;if((A===3||A===4)&&(A=x.stateNode.containerInfo,A===m||A.nodeType===8&&A.parentNode===m))return;x=x.return}for(;b!==null;){if(x=Lr(b),x===null)return;if(A=x.tag,A===5||A===6){f=y=x;continue e}b=b.parentNode}}f=f.return}wd(function(){var N=y,V=su(c),U=[];e:{var q=hp.get(s);if(q!==void 0){var Z=xu,ne=s;switch(s){case"keypress":if(Wo(c)===0)break e;case"keydown":case"keyup":Z=L1;break;case"focusin":ne="focus",Z=Su;break;case"focusout":ne="blur",Z=Su;break;case"beforeblur":case"afterblur":Z=Su;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=Hd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=w1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=R1;break;case lp:case ap:case up:Z=b1;break;case cp:Z=I1;break;case"scroll":Z=v1;break;case"wheel":Z=j1;break;case"copy":case"cut":case"paste":Z=A1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=qd}var se=(l&4)!==0,Ge=!se&&s==="scroll",T=se?q!==null?q+"Capture":null:q;se=[];for(var _=N,L;_!==null;){L=_;var K=L.stateNode;if(L.tag===5&&K!==null&&(L=K,T!==null&&(K=os(_,T),K!=null&&se.push(As(_,K,L)))),Ge)break;_=_.return}0<se.length&&(q=new Z(q,ne,null,c,V),U.push({event:q,listeners:se}))}}if((l&7)===0){e:{if(q=s==="mouseover"||s==="pointerover",Z=s==="mouseout"||s==="pointerout",q&&c!==iu&&(ne=c.relatedTarget||c.fromElement)&&(Lr(ne)||ne[Bn]))break e;if((Z||q)&&(q=V.window===V?V:(q=V.ownerDocument)?q.defaultView||q.parentWindow:window,Z?(ne=c.relatedTarget||c.toElement,Z=N,ne=ne?Lr(ne):null,ne!==null&&(Ge=Mr(ne),ne!==Ge||ne.tag!==5&&ne.tag!==6)&&(ne=null)):(Z=null,ne=N),Z!==ne)){if(se=Hd,K="onMouseLeave",T="onMouseEnter",_="mouse",(s==="pointerout"||s==="pointerover")&&(se=qd,K="onPointerLeave",T="onPointerEnter",_="pointer"),Ge=Z==null?q:mi(Z),L=ne==null?q:mi(ne),q=new se(K,_+"leave",Z,c,V),q.target=Ge,q.relatedTarget=L,K=null,Lr(V)===N&&(se=new se(T,_+"enter",ne,c,V),se.target=L,se.relatedTarget=Ge,K=se),Ge=K,Z&&ne)t:{for(se=Z,T=ne,_=0,L=se;L;L=di(L))_++;for(L=0,K=T;K;K=di(K))L++;for(;0<_-L;)se=di(se),_--;for(;0<L-_;)T=di(T),L--;for(;_--;){if(se===T||T!==null&&se===T.alternate)break t;se=di(se),T=di(T)}se=null}else se=null;Z!==null&&gp(U,q,Z,se,!1),ne!==null&&Ge!==null&&gp(U,Ge,ne,se,!0)}}e:{if(q=N?mi(N):window,Z=q.nodeName&&q.nodeName.toLowerCase(),Z==="select"||Z==="input"&&q.type==="file")var ae=U1;else if(Gd(q))if(Yd)ae=X1;else{ae=K1;var pe=$1}else(Z=q.nodeName)&&Z.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(ae=G1);if(ae&&(ae=ae(s,N))){Xd(U,ae,c,V);break e}pe&&pe(s,q,N),s==="focusout"&&(pe=q._wrapperState)&&pe.controlled&&q.type==="number"&&Za(q,"number",q.value)}switch(pe=N?mi(N):window,s){case"focusin":(Gd(pe)||pe.contentEditable==="true")&&(hi=pe,Ou=N,Ss=null);break;case"focusout":Ss=Ou=hi=null;break;case"mousedown":Pu=!0;break;case"contextmenu":case"mouseup":case"dragend":Pu=!1,sp(U,c,V);break;case"selectionchange":if(Z1)break;case"keydown":case"keyup":sp(U,c,V)}var me;if(Cu)e:{switch(s){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else ci?$d(s,c)&&(ke="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(ke="onCompositionStart");ke&&(Vd&&c.locale!=="ko"&&(ci||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&ci&&(me=jd()):(tr=V,vu="value"in tr?tr.value:tr.textContent,ci=!0)),pe=Go(N,ke),0<pe.length&&(ke=new Wd(ke,s,null,c,V),U.push({event:ke,listeners:pe}),me?ke.data=me:(me=Kd(c),me!==null&&(ke.data=me)))),(me=H1?W1(s,c):q1(s,c))&&(N=Go(N,"onBeforeInput"),0<N.length&&(V=new Wd("onBeforeInput","beforeinput",null,c,V),U.push({event:V,listeners:N}),V.data=me))}pp(U,l)})}function As(s,l,c){return{instance:s,listener:l,currentTarget:c}}function Go(s,l){for(var c=l+"Capture",f=[];s!==null;){var m=s,y=m.stateNode;m.tag===5&&y!==null&&(m=y,y=os(s,c),y!=null&&f.unshift(As(s,y,m)),y=os(s,l),y!=null&&f.push(As(s,y,m))),s=s.return}return f}function di(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function gp(s,l,c,f,m){for(var y=l._reactName,x=[];c!==null&&c!==f;){var b=c,A=b.alternate,N=b.stateNode;if(A!==null&&A===f)break;b.tag===5&&N!==null&&(b=N,m?(A=os(c,y),A!=null&&x.unshift(As(c,A,b))):m||(A=os(c,y),A!=null&&x.push(As(c,A,b)))),c=c.return}x.length!==0&&s.push({event:l,listeners:x})}var rw=/\r\n?/g,iw=/\u0000|\uFFFD/g;function yp(s){return(typeof s=="string"?s:""+s).replace(rw,`
39
+ `).replace(iw,"")}function Xo(s,l,c){if(l=yp(l),yp(s)!==l&&c)throw Error(t(425))}function Yo(){}var Ru=null,Bu=null;function Iu(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var zu=typeof setTimeout=="function"?setTimeout:void 0,sw=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,ow=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(s){return vp.resolve(null).then(s).catch(lw)}:zu;function lw(s){setTimeout(function(){throw s})}function ju(s,l){var c=l,f=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(f===0){s.removeChild(m),ms(l);return}f--}else c!=="$"&&c!=="$?"&&c!=="$!"||f++;c=m}while(c);ms(l)}function rr(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return s}function xp(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"){if(l===0)return s;l--}else c==="/$"&&l++}s=s.previousSibling}return null}var pi=Math.random().toString(36).slice(2),kn="__reactFiber$"+pi,Es="__reactProps$"+pi,Bn="__reactContainer$"+pi,Fu="__reactEvents$"+pi,aw="__reactListeners$"+pi,uw="__reactHandles$"+pi;function Lr(s){var l=s[kn];if(l)return l;for(var c=s.parentNode;c;){if(l=c[Bn]||c[kn]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(s=xp(s);s!==null;){if(c=s[kn])return c;s=xp(s)}return l}s=c,c=s.parentNode}return null}function _s(s){return s=s[kn]||s[Bn],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function mi(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(t(33))}function Jo(s){return s[Es]||null}var Hu=[],gi=-1;function ir(s){return{current:s}}function He(s){0>gi||(s.current=Hu[gi],Hu[gi]=null,gi--)}function Ie(s,l){gi++,Hu[gi]=s.current,s.current=l}var sr={},dt=ir(sr),_t=ir(!1),Nr=sr;function yi(s,l){var c=s.type.contextTypes;if(!c)return sr;var f=s.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===l)return f.__reactInternalMemoizedMaskedChildContext;var m={},y;for(y in c)m[y]=l[y];return f&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=l,s.__reactInternalMemoizedMaskedChildContext=m),m}function Ot(s){return s=s.childContextTypes,s!=null}function Zo(){He(_t),He(dt)}function wp(s,l,c){if(dt.current!==sr)throw Error(t(168));Ie(dt,l),Ie(_t,c)}function kp(s,l,c){var f=s.stateNode;if(l=l.childContextTypes,typeof f.getChildContext!="function")return c;f=f.getChildContext();for(var m in f)if(!(m in l))throw Error(t(108,le(s)||"Unknown",m));return W({},c,f)}function el(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||sr,Nr=dt.current,Ie(dt,s),Ie(_t,_t.current),!0}function Sp(s,l,c){var f=s.stateNode;if(!f)throw Error(t(169));c?(s=kp(s,l,Nr),f.__reactInternalMemoizedMergedChildContext=s,He(_t),He(dt),Ie(dt,s)):He(_t),Ie(_t,c)}var In=null,tl=!1,Wu=!1;function bp(s){In===null?In=[s]:In.push(s)}function cw(s){tl=!0,bp(s)}function or(){if(!Wu&&In!==null){Wu=!0;var s=0,l=Ne;try{var c=In;for(Ne=1;s<c.length;s++){var f=c[s];do f=f(!0);while(f!==null)}In=null,tl=!1}catch(m){throw In!==null&&(In=In.slice(s+1)),Ad(cu,or),m}finally{Ne=l,Wu=!1}}return null}var vi=[],xi=0,nl=null,rl=0,$t=[],Kt=0,Dr=null,zn=1,jn="";function Rr(s,l){vi[xi++]=rl,vi[xi++]=nl,nl=s,rl=l}function Cp(s,l,c){$t[Kt++]=zn,$t[Kt++]=jn,$t[Kt++]=Dr,Dr=s;var f=zn;s=jn;var m=32-ln(f)-1;f&=~(1<<m),c+=1;var y=32-ln(l)+m;if(30<y){var x=m-m%5;y=(f&(1<<x)-1).toString(32),f>>=x,m-=x,zn=1<<32-ln(l)+m|c<<m|f,jn=y+s}else zn=1<<y|c<<m|f,jn=s}function qu(s){s.return!==null&&(Rr(s,1),Cp(s,1,0))}function Vu(s){for(;s===nl;)nl=vi[--xi],vi[xi]=null,rl=vi[--xi],vi[xi]=null;for(;s===Dr;)Dr=$t[--Kt],$t[Kt]=null,jn=$t[--Kt],$t[Kt]=null,zn=$t[--Kt],$t[Kt]=null}var Ft=null,Ht=null,We=!1,un=null;function Ap(s,l){var c=Jt(5,null,null,0);c.elementType="DELETED",c.stateNode=l,c.return=s,l=s.deletions,l===null?(s.deletions=[c],s.flags|=16):l.push(c)}function Ep(s,l){switch(s.tag){case 5:var c=s.type;return l=l.nodeType!==1||c.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(s.stateNode=l,Ft=s,Ht=rr(l.firstChild),!0):!1;case 6:return l=s.pendingProps===""||l.nodeType!==3?null:l,l!==null?(s.stateNode=l,Ft=s,Ht=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(c=Dr!==null?{id:zn,overflow:jn}:null,s.memoizedState={dehydrated:l,treeContext:c,retryLane:1073741824},c=Jt(18,null,null,0),c.stateNode=l,c.return=s,s.child=c,Ft=s,Ht=null,!0):!1;default:return!1}}function Qu(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Uu(s){if(We){var l=Ht;if(l){var c=l;if(!Ep(s,l)){if(Qu(s))throw Error(t(418));l=rr(c.nextSibling);var f=Ft;l&&Ep(s,l)?Ap(f,c):(s.flags=s.flags&-4097|2,We=!1,Ft=s)}}else{if(Qu(s))throw Error(t(418));s.flags=s.flags&-4097|2,We=!1,Ft=s}}}function _p(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Ft=s}function il(s){if(s!==Ft)return!1;if(!We)return _p(s),We=!0,!1;var l;if((l=s.tag!==3)&&!(l=s.tag!==5)&&(l=s.type,l=l!=="head"&&l!=="body"&&!Iu(s.type,s.memoizedProps)),l&&(l=Ht)){if(Qu(s))throw Op(),Error(t(418));for(;l;)Ap(s,l),l=rr(l.nextSibling)}if(_p(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(t(317));e:{for(s=s.nextSibling,l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"){if(l===0){Ht=rr(s.nextSibling);break e}l--}else c!=="$"&&c!=="$!"&&c!=="$?"||l++}s=s.nextSibling}Ht=null}}else Ht=Ft?rr(s.stateNode.nextSibling):null;return!0}function Op(){for(var s=Ht;s;)s=rr(s.nextSibling)}function wi(){Ht=Ft=null,We=!1}function $u(s){un===null?un=[s]:un.push(s)}var hw=Q.ReactCurrentBatchConfig;function Os(s,l,c){if(s=c.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(t(309));var f=c.stateNode}if(!f)throw Error(t(147,s));var m=f,y=""+s;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===y?l.ref:(l=function(x){var b=m.refs;x===null?delete b[y]:b[y]=x},l._stringRef=y,l)}if(typeof s!="string")throw Error(t(284));if(!c._owner)throw Error(t(290,s))}return s}function sl(s,l){throw s=Object.prototype.toString.call(l),Error(t(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s))}function Pp(s){var l=s._init;return l(s._payload)}function Tp(s){function l(T,_){if(s){var L=T.deletions;L===null?(T.deletions=[_],T.flags|=16):L.push(_)}}function c(T,_){if(!s)return null;for(;_!==null;)l(T,_),_=_.sibling;return null}function f(T,_){for(T=new Map;_!==null;)_.key!==null?T.set(_.key,_):T.set(_.index,_),_=_.sibling;return T}function m(T,_){return T=pr(T,_),T.index=0,T.sibling=null,T}function y(T,_,L){return T.index=L,s?(L=T.alternate,L!==null?(L=L.index,L<_?(T.flags|=2,_):L):(T.flags|=2,_)):(T.flags|=1048576,_)}function x(T){return s&&T.alternate===null&&(T.flags|=2),T}function b(T,_,L,K){return _===null||_.tag!==6?(_=zc(L,T.mode,K),_.return=T,_):(_=m(_,L),_.return=T,_)}function A(T,_,L,K){var ae=L.type;return ae===H?V(T,_,L.props.children,K,L.key):_!==null&&(_.elementType===ae||typeof ae=="object"&&ae!==null&&ae.$$typeof===Ae&&Pp(ae)===_.type)?(K=m(_,L.props),K.ref=Os(T,_,L),K.return=T,K):(K=Pl(L.type,L.key,L.props,null,T.mode,K),K.ref=Os(T,_,L),K.return=T,K)}function N(T,_,L,K){return _===null||_.tag!==4||_.stateNode.containerInfo!==L.containerInfo||_.stateNode.implementation!==L.implementation?(_=jc(L,T.mode,K),_.return=T,_):(_=m(_,L.children||[]),_.return=T,_)}function V(T,_,L,K,ae){return _===null||_.tag!==7?(_=qr(L,T.mode,K,ae),_.return=T,_):(_=m(_,L),_.return=T,_)}function U(T,_,L){if(typeof _=="string"&&_!==""||typeof _=="number")return _=zc(""+_,T.mode,L),_.return=T,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case B:return L=Pl(_.type,_.key,_.props,null,T.mode,L),L.ref=Os(T,null,_),L.return=T,L;case I:return _=jc(_,T.mode,L),_.return=T,_;case Ae:var K=_._init;return U(T,K(_._payload),L)}if(rs(_)||z(_))return _=qr(_,T.mode,L,null),_.return=T,_;sl(T,_)}return null}function q(T,_,L,K){var ae=_!==null?_.key:null;if(typeof L=="string"&&L!==""||typeof L=="number")return ae!==null?null:b(T,_,""+L,K);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case B:return L.key===ae?A(T,_,L,K):null;case I:return L.key===ae?N(T,_,L,K):null;case Ae:return ae=L._init,q(T,_,ae(L._payload),K)}if(rs(L)||z(L))return ae!==null?null:V(T,_,L,K,null);sl(T,L)}return null}function Z(T,_,L,K,ae){if(typeof K=="string"&&K!==""||typeof K=="number")return T=T.get(L)||null,b(_,T,""+K,ae);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case B:return T=T.get(K.key===null?L:K.key)||null,A(_,T,K,ae);case I:return T=T.get(K.key===null?L:K.key)||null,N(_,T,K,ae);case Ae:var pe=K._init;return Z(T,_,L,pe(K._payload),ae)}if(rs(K)||z(K))return T=T.get(L)||null,V(_,T,K,ae,null);sl(_,K)}return null}function ne(T,_,L,K){for(var ae=null,pe=null,me=_,ke=_=0,st=null;me!==null&&ke<L.length;ke++){me.index>ke?(st=me,me=null):st=me.sibling;var Te=q(T,me,L[ke],K);if(Te===null){me===null&&(me=st);break}s&&me&&Te.alternate===null&&l(T,me),_=y(Te,_,ke),pe===null?ae=Te:pe.sibling=Te,pe=Te,me=st}if(ke===L.length)return c(T,me),We&&Rr(T,ke),ae;if(me===null){for(;ke<L.length;ke++)me=U(T,L[ke],K),me!==null&&(_=y(me,_,ke),pe===null?ae=me:pe.sibling=me,pe=me);return We&&Rr(T,ke),ae}for(me=f(T,me);ke<L.length;ke++)st=Z(me,T,ke,L[ke],K),st!==null&&(s&&st.alternate!==null&&me.delete(st.key===null?ke:st.key),_=y(st,_,ke),pe===null?ae=st:pe.sibling=st,pe=st);return s&&me.forEach(function(mr){return l(T,mr)}),We&&Rr(T,ke),ae}function se(T,_,L,K){var ae=z(L);if(typeof ae!="function")throw Error(t(150));if(L=ae.call(L),L==null)throw Error(t(151));for(var pe=ae=null,me=_,ke=_=0,st=null,Te=L.next();me!==null&&!Te.done;ke++,Te=L.next()){me.index>ke?(st=me,me=null):st=me.sibling;var mr=q(T,me,Te.value,K);if(mr===null){me===null&&(me=st);break}s&&me&&mr.alternate===null&&l(T,me),_=y(mr,_,ke),pe===null?ae=mr:pe.sibling=mr,pe=mr,me=st}if(Te.done)return c(T,me),We&&Rr(T,ke),ae;if(me===null){for(;!Te.done;ke++,Te=L.next())Te=U(T,Te.value,K),Te!==null&&(_=y(Te,_,ke),pe===null?ae=Te:pe.sibling=Te,pe=Te);return We&&Rr(T,ke),ae}for(me=f(T,me);!Te.done;ke++,Te=L.next())Te=Z(me,T,ke,Te.value,K),Te!==null&&(s&&Te.alternate!==null&&me.delete(Te.key===null?ke:Te.key),_=y(Te,_,ke),pe===null?ae=Te:pe.sibling=Te,pe=Te);return s&&me.forEach(function(Vw){return l(T,Vw)}),We&&Rr(T,ke),ae}function Ge(T,_,L,K){if(typeof L=="object"&&L!==null&&L.type===H&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case B:e:{for(var ae=L.key,pe=_;pe!==null;){if(pe.key===ae){if(ae=L.type,ae===H){if(pe.tag===7){c(T,pe.sibling),_=m(pe,L.props.children),_.return=T,T=_;break e}}else if(pe.elementType===ae||typeof ae=="object"&&ae!==null&&ae.$$typeof===Ae&&Pp(ae)===pe.type){c(T,pe.sibling),_=m(pe,L.props),_.ref=Os(T,pe,L),_.return=T,T=_;break e}c(T,pe);break}else l(T,pe);pe=pe.sibling}L.type===H?(_=qr(L.props.children,T.mode,K,L.key),_.return=T,T=_):(K=Pl(L.type,L.key,L.props,null,T.mode,K),K.ref=Os(T,_,L),K.return=T,T=K)}return x(T);case I:e:{for(pe=L.key;_!==null;){if(_.key===pe)if(_.tag===4&&_.stateNode.containerInfo===L.containerInfo&&_.stateNode.implementation===L.implementation){c(T,_.sibling),_=m(_,L.children||[]),_.return=T,T=_;break e}else{c(T,_);break}else l(T,_);_=_.sibling}_=jc(L,T.mode,K),_.return=T,T=_}return x(T);case Ae:return pe=L._init,Ge(T,_,pe(L._payload),K)}if(rs(L))return ne(T,_,L,K);if(z(L))return se(T,_,L,K);sl(T,L)}return typeof L=="string"&&L!==""||typeof L=="number"?(L=""+L,_!==null&&_.tag===6?(c(T,_.sibling),_=m(_,L),_.return=T,T=_):(c(T,_),_=zc(L,T.mode,K),_.return=T,T=_),x(T)):c(T,_)}return Ge}var ki=Tp(!0),Mp=Tp(!1),ol=ir(null),ll=null,Si=null,Ku=null;function Gu(){Ku=Si=ll=null}function Xu(s){var l=ol.current;He(ol),s._currentValue=l}function Yu(s,l,c){for(;s!==null;){var f=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,f!==null&&(f.childLanes|=l)):f!==null&&(f.childLanes&l)!==l&&(f.childLanes|=l),s===c)break;s=s.return}}function bi(s,l){ll=s,Ku=Si=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&l)!==0&&(Pt=!0),s.firstContext=null)}function Gt(s){var l=s._currentValue;if(Ku!==s)if(s={context:s,memoizedValue:l,next:null},Si===null){if(ll===null)throw Error(t(308));Si=s,ll.dependencies={lanes:0,firstContext:s}}else Si=Si.next=s;return l}var Br=null;function Ju(s){Br===null?Br=[s]:Br.push(s)}function Lp(s,l,c,f){var m=l.interleaved;return m===null?(c.next=c,Ju(l)):(c.next=m.next,m.next=c),l.interleaved=c,Fn(s,f)}function Fn(s,l){s.lanes|=l;var c=s.alternate;for(c!==null&&(c.lanes|=l),c=s,s=s.return;s!==null;)s.childLanes|=l,c=s.alternate,c!==null&&(c.childLanes|=l),c=s,s=s.return;return c.tag===3?c.stateNode:null}var lr=!1;function Zu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Np(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Hn(s,l){return{eventTime:s,lane:l,tag:0,payload:null,callback:null,next:null}}function ar(s,l,c){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Oe&2)!==0){var m=f.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),f.pending=l,Fn(s,c)}return m=f.interleaved,m===null?(l.next=l,Ju(f)):(l.next=m.next,m.next=l),f.interleaved=l,Fn(s,c)}function al(s,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194240)!==0)){var f=l.lanes;f&=s.pendingLanes,c|=f,l.lanes=c,du(s,c)}}function Dp(s,l){var c=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var m=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var x={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};y===null?m=y=x:y=y.next=x,c=c.next}while(c!==null);y===null?m=y=l:y=y.next=l}else m=y=l;c={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:f.shared,effects:f.effects},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=l}function ul(s,l,c,f){var m=s.updateQueue;lr=!1;var y=m.firstBaseUpdate,x=m.lastBaseUpdate,b=m.shared.pending;if(b!==null){m.shared.pending=null;var A=b,N=A.next;A.next=null,x===null?y=N:x.next=N,x=A;var V=s.alternate;V!==null&&(V=V.updateQueue,b=V.lastBaseUpdate,b!==x&&(b===null?V.firstBaseUpdate=N:b.next=N,V.lastBaseUpdate=A))}if(y!==null){var U=m.baseState;x=0,V=N=A=null,b=y;do{var q=b.lane,Z=b.eventTime;if((f&q)===q){V!==null&&(V=V.next={eventTime:Z,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var ne=s,se=b;switch(q=l,Z=c,se.tag){case 1:if(ne=se.payload,typeof ne=="function"){U=ne.call(Z,U,q);break e}U=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=se.payload,q=typeof ne=="function"?ne.call(Z,U,q):ne,q==null)break e;U=W({},U,q);break e;case 2:lr=!0}}b.callback!==null&&b.lane!==0&&(s.flags|=64,q=m.effects,q===null?m.effects=[b]:q.push(b))}else Z={eventTime:Z,lane:q,tag:b.tag,payload:b.payload,callback:b.callback,next:null},V===null?(N=V=Z,A=U):V=V.next=Z,x|=q;if(b=b.next,b===null){if(b=m.shared.pending,b===null)break;q=b,b=q.next,q.next=null,m.lastBaseUpdate=q,m.shared.pending=null}}while(!0);if(V===null&&(A=U),m.baseState=A,m.firstBaseUpdate=N,m.lastBaseUpdate=V,l=m.shared.interleaved,l!==null){m=l;do x|=m.lane,m=m.next;while(m!==l)}else y===null&&(m.shared.lanes=0);jr|=x,s.lanes=x,s.memoizedState=U}}function Rp(s,l,c){if(s=l.effects,l.effects=null,s!==null)for(l=0;l<s.length;l++){var f=s[l],m=f.callback;if(m!==null){if(f.callback=null,f=c,typeof m!="function")throw Error(t(191,m));m.call(f)}}}var Ps={},Sn=ir(Ps),Ts=ir(Ps),Ms=ir(Ps);function Ir(s){if(s===Ps)throw Error(t(174));return s}function ec(s,l){switch(Ie(Ms,l),Ie(Ts,s),Ie(Sn,Ps),s=l.nodeType,s){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:tu(null,"");break;default:s=s===8?l.parentNode:l,l=s.namespaceURI||null,s=s.tagName,l=tu(l,s)}He(Sn),Ie(Sn,l)}function Ci(){He(Sn),He(Ts),He(Ms)}function Bp(s){Ir(Ms.current);var l=Ir(Sn.current),c=tu(l,s.type);l!==c&&(Ie(Ts,s),Ie(Sn,c))}function tc(s){Ts.current===s&&(He(Sn),He(Ts))}var qe=ir(0);function cl(s){for(var l=s;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var nc=[];function rc(){for(var s=0;s<nc.length;s++)nc[s]._workInProgressVersionPrimary=null;nc.length=0}var hl=Q.ReactCurrentDispatcher,ic=Q.ReactCurrentBatchConfig,zr=0,Ve=null,Ze=null,rt=null,fl=!1,Ls=!1,Ns=0,fw=0;function pt(){throw Error(t(321))}function sc(s,l){if(l===null)return!1;for(var c=0;c<l.length&&c<s.length;c++)if(!an(s[c],l[c]))return!1;return!0}function oc(s,l,c,f,m,y){if(zr=y,Ve=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,hl.current=s===null||s.memoizedState===null?gw:yw,s=c(f,m),Ls){y=0;do{if(Ls=!1,Ns=0,25<=y)throw Error(t(301));y+=1,rt=Ze=null,l.updateQueue=null,hl.current=vw,s=c(f,m)}while(Ls)}if(hl.current=ml,l=Ze!==null&&Ze.next!==null,zr=0,rt=Ze=Ve=null,fl=!1,l)throw Error(t(300));return s}function lc(){var s=Ns!==0;return Ns=0,s}function bn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?Ve.memoizedState=rt=s:rt=rt.next=s,rt}function Xt(){if(Ze===null){var s=Ve.alternate;s=s!==null?s.memoizedState:null}else s=Ze.next;var l=rt===null?Ve.memoizedState:rt.next;if(l!==null)rt=l,Ze=s;else{if(s===null)throw Error(t(310));Ze=s,s={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},rt===null?Ve.memoizedState=rt=s:rt=rt.next=s}return rt}function Ds(s,l){return typeof l=="function"?l(s):l}function ac(s){var l=Xt(),c=l.queue;if(c===null)throw Error(t(311));c.lastRenderedReducer=s;var f=Ze,m=f.baseQueue,y=c.pending;if(y!==null){if(m!==null){var x=m.next;m.next=y.next,y.next=x}f.baseQueue=m=y,c.pending=null}if(m!==null){y=m.next,f=f.baseState;var b=x=null,A=null,N=y;do{var V=N.lane;if((zr&V)===V)A!==null&&(A=A.next={lane:0,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),f=N.hasEagerState?N.eagerState:s(f,N.action);else{var U={lane:V,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null};A===null?(b=A=U,x=f):A=A.next=U,Ve.lanes|=V,jr|=V}N=N.next}while(N!==null&&N!==y);A===null?x=f:A.next=b,an(f,l.memoizedState)||(Pt=!0),l.memoizedState=f,l.baseState=x,l.baseQueue=A,c.lastRenderedState=f}if(s=c.interleaved,s!==null){m=s;do y=m.lane,Ve.lanes|=y,jr|=y,m=m.next;while(m!==s)}else m===null&&(c.lanes=0);return[l.memoizedState,c.dispatch]}function uc(s){var l=Xt(),c=l.queue;if(c===null)throw Error(t(311));c.lastRenderedReducer=s;var f=c.dispatch,m=c.pending,y=l.memoizedState;if(m!==null){c.pending=null;var x=m=m.next;do y=s(y,x.action),x=x.next;while(x!==m);an(y,l.memoizedState)||(Pt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),c.lastRenderedState=y}return[y,f]}function Ip(){}function zp(s,l){var c=Ve,f=Xt(),m=l(),y=!an(f.memoizedState,m);if(y&&(f.memoizedState=m,Pt=!0),f=f.queue,cc(Hp.bind(null,c,f,s),[s]),f.getSnapshot!==l||y||rt!==null&&rt.memoizedState.tag&1){if(c.flags|=2048,Rs(9,Fp.bind(null,c,f,m,l),void 0,null),it===null)throw Error(t(349));(zr&30)!==0||jp(c,l,m)}return m}function jp(s,l,c){s.flags|=16384,s={getSnapshot:l,value:c},l=Ve.updateQueue,l===null?(l={lastEffect:null,stores:null},Ve.updateQueue=l,l.stores=[s]):(c=l.stores,c===null?l.stores=[s]:c.push(s))}function Fp(s,l,c,f){l.value=c,l.getSnapshot=f,Wp(l)&&qp(s)}function Hp(s,l,c){return c(function(){Wp(l)&&qp(s)})}function Wp(s){var l=s.getSnapshot;s=s.value;try{var c=l();return!an(s,c)}catch{return!0}}function qp(s){var l=Fn(s,1);l!==null&&dn(l,s,1,-1)}function Vp(s){var l=bn();return typeof s=="function"&&(s=s()),l.memoizedState=l.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:s},l.queue=s,s=s.dispatch=mw.bind(null,Ve,s),[l.memoizedState,s]}function Rs(s,l,c,f){return s={tag:s,create:l,destroy:c,deps:f,next:null},l=Ve.updateQueue,l===null?(l={lastEffect:null,stores:null},Ve.updateQueue=l,l.lastEffect=s.next=s):(c=l.lastEffect,c===null?l.lastEffect=s.next=s:(f=c.next,c.next=s,s.next=f,l.lastEffect=s)),s}function Qp(){return Xt().memoizedState}function dl(s,l,c,f){var m=bn();Ve.flags|=s,m.memoizedState=Rs(1|l,c,void 0,f===void 0?null:f)}function pl(s,l,c,f){var m=Xt();f=f===void 0?null:f;var y=void 0;if(Ze!==null){var x=Ze.memoizedState;if(y=x.destroy,f!==null&&sc(f,x.deps)){m.memoizedState=Rs(l,c,y,f);return}}Ve.flags|=s,m.memoizedState=Rs(1|l,c,y,f)}function Up(s,l){return dl(8390656,8,s,l)}function cc(s,l){return pl(2048,8,s,l)}function $p(s,l){return pl(4,2,s,l)}function Kp(s,l){return pl(4,4,s,l)}function Gp(s,l){if(typeof l=="function")return s=s(),l(s),function(){l(null)};if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function Xp(s,l,c){return c=c!=null?c.concat([s]):null,pl(4,4,Gp.bind(null,l,s),c)}function hc(){}function Yp(s,l){var c=Xt();l=l===void 0?null:l;var f=c.memoizedState;return f!==null&&l!==null&&sc(l,f[1])?f[0]:(c.memoizedState=[s,l],s)}function Jp(s,l){var c=Xt();l=l===void 0?null:l;var f=c.memoizedState;return f!==null&&l!==null&&sc(l,f[1])?f[0]:(s=s(),c.memoizedState=[s,l],s)}function Zp(s,l,c){return(zr&21)===0?(s.baseState&&(s.baseState=!1,Pt=!0),s.memoizedState=c):(an(c,l)||(c=Pd(),Ve.lanes|=c,jr|=c,s.baseState=!0),l)}function dw(s,l){var c=Ne;Ne=c!==0&&4>c?c:4,s(!0);var f=ic.transition;ic.transition={};try{s(!1),l()}finally{Ne=c,ic.transition=f}}function em(){return Xt().memoizedState}function pw(s,l,c){var f=fr(s);if(c={lane:f,action:c,hasEagerState:!1,eagerState:null,next:null},tm(s))nm(l,c);else if(c=Lp(s,l,c,f),c!==null){var m=kt();dn(c,s,f,m),rm(c,l,f)}}function mw(s,l,c){var f=fr(s),m={lane:f,action:c,hasEagerState:!1,eagerState:null,next:null};if(tm(s))nm(l,m);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var x=l.lastRenderedState,b=y(x,c);if(m.hasEagerState=!0,m.eagerState=b,an(b,x)){var A=l.interleaved;A===null?(m.next=m,Ju(l)):(m.next=A.next,A.next=m),l.interleaved=m;return}}catch{}finally{}c=Lp(s,l,m,f),c!==null&&(m=kt(),dn(c,s,f,m),rm(c,l,f))}}function tm(s){var l=s.alternate;return s===Ve||l!==null&&l===Ve}function nm(s,l){Ls=fl=!0;var c=s.pending;c===null?l.next=l:(l.next=c.next,c.next=l),s.pending=l}function rm(s,l,c){if((c&4194240)!==0){var f=l.lanes;f&=s.pendingLanes,c|=f,l.lanes=c,du(s,c)}}var ml={readContext:Gt,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useInsertionEffect:pt,useLayoutEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useMutableSource:pt,useSyncExternalStore:pt,useId:pt,unstable_isNewReconciler:!1},gw={readContext:Gt,useCallback:function(s,l){return bn().memoizedState=[s,l===void 0?null:l],s},useContext:Gt,useEffect:Up,useImperativeHandle:function(s,l,c){return c=c!=null?c.concat([s]):null,dl(4194308,4,Gp.bind(null,l,s),c)},useLayoutEffect:function(s,l){return dl(4194308,4,s,l)},useInsertionEffect:function(s,l){return dl(4,2,s,l)},useMemo:function(s,l){var c=bn();return l=l===void 0?null:l,s=s(),c.memoizedState=[s,l],s},useReducer:function(s,l,c){var f=bn();return l=c!==void 0?c(l):l,f.memoizedState=f.baseState=l,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:l},f.queue=s,s=s.dispatch=pw.bind(null,Ve,s),[f.memoizedState,s]},useRef:function(s){var l=bn();return s={current:s},l.memoizedState=s},useState:Vp,useDebugValue:hc,useDeferredValue:function(s){return bn().memoizedState=s},useTransition:function(){var s=Vp(!1),l=s[0];return s=dw.bind(null,s[1]),bn().memoizedState=s,[l,s]},useMutableSource:function(){},useSyncExternalStore:function(s,l,c){var f=Ve,m=bn();if(We){if(c===void 0)throw Error(t(407));c=c()}else{if(c=l(),it===null)throw Error(t(349));(zr&30)!==0||jp(f,l,c)}m.memoizedState=c;var y={value:c,getSnapshot:l};return m.queue=y,Up(Hp.bind(null,f,y,s),[s]),f.flags|=2048,Rs(9,Fp.bind(null,f,y,c,l),void 0,null),c},useId:function(){var s=bn(),l=it.identifierPrefix;if(We){var c=jn,f=zn;c=(f&~(1<<32-ln(f)-1)).toString(32)+c,l=":"+l+"R"+c,c=Ns++,0<c&&(l+="H"+c.toString(32)),l+=":"}else c=fw++,l=":"+l+"r"+c.toString(32)+":";return s.memoizedState=l},unstable_isNewReconciler:!1},yw={readContext:Gt,useCallback:Yp,useContext:Gt,useEffect:cc,useImperativeHandle:Xp,useInsertionEffect:$p,useLayoutEffect:Kp,useMemo:Jp,useReducer:ac,useRef:Qp,useState:function(){return ac(Ds)},useDebugValue:hc,useDeferredValue:function(s){var l=Xt();return Zp(l,Ze.memoizedState,s)},useTransition:function(){var s=ac(Ds)[0],l=Xt().memoizedState;return[s,l]},useMutableSource:Ip,useSyncExternalStore:zp,useId:em,unstable_isNewReconciler:!1},vw={readContext:Gt,useCallback:Yp,useContext:Gt,useEffect:cc,useImperativeHandle:Xp,useInsertionEffect:$p,useLayoutEffect:Kp,useMemo:Jp,useReducer:uc,useRef:Qp,useState:function(){return uc(Ds)},useDebugValue:hc,useDeferredValue:function(s){var l=Xt();return Ze===null?l.memoizedState=s:Zp(l,Ze.memoizedState,s)},useTransition:function(){var s=uc(Ds)[0],l=Xt().memoizedState;return[s,l]},useMutableSource:Ip,useSyncExternalStore:zp,useId:em,unstable_isNewReconciler:!1};function cn(s,l){if(s&&s.defaultProps){l=W({},l),s=s.defaultProps;for(var c in s)l[c]===void 0&&(l[c]=s[c]);return l}return l}function fc(s,l,c,f){l=s.memoizedState,c=c(f,l),c=c==null?l:W({},l,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var gl={isMounted:function(s){return(s=s._reactInternals)?Mr(s)===s:!1},enqueueSetState:function(s,l,c){s=s._reactInternals;var f=kt(),m=fr(s),y=Hn(f,m);y.payload=l,c!=null&&(y.callback=c),l=ar(s,y,m),l!==null&&(dn(l,s,m,f),al(l,s,m))},enqueueReplaceState:function(s,l,c){s=s._reactInternals;var f=kt(),m=fr(s),y=Hn(f,m);y.tag=1,y.payload=l,c!=null&&(y.callback=c),l=ar(s,y,m),l!==null&&(dn(l,s,m,f),al(l,s,m))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var c=kt(),f=fr(s),m=Hn(c,f);m.tag=2,l!=null&&(m.callback=l),l=ar(s,m,f),l!==null&&(dn(l,s,f,c),al(l,s,f))}};function im(s,l,c,f,m,y,x){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,y,x):l.prototype&&l.prototype.isPureReactComponent?!ks(c,f)||!ks(m,y):!0}function sm(s,l,c){var f=!1,m=sr,y=l.contextType;return typeof y=="object"&&y!==null?y=Gt(y):(m=Ot(l)?Nr:dt.current,f=l.contextTypes,y=(f=f!=null)?yi(s,m):sr),l=new l(c,y),s.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=gl,s.stateNode=l,l._reactInternals=s,f&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=m,s.__reactInternalMemoizedMaskedChildContext=y),l}function om(s,l,c,f){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,f),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,f),l.state!==s&&gl.enqueueReplaceState(l,l.state,null)}function dc(s,l,c,f){var m=s.stateNode;m.props=c,m.state=s.memoizedState,m.refs={},Zu(s);var y=l.contextType;typeof y=="object"&&y!==null?m.context=Gt(y):(y=Ot(l)?Nr:dt.current,m.context=yi(s,y)),m.state=s.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(fc(s,l,y,c),m.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(l=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),l!==m.state&&gl.enqueueReplaceState(m,m.state,null),ul(s,c,m,f),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308)}function Ai(s,l){try{var c="",f=l;do c+=j(f),f=f.return;while(f);var m=c}catch(y){m=`
40
+ Error generating stack: `+y.message+`
41
+ `+y.stack}return{value:s,source:l,stack:m,digest:null}}function pc(s,l,c){return{value:s,source:null,stack:c??null,digest:l??null}}function mc(s,l){try{console.error(l.value)}catch(c){setTimeout(function(){throw c})}}var xw=typeof WeakMap=="function"?WeakMap:Map;function lm(s,l,c){c=Hn(-1,c),c.tag=3,c.payload={element:null};var f=l.value;return c.callback=function(){bl||(bl=!0,Tc=f),mc(s,l)},c}function am(s,l,c){c=Hn(-1,c),c.tag=3;var f=s.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;c.payload=function(){return f(m)},c.callback=function(){mc(s,l)}}var y=s.stateNode;return y!==null&&typeof y.componentDidCatch=="function"&&(c.callback=function(){mc(s,l),typeof f!="function"&&(cr===null?cr=new Set([this]):cr.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})}),c}function um(s,l,c){var f=s.pingCache;if(f===null){f=s.pingCache=new xw;var m=new Set;f.set(l,m)}else m=f.get(l),m===void 0&&(m=new Set,f.set(l,m));m.has(c)||(m.add(c),s=Nw.bind(null,s,l,c),l.then(s,s))}function cm(s){do{var l;if((l=s.tag===13)&&(l=s.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return s;s=s.return}while(s!==null);return null}function hm(s,l,c,f,m){return(s.mode&1)===0?(s===l?s.flags|=65536:(s.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(l=Hn(-1,1),l.tag=2,ar(c,l,1))),c.lanes|=1),s):(s.flags|=65536,s.lanes=m,s)}var ww=Q.ReactCurrentOwner,Pt=!1;function wt(s,l,c,f){l.child=s===null?Mp(l,null,c,f):ki(l,s.child,c,f)}function fm(s,l,c,f,m){c=c.render;var y=l.ref;return bi(l,m),f=oc(s,l,c,f,y,m),c=lc(),s!==null&&!Pt?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~m,Wn(s,l,m)):(We&&c&&qu(l),l.flags|=1,wt(s,l,f,m),l.child)}function dm(s,l,c,f,m){if(s===null){var y=c.type;return typeof y=="function"&&!Ic(y)&&y.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(l.tag=15,l.type=y,pm(s,l,y,f,m)):(s=Pl(c.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,(s.lanes&m)===0){var x=y.memoizedProps;if(c=c.compare,c=c!==null?c:ks,c(x,f)&&s.ref===l.ref)return Wn(s,l,m)}return l.flags|=1,s=pr(y,f),s.ref=l.ref,s.return=l,l.child=s}function pm(s,l,c,f,m){if(s!==null){var y=s.memoizedProps;if(ks(y,f)&&s.ref===l.ref)if(Pt=!1,l.pendingProps=f=y,(s.lanes&m)!==0)(s.flags&131072)!==0&&(Pt=!0);else return l.lanes=s.lanes,Wn(s,l,m)}return gc(s,l,c,f,m)}function mm(s,l,c){var f=l.pendingProps,m=f.children,y=s!==null?s.memoizedState:null;if(f.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ie(_i,Wt),Wt|=c;else{if((c&1073741824)===0)return s=y!==null?y.baseLanes|c:c,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:s,cachePool:null,transitions:null},l.updateQueue=null,Ie(_i,Wt),Wt|=s,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=y!==null?y.baseLanes:c,Ie(_i,Wt),Wt|=f}else y!==null?(f=y.baseLanes|c,l.memoizedState=null):f=c,Ie(_i,Wt),Wt|=f;return wt(s,l,m,c),l.child}function gm(s,l){var c=l.ref;(s===null&&c!==null||s!==null&&s.ref!==c)&&(l.flags|=512,l.flags|=2097152)}function gc(s,l,c,f,m){var y=Ot(c)?Nr:dt.current;return y=yi(l,y),bi(l,m),c=oc(s,l,c,f,y,m),f=lc(),s!==null&&!Pt?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~m,Wn(s,l,m)):(We&&f&&qu(l),l.flags|=1,wt(s,l,c,m),l.child)}function ym(s,l,c,f,m){if(Ot(c)){var y=!0;el(l)}else y=!1;if(bi(l,m),l.stateNode===null)vl(s,l),sm(l,c,f),dc(l,c,f,m),f=!0;else if(s===null){var x=l.stateNode,b=l.memoizedProps;x.props=b;var A=x.context,N=c.contextType;typeof N=="object"&&N!==null?N=Gt(N):(N=Ot(c)?Nr:dt.current,N=yi(l,N));var V=c.getDerivedStateFromProps,U=typeof V=="function"||typeof x.getSnapshotBeforeUpdate=="function";U||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(b!==f||A!==N)&&om(l,x,f,N),lr=!1;var q=l.memoizedState;x.state=q,ul(l,f,x,m),A=l.memoizedState,b!==f||q!==A||_t.current||lr?(typeof V=="function"&&(fc(l,c,V,f),A=l.memoizedState),(b=lr||im(l,c,b,f,q,A,N))?(U||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(l.flags|=4194308)):(typeof x.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=f,l.memoizedState=A),x.props=f,x.state=A,x.context=N,f=b):(typeof x.componentDidMount=="function"&&(l.flags|=4194308),f=!1)}else{x=l.stateNode,Np(s,l),b=l.memoizedProps,N=l.type===l.elementType?b:cn(l.type,b),x.props=N,U=l.pendingProps,q=x.context,A=c.contextType,typeof A=="object"&&A!==null?A=Gt(A):(A=Ot(c)?Nr:dt.current,A=yi(l,A));var Z=c.getDerivedStateFromProps;(V=typeof Z=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(b!==U||q!==A)&&om(l,x,f,A),lr=!1,q=l.memoizedState,x.state=q,ul(l,f,x,m);var ne=l.memoizedState;b!==U||q!==ne||_t.current||lr?(typeof Z=="function"&&(fc(l,c,Z,f),ne=l.memoizedState),(N=lr||im(l,c,N,f,q,ne,A)||!1)?(V||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ne,A),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ne,A)),typeof x.componentDidUpdate=="function"&&(l.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof x.componentDidUpdate!="function"||b===s.memoizedProps&&q===s.memoizedState||(l.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&q===s.memoizedState||(l.flags|=1024),l.memoizedProps=f,l.memoizedState=ne),x.props=f,x.state=ne,x.context=A,f=N):(typeof x.componentDidUpdate!="function"||b===s.memoizedProps&&q===s.memoizedState||(l.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&q===s.memoizedState||(l.flags|=1024),f=!1)}return yc(s,l,c,f,y,m)}function yc(s,l,c,f,m,y){gm(s,l);var x=(l.flags&128)!==0;if(!f&&!x)return m&&Sp(l,c,!1),Wn(s,l,y);f=l.stateNode,ww.current=l;var b=x&&typeof c.getDerivedStateFromError!="function"?null:f.render();return l.flags|=1,s!==null&&x?(l.child=ki(l,s.child,null,y),l.child=ki(l,null,b,y)):wt(s,l,b,y),l.memoizedState=f.state,m&&Sp(l,c,!0),l.child}function vm(s){var l=s.stateNode;l.pendingContext?wp(s,l.pendingContext,l.pendingContext!==l.context):l.context&&wp(s,l.context,!1),ec(s,l.containerInfo)}function xm(s,l,c,f,m){return wi(),$u(m),l.flags|=256,wt(s,l,c,f),l.child}var vc={dehydrated:null,treeContext:null,retryLane:0};function xc(s){return{baseLanes:s,cachePool:null,transitions:null}}function wm(s,l,c){var f=l.pendingProps,m=qe.current,y=!1,x=(l.flags&128)!==0,b;if((b=x)||(b=s!==null&&s.memoizedState===null?!1:(m&2)!==0),b?(y=!0,l.flags&=-129):(s===null||s.memoizedState!==null)&&(m|=1),Ie(qe,m&1),s===null)return Uu(l),s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((l.mode&1)===0?l.lanes=1:s.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(x=f.children,s=f.fallback,y?(f=l.mode,y=l.child,x={mode:"hidden",children:x},(f&1)===0&&y!==null?(y.childLanes=0,y.pendingProps=x):y=Tl(x,f,0,null),s=qr(s,f,c,null),y.return=l,s.return=l,y.sibling=s,l.child=y,l.child.memoizedState=xc(c),l.memoizedState=vc,s):wc(l,x));if(m=s.memoizedState,m!==null&&(b=m.dehydrated,b!==null))return kw(s,l,x,f,b,m,c);if(y){y=f.fallback,x=l.mode,m=s.child,b=m.sibling;var A={mode:"hidden",children:f.children};return(x&1)===0&&l.child!==m?(f=l.child,f.childLanes=0,f.pendingProps=A,l.deletions=null):(f=pr(m,A),f.subtreeFlags=m.subtreeFlags&14680064),b!==null?y=pr(b,y):(y=qr(y,x,c,null),y.flags|=2),y.return=l,f.return=l,f.sibling=y,l.child=f,f=y,y=l.child,x=s.child.memoizedState,x=x===null?xc(c):{baseLanes:x.baseLanes|c,cachePool:null,transitions:x.transitions},y.memoizedState=x,y.childLanes=s.childLanes&~c,l.memoizedState=vc,f}return y=s.child,s=y.sibling,f=pr(y,{mode:"visible",children:f.children}),(l.mode&1)===0&&(f.lanes=c),f.return=l,f.sibling=null,s!==null&&(c=l.deletions,c===null?(l.deletions=[s],l.flags|=16):c.push(s)),l.child=f,l.memoizedState=null,f}function wc(s,l){return l=Tl({mode:"visible",children:l},s.mode,0,null),l.return=s,s.child=l}function yl(s,l,c,f){return f!==null&&$u(f),ki(l,s.child,null,c),s=wc(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function kw(s,l,c,f,m,y,x){if(c)return l.flags&256?(l.flags&=-257,f=pc(Error(t(422))),yl(s,l,x,f)):l.memoizedState!==null?(l.child=s.child,l.flags|=128,null):(y=f.fallback,m=l.mode,f=Tl({mode:"visible",children:f.children},m,0,null),y=qr(y,m,x,null),y.flags|=2,f.return=l,y.return=l,f.sibling=y,l.child=f,(l.mode&1)!==0&&ki(l,s.child,null,x),l.child.memoizedState=xc(x),l.memoizedState=vc,y);if((l.mode&1)===0)return yl(s,l,x,null);if(m.data==="$!"){if(f=m.nextSibling&&m.nextSibling.dataset,f)var b=f.dgst;return f=b,y=Error(t(419)),f=pc(y,f,void 0),yl(s,l,x,f)}if(b=(x&s.childLanes)!==0,Pt||b){if(f=it,f!==null){switch(x&-x){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(f.suspendedLanes|x))!==0?0:m,m!==0&&m!==y.retryLane&&(y.retryLane=m,Fn(s,m),dn(f,s,m,-1))}return Bc(),f=pc(Error(t(421))),yl(s,l,x,f)}return m.data==="$?"?(l.flags|=128,l.child=s.child,l=Dw.bind(null,s),m._reactRetry=l,null):(s=y.treeContext,Ht=rr(m.nextSibling),Ft=l,We=!0,un=null,s!==null&&($t[Kt++]=zn,$t[Kt++]=jn,$t[Kt++]=Dr,zn=s.id,jn=s.overflow,Dr=l),l=wc(l,f.children),l.flags|=4096,l)}function km(s,l,c){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),Yu(s.return,l,c)}function kc(s,l,c,f,m){var y=s.memoizedState;y===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:m}:(y.isBackwards=l,y.rendering=null,y.renderingStartTime=0,y.last=f,y.tail=c,y.tailMode=m)}function Sm(s,l,c){var f=l.pendingProps,m=f.revealOrder,y=f.tail;if(wt(s,l,f.children,c),f=qe.current,(f&2)!==0)f=f&1|2,l.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&km(s,c,l);else if(s.tag===19)km(s,c,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}f&=1}if(Ie(qe,f),(l.mode&1)===0)l.memoizedState=null;else switch(m){case"forwards":for(c=l.child,m=null;c!==null;)s=c.alternate,s!==null&&cl(s)===null&&(m=c),c=c.sibling;c=m,c===null?(m=l.child,l.child=null):(m=c.sibling,c.sibling=null),kc(l,!1,m,c,y);break;case"backwards":for(c=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&cl(s)===null){l.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}kc(l,!0,c,null,y);break;case"together":kc(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function vl(s,l){(l.mode&1)===0&&s!==null&&(s.alternate=null,l.alternate=null,l.flags|=2)}function Wn(s,l,c){if(s!==null&&(l.dependencies=s.dependencies),jr|=l.lanes,(c&l.childLanes)===0)return null;if(s!==null&&l.child!==s.child)throw Error(t(153));if(l.child!==null){for(s=l.child,c=pr(s,s.pendingProps),l.child=c,c.return=l;s.sibling!==null;)s=s.sibling,c=c.sibling=pr(s,s.pendingProps),c.return=l;c.sibling=null}return l.child}function Sw(s,l,c){switch(l.tag){case 3:vm(l),wi();break;case 5:Bp(l);break;case 1:Ot(l.type)&&el(l);break;case 4:ec(l,l.stateNode.containerInfo);break;case 10:var f=l.type._context,m=l.memoizedProps.value;Ie(ol,f._currentValue),f._currentValue=m;break;case 13:if(f=l.memoizedState,f!==null)return f.dehydrated!==null?(Ie(qe,qe.current&1),l.flags|=128,null):(c&l.child.childLanes)!==0?wm(s,l,c):(Ie(qe,qe.current&1),s=Wn(s,l,c),s!==null?s.sibling:null);Ie(qe,qe.current&1);break;case 19:if(f=(c&l.childLanes)!==0,(s.flags&128)!==0){if(f)return Sm(s,l,c);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Ie(qe,qe.current),f)break;return null;case 22:case 23:return l.lanes=0,mm(s,l,c)}return Wn(s,l,c)}var bm,Sc,Cm,Am;bm=function(s,l){for(var c=l.child;c!==null;){if(c.tag===5||c.tag===6)s.appendChild(c.stateNode);else if(c.tag!==4&&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;c=c.return}c.sibling.return=c.return,c=c.sibling}},Sc=function(){},Cm=function(s,l,c,f){var m=s.memoizedProps;if(m!==f){s=l.stateNode,Ir(Sn.current);var y=null;switch(c){case"input":m=Ya(s,m),f=Ya(s,f),y=[];break;case"select":m=W({},m,{value:void 0}),f=W({},f,{value:void 0}),y=[];break;case"textarea":m=eu(s,m),f=eu(s,f),y=[];break;default:typeof m.onClick!="function"&&typeof f.onClick=="function"&&(s.onclick=Yo)}nu(c,f);var x;c=null;for(N in m)if(!f.hasOwnProperty(N)&&m.hasOwnProperty(N)&&m[N]!=null)if(N==="style"){var b=m[N];for(x in b)b.hasOwnProperty(x)&&(c||(c={}),c[x]="")}else N!=="dangerouslySetInnerHTML"&&N!=="children"&&N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(i.hasOwnProperty(N)?y||(y=[]):(y=y||[]).push(N,null));for(N in f){var A=f[N];if(b=m!=null?m[N]:void 0,f.hasOwnProperty(N)&&A!==b&&(A!=null||b!=null))if(N==="style")if(b){for(x in b)!b.hasOwnProperty(x)||A&&A.hasOwnProperty(x)||(c||(c={}),c[x]="");for(x in A)A.hasOwnProperty(x)&&b[x]!==A[x]&&(c||(c={}),c[x]=A[x])}else c||(y||(y=[]),y.push(N,c)),c=A;else N==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,b=b?b.__html:void 0,A!=null&&b!==A&&(y=y||[]).push(N,A)):N==="children"?typeof A!="string"&&typeof A!="number"||(y=y||[]).push(N,""+A):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&(i.hasOwnProperty(N)?(A!=null&&N==="onScroll"&&Fe("scroll",s),y||b===A||(y=[])):(y=y||[]).push(N,A))}c&&(y=y||[]).push("style",c);var N=y;(l.updateQueue=N)&&(l.flags|=4)}},Am=function(s,l,c,f){c!==f&&(l.flags|=4)};function Bs(s,l){if(!We)switch(s.tailMode){case"hidden":l=s.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function mt(s){var l=s.alternate!==null&&s.alternate.child===s.child,c=0,f=0;if(l)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,f|=m.subtreeFlags&14680064,f|=m.flags&14680064,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=f,s.childLanes=c,l}function bw(s,l,c){var f=l.pendingProps;switch(Vu(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(l),null;case 1:return Ot(l.type)&&Zo(),mt(l),null;case 3:return f=l.stateNode,Ci(),He(_t),He(dt),rc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(s===null||s.child===null)&&(il(l)?l.flags|=4:s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,un!==null&&(Nc(un),un=null))),Sc(s,l),mt(l),null;case 5:tc(l);var m=Ir(Ms.current);if(c=l.type,s!==null&&l.stateNode!=null)Cm(s,l,c,f,m),s.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!f){if(l.stateNode===null)throw Error(t(166));return mt(l),null}if(s=Ir(Sn.current),il(l)){f=l.stateNode,c=l.type;var y=l.memoizedProps;switch(f[kn]=l,f[Es]=y,s=(l.mode&1)!==0,c){case"dialog":Fe("cancel",f),Fe("close",f);break;case"iframe":case"object":case"embed":Fe("load",f);break;case"video":case"audio":for(m=0;m<bs.length;m++)Fe(bs[m],f);break;case"source":Fe("error",f);break;case"img":case"image":case"link":Fe("error",f),Fe("load",f);break;case"details":Fe("toggle",f);break;case"input":sd(f,y),Fe("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!y.multiple},Fe("invalid",f);break;case"textarea":ad(f,y),Fe("invalid",f)}nu(c,y),m=null;for(var x in y)if(y.hasOwnProperty(x)){var b=y[x];x==="children"?typeof b=="string"?f.textContent!==b&&(y.suppressHydrationWarning!==!0&&Xo(f.textContent,b,s),m=["children",b]):typeof b=="number"&&f.textContent!==""+b&&(y.suppressHydrationWarning!==!0&&Xo(f.textContent,b,s),m=["children",""+b]):i.hasOwnProperty(x)&&b!=null&&x==="onScroll"&&Fe("scroll",f)}switch(c){case"input":_o(f),ld(f,y,!0);break;case"textarea":_o(f),cd(f);break;case"select":case"option":break;default:typeof y.onClick=="function"&&(f.onclick=Yo)}f=m,l.updateQueue=f,f!==null&&(l.flags|=4)}else{x=m.nodeType===9?m:m.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=hd(c)),s==="http://www.w3.org/1999/xhtml"?c==="script"?(s=x.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof f.is=="string"?s=x.createElement(c,{is:f.is}):(s=x.createElement(c),c==="select"&&(x=s,f.multiple?x.multiple=!0:f.size&&(x.size=f.size))):s=x.createElementNS(s,c),s[kn]=l,s[Es]=f,bm(s,l,!1,!1),l.stateNode=s;e:{switch(x=ru(c,f),c){case"dialog":Fe("cancel",s),Fe("close",s),m=f;break;case"iframe":case"object":case"embed":Fe("load",s),m=f;break;case"video":case"audio":for(m=0;m<bs.length;m++)Fe(bs[m],s);m=f;break;case"source":Fe("error",s),m=f;break;case"img":case"image":case"link":Fe("error",s),Fe("load",s),m=f;break;case"details":Fe("toggle",s),m=f;break;case"input":sd(s,f),m=Ya(s,f),Fe("invalid",s);break;case"option":m=f;break;case"select":s._wrapperState={wasMultiple:!!f.multiple},m=W({},f,{value:void 0}),Fe("invalid",s);break;case"textarea":ad(s,f),m=eu(s,f),Fe("invalid",s);break;default:m=f}nu(c,m),b=m;for(y in b)if(b.hasOwnProperty(y)){var A=b[y];y==="style"?pd(s,A):y==="dangerouslySetInnerHTML"?(A=A?A.__html:void 0,A!=null&&fd(s,A)):y==="children"?typeof A=="string"?(c!=="textarea"||A!=="")&&is(s,A):typeof A=="number"&&is(s,""+A):y!=="suppressContentEditableWarning"&&y!=="suppressHydrationWarning"&&y!=="autoFocus"&&(i.hasOwnProperty(y)?A!=null&&y==="onScroll"&&Fe("scroll",s):A!=null&&M(s,y,A,x))}switch(c){case"input":_o(s),ld(s,f,!1);break;case"textarea":_o(s),cd(s);break;case"option":f.value!=null&&s.setAttribute("value",""+ve(f.value));break;case"select":s.multiple=!!f.multiple,y=f.value,y!=null?si(s,!!f.multiple,y,!1):f.defaultValue!=null&&si(s,!!f.multiple,f.defaultValue,!0);break;default:typeof m.onClick=="function"&&(s.onclick=Yo)}switch(c){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return mt(l),null;case 6:if(s&&l.stateNode!=null)Am(s,l,s.memoizedProps,f);else{if(typeof f!="string"&&l.stateNode===null)throw Error(t(166));if(c=Ir(Ms.current),Ir(Sn.current),il(l)){if(f=l.stateNode,c=l.memoizedProps,f[kn]=l,(y=f.nodeValue!==c)&&(s=Ft,s!==null))switch(s.tag){case 3:Xo(f.nodeValue,c,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&Xo(f.nodeValue,c,(s.mode&1)!==0)}y&&(l.flags|=4)}else f=(c.nodeType===9?c:c.ownerDocument).createTextNode(f),f[kn]=l,l.stateNode=f}return mt(l),null;case 13:if(He(qe),f=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(We&&Ht!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Op(),wi(),l.flags|=98560,y=!1;else if(y=il(l),f!==null&&f.dehydrated!==null){if(s===null){if(!y)throw Error(t(318));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(t(317));y[kn]=l}else wi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;mt(l),y=!1}else un!==null&&(Nc(un),un=null),y=!0;if(!y)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=c,l):(f=f!==null,f!==(s!==null&&s.memoizedState!==null)&&f&&(l.child.flags|=8192,(l.mode&1)!==0&&(s===null||(qe.current&1)!==0?et===0&&(et=3):Bc())),l.updateQueue!==null&&(l.flags|=4),mt(l),null);case 4:return Ci(),Sc(s,l),s===null&&Cs(l.stateNode.containerInfo),mt(l),null;case 10:return Xu(l.type._context),mt(l),null;case 17:return Ot(l.type)&&Zo(),mt(l),null;case 19:if(He(qe),y=l.memoizedState,y===null)return mt(l),null;if(f=(l.flags&128)!==0,x=y.rendering,x===null)if(f)Bs(y,!1);else{if(et!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(x=cl(s),x!==null){for(l.flags|=128,Bs(y,!1),f=x.updateQueue,f!==null&&(l.updateQueue=f,l.flags|=4),l.subtreeFlags=0,f=c,c=l.child;c!==null;)y=c,s=f,y.flags&=14680066,x=y.alternate,x===null?(y.childLanes=0,y.lanes=s,y.child=null,y.subtreeFlags=0,y.memoizedProps=null,y.memoizedState=null,y.updateQueue=null,y.dependencies=null,y.stateNode=null):(y.childLanes=x.childLanes,y.lanes=x.lanes,y.child=x.child,y.subtreeFlags=0,y.deletions=null,y.memoizedProps=x.memoizedProps,y.memoizedState=x.memoizedState,y.updateQueue=x.updateQueue,y.type=x.type,s=x.dependencies,y.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),c=c.sibling;return Ie(qe,qe.current&1|2),l.child}s=s.sibling}y.tail!==null&&Ke()>Oi&&(l.flags|=128,f=!0,Bs(y,!1),l.lanes=4194304)}else{if(!f)if(s=cl(x),s!==null){if(l.flags|=128,f=!0,c=s.updateQueue,c!==null&&(l.updateQueue=c,l.flags|=4),Bs(y,!0),y.tail===null&&y.tailMode==="hidden"&&!x.alternate&&!We)return mt(l),null}else 2*Ke()-y.renderingStartTime>Oi&&c!==1073741824&&(l.flags|=128,f=!0,Bs(y,!1),l.lanes=4194304);y.isBackwards?(x.sibling=l.child,l.child=x):(c=y.last,c!==null?c.sibling=x:l.child=x,y.last=x)}return y.tail!==null?(l=y.tail,y.rendering=l,y.tail=l.sibling,y.renderingStartTime=Ke(),l.sibling=null,c=qe.current,Ie(qe,f?c&1|2:c&1),l):(mt(l),null);case 22:case 23:return Rc(),f=l.memoizedState!==null,s!==null&&s.memoizedState!==null!==f&&(l.flags|=8192),f&&(l.mode&1)!==0?(Wt&1073741824)!==0&&(mt(l),l.subtreeFlags&6&&(l.flags|=8192)):mt(l),null;case 24:return null;case 25:return null}throw Error(t(156,l.tag))}function Cw(s,l){switch(Vu(l),l.tag){case 1:return Ot(l.type)&&Zo(),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Ci(),He(_t),He(dt),rc(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 5:return tc(l),null;case 13:if(He(qe),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(t(340));wi()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return He(qe),null;case 4:return Ci(),null;case 10:return Xu(l.type._context),null;case 22:case 23:return Rc(),null;case 24:return null;default:return null}}var xl=!1,gt=!1,Aw=typeof WeakSet=="function"?WeakSet:Set,te=null;function Ei(s,l){var c=s.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(f){Qe(s,l,f)}else c.current=null}function bc(s,l,c){try{c()}catch(f){Qe(s,l,f)}}var Em=!1;function Ew(s,l){if(Ru=jo,s=ip(),_u(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var m=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var x=0,b=-1,A=-1,N=0,V=0,U=s,q=null;t:for(;;){for(var Z;U!==c||m!==0&&U.nodeType!==3||(b=x+m),U!==y||f!==0&&U.nodeType!==3||(A=x+f),U.nodeType===3&&(x+=U.nodeValue.length),(Z=U.firstChild)!==null;)q=U,U=Z;for(;;){if(U===s)break t;if(q===c&&++N===m&&(b=x),q===y&&++V===f&&(A=x),(Z=U.nextSibling)!==null)break;U=q,q=U.parentNode}U=Z}c=b===-1||A===-1?null:{start:b,end:A}}else c=null}c=c||{start:0,end:0}}else c=null;for(Bu={focusedElem:s,selectionRange:c},jo=!1,te=l;te!==null;)if(l=te,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,te=s;else for(;te!==null;){l=te;try{var ne=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(ne!==null){var se=ne.memoizedProps,Ge=ne.memoizedState,T=l.stateNode,_=T.getSnapshotBeforeUpdate(l.elementType===l.type?se:cn(l.type,se),Ge);T.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var L=l.stateNode.containerInfo;L.nodeType===1?L.textContent="":L.nodeType===9&&L.documentElement&&L.removeChild(L.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(K){Qe(l,l.return,K)}if(s=l.sibling,s!==null){s.return=l.return,te=s;break}te=l.return}return ne=Em,Em=!1,ne}function Is(s,l,c){var f=l.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var m=f=f.next;do{if((m.tag&s)===s){var y=m.destroy;m.destroy=void 0,y!==void 0&&bc(l,c,y)}m=m.next}while(m!==f)}}function wl(s,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var c=l=l.next;do{if((c.tag&s)===s){var f=c.create;c.destroy=f()}c=c.next}while(c!==l)}}function Cc(s){var l=s.ref;if(l!==null){var c=s.stateNode;switch(s.tag){case 5:s=c;break;default:s=c}typeof l=="function"?l(s):l.current=s}}function _m(s){var l=s.alternate;l!==null&&(s.alternate=null,_m(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&(delete l[kn],delete l[Es],delete l[Fu],delete l[aw],delete l[uw])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Om(s){return s.tag===5||s.tag===3||s.tag===4}function Pm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Om(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Ac(s,l,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?c.nodeType===8?c.parentNode.insertBefore(s,l):c.insertBefore(s,l):(c.nodeType===8?(l=c.parentNode,l.insertBefore(s,c)):(l=c,l.appendChild(s)),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=Yo));else if(f!==4&&(s=s.child,s!==null))for(Ac(s,l,c),s=s.sibling;s!==null;)Ac(s,l,c),s=s.sibling}function Ec(s,l,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?c.insertBefore(s,l):c.appendChild(s);else if(f!==4&&(s=s.child,s!==null))for(Ec(s,l,c),s=s.sibling;s!==null;)Ec(s,l,c),s=s.sibling}var at=null,hn=!1;function ur(s,l,c){for(c=c.child;c!==null;)Tm(s,l,c),c=c.sibling}function Tm(s,l,c){if(wn&&typeof wn.onCommitFiberUnmount=="function")try{wn.onCommitFiberUnmount(No,c)}catch{}switch(c.tag){case 5:gt||Ei(c,l);case 6:var f=at,m=hn;at=null,ur(s,l,c),at=f,hn=m,at!==null&&(hn?(s=at,c=c.stateNode,s.nodeType===8?s.parentNode.removeChild(c):s.removeChild(c)):at.removeChild(c.stateNode));break;case 18:at!==null&&(hn?(s=at,c=c.stateNode,s.nodeType===8?ju(s.parentNode,c):s.nodeType===1&&ju(s,c),ms(s)):ju(at,c.stateNode));break;case 4:f=at,m=hn,at=c.stateNode.containerInfo,hn=!0,ur(s,l,c),at=f,hn=m;break;case 0:case 11:case 14:case 15:if(!gt&&(f=c.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){m=f=f.next;do{var y=m,x=y.destroy;y=y.tag,x!==void 0&&((y&2)!==0||(y&4)!==0)&&bc(c,l,x),m=m.next}while(m!==f)}ur(s,l,c);break;case 1:if(!gt&&(Ei(c,l),f=c.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=c.memoizedProps,f.state=c.memoizedState,f.componentWillUnmount()}catch(b){Qe(c,l,b)}ur(s,l,c);break;case 21:ur(s,l,c);break;case 22:c.mode&1?(gt=(f=gt)||c.memoizedState!==null,ur(s,l,c),gt=f):ur(s,l,c);break;default:ur(s,l,c)}}function Mm(s){var l=s.updateQueue;if(l!==null){s.updateQueue=null;var c=s.stateNode;c===null&&(c=s.stateNode=new Aw),l.forEach(function(f){var m=Rw.bind(null,s,f);c.has(f)||(c.add(f),f.then(m,m))})}}function fn(s,l){var c=l.deletions;if(c!==null)for(var f=0;f<c.length;f++){var m=c[f];try{var y=s,x=l,b=x;e:for(;b!==null;){switch(b.tag){case 5:at=b.stateNode,hn=!1;break e;case 3:at=b.stateNode.containerInfo,hn=!0;break e;case 4:at=b.stateNode.containerInfo,hn=!0;break e}b=b.return}if(at===null)throw Error(t(160));Tm(y,x,m),at=null,hn=!1;var A=m.alternate;A!==null&&(A.return=null),m.return=null}catch(N){Qe(m,l,N)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)Lm(l,s),l=l.sibling}function Lm(s,l){var c=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(fn(l,s),Cn(s),f&4){try{Is(3,s,s.return),wl(3,s)}catch(se){Qe(s,s.return,se)}try{Is(5,s,s.return)}catch(se){Qe(s,s.return,se)}}break;case 1:fn(l,s),Cn(s),f&512&&c!==null&&Ei(c,c.return);break;case 5:if(fn(l,s),Cn(s),f&512&&c!==null&&Ei(c,c.return),s.flags&32){var m=s.stateNode;try{is(m,"")}catch(se){Qe(s,s.return,se)}}if(f&4&&(m=s.stateNode,m!=null)){var y=s.memoizedProps,x=c!==null?c.memoizedProps:y,b=s.type,A=s.updateQueue;if(s.updateQueue=null,A!==null)try{b==="input"&&y.type==="radio"&&y.name!=null&&od(m,y),ru(b,x);var N=ru(b,y);for(x=0;x<A.length;x+=2){var V=A[x],U=A[x+1];V==="style"?pd(m,U):V==="dangerouslySetInnerHTML"?fd(m,U):V==="children"?is(m,U):M(m,V,U,N)}switch(b){case"input":Ja(m,y);break;case"textarea":ud(m,y);break;case"select":var q=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!y.multiple;var Z=y.value;Z!=null?si(m,!!y.multiple,Z,!1):q!==!!y.multiple&&(y.defaultValue!=null?si(m,!!y.multiple,y.defaultValue,!0):si(m,!!y.multiple,y.multiple?[]:"",!1))}m[Es]=y}catch(se){Qe(s,s.return,se)}}break;case 6:if(fn(l,s),Cn(s),f&4){if(s.stateNode===null)throw Error(t(162));m=s.stateNode,y=s.memoizedProps;try{m.nodeValue=y}catch(se){Qe(s,s.return,se)}}break;case 3:if(fn(l,s),Cn(s),f&4&&c!==null&&c.memoizedState.isDehydrated)try{ms(l.containerInfo)}catch(se){Qe(s,s.return,se)}break;case 4:fn(l,s),Cn(s);break;case 13:fn(l,s),Cn(s),m=s.child,m.flags&8192&&(y=m.memoizedState!==null,m.stateNode.isHidden=y,!y||m.alternate!==null&&m.alternate.memoizedState!==null||(Pc=Ke())),f&4&&Mm(s);break;case 22:if(V=c!==null&&c.memoizedState!==null,s.mode&1?(gt=(N=gt)||V,fn(l,s),gt=N):fn(l,s),Cn(s),f&8192){if(N=s.memoizedState!==null,(s.stateNode.isHidden=N)&&!V&&(s.mode&1)!==0)for(te=s,V=s.child;V!==null;){for(U=te=V;te!==null;){switch(q=te,Z=q.child,q.tag){case 0:case 11:case 14:case 15:Is(4,q,q.return);break;case 1:Ei(q,q.return);var ne=q.stateNode;if(typeof ne.componentWillUnmount=="function"){f=q,c=q.return;try{l=f,ne.props=l.memoizedProps,ne.state=l.memoizedState,ne.componentWillUnmount()}catch(se){Qe(f,c,se)}}break;case 5:Ei(q,q.return);break;case 22:if(q.memoizedState!==null){Rm(U);continue}}Z!==null?(Z.return=q,te=Z):Rm(U)}V=V.sibling}e:for(V=null,U=s;;){if(U.tag===5){if(V===null){V=U;try{m=U.stateNode,N?(y=m.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none"):(b=U.stateNode,A=U.memoizedProps.style,x=A!=null&&A.hasOwnProperty("display")?A.display:null,b.style.display=dd("display",x))}catch(se){Qe(s,s.return,se)}}}else if(U.tag===6){if(V===null)try{U.stateNode.nodeValue=N?"":U.memoizedProps}catch(se){Qe(s,s.return,se)}}else if((U.tag!==22&&U.tag!==23||U.memoizedState===null||U===s)&&U.child!==null){U.child.return=U,U=U.child;continue}if(U===s)break e;for(;U.sibling===null;){if(U.return===null||U.return===s)break e;V===U&&(V=null),U=U.return}V===U&&(V=null),U.sibling.return=U.return,U=U.sibling}}break;case 19:fn(l,s),Cn(s),f&4&&Mm(s);break;case 21:break;default:fn(l,s),Cn(s)}}function Cn(s){var l=s.flags;if(l&2){try{e:{for(var c=s.return;c!==null;){if(Om(c)){var f=c;break e}c=c.return}throw Error(t(160))}switch(f.tag){case 5:var m=f.stateNode;f.flags&32&&(is(m,""),f.flags&=-33);var y=Pm(s);Ec(s,y,m);break;case 3:case 4:var x=f.stateNode.containerInfo,b=Pm(s);Ac(s,b,x);break;default:throw Error(t(161))}}catch(A){Qe(s,s.return,A)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function _w(s,l,c){te=s,Nm(s)}function Nm(s,l,c){for(var f=(s.mode&1)!==0;te!==null;){var m=te,y=m.child;if(m.tag===22&&f){var x=m.memoizedState!==null||xl;if(!x){var b=m.alternate,A=b!==null&&b.memoizedState!==null||gt;b=xl;var N=gt;if(xl=x,(gt=A)&&!N)for(te=m;te!==null;)x=te,A=x.child,x.tag===22&&x.memoizedState!==null?Bm(m):A!==null?(A.return=x,te=A):Bm(m);for(;y!==null;)te=y,Nm(y),y=y.sibling;te=m,xl=b,gt=N}Dm(s)}else(m.subtreeFlags&8772)!==0&&y!==null?(y.return=m,te=y):Dm(s)}}function Dm(s){for(;te!==null;){var l=te;if((l.flags&8772)!==0){var c=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:gt||wl(5,l);break;case 1:var f=l.stateNode;if(l.flags&4&&!gt)if(c===null)f.componentDidMount();else{var m=l.elementType===l.type?c.memoizedProps:cn(l.type,c.memoizedProps);f.componentDidUpdate(m,c.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var y=l.updateQueue;y!==null&&Rp(l,y,f);break;case 3:var x=l.updateQueue;if(x!==null){if(c=null,l.child!==null)switch(l.child.tag){case 5:c=l.child.stateNode;break;case 1:c=l.child.stateNode}Rp(l,x,c)}break;case 5:var b=l.stateNode;if(c===null&&l.flags&4){c=b;var A=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":A.autoFocus&&c.focus();break;case"img":A.src&&(c.src=A.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var N=l.alternate;if(N!==null){var V=N.memoizedState;if(V!==null){var U=V.dehydrated;U!==null&&ms(U)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}gt||l.flags&512&&Cc(l)}catch(q){Qe(l,l.return,q)}}if(l===s){te=null;break}if(c=l.sibling,c!==null){c.return=l.return,te=c;break}te=l.return}}function Rm(s){for(;te!==null;){var l=te;if(l===s){te=null;break}var c=l.sibling;if(c!==null){c.return=l.return,te=c;break}te=l.return}}function Bm(s){for(;te!==null;){var l=te;try{switch(l.tag){case 0:case 11:case 15:var c=l.return;try{wl(4,l)}catch(A){Qe(l,c,A)}break;case 1:var f=l.stateNode;if(typeof f.componentDidMount=="function"){var m=l.return;try{f.componentDidMount()}catch(A){Qe(l,m,A)}}var y=l.return;try{Cc(l)}catch(A){Qe(l,y,A)}break;case 5:var x=l.return;try{Cc(l)}catch(A){Qe(l,x,A)}}}catch(A){Qe(l,l.return,A)}if(l===s){te=null;break}var b=l.sibling;if(b!==null){b.return=l.return,te=b;break}te=l.return}}var Ow=Math.ceil,kl=Q.ReactCurrentDispatcher,_c=Q.ReactCurrentOwner,Yt=Q.ReactCurrentBatchConfig,Oe=0,it=null,Ye=null,ut=0,Wt=0,_i=ir(0),et=0,zs=null,jr=0,Sl=0,Oc=0,js=null,Tt=null,Pc=0,Oi=1/0,qn=null,bl=!1,Tc=null,cr=null,Cl=!1,hr=null,Al=0,Fs=0,Mc=null,El=-1,_l=0;function kt(){return(Oe&6)!==0?Ke():El!==-1?El:El=Ke()}function fr(s){return(s.mode&1)===0?1:(Oe&2)!==0&&ut!==0?ut&-ut:hw.transition!==null?(_l===0&&(_l=Pd()),_l):(s=Ne,s!==0||(s=window.event,s=s===void 0?16:zd(s.type)),s)}function dn(s,l,c,f){if(50<Fs)throw Fs=0,Mc=null,Error(t(185));cs(s,c,f),((Oe&2)===0||s!==it)&&(s===it&&((Oe&2)===0&&(Sl|=c),et===4&&dr(s,ut)),Mt(s,f),c===1&&Oe===0&&(l.mode&1)===0&&(Oi=Ke()+500,tl&&or()))}function Mt(s,l){var c=s.callbackNode;h1(s,l);var f=Bo(s,s===it?ut:0);if(f===0)c!==null&&Ed(c),s.callbackNode=null,s.callbackPriority=0;else if(l=f&-f,s.callbackPriority!==l){if(c!=null&&Ed(c),l===1)s.tag===0?cw(zm.bind(null,s)):bp(zm.bind(null,s)),ow(function(){(Oe&6)===0&&or()}),c=null;else{switch(Td(f)){case 1:c=cu;break;case 4:c=_d;break;case 16:c=Lo;break;case 536870912:c=Od;break;default:c=Lo}c=Um(c,Im.bind(null,s))}s.callbackPriority=l,s.callbackNode=c}}function Im(s,l){if(El=-1,_l=0,(Oe&6)!==0)throw Error(t(327));var c=s.callbackNode;if(Pi()&&s.callbackNode!==c)return null;var f=Bo(s,s===it?ut:0);if(f===0)return null;if((f&30)!==0||(f&s.expiredLanes)!==0||l)l=Ol(s,f);else{l=f;var m=Oe;Oe|=2;var y=Fm();(it!==s||ut!==l)&&(qn=null,Oi=Ke()+500,Hr(s,l));do try{Mw();break}catch(b){jm(s,b)}while(!0);Gu(),kl.current=y,Oe=m,Ye!==null?l=0:(it=null,ut=0,l=et)}if(l!==0){if(l===2&&(m=hu(s),m!==0&&(f=m,l=Lc(s,m))),l===1)throw c=zs,Hr(s,0),dr(s,f),Mt(s,Ke()),c;if(l===6)dr(s,f);else{if(m=s.current.alternate,(f&30)===0&&!Pw(m)&&(l=Ol(s,f),l===2&&(y=hu(s),y!==0&&(f=y,l=Lc(s,y))),l===1))throw c=zs,Hr(s,0),dr(s,f),Mt(s,Ke()),c;switch(s.finishedWork=m,s.finishedLanes=f,l){case 0:case 1:throw Error(t(345));case 2:Wr(s,Tt,qn);break;case 3:if(dr(s,f),(f&130023424)===f&&(l=Pc+500-Ke(),10<l)){if(Bo(s,0)!==0)break;if(m=s.suspendedLanes,(m&f)!==f){kt(),s.pingedLanes|=s.suspendedLanes&m;break}s.timeoutHandle=zu(Wr.bind(null,s,Tt,qn),l);break}Wr(s,Tt,qn);break;case 4:if(dr(s,f),(f&4194240)===f)break;for(l=s.eventTimes,m=-1;0<f;){var x=31-ln(f);y=1<<x,x=l[x],x>m&&(m=x),f&=~y}if(f=m,f=Ke()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*Ow(f/1960))-f,10<f){s.timeoutHandle=zu(Wr.bind(null,s,Tt,qn),f);break}Wr(s,Tt,qn);break;case 5:Wr(s,Tt,qn);break;default:throw Error(t(329))}}}return Mt(s,Ke()),s.callbackNode===c?Im.bind(null,s):null}function Lc(s,l){var c=js;return s.current.memoizedState.isDehydrated&&(Hr(s,l).flags|=256),s=Ol(s,l),s!==2&&(l=Tt,Tt=c,l!==null&&Nc(l)),s}function Nc(s){Tt===null?Tt=s:Tt.push.apply(Tt,s)}function Pw(s){for(var l=s;;){if(l.flags&16384){var c=l.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var f=0;f<c.length;f++){var m=c[f],y=m.getSnapshot;m=m.value;try{if(!an(y(),m))return!1}catch{return!1}}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function dr(s,l){for(l&=~Oc,l&=~Sl,s.suspendedLanes|=l,s.pingedLanes&=~l,s=s.expirationTimes;0<l;){var c=31-ln(l),f=1<<c;s[c]=-1,l&=~f}}function zm(s){if((Oe&6)!==0)throw Error(t(327));Pi();var l=Bo(s,0);if((l&1)===0)return Mt(s,Ke()),null;var c=Ol(s,l);if(s.tag!==0&&c===2){var f=hu(s);f!==0&&(l=f,c=Lc(s,f))}if(c===1)throw c=zs,Hr(s,0),dr(s,l),Mt(s,Ke()),c;if(c===6)throw Error(t(345));return s.finishedWork=s.current.alternate,s.finishedLanes=l,Wr(s,Tt,qn),Mt(s,Ke()),null}function Dc(s,l){var c=Oe;Oe|=1;try{return s(l)}finally{Oe=c,Oe===0&&(Oi=Ke()+500,tl&&or())}}function Fr(s){hr!==null&&hr.tag===0&&(Oe&6)===0&&Pi();var l=Oe;Oe|=1;var c=Yt.transition,f=Ne;try{if(Yt.transition=null,Ne=1,s)return s()}finally{Ne=f,Yt.transition=c,Oe=l,(Oe&6)===0&&or()}}function Rc(){Wt=_i.current,He(_i)}function Hr(s,l){s.finishedWork=null,s.finishedLanes=0;var c=s.timeoutHandle;if(c!==-1&&(s.timeoutHandle=-1,sw(c)),Ye!==null)for(c=Ye.return;c!==null;){var f=c;switch(Vu(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&Zo();break;case 3:Ci(),He(_t),He(dt),rc();break;case 5:tc(f);break;case 4:Ci();break;case 13:He(qe);break;case 19:He(qe);break;case 10:Xu(f.type._context);break;case 22:case 23:Rc()}c=c.return}if(it=s,Ye=s=pr(s.current,null),ut=Wt=l,et=0,zs=null,Oc=Sl=jr=0,Tt=js=null,Br!==null){for(l=0;l<Br.length;l++)if(c=Br[l],f=c.interleaved,f!==null){c.interleaved=null;var m=f.next,y=c.pending;if(y!==null){var x=y.next;y.next=m,f.next=x}c.pending=f}Br=null}return s}function jm(s,l){do{var c=Ye;try{if(Gu(),hl.current=ml,fl){for(var f=Ve.memoizedState;f!==null;){var m=f.queue;m!==null&&(m.pending=null),f=f.next}fl=!1}if(zr=0,rt=Ze=Ve=null,Ls=!1,Ns=0,_c.current=null,c===null||c.return===null){et=1,zs=l,Ye=null;break}e:{var y=s,x=c.return,b=c,A=l;if(l=ut,b.flags|=32768,A!==null&&typeof A=="object"&&typeof A.then=="function"){var N=A,V=b,U=V.tag;if((V.mode&1)===0&&(U===0||U===11||U===15)){var q=V.alternate;q?(V.updateQueue=q.updateQueue,V.memoizedState=q.memoizedState,V.lanes=q.lanes):(V.updateQueue=null,V.memoizedState=null)}var Z=cm(x);if(Z!==null){Z.flags&=-257,hm(Z,x,b,y,l),Z.mode&1&&um(y,N,l),l=Z,A=N;var ne=l.updateQueue;if(ne===null){var se=new Set;se.add(A),l.updateQueue=se}else ne.add(A);break e}else{if((l&1)===0){um(y,N,l),Bc();break e}A=Error(t(426))}}else if(We&&b.mode&1){var Ge=cm(x);if(Ge!==null){(Ge.flags&65536)===0&&(Ge.flags|=256),hm(Ge,x,b,y,l),$u(Ai(A,b));break e}}y=A=Ai(A,b),et!==4&&(et=2),js===null?js=[y]:js.push(y),y=x;do{switch(y.tag){case 3:y.flags|=65536,l&=-l,y.lanes|=l;var T=lm(y,A,l);Dp(y,T);break e;case 1:b=A;var _=y.type,L=y.stateNode;if((y.flags&128)===0&&(typeof _.getDerivedStateFromError=="function"||L!==null&&typeof L.componentDidCatch=="function"&&(cr===null||!cr.has(L)))){y.flags|=65536,l&=-l,y.lanes|=l;var K=am(y,b,l);Dp(y,K);break e}}y=y.return}while(y!==null)}Wm(c)}catch(ae){l=ae,Ye===c&&c!==null&&(Ye=c=c.return);continue}break}while(!0)}function Fm(){var s=kl.current;return kl.current=ml,s===null?ml:s}function Bc(){(et===0||et===3||et===2)&&(et=4),it===null||(jr&268435455)===0&&(Sl&268435455)===0||dr(it,ut)}function Ol(s,l){var c=Oe;Oe|=2;var f=Fm();(it!==s||ut!==l)&&(qn=null,Hr(s,l));do try{Tw();break}catch(m){jm(s,m)}while(!0);if(Gu(),Oe=c,kl.current=f,Ye!==null)throw Error(t(261));return it=null,ut=0,et}function Tw(){for(;Ye!==null;)Hm(Ye)}function Mw(){for(;Ye!==null&&!n1();)Hm(Ye)}function Hm(s){var l=Qm(s.alternate,s,Wt);s.memoizedProps=s.pendingProps,l===null?Wm(s):Ye=l,_c.current=null}function Wm(s){var l=s;do{var c=l.alternate;if(s=l.return,(l.flags&32768)===0){if(c=bw(c,l,Wt),c!==null){Ye=c;return}}else{if(c=Cw(c,l),c!==null){c.flags&=32767,Ye=c;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{et=6,Ye=null;return}}if(l=l.sibling,l!==null){Ye=l;return}Ye=l=s}while(l!==null);et===0&&(et=5)}function Wr(s,l,c){var f=Ne,m=Yt.transition;try{Yt.transition=null,Ne=1,Lw(s,l,c,f)}finally{Yt.transition=m,Ne=f}return null}function Lw(s,l,c,f){do Pi();while(hr!==null);if((Oe&6)!==0)throw Error(t(327));c=s.finishedWork;var m=s.finishedLanes;if(c===null)return null;if(s.finishedWork=null,s.finishedLanes=0,c===s.current)throw Error(t(177));s.callbackNode=null,s.callbackPriority=0;var y=c.lanes|c.childLanes;if(f1(s,y),s===it&&(Ye=it=null,ut=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Cl||(Cl=!0,Um(Lo,function(){return Pi(),null})),y=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||y){y=Yt.transition,Yt.transition=null;var x=Ne;Ne=1;var b=Oe;Oe|=4,_c.current=null,Ew(s,c),Lm(c,s),J1(Bu),jo=!!Ru,Bu=Ru=null,s.current=c,_w(c),r1(),Oe=b,Ne=x,Yt.transition=y}else s.current=c;if(Cl&&(Cl=!1,hr=s,Al=m),y=s.pendingLanes,y===0&&(cr=null),o1(c.stateNode),Mt(s,Ke()),l!==null)for(f=s.onRecoverableError,c=0;c<l.length;c++)m=l[c],f(m.value,{componentStack:m.stack,digest:m.digest});if(bl)throw bl=!1,s=Tc,Tc=null,s;return(Al&1)!==0&&s.tag!==0&&Pi(),y=s.pendingLanes,(y&1)!==0?s===Mc?Fs++:(Fs=0,Mc=s):Fs=0,or(),null}function Pi(){if(hr!==null){var s=Td(Al),l=Yt.transition,c=Ne;try{if(Yt.transition=null,Ne=16>s?16:s,hr===null)var f=!1;else{if(s=hr,hr=null,Al=0,(Oe&6)!==0)throw Error(t(331));var m=Oe;for(Oe|=4,te=s.current;te!==null;){var y=te,x=y.child;if((te.flags&16)!==0){var b=y.deletions;if(b!==null){for(var A=0;A<b.length;A++){var N=b[A];for(te=N;te!==null;){var V=te;switch(V.tag){case 0:case 11:case 15:Is(8,V,y)}var U=V.child;if(U!==null)U.return=V,te=U;else for(;te!==null;){V=te;var q=V.sibling,Z=V.return;if(_m(V),V===N){te=null;break}if(q!==null){q.return=Z,te=q;break}te=Z}}}var ne=y.alternate;if(ne!==null){var se=ne.child;if(se!==null){ne.child=null;do{var Ge=se.sibling;se.sibling=null,se=Ge}while(se!==null)}}te=y}}if((y.subtreeFlags&2064)!==0&&x!==null)x.return=y,te=x;else e:for(;te!==null;){if(y=te,(y.flags&2048)!==0)switch(y.tag){case 0:case 11:case 15:Is(9,y,y.return)}var T=y.sibling;if(T!==null){T.return=y.return,te=T;break e}te=y.return}}var _=s.current;for(te=_;te!==null;){x=te;var L=x.child;if((x.subtreeFlags&2064)!==0&&L!==null)L.return=x,te=L;else e:for(x=_;te!==null;){if(b=te,(b.flags&2048)!==0)try{switch(b.tag){case 0:case 11:case 15:wl(9,b)}}catch(ae){Qe(b,b.return,ae)}if(b===x){te=null;break e}var K=b.sibling;if(K!==null){K.return=b.return,te=K;break e}te=b.return}}if(Oe=m,or(),wn&&typeof wn.onPostCommitFiberRoot=="function")try{wn.onPostCommitFiberRoot(No,s)}catch{}f=!0}return f}finally{Ne=c,Yt.transition=l}}return!1}function qm(s,l,c){l=Ai(c,l),l=lm(s,l,1),s=ar(s,l,1),l=kt(),s!==null&&(cs(s,1,l),Mt(s,l))}function Qe(s,l,c){if(s.tag===3)qm(s,s,c);else for(;l!==null;){if(l.tag===3){qm(l,s,c);break}else if(l.tag===1){var f=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(cr===null||!cr.has(f))){s=Ai(c,s),s=am(l,s,1),l=ar(l,s,1),s=kt(),l!==null&&(cs(l,1,s),Mt(l,s));break}}l=l.return}}function Nw(s,l,c){var f=s.pingCache;f!==null&&f.delete(l),l=kt(),s.pingedLanes|=s.suspendedLanes&c,it===s&&(ut&c)===c&&(et===4||et===3&&(ut&130023424)===ut&&500>Ke()-Pc?Hr(s,0):Oc|=c),Mt(s,l)}function Vm(s,l){l===0&&((s.mode&1)===0?l=1:(l=Ro,Ro<<=1,(Ro&130023424)===0&&(Ro=4194304)));var c=kt();s=Fn(s,l),s!==null&&(cs(s,l,c),Mt(s,c))}function Dw(s){var l=s.memoizedState,c=0;l!==null&&(c=l.retryLane),Vm(s,c)}function Rw(s,l){var c=0;switch(s.tag){case 13:var f=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:f=s.stateNode;break;default:throw Error(t(314))}f!==null&&f.delete(l),Vm(s,c)}var Qm;Qm=function(s,l,c){if(s!==null)if(s.memoizedProps!==l.pendingProps||_t.current)Pt=!0;else{if((s.lanes&c)===0&&(l.flags&128)===0)return Pt=!1,Sw(s,l,c);Pt=(s.flags&131072)!==0}else Pt=!1,We&&(l.flags&1048576)!==0&&Cp(l,rl,l.index);switch(l.lanes=0,l.tag){case 2:var f=l.type;vl(s,l),s=l.pendingProps;var m=yi(l,dt.current);bi(l,c),m=oc(null,l,f,s,m,c);var y=lc();return l.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Ot(f)?(y=!0,el(l)):y=!1,l.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,Zu(l),m.updater=gl,l.stateNode=m,m._reactInternals=l,dc(l,f,s,c),l=yc(null,l,f,!0,y,c)):(l.tag=0,We&&y&&qu(l),wt(null,l,m,c),l=l.child),l;case 16:f=l.elementType;e:{switch(vl(s,l),s=l.pendingProps,m=f._init,f=m(f._payload),l.type=f,m=l.tag=Iw(f),s=cn(f,s),m){case 0:l=gc(null,l,f,s,c);break e;case 1:l=ym(null,l,f,s,c);break e;case 11:l=fm(null,l,f,s,c);break e;case 14:l=dm(null,l,f,cn(f.type,s),c);break e}throw Error(t(306,f,""))}return l;case 0:return f=l.type,m=l.pendingProps,m=l.elementType===f?m:cn(f,m),gc(s,l,f,m,c);case 1:return f=l.type,m=l.pendingProps,m=l.elementType===f?m:cn(f,m),ym(s,l,f,m,c);case 3:e:{if(vm(l),s===null)throw Error(t(387));f=l.pendingProps,y=l.memoizedState,m=y.element,Np(s,l),ul(l,f,null,c);var x=l.memoizedState;if(f=x.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:x.cache,pendingSuspenseBoundaries:x.pendingSuspenseBoundaries,transitions:x.transitions},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){m=Ai(Error(t(423)),l),l=xm(s,l,f,c,m);break e}else if(f!==m){m=Ai(Error(t(424)),l),l=xm(s,l,f,c,m);break e}else for(Ht=rr(l.stateNode.containerInfo.firstChild),Ft=l,We=!0,un=null,c=Mp(l,null,f,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(wi(),f===m){l=Wn(s,l,c);break e}wt(s,l,f,c)}l=l.child}return l;case 5:return Bp(l),s===null&&Uu(l),f=l.type,m=l.pendingProps,y=s!==null?s.memoizedProps:null,x=m.children,Iu(f,m)?x=null:y!==null&&Iu(f,y)&&(l.flags|=32),gm(s,l),wt(s,l,x,c),l.child;case 6:return s===null&&Uu(l),null;case 13:return wm(s,l,c);case 4:return ec(l,l.stateNode.containerInfo),f=l.pendingProps,s===null?l.child=ki(l,null,f,c):wt(s,l,f,c),l.child;case 11:return f=l.type,m=l.pendingProps,m=l.elementType===f?m:cn(f,m),fm(s,l,f,m,c);case 7:return wt(s,l,l.pendingProps,c),l.child;case 8:return wt(s,l,l.pendingProps.children,c),l.child;case 12:return wt(s,l,l.pendingProps.children,c),l.child;case 10:e:{if(f=l.type._context,m=l.pendingProps,y=l.memoizedProps,x=m.value,Ie(ol,f._currentValue),f._currentValue=x,y!==null)if(an(y.value,x)){if(y.children===m.children&&!_t.current){l=Wn(s,l,c);break e}}else for(y=l.child,y!==null&&(y.return=l);y!==null;){var b=y.dependencies;if(b!==null){x=y.child;for(var A=b.firstContext;A!==null;){if(A.context===f){if(y.tag===1){A=Hn(-1,c&-c),A.tag=2;var N=y.updateQueue;if(N!==null){N=N.shared;var V=N.pending;V===null?A.next=A:(A.next=V.next,V.next=A),N.pending=A}}y.lanes|=c,A=y.alternate,A!==null&&(A.lanes|=c),Yu(y.return,c,l),b.lanes|=c;break}A=A.next}}else if(y.tag===10)x=y.type===l.type?null:y.child;else if(y.tag===18){if(x=y.return,x===null)throw Error(t(341));x.lanes|=c,b=x.alternate,b!==null&&(b.lanes|=c),Yu(x,c,l),x=y.sibling}else x=y.child;if(x!==null)x.return=y;else for(x=y;x!==null;){if(x===l){x=null;break}if(y=x.sibling,y!==null){y.return=x.return,x=y;break}x=x.return}y=x}wt(s,l,m.children,c),l=l.child}return l;case 9:return m=l.type,f=l.pendingProps.children,bi(l,c),m=Gt(m),f=f(m),l.flags|=1,wt(s,l,f,c),l.child;case 14:return f=l.type,m=cn(f,l.pendingProps),m=cn(f.type,m),dm(s,l,f,m,c);case 15:return pm(s,l,l.type,l.pendingProps,c);case 17:return f=l.type,m=l.pendingProps,m=l.elementType===f?m:cn(f,m),vl(s,l),l.tag=1,Ot(f)?(s=!0,el(l)):s=!1,bi(l,c),sm(l,f,m),dc(l,f,m,c),yc(null,l,f,!0,s,c);case 19:return Sm(s,l,c);case 22:return mm(s,l,c)}throw Error(t(156,l.tag))};function Um(s,l){return Ad(s,l)}function Bw(s,l,c,f){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(s,l,c,f){return new Bw(s,l,c,f)}function Ic(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Iw(s){if(typeof s=="function")return Ic(s)?1:0;if(s!=null){if(s=s.$$typeof,s===J)return 11;if(s===xe)return 14}return 2}function pr(s,l){var c=s.alternate;return c===null?(c=Jt(s.tag,l,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=l,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&14680064,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,l=s.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c}function Pl(s,l,c,f,m,y){var x=2;if(f=s,typeof s=="function")Ic(s)&&(x=1);else if(typeof s=="string")x=5;else e:switch(s){case H:return qr(c.children,m,y,l);case ie:x=8,m|=8;break;case de:return s=Jt(12,c,l,m|2),s.elementType=de,s.lanes=y,s;case fe:return s=Jt(13,c,l,m),s.elementType=fe,s.lanes=y,s;case he:return s=Jt(19,c,l,m),s.elementType=he,s.lanes=y,s;case we:return Tl(c,m,y,l);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case Se:x=10;break e;case ge:x=9;break e;case J:x=11;break e;case xe:x=14;break e;case Ae:x=16,f=null;break e}throw Error(t(130,s==null?s:typeof s,""))}return l=Jt(x,c,l,m),l.elementType=s,l.type=f,l.lanes=y,l}function qr(s,l,c,f){return s=Jt(7,s,f,l),s.lanes=c,s}function Tl(s,l,c,f){return s=Jt(22,s,f,l),s.elementType=we,s.lanes=c,s.stateNode={isHidden:!1},s}function zc(s,l,c){return s=Jt(6,s,null,l),s.lanes=c,s}function jc(s,l,c){return l=Jt(4,s.children!==null?s.children:[],s.key,l),l.lanes=c,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}function zw(s,l,c,f,m){this.tag=l,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fu(0),this.expirationTimes=fu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fu(0),this.identifierPrefix=f,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Fc(s,l,c,f,m,y,x,b,A){return s=new zw(s,l,c,b,A),l===1?(l=1,y===!0&&(l|=8)):l=0,y=Jt(3,null,null,l),s.current=y,y.stateNode=s,y.memoizedState={element:f,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zu(y),s}function jw(s,l,c){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:f==null?null:""+f,children:s,containerInfo:l,implementation:c}}function $m(s){if(!s)return sr;s=s._reactInternals;e:{if(Mr(s)!==s||s.tag!==1)throw Error(t(170));var l=s;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Ot(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(t(171))}if(s.tag===1){var c=s.type;if(Ot(c))return kp(s,c,l)}return l}function Km(s,l,c,f,m,y,x,b,A){return s=Fc(c,f,!0,s,m,y,x,b,A),s.context=$m(null),c=s.current,f=kt(),m=fr(c),y=Hn(f,m),y.callback=l??null,ar(c,y,m),s.current.lanes=m,cs(s,m,f),Mt(s,f),s}function Ml(s,l,c,f){var m=l.current,y=kt(),x=fr(m);return c=$m(c),l.context===null?l.context=c:l.pendingContext=c,l=Hn(y,x),l.payload={element:s},f=f===void 0?null:f,f!==null&&(l.callback=f),s=ar(m,l,x),s!==null&&(dn(s,m,x,y),al(s,m,x)),x}function Ll(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function Gm(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<l?c:l}}function Hc(s,l){Gm(s,l),(s=s.alternate)&&Gm(s,l)}function Fw(){return null}var Xm=typeof reportError=="function"?reportError:function(s){console.error(s)};function Wc(s){this._internalRoot=s}Nl.prototype.render=Wc.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(t(409));Ml(s,l,null,null)},Nl.prototype.unmount=Wc.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;Fr(function(){Ml(null,s,null,null)}),l[Bn]=null}};function Nl(s){this._internalRoot=s}Nl.prototype.unstable_scheduleHydration=function(s){if(s){var l=Nd();s={blockedOn:null,target:s,priority:l};for(var c=0;c<er.length&&l!==0&&l<er[c].priority;c++);er.splice(c,0,s),c===0&&Bd(s)}};function qc(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Dl(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Ym(){}function Hw(s,l,c,f,m){if(m){if(typeof f=="function"){var y=f;f=function(){var N=Ll(x);y.call(N)}}var x=Km(l,f,s,0,null,!1,!1,"",Ym);return s._reactRootContainer=x,s[Bn]=x.current,Cs(s.nodeType===8?s.parentNode:s),Fr(),x}for(;m=s.lastChild;)s.removeChild(m);if(typeof f=="function"){var b=f;f=function(){var N=Ll(A);b.call(N)}}var A=Fc(s,0,!1,null,null,!1,!1,"",Ym);return s._reactRootContainer=A,s[Bn]=A.current,Cs(s.nodeType===8?s.parentNode:s),Fr(function(){Ml(l,A,c,f)}),A}function Rl(s,l,c,f,m){var y=c._reactRootContainer;if(y){var x=y;if(typeof m=="function"){var b=m;m=function(){var A=Ll(x);b.call(A)}}Ml(l,x,s,m)}else x=Hw(c,l,s,m,f);return Ll(x)}Md=function(s){switch(s.tag){case 3:var l=s.stateNode;if(l.current.memoizedState.isDehydrated){var c=us(l.pendingLanes);c!==0&&(du(l,c|1),Mt(l,Ke()),(Oe&6)===0&&(Oi=Ke()+500,or()))}break;case 13:Fr(function(){var f=Fn(s,1);if(f!==null){var m=kt();dn(f,s,1,m)}}),Hc(s,1)}},pu=function(s){if(s.tag===13){var l=Fn(s,134217728);if(l!==null){var c=kt();dn(l,s,134217728,c)}Hc(s,134217728)}},Ld=function(s){if(s.tag===13){var l=fr(s),c=Fn(s,l);if(c!==null){var f=kt();dn(c,s,l,f)}Hc(s,l)}},Nd=function(){return Ne},Dd=function(s,l){var c=Ne;try{return Ne=s,l()}finally{Ne=c}},ou=function(s,l,c){switch(l){case"input":if(Ja(s,c),l=c.name,c.type==="radio"&&l!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<c.length;l++){var f=c[l];if(f!==s&&f.form===s.form){var m=Jo(f);if(!m)throw Error(t(90));id(f),Ja(f,m)}}}break;case"textarea":ud(s,c);break;case"select":l=c.value,l!=null&&si(s,!!c.multiple,l,!1)}},vd=Dc,xd=Fr;var Ww={usingClientEntryPoint:!1,Events:[_s,mi,Jo,gd,yd,Dc]},Hs={findFiberByHostInstance:Lr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qw={bundleType:Hs.bundleType,version:Hs.version,rendererPackageName:Hs.rendererPackageName,rendererConfig:Hs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Q.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=bd(s),s===null?null:s.stateNode},findFiberByHostInstance:Hs.findFiberByHostInstance||Fw,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 Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{No=Bl.inject(qw),wn=Bl}catch{}}return Lt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ww,Lt.createPortal=function(s,l){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qc(l))throw Error(t(200));return jw(s,l,null,c)},Lt.createRoot=function(s,l){if(!qc(s))throw Error(t(299));var c=!1,f="",m=Xm;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onRecoverableError!==void 0&&(m=l.onRecoverableError)),l=Fc(s,1,!1,null,null,c,!1,f,m),s[Bn]=l.current,Cs(s.nodeType===8?s.parentNode:s),new Wc(l)},Lt.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(t(188)):(s=Object.keys(s).join(","),Error(t(268,s)));return s=bd(l),s=s===null?null:s.stateNode,s},Lt.flushSync=function(s){return Fr(s)},Lt.hydrate=function(s,l,c){if(!Dl(l))throw Error(t(200));return Rl(null,s,l,!0,c)},Lt.hydrateRoot=function(s,l,c){if(!qc(s))throw Error(t(405));var f=c!=null&&c.hydratedSources||null,m=!1,y="",x=Xm;if(c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onRecoverableError!==void 0&&(x=c.onRecoverableError)),l=Km(l,null,s,1,c??null,m,!1,y,x),s[Bn]=l.current,Cs(s),f)for(s=0;s<f.length;s++)c=f[s],m=c._getVersion,m=m(c._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[c,m]:l.mutableSourceEagerHydrationData.push(c,m);return new Nl(l)},Lt.render=function(s,l,c){if(!Dl(l))throw Error(t(200));return Rl(null,s,l,!1,c)},Lt.unmountComponentAtNode=function(s){if(!Dl(s))throw Error(t(40));return s._reactRootContainer?(Fr(function(){Rl(null,null,s,!1,function(){s._reactRootContainer=null,s[Bn]=null})}),!0):!1},Lt.unstable_batchedUpdates=Dc,Lt.unstable_renderSubtreeIntoContainer=function(s,l,c,f){if(!Dl(c))throw Error(t(200));if(s==null||s._reactInternals===void 0)throw Error(t(38));return Rl(s,l,c,!1,f)},Lt.version="18.3.1-next-f1338f8080-20240426",Lt}var og;function oy(){if(og)return $c.exports;og=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),$c.exports=tk(),$c.exports}var lg;function nk(){if(lg)return Il;lg=1;var r=oy();return Il.createRoot=r.createRoot,Il.hydrateRoot=r.hydrateRoot,Il}var ly=nk();const rk=[{code:"en",name:"English"},{code:"es",name:"Español"},{code:"fr",name:"Français"},{code:"de",name:"Deutsch"},{code:"pt",name:"Português"},{code:"it",name:"Italiano"},{code:"ja",name:"日本語"},{code:"ko",name:"한국어"},{code:"zh",name:"中文"},{code:"ru",name:"Русский"},{code:"ro",name:"Română"}];function ik(r){return rk.some(e=>e.code===r)}const ag={en:{serverPluginMissing:"This page needs the server plugin {title}",serverPluginMissingHint:"{title} is not installed on this server, so this page has nothing to show. Install it, then restart the server.",serverPluginOpen:"Open it in the marketplace",serverPluginFromCode:"Add it in the server’s code:",paletteSearchIn:"Search {page} for “{query}”",autoScrollOn:"Auto-scroll ON",autoScrollOff:"Auto-scroll OFF",breadcrumb:"Path",root:"Root directory",paletteOpen:"Search…",paletteTitle:"Go to",palettePlaceholder:"Go to a page, a job or a command, or search…",paletteEmpty:"Nothing found.",palettePages:"Pages",paletteSearchGroup:"Search",paletteSearchLogs:"Search logs for “{query}”",paletteMove:"move",paletteOpenItem:"open",paletteClose:"close",pagination:"Pages",rowsPerPage:"Rows per page",pageRange:"{from}–{to} of {total}",previousPage:"Previous",nextPage:"Next",pageOf:"Page {page} of {pages}",selectSearch:"Search…",selectNoMatches:"No matches",selectClear:"Clear",selectMore:"+{count}",dialogClose:"Close",confirmOk:"Confirm",confirmCancel:"Cancel",confirmBusy:"Working…",moreActions:"More actions",rowActions:"Actions for {name}",noData:"No data",sortBy:"Sort by {column}",table:"Table",pageFailed:"This page failed to load",retry:"Retry",loading:"Loading…",loadFailed:"Could not load the data",noAccess:"You don't have access to this page",noAccessPermission:"It needs the permission {permission}. Ask an administrator to grant it.",noAccessHint:"Ask an administrator to give you access.",missingPermission:"Missing permission: {permission}",sectionFailed:"{label} failed to render",thisSection:"This section",panel:"Panel",chipListMore:"+{count} more",chipListShowAll:"Show all {count}",chipListTitle:"All items ({count})",chipListSearch:"Search the list",chipListMatches:"{shown} of {total}"},es:{serverPluginMissing:"Esta página necesita el plugin de servidor {title}",serverPluginMissingHint:"{title} no está instalado en este servidor, así que esta página no tiene nada que mostrar. Instálalo y reinicia el servidor.",serverPluginOpen:"Abrirlo en el marketplace",serverPluginFromCode:"Añádelo en el código del servidor:",paletteClose:"cerrar",paletteOpenItem:"abrir",paletteMove:"mover",paletteSearchIn:"Buscar «{query}» en {page}",paletteSearchLogs:"Buscar «{query}» en los registros",paletteSearchGroup:"Buscar",palettePages:"Páginas",paletteEmpty:"No se encontró nada.",palettePlaceholder:"Ir a una página, una tarea o un comando, o buscar…",paletteTitle:"Ir a",paletteOpen:"Buscar…",autoScrollOn:"Desplazamiento auto: SÍ",autoScrollOff:"Desplazamiento auto: NO",breadcrumb:"Ruta",root:"Directorio raíz",pagination:"Páginas",rowsPerPage:"Filas por página",pageRange:"{from}–{to} de {total}",previousPage:"Anterior",nextPage:"Siguiente",pageOf:"Página {page} de {pages}",selectSearch:"Buscar…",selectNoMatches:"Sin coincidencias",selectClear:"Borrar",selectMore:"+{count}",dialogClose:"Cerrar",confirmOk:"Confirmar",confirmCancel:"Cancelar",confirmBusy:"Procesando…",moreActions:"Más acciones",rowActions:"Acciones de {name}",noData:"Sin datos",sortBy:"Ordenar por {column}",table:"Tabla",pageFailed:"No se pudo cargar esta página",retry:"Reintentar",loading:"Cargando…",loadFailed:"No se pudieron cargar los datos",noAccess:"No tienes acceso a esta página",noAccessPermission:"Necesita el permiso {permission}. Pide a un administrador que te lo conceda.",noAccessHint:"Pide acceso a un administrador.",missingPermission:"Falta el permiso: {permission}",sectionFailed:"No se pudo mostrar {label}",thisSection:"Esta sección",panel:"Panel",chipListMore:"+{count} más",chipListShowAll:"Mostrar los {count}",chipListTitle:"Todos los elementos ({count})",chipListSearch:"Buscar en la lista",chipListMatches:"{shown} de {total}"},fr:{serverPluginMissing:"Cette page a besoin du plugin serveur {title}",serverPluginMissingHint:"{title} n’est pas installé sur ce serveur : cette page n’a rien à afficher. Installez-le, puis redémarrez le serveur.",serverPluginOpen:"L’ouvrir dans le marketplace",serverPluginFromCode:"Ajoutez-le dans le code du serveur :",paletteClose:"fermer",paletteOpenItem:"ouvrir",paletteMove:"déplacer",paletteSearchIn:"Rechercher « {query} » dans {page}",paletteSearchLogs:"Rechercher « {query} » dans les journaux",paletteSearchGroup:"Rechercher",palettePages:"Pages",paletteEmpty:"Aucun résultat.",palettePlaceholder:"Aller à une page, une tâche ou une commande, ou rechercher…",paletteTitle:"Aller à",paletteOpen:"Rechercher…",autoScrollOn:"Défilement auto : ON",autoScrollOff:"Défilement auto : OFF",breadcrumb:"Chemin",root:"Répertoire racine",pagination:"Pages",rowsPerPage:"Lignes par page",pageRange:"{from}–{to} sur {total}",previousPage:"Précédent",nextPage:"Suivant",pageOf:"Page {page} sur {pages}",selectSearch:"Rechercher…",selectNoMatches:"Aucun résultat",selectClear:"Effacer",selectMore:"+{count}",dialogClose:"Fermer",confirmOk:"Confirmer",confirmCancel:"Annuler",confirmBusy:"En cours…",moreActions:"Plus d’actions",rowActions:"Actions pour {name}",noData:"Aucune donnée",sortBy:"Trier par {column}",table:"Tableau",pageFailed:"Impossible de charger cette page",retry:"Réessayer",loading:"Chargement…",loadFailed:"Impossible de charger les données",noAccess:"Vous n’avez pas accès à cette page",noAccessPermission:"Elle nécessite la permission {permission}. Demandez-la à un administrateur.",noAccessHint:"Demandez l’accès à un administrateur.",missingPermission:"Permission manquante : {permission}",sectionFailed:"Impossible d’afficher {label}",thisSection:"Cette section",panel:"Panneau",chipListMore:"+{count} de plus",chipListShowAll:"Tout afficher ({count})",chipListTitle:"Tous les éléments ({count})",chipListSearch:"Rechercher dans la liste",chipListMatches:"{shown} sur {total}"},de:{serverPluginMissing:"Diese Seite braucht das Server-Plugin {title}",serverPluginMissingHint:"{title} ist auf diesem Server nicht installiert, daher hat diese Seite nichts anzuzeigen. Installieren Sie es und starten Sie den Server neu.",serverPluginOpen:"Im Marketplace öffnen",serverPluginFromCode:"Im Code des Servers hinzufügen:",paletteClose:"schließen",paletteOpenItem:"öffnen",paletteMove:"bewegen",paletteSearchIn:"„{query}“ in {page} suchen",paletteSearchLogs:"„{query}“ in den Logs suchen",paletteSearchGroup:"Suche",palettePages:"Seiten",paletteEmpty:"Nichts gefunden.",palettePlaceholder:"Zu einer Seite, einem Job oder einem Befehl springen oder suchen…",paletteTitle:"Gehe zu",paletteOpen:"Suchen…",autoScrollOn:"Auto-Scroll AN",autoScrollOff:"Auto-Scroll AUS",breadcrumb:"Pfad",root:"Stammverzeichnis",pagination:"Seiten",rowsPerPage:"Zeilen pro Seite",pageRange:"{from}–{to} von {total}",previousPage:"Zurück",nextPage:"Weiter",pageOf:"Seite {page} von {pages}",selectSearch:"Suchen…",selectNoMatches:"Keine Treffer",selectClear:"Leeren",selectMore:"+{count}",dialogClose:"Schließen",confirmOk:"Bestätigen",confirmCancel:"Abbrechen",confirmBusy:"Wird ausgeführt…",moreActions:"Weitere Aktionen",rowActions:"Aktionen für {name}",noData:"Keine Daten",sortBy:"Nach {column} sortieren",table:"Tabelle",pageFailed:"Diese Seite konnte nicht geladen werden",retry:"Erneut versuchen",loading:"Wird geladen…",loadFailed:"Die Daten konnten nicht geladen werden",noAccess:"Sie haben keinen Zugriff auf diese Seite",noAccessPermission:"Sie benötigt die Berechtigung {permission}. Bitten Sie einen Administrator, sie Ihnen zu erteilen.",noAccessHint:"Bitten Sie einen Administrator um Zugriff.",missingPermission:"Fehlende Berechtigung: {permission}",sectionFailed:"{label} konnte nicht angezeigt werden",thisSection:"Dieser Bereich",panel:"Bereich",chipListMore:"+{count} weitere",chipListShowAll:"Alle {count} anzeigen",chipListTitle:"Alle Einträge ({count})",chipListSearch:"Liste durchsuchen",chipListMatches:"{shown} von {total}"},pt:{serverPluginMissing:"Esta página precisa do plugin de servidor {title}",serverPluginMissingHint:"{title} não está instalado neste servidor, por isso esta página não tem nada para mostrar. Instale-o e reinicie o servidor.",serverPluginOpen:"Abrir no marketplace",serverPluginFromCode:"Adicione-o no código do servidor:",paletteClose:"fechar",paletteOpenItem:"abrir",paletteMove:"mover",paletteSearchIn:"Pesquisar “{query}” em {page}",paletteSearchLogs:"Pesquisar “{query}” nos logs",paletteSearchGroup:"Pesquisar",palettePages:"Páginas",paletteEmpty:"Nada encontrado.",palettePlaceholder:"Ir para uma página, uma tarefa ou um comando, ou pesquisar…",paletteTitle:"Ir para",paletteOpen:"Pesquisar…",autoScrollOn:"Rolagem automática: SIM",autoScrollOff:"Rolagem automática: NÃO",breadcrumb:"Caminho",root:"Diretório raiz",pagination:"Páginas",rowsPerPage:"Linhas por página",pageRange:"{from}–{to} de {total}",previousPage:"Anterior",nextPage:"Seguinte",pageOf:"Página {page} de {pages}",selectSearch:"Pesquisar…",selectNoMatches:"Nenhum resultado",selectClear:"Limpar",selectMore:"+{count}",dialogClose:"Fechar",confirmOk:"Confirmar",confirmCancel:"Cancelar",confirmBusy:"Processando…",moreActions:"Mais ações",rowActions:"Ações de {name}",noData:"Sem dados",sortBy:"Ordenar por {column}",table:"Tabela",pageFailed:"Não foi possível carregar esta página",retry:"Tentar novamente",loading:"Carregando…",loadFailed:"Não foi possível carregar os dados",noAccess:"Você não tem acesso a esta página",noAccessPermission:"Ela requer a permissão {permission}. Peça a um administrador para concedê-la.",noAccessHint:"Peça acesso a um administrador.",missingPermission:"Permissão ausente: {permission}",sectionFailed:"Não foi possível exibir {label}",thisSection:"Esta seção",panel:"Painel",chipListMore:"+{count} mais",chipListShowAll:"Mostrar todos os {count}",chipListTitle:"Todos os itens ({count})",chipListSearch:"Pesquisar na lista",chipListMatches:"{shown} de {total}"},it:{serverPluginMissing:"Questa pagina richiede il plugin server {title}",serverPluginMissingHint:"{title} non è installato su questo server, quindi questa pagina non ha nulla da mostrare. Installalo, poi riavvia il server.",serverPluginOpen:"Aprilo nel marketplace",serverPluginFromCode:"Aggiungilo nel codice del server:",paletteClose:"chiudi",paletteOpenItem:"apri",paletteMove:"sposta",paletteSearchIn:"Cerca “{query}” in {page}",paletteSearchLogs:"Cerca “{query}” nei log",paletteSearchGroup:"Cerca",palettePages:"Pagine",paletteEmpty:"Nessun risultato.",palettePlaceholder:"Vai a una pagina, un job o un comando, o cerca…",paletteTitle:"Vai a",paletteOpen:"Cerca…",autoScrollOn:"Scorrimento auto: ON",autoScrollOff:"Scorrimento auto: OFF",breadcrumb:"Percorso",root:"Directory radice",pagination:"Pagine",rowsPerPage:"Righe per pagina",pageRange:"{from}–{to} di {total}",previousPage:"Precedente",nextPage:"Successiva",pageOf:"Pagina {page} di {pages}",selectSearch:"Cerca…",selectNoMatches:"Nessun risultato",selectClear:"Cancella",selectMore:"+{count}",dialogClose:"Chiudi",confirmOk:"Conferma",confirmCancel:"Annulla",confirmBusy:"In corso…",moreActions:"Altre azioni",rowActions:"Azioni per {name}",noData:"Nessun dato",sortBy:"Ordina per {column}",table:"Tabella",pageFailed:"Impossibile caricare questa pagina",retry:"Riprova",loading:"Caricamento…",loadFailed:"Impossibile caricare i dati",noAccess:"Non hai accesso a questa pagina",noAccessPermission:"Richiede il permesso {permission}. Chiedi a un amministratore di concedertelo.",noAccessHint:"Chiedi l’accesso a un amministratore.",missingPermission:"Permesso mancante: {permission}",sectionFailed:"Impossibile visualizzare {label}",thisSection:"Questa sezione",panel:"Pannello",chipListMore:"+{count} altri",chipListShowAll:"Mostra tutti i {count}",chipListTitle:"Tutti gli elementi ({count})",chipListSearch:"Cerca nell’elenco",chipListMatches:"{shown} di {total}"},ja:{serverPluginMissing:"このページにはサーバープラグイン {title} が必要です",serverPluginMissingHint:"{title} がこのサーバーにインストールされていないため、このページには表示する内容がありません。インストールしてからサーバーを再起動してください。",serverPluginOpen:"マーケットプレイスで開く",serverPluginFromCode:"サーバーのコードに追加:",paletteClose:"閉じる",paletteOpenItem:"開く",paletteMove:"移動",paletteSearchIn:"{page}で「{query}」を検索",paletteSearchLogs:"ログで「{query}」を検索",paletteSearchGroup:"検索",palettePages:"ページ",paletteEmpty:"見つかりませんでした。",palettePlaceholder:"ページ、ジョブ、コマンドへ移動、または検索…",paletteTitle:"移動",paletteOpen:"検索…",autoScrollOn:"自動スクロール: オン",autoScrollOff:"自動スクロール: オフ",breadcrumb:"パス",root:"ルートディレクトリ",pagination:"ページ",rowsPerPage:"1 ページの行数",pageRange:"{total} 件中 {from}–{to}",previousPage:"前へ",nextPage:"次へ",pageOf:"{page} / {pages} ページ",selectSearch:"検索…",selectNoMatches:"一致なし",selectClear:"クリア",selectMore:"+{count}",dialogClose:"閉じる",confirmOk:"確認",confirmCancel:"キャンセル",confirmBusy:"処理中…",moreActions:"その他の操作",rowActions:"{name} の操作",noData:"データがありません",sortBy:"{column} で並べ替え",table:"テーブル",pageFailed:"このページを読み込めませんでした",retry:"再試行",loading:"読み込み中…",loadFailed:"データを読み込めませんでした",noAccess:"このページにアクセスする権限がありません",noAccessPermission:"権限 {permission} が必要です。管理者に付与を依頼してください。",noAccessHint:"管理者にアクセスを依頼してください。",missingPermission:"不足している権限: {permission}",sectionFailed:"{label}を表示できませんでした",thisSection:"このセクション",panel:"パネル",chipListMore:"+{count} 件",chipListShowAll:"すべて表示 ({count})",chipListTitle:"すべての項目 ({count})",chipListSearch:"リストを検索",chipListMatches:"{total} 件中 {shown} 件"},ko:{serverPluginMissing:"이 페이지에는 서버 플러그인 {title}이(가) 필요합니다",serverPluginMissingHint:"{title}이(가) 이 서버에 설치되어 있지 않아 이 페이지에 표시할 내용이 없습니다. 설치한 뒤 서버를 다시 시작하세요.",serverPluginOpen:"마켓플레이스에서 열기",serverPluginFromCode:"서버 코드에 추가:",paletteClose:"닫기",paletteOpenItem:"열기",paletteMove:"이동",paletteSearchIn:"{page}에서 “{query}” 검색",paletteSearchLogs:"로그에서 “{query}” 검색",paletteSearchGroup:"검색",palettePages:"페이지",paletteEmpty:"찾을 수 없습니다.",palettePlaceholder:"페이지, 작업, 명령으로 이동하거나 검색…",paletteTitle:"이동",paletteOpen:"검색…",autoScrollOn:"자동 스크롤 켜짐",autoScrollOff:"자동 스크롤 꺼짐",breadcrumb:"경로",root:"루트 디렉터리",pagination:"페이지",rowsPerPage:"페이지당 행 수",pageRange:"{total}개 중 {from}–{to}",previousPage:"이전",nextPage:"다음",pageOf:"{pages}페이지 중 {page}페이지",selectSearch:"검색…",selectNoMatches:"일치 항목 없음",selectClear:"지우기",selectMore:"+{count}",dialogClose:"닫기",confirmOk:"확인",confirmCancel:"취소",confirmBusy:"처리 중…",moreActions:"추가 작업",rowActions:"{name} 작업",noData:"데이터 없음",sortBy:"{column} 기준 정렬",table:"표",pageFailed:"이 페이지를 불러오지 못했습니다",retry:"다시 시도",loading:"불러오는 중…",loadFailed:"데이터를 불러오지 못했습니다",noAccess:"이 페이지에 접근할 권한이 없습니다",noAccessPermission:"{permission} 권한이 필요합니다. 관리자에게 권한을 요청하세요.",noAccessHint:"관리자에게 접근 권한을 요청하세요.",missingPermission:"누락된 권한: {permission}",sectionFailed:"{label}을(를) 표시하지 못했습니다",thisSection:"이 섹션",panel:"패널",chipListMore:"+{count}개 더 보기",chipListShowAll:"{count}개 모두 보기",chipListTitle:"전체 항목 ({count})",chipListSearch:"목록 검색",chipListMatches:"{total}개 중 {shown}개"},zh:{serverPluginMissing:"此页面需要服务器插件 {title}",serverPluginMissingHint:"此服务器未安装 {title},因此此页面没有内容可显示。请安装它,然后重启服务器。",serverPluginOpen:"在市场中打开",serverPluginFromCode:"在服务器代码中添加:",paletteClose:"关闭",paletteOpenItem:"打开",paletteMove:"移动",paletteSearchIn:"在{page}中搜索“{query}”",paletteSearchLogs:"在日志中搜索“{query}”",paletteSearchGroup:"搜索",palettePages:"页面",paletteEmpty:"未找到。",palettePlaceholder:"转到页面、任务或命令,或搜索…",paletteTitle:"转到",paletteOpen:"搜索…",autoScrollOn:"自动滚动:开",autoScrollOff:"自动滚动:关",breadcrumb:"路径",root:"根目录",pagination:"分页",rowsPerPage:"每页行数",pageRange:"第 {from}–{to} 条,共 {total} 条",previousPage:"上一页",nextPage:"下一页",pageOf:"第 {page} / {pages} 页",selectSearch:"搜索…",selectNoMatches:"无匹配项",selectClear:"清除",selectMore:"+{count}",dialogClose:"关闭",confirmOk:"确认",confirmCancel:"取消",confirmBusy:"处理中…",moreActions:"更多操作",rowActions:"{name} 的操作",noData:"暂无数据",sortBy:"按 {column} 排序",table:"表格",pageFailed:"此页面加载失败",retry:"重试",loading:"加载中…",loadFailed:"无法加载数据",noAccess:"您无权访问此页面",noAccessPermission:"需要权限 {permission}。请联系管理员授予。",noAccessHint:"请联系管理员获取访问权限。",missingPermission:"缺少权限:{permission}",sectionFailed:"无法显示{label}",thisSection:"此部分",panel:"面板",chipListMore:"+{count} 项",chipListShowAll:"显示全部 {count} 项",chipListTitle:"全部项目 ({count})",chipListSearch:"搜索列表",chipListMatches:"{shown} / {total}"},ru:{serverPluginMissing:"Этой странице нужен серверный плагин {title}",serverPluginMissingHint:"{title} не установлен на этом сервере, поэтому странице нечего показать. Установите его и перезапустите сервер.",serverPluginOpen:"Открыть в маркетплейсе",serverPluginFromCode:"Добавьте его в код сервера:",paletteClose:"закрыть",paletteOpenItem:"открыть",paletteMove:"перейти",paletteSearchIn:"Искать «{query}» в разделе {page}",paletteSearchLogs:"Искать «{query}» в журналах",paletteSearchGroup:"Поиск",palettePages:"Страницы",paletteEmpty:"Ничего не найдено.",palettePlaceholder:"Перейти к странице, заданию или команде, или искать…",paletteTitle:"Перейти",paletteOpen:"Поиск…",autoScrollOn:"Автопрокрутка: ВКЛ",autoScrollOff:"Автопрокрутка: ВЫКЛ",breadcrumb:"Путь",root:"Корневой каталог",pagination:"Страницы",rowsPerPage:"Строк на странице",pageRange:"{from}–{to} из {total}",previousPage:"Назад",nextPage:"Вперёд",pageOf:"Страница {page} из {pages}",selectSearch:"Поиск…",selectNoMatches:"Нет совпадений",selectClear:"Очистить",selectMore:"+{count}",dialogClose:"Закрыть",confirmOk:"Подтвердить",confirmCancel:"Отмена",confirmBusy:"Выполняется…",moreActions:"Другие действия",rowActions:"Действия для {name}",noData:"Нет данных",sortBy:"Сортировать по «{column}»",table:"Таблица",pageFailed:"Не удалось загрузить страницу",retry:"Повторить",loading:"Загрузка…",loadFailed:"Не удалось загрузить данные",noAccess:"У вас нет доступа к этой странице",noAccessPermission:"Нужно разрешение {permission}. Попросите администратора выдать его.",noAccessHint:"Попросите администратора предоставить доступ.",missingPermission:"Не хватает разрешения: {permission}",sectionFailed:"Не удалось отобразить: {label}",thisSection:"Этот раздел",panel:"Панель",chipListMore:"ещё {count}",chipListShowAll:"Показать все ({count})",chipListTitle:"Все элементы ({count})",chipListSearch:"Поиск по списку",chipListMatches:"{shown} из {total}"},ro:{serverPluginMissing:"Această pagină are nevoie de pluginul de server {title}",serverPluginMissingHint:"{title} nu este instalat pe acest server, așa că pagina nu are nimic de afișat. Instalează-l, apoi repornește serverul.",serverPluginOpen:"Deschide-l în marketplace",serverPluginFromCode:"Adaugă-l în codul serverului:",paletteSearchIn:"Caută „{query}” în {page}",autoScrollOn:"Derulare automată ACTIVĂ",autoScrollOff:"Derulare automată OPRITĂ",breadcrumb:"Cale",root:"Directorul rădăcină",paletteOpen:"Caută…",paletteTitle:"Mergi la",palettePlaceholder:"Mergi la o pagină, un job sau o comandă, ori caută…",paletteEmpty:"Nu s-a găsit nimic.",palettePages:"Pagini",paletteSearchGroup:"Căutare",paletteSearchLogs:"Caută „{query}” în jurnale",paletteMove:"mută",paletteOpenItem:"deschide",paletteClose:"închide",pagination:"Pagini",rowsPerPage:"Rânduri pe pagină",pageRange:"{from}–{to} din {total}",previousPage:"Înapoi",nextPage:"Înainte",pageOf:"Pagina {page} din {pages}",selectSearch:"Caută…",selectNoMatches:"Niciun rezultat",selectClear:"Golește",selectMore:"+{count}",dialogClose:"Închide",confirmOk:"Confirmă",confirmCancel:"Anulează",confirmBusy:"Se lucrează…",moreActions:"Mai multe acțiuni",rowActions:"Acțiuni pentru {name}",noData:"Nu există date",sortBy:"Sortează după {column}",table:"Tabel",pageFailed:"Această pagină nu s-a putut încărca",retry:"Reîncearcă",loading:"Se încarcă…",loadFailed:"Datele nu s-au putut încărca",noAccess:"Nu ai acces la această pagină",noAccessPermission:"Este nevoie de permisiunea {permission}. Cere unui administrator să ți-o acorde.",noAccessHint:"Cere acces unui administrator.",missingPermission:"Lipsește permisiunea: {permission}",sectionFailed:"{label} nu a putut fi afișat",thisSection:"Această secțiune",panel:"Panou",chipListMore:"încă {count}",chipListShowAll:"Arată toate ({count})",chipListTitle:"Toate elementele ({count})",chipListSearch:"Caută în listă",chipListMatches:"{shown} din {total}"}},ay=oe.createContext("en");function uy({locale:r,children:e}){const t=r.toLowerCase().split("-")[0];return E.jsx(ay.Provider,{value:ik(t)?t:"en",children:e})}function cy(){return oe.useContext(ay)}function sk(r,e,t){const n=ag[r];return((n==null?void 0:n[e])??ag.en[e]).replace(/\{(\w+)\}/g,(o,a)=>t&&a in t?String(t[a]):o)}function es(){const r=cy();return oe.useMemo(()=>{const e=new Intl.NumberFormat(r);return{t:(t,n)=>sk(r,t,n),formatNumber:t=>e.format(t)}},[r])}const ok="qcli-extension";let Oh=null,gr=null;function lk(r){Oh=r}function ak(){return Oh?(gr!=null&&gr.isConnected||(gr=document.createElement("div"),gr.className=Oh,gr.dataset.qcliOverlays="",document.body.appendChild(gr)),gr):document.body}const zl=4,qs=8;function uk(r,e,t,n="start"){const[i,o]=oe.useState(null),a=oe.useCallback(()=>{if(!e||!t.current)return;const u=e.getBoundingClientRect(),h=t.current.getBoundingClientRect(),d=window.innerHeight-u.bottom-zl-qs,p=u.top-zl-qs,g=h.height>d&&p>d?"top":"bottom",v=Math.max(120,g==="bottom"?d:p),w=Math.min(h.height,v),k=Math.max(h.width,u.width),S=n==="end"?u.right-k:u.left,C=Math.min(Math.max(qs,S),Math.max(qs,window.innerWidth-k-qs)),P=g==="bottom"?u.bottom+zl:u.top-zl-w;o(D=>D&&D.left===C&&D.top===P&&D.minWidth===u.width&&D.maxHeight===v&&D.placement===g?D:{left:C,top:P,minWidth:u.width,maxHeight:v,placement:g})},[e,t,n]);return oe.useLayoutEffect(()=>{if(!r)return;a(),window.addEventListener("resize",a);const u=typeof ResizeObserver=="function"&&t.current?new ResizeObserver(a):null;return u&&t.current&&u.observe(t.current),()=>{window.removeEventListener("resize",a),u==null||u.disconnect()}},[r,a,t]),r?i:null}function ck(r,e,t,n){const i=oe.useRef(e),o=oe.useRef(t),a=oe.useRef(n);oe.useEffect(()=>{i.current=e,o.current=t,a.current=n}),oe.useEffect(()=>{if(!r)return;const u=p=>p instanceof Node&&i.current().some(g=>g==null?void 0:g.contains(p)),h=p=>{u(p.target)||o.current()},d=p=>{var g;u(p.target)||(g=a.current)==null||g.call(a)};return document.addEventListener("pointerdown",h,!0),document.addEventListener("mousedown",h,!0),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("pointerdown",h,!0),document.removeEventListener("mousedown",h,!0),window.removeEventListener("scroll",d,!0)}},[r])}function Xc(r,e,t){for(let n=e+t;n>=0&&n<r.length;n+=t)if(!r[n])return n;return e}function Vs(r){return r.findIndex(e=>!e)}function Yc(r){for(let e=r.length-1;e>=0;e--)if(!r[e])return e;return-1}function hk(){const r=oe.useRef(""),e=oe.useRef(void 0);return oe.useEffect(()=>()=>clearTimeout(e.current),[]),oe.useCallback((t,n,i,o)=>{clearTimeout(e.current),e.current=setTimeout(()=>{r.current=""},500),r.current+=t.toLowerCase();const a=r.current,u=a.length>1&&[...a].every(p=>p===a[0]),h=u?a[0]:a,d=a.length===1||u?o+1:o;for(let p=0;p<n.length;p++){const g=(Math.max(0,d)+p)%n.length;if(!i[g]&&n[g].toLowerCase().startsWith(h))return g}return o},[])}function ug(r){return r.key.length===1&&r.key!==" "&&!r.ctrlKey&&!r.metaKey&&!r.altKey}function hy(r){if(!r||typeof r!="object")return null;const e=r;for(const t of["error","message","detail","title"]){const n=e[t];if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"){const i=hy(n);if(i)return i}}return null}const fk={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",413:"Payload Too Large",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"};function Ph(r,e=""){const t=e.trim()||fk[r]||"";return`HTTP ${r}${t?` ${t}`:""}`}function dk(r){return/^\s*<(!doctype|html|head|body|\?xml|[a-z][\w-]*[\s>/])/i.test(r)}const cg={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ","#39":"'"};function pk(r){return r.replace(/<[^>]*>/g," ").replace(/&(#\d+|#x[\da-f]+|[a-z]+);/gi,(e,t)=>cg[t.toLowerCase()]!==void 0?cg[t.toLowerCase()]:t.startsWith("#x")||t.startsWith("#X")?String.fromCodePoint(parseInt(t.slice(2),16)):t.startsWith("#")?String.fromCodePoint(Number(t.slice(1))):e).replace(/\s+/g," ").trim()}function mk(r){for(const e of["pre","h1","title"]){const t=new RegExp(`<${e}\\b[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r),n=t?pk(t[1]):"";if(n&&!(e==="title"&&/^error$/i.test(n)))return n}return null}function Ba(r){const e=r instanceof Error?r.message||String(r):typeof r=="string"?r:String(r),t=e.trim();if(t.startsWith("{"))try{const n=hy(JSON.parse(t));if(n)return n}catch{}if(dk(t)){const n=mk(t);if(n)return n;const i=r,o=i&&typeof i=="object"&&typeof i.status=="number"?i.status:0;return o?Ph(o,typeof i.statusText=="string"?i.statusText:""):"HTTP error"}return e}function gk(r,e,t){const n=t.trim();if(!n)return Ph(r,e);const i=Ba(Object.assign(new Error(n),{status:r,statusText:e}));return i===n&&n.startsWith("{")?Ph(r,e):i}const yk=/(?:missing permissions?|permission denied:)\s*([\w.*-]+:[\w.*-]+(?:\s*,\s*[\w.*-]+:[\w.*-]+)*)/i;function vk(r){if(r==null||r==="")return null;const e=r,t=typeof e=="object"&&e!==null&&typeof e.status=="number"?e.status:0,n=Ba(r).trim(),i=yk.exec(n);return t===403||i||/^(forbidden\b|HTTP 403\b)/i.test(n)?{permission:i?i[1].replace(/\s*,\s*/g,", "):null}:null}function xk(r,e){if(r!==404)return!1;const t=e.trim();if(!t.startsWith("{"))return!0;try{const n=JSON.parse(t);return typeof(n==null?void 0:n.error)!="string"}catch{return!0}}function hg(r){const e=r.split(/[?#]/)[0],t=e.indexOf("/api/");return(t===-1?e:e.slice(t)).replace(/\/+$/,"")}function wk(r,e,t){const n=hg(e);return async(i,o)=>{const a=await r(i,o);if(a.status===404&&hg(i)===n){const u=await a.clone().text().catch(()=>"");xk(a.status,u)&&t()}return a}}function fy(r,e=typeof window>"u"?"":window.location.pathname){const t=e.indexOf("/x/");return`${t===-1?"":e.slice(0,t)}/plugins?${new URLSearchParams({tab:"marketplace",kind:"server",q:r})}`}const kk=[["node","Node",r=>`npm install ${r}`],["python","Python",r=>`pip install ${r}`],["dotnet",".NET",r=>`dotnet add package ${r}`]];function Sk({requirement:r}){const{t:e}=es(),t=kk.filter(([n])=>r.packages[n]);return E.jsx("div",{className:"p-4 sm:p-6",children:E.jsxs("div",{role:"alert","data-testid":"missing-server-plugin",className:"rounded-xl border border-warning/40 bg-warning/[0.06] p-4 sm:p-5 space-y-3 max-w-3xl",children:[E.jsxs("div",{children:[E.jsx("h2",{className:"text-sm font-semibold text-heading",children:e("serverPluginMissing",{title:r.title})}),E.jsx("p",{className:"text-xs text-muted mt-1",children:e("serverPluginMissingHint",{title:r.title})})]}),!r.codeOnly&&E.jsx("a",{href:fy(r.id),className:"inline-flex items-center px-3 py-1.5 text-xs rounded-lg bg-primary text-on-primary hover:bg-primary/90 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",children:e("serverPluginOpen")}),t.length>0&&E.jsxs("div",{className:"space-y-1",children:[E.jsx("p",{className:"text-xs text-subtle",children:e("serverPluginFromCode")}),E.jsx("ul",{className:"space-y-0.5",children:t.map(([n,i,o])=>E.jsxs("li",{className:"text-[11px] font-mono text-text break-all",children:[E.jsxs("span",{className:"text-subtle",children:[i,": "]}),o(r.packages[n])]},n))})]})]})})}function bk({requirement:r,fetcher:e,provide:t}){const[n,i]=oe.useState(!1),o=oe.useMemo(()=>wk(e,r.api,()=>i(!0)),[e,r.api]);return n?E.jsx(Sk,{requirement:r}):E.jsx(E.Fragment,{children:t(o)})}const Ia=oe.createContext(null);function fg(r){return(e,t)=>{var h;const n=ly.createRoot(e);let i={...t};const o=()=>n.render(E.jsx(Ia.Provider,{value:i,children:E.jsx(uy,{locale:i.language,children:E.jsx(r,{})})})),a=d=>{i={...i,...d},o()},u=[t.onThemeChange(d=>a({theme:d})),t.onLanguageChange(d=>a({language:d})),t.onPathChange(d=>a({path:d})),((h=t.onConfigChange)==null?void 0:h.call(t,d=>a({config:d})))??(()=>{})];return o(),()=>{u.forEach(d=>d()),n.unmount()}}}function Ck(r){return(e,t,n)=>{const i=ly.createRoot(e),o=a=>i.render(E.jsx(Ia.Provider,{value:n,children:E.jsx(uy,{locale:n.language,children:E.jsx(r,{...a})})}));return o(t),{update:o,unmount:()=>i.unmount()}}}function Ak(r,e={}){lk(ok);const t=e.overview,n=e.serverPlugin;return{mount:fg(n?function(){const a=dy();return E.jsx(bk,{requirement:n,fetcher:a.fetch,provide:u=>E.jsx(Ia.Provider,{value:{...a,fetch:u},children:E.jsx(r,{})})})}:r),...t?{overview:{cards:(t.cards??[]).map(o=>({id:o.id,size:o.size,mount:fg(o.component)})),...t.attention?{attention:t.attention}:{}}}:{},...e.palette?{palette:e.palette}:{},...e.configEditors?{configEditors:Object.fromEntries(Object.entries(e.configEditors).map(([o,a])=>[o,Ck(a)]))}:{}}}function dy(){const r=oe.useContext(Ia);if(!r)throw new Error("useConsole() is only available inside defineExtension");return r}class Ek extends Error{constructor(e,t,n){super(t),this.status=e,this.error=t,this.body=n,this.name="ApiError"}}const _k=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function Ok(r){const e=cy();return oe.useMemo(()=>Pk(r,e),[r,e])}function Pk(r,e){const t=new Intl.PluralRules(e),n=new Intl.NumberFormat(e),i=new Intl.RelativeTimeFormat(e,{numeric:"auto"}),o=(u,h)=>{var p,g;const d=r[u];return((p=d==null?void 0:d[e])==null?void 0:p[h])??((g=d==null?void 0:d.en)==null?void 0:g[h])};return{locale:e,t:(u,h)=>{const d=u.indexOf("."),p=u.slice(0,d),g=u.slice(d+1);if(h&&"count"in h&&typeof h.count!="number"){const w=Number(h.count);h={...h,count:Number.isFinite(w)?w:0}}let v;return h&&typeof h.count=="number"&&(v=o(p,`${g}_${t.select(h.count)}`)??o(p,`${g}_other`)),v??(v=o(p,g)??o(p,`${g}_other`)??u),h?v.replace(/\{(\w+)\}/g,(w,k)=>h[k]!=null?typeof h[k]=="number"?n.format(h[k]):String(h[k]):w):v},formatDate:(u,h)=>{const d=new Date(u);return Number.isNaN(d.getTime())?"—":d.toLocaleString(e,h)},formatNumber:(u,h)=>new Intl.NumberFormat(e,h).format(u),formatRelative:u=>{const h=new Date(u).getTime();if(Number.isNaN(h))return"—";const d=Math.round((h-Date.now())/1e3);for(const[p,g]of _k)if(Math.abs(d)>=g)return i.format(Math.round(d/g),p);return i.format(d,"second")}}}const Tk={success:"bg-success/15 text-success border-success/30",warning:"bg-warning/15 text-warning border-warning/30",error:"bg-error/15 text-error border-error/30",info:"bg-info/15 text-info border-info/30",neutral:"bg-subtle/15 text-muted border-subtle/30"};function Ni({variant:r,children:e,dot:t}){return E.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border ${Tk[r]}`,children:[t&&E.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),e]})}var Mk=oy();function Lk(){return es().t}function Nk({size:r=14,label:e,className:t=""}){const n=E.jsxs("svg",{"aria-hidden":!0,width:r,height:r,viewBox:"0 0 24 24",className:`animate-spin motion-reduce:animate-none ${t}`,children:[E.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.3"}),E.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]});return e?E.jsxs("span",{role:"status","aria-live":"polite",className:"inline-flex items-center",children:[n,E.jsx("span",{className:"sr-only",children:e})]}):n}function Dk(r=[],e=[]){return r.length!==e.length||r.some((t,n)=>!Object.is(t,e[n]))}class Rk extends oe.Component{constructor(){super(...arguments);Vc(this,"state",{error:null});Vc(this,"retry",()=>this.setState({error:null}))}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error(`[console] ${this.props.label??"section"} failed to render`,t,n.componentStack)}componentDidUpdate(t,n){this.state.error&&n.error&&Dk(t.resetKeys,this.props.resetKeys)&&this.setState({error:null})}render(){const{error:t}=this.state;return t?E.jsx(Bk,{error:t,label:this.props.label,page:this.props.variant==="page",onRetry:this.retry}):this.props.children}}function Bk({error:r,label:e,page:t,onRetry:n}){const{t:i}=es(),o={page:i("pageFailed"),section:i("sectionFailed",{label:e??i("thisSection")}),retry:i("retry")};return E.jsxs("div",{role:"alert",className:t?"m-6 p-6 rounded-xl border border-error/30 bg-error/[0.06]":"p-4 rounded-lg border border-error/30 bg-error/[0.06]",children:[E.jsx("div",{className:"text-sm font-medium text-error",children:t?o.page:o.section}),E.jsx("div",{className:"mt-1 text-xs text-error/70 font-mono break-all",children:r.message||String(r)}),E.jsx("button",{onClick:n,className:"mt-3 text-xs px-3 py-1 rounded-md border border-border text-text hover:bg-control",children:o.retry})]})}function Ik({permission:r,title:e,className:t=""}){const{t:n}=es();return E.jsxs("div",{role:"status",className:`rounded-lg border border-border bg-control/40 p-4 flex items-start gap-3 ${t}`,children:[E.jsx("span",{"aria-hidden":!0,className:"text-lg leading-none text-subtle",children:"🔒"}),E.jsxs("div",{className:"min-w-0",children:[E.jsx("div",{className:"text-sm font-medium text-heading",children:e??n("noAccess")}),E.jsx("div",{className:"mt-0.5 text-xs text-muted",children:r?zk(n("noAccessPermission",{permission:"\0"}),r):n("noAccessHint")})]})]})}function zk(r,e){const[t,n=""]=r.split("\0");return E.jsxs(E.Fragment,{children:[t,E.jsx("code",{className:"font-mono text-text",children:e}),n]})}function py({title:r,error:e,onRetry:t,compact:n=!1,className:i=""}){const{t:o}=es(),a=vk(e);if(a&&!n)return E.jsx(Ik,{permission:a.permission,className:i});const u=e==null||e===""?"":a!=null&&a.permission?o("missingPermission",{permission:a.permission}):Ba(e);return E.jsxs("div",{role:"alert",className:`rounded-lg border border-error/30 bg-error/[0.06] ${n?"px-3 py-2":"p-4"} flex flex-wrap items-start justify-between gap-3 ${i}`,children:[E.jsxs("div",{className:"min-w-0",children:[E.jsx("div",{className:"text-sm font-medium text-error",children:r??o("loadFailed")}),u&&E.jsx("div",{className:"mt-0.5 text-xs text-error/80 font-mono break-all",children:u})]}),t&&E.jsx("button",{type:"button",onClick:t,className:"shrink-0 px-3 py-1 text-xs rounded-md border border-error/40 text-error hover:bg-error/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-error/50",children:o("retry")})]})}const jk={responsive:"w-full sm:w-auto",full:"w-full",auto:"w-auto"},Fk={sm:"min-h-11 sm:min-h-0 px-2.5 py-1.5 text-xs",md:"min-h-11 sm:min-h-0 px-3 py-2 text-sm"};function Hk(r){const{value:e,onChange:t,onClear:n,...i}=r;return E.jsx(Wk,{...i,multiple:!1,selected:e===null?[]:[e],onPick:o=>t(o),onClear:n})}function Wk({options:r,label:e,id:t,placeholder:n,searchable:i,disabled:o=!1,size:a="sm",width:u="responsive",className:h="",multiple:d,selected:p,onPick:g,onClear:v,maxChips:w=2}){const k=Lk(),S=oe.useId(),C=j=>`${S}-o${j}`,[P,D]=oe.useState(!1),[M,Q]=oe.useState(-1),[B,I]=oe.useState(""),[H,ie]=oe.useState(null),de=oe.useRef(null),Se=oe.useRef(null),ge=oe.useRef(null),J=hk(),fe=i??r.length>10,he=oe.useMemo(()=>{const j=B.trim().toLowerCase();return j?r.filter(ee=>ee.label.toLowerCase().includes(j)||ee.value.toLowerCase().includes(j)):r},[r,B]),xe=oe.useMemo(()=>he.map(j=>!!j.disabled),[he]),Ae=oe.useMemo(()=>he.map(j=>j.label),[he]),we=uk(P,H,de),$=(j=!0)=>{D(!1),I(""),j&&(H==null||H.focus())};ck(P,()=>[H,de.current],()=>$(!1),()=>$(!1));function z(j){if(o)return;const ee=r.findIndex(ve=>p.includes(ve.value)&&!ve.disabled),le=r.map(ve=>!!ve.disabled);I(""),Q(j??(ee>=0?ee:Vs(le))),D(!0)}oe.useEffect(()=>{var j;P&&fe&&((j=ge.current)==null||j.focus())},[P,fe]),oe.useEffect(()=>{var j,ee;!P||M<0||(ee=(j=document.getElementById(`${S}-o${M}`))==null?void 0:j.scrollIntoView)==null||ee.call(j,{block:"nearest"})},[P,M,S]);function W(j){const ee=he[j];!ee||ee.disabled||(g(ee.value),d||$())}function O(j){const ee=j.currentTarget===ge.current;if(!P){if(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")j.preventDefault(),z();else if(j.key==="Home"||j.key==="End"){j.preventDefault();const le=r.map(ve=>!!ve.disabled);z(j.key==="Home"?Vs(le):Yc(le))}else if(ug(j)){const le=r.findIndex(Ee=>p.includes(Ee.value)),ve=J(j.key,r.map(Ee=>Ee.label),r.map(Ee=>!!Ee.disabled),le);ve!==le&&ve>=0&&(d?z(ve):g(r[ve].value))}return}switch(j.key){case"ArrowDown":j.preventDefault(),Q(le=>le<0?Vs(xe):Xc(xe,le,1));break;case"ArrowUp":if(j.preventDefault(),j.altKey){d||W(M),$();break}Q(le=>le<0?Yc(xe):Xc(xe,le,-1));break;case"Home":case"End":if(ee&&!j.ctrlKey)break;j.preventDefault(),Q(j.key==="Home"?Vs(xe):Yc(xe));break;case"PageDown":case"PageUp":{j.preventDefault();let le=M;for(let ve=0;ve<10;ve++)le=Xc(xe,le,j.key==="PageDown"?1:-1);Q(le);break}case"Enter":j.preventDefault(),W(M);break;case" ":if(ee)break;j.preventDefault(),W(M);break;case"Escape":j.preventDefault(),j.stopPropagation(),$();break;case"Tab":ee?(j.preventDefault(),$()):$(!1);break;default:!ee&&ug(j)&&Q(le=>J(j.key,Ae,xe,le))}}const R=r.filter(j=>p.includes(j.value)),ue=R.length>0,ye=!!v&&ue&&!o;return E.jsxs("div",{className:`relative inline-flex max-w-full ${jk[u]} ${h}`,children:[E.jsx("button",{ref:ie,id:t,type:"button",role:"combobox","aria-label":e,"aria-haspopup":"listbox","aria-expanded":P,"aria-controls":P?S:void 0,"aria-activedescendant":P&&!fe&&M>=0?C(M):void 0,disabled:o,onClick:()=>P?$():z(),onKeyDown:O,className:`flex-1 min-w-0 inline-flex items-center gap-2 bg-control border rounded-lg text-left text-text transition-colors hover:bg-control-hover focus:outline-none focus-visible:border-primary disabled:opacity-50 disabled:cursor-not-allowed ${P?"border-primary":"border-border/75"} ${Fk[a]} ${ye?"pr-16 sm:pr-12":"pr-7"}`,children:E.jsxs("span",{className:"flex-1 min-w-0 flex items-center gap-1.5 truncate",children:[!ue&&E.jsx("span",{className:"truncate text-subtle",children:n??"—"}),ue&&!d&&E.jsxs(E.Fragment,{children:[R[0].icon&&E.jsx("span",{"aria-hidden":!0,className:"inline-flex shrink-0",children:R[0].icon}),E.jsx("span",{className:"truncate",children:R[0].label})]}),ue&&d&&E.jsxs(E.Fragment,{children:[R.slice(0,w).map(j=>E.jsxs("span",{className:"inline-flex items-center gap-1 max-w-[8rem] px-1.5 py-px rounded bg-primary/15 text-accent text-[11px] leading-4",children:[j.icon&&E.jsx("span",{"aria-hidden":!0,className:"inline-flex shrink-0",children:j.icon}),E.jsx("span",{className:"truncate",children:j.label})]},j.value)),R.length>w&&E.jsx("span",{className:"shrink-0 text-[11px] text-muted tabular-nums",children:k("selectMore",{count:R.length-w})})]})]})}),E.jsx(qk,{open:P}),ye&&E.jsx("button",{type:"button","aria-label":k("selectClear"),title:k("selectClear"),onClick:()=>{v==null||v(),H==null||H.focus()},className:"absolute right-6 sm:right-5 top-1/2 -translate-y-1/2 w-8 h-8 sm:w-5 sm:h-5 inline-flex items-center justify-center rounded text-subtle hover:text-text hover:bg-control-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:E.jsx("svg",{"aria-hidden":!0,width:"10",height:"10",viewBox:"0 0 10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:E.jsx("path",{d:"M2 2l6 6M8 2l-6 6"})})}),P&&Mk.createPortal(E.jsxs("div",{ref:de,"data-placement":we==null?void 0:we.placement,style:we?{left:we.left,top:we.top,minWidth:we.minWidth,maxHeight:we.maxHeight}:{left:0,top:0,visibility:"hidden"},className:"fixed z-[60] flex flex-col max-w-[min(24rem,calc(100vw-1rem))] rounded-lg border border-border bg-popover shadow-xl overflow-hidden motion-safe:animate-pop-in",children:[fe&&E.jsx("div",{className:"p-1.5 border-b border-border/75",children:E.jsx("input",{ref:ge,type:"text",role:"combobox","aria-label":e?`${e}: ${k("selectSearch")}`:k("selectSearch"),"aria-autocomplete":"list","aria-expanded":!0,"aria-controls":S,"aria-activedescendant":M>=0&&M<he.length?C(M):void 0,placeholder:k("selectSearch"),value:B,onChange:j=>{const ee=j.target.value;I(ee);const le=ee.trim().toLowerCase(),ve=r.filter(Ee=>!le||Ee.label.toLowerCase().includes(le)||Ee.value.toLowerCase().includes(le)).map(Ee=>!!Ee.disabled);Q(Vs(ve))},onKeyDown:O,className:"w-full min-h-11 sm:min-h-0 px-2.5 py-1.5 text-base sm:text-xs bg-control border border-border/75 rounded-md text-text placeholder:text-subtle focus:outline-none focus:border-primary"})}),E.jsxs("ul",{ref:Se,id:S,role:"listbox","aria-label":e,"aria-multiselectable":d||void 0,tabIndex:-1,className:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-1",children:[he.length===0&&E.jsx("li",{role:"presentation",className:"px-2.5 py-2 text-xs text-subtle",children:k("selectNoMatches")}),he.map((j,ee)=>{const le=p.includes(j.value);return E.jsxs("li",{id:C(ee),role:"option","aria-selected":le,"aria-disabled":j.disabled||void 0,onMouseMove:()=>{!j.disabled&&M!==ee&&Q(ee)},onMouseDown:ve=>ve.preventDefault(),onClick:()=>W(ee),className:`flex items-center gap-2 min-h-11 sm:min-h-8 px-2.5 py-1 rounded-md text-sm sm:text-xs select-none ${j.disabled?"opacity-40 cursor-not-allowed":"cursor-pointer"} ${ee===M?"bg-control-hover":""} ${le?"text-accent font-medium":"text-text"}`,children:[E.jsx(Vk,{checked:le,box:d}),j.icon&&E.jsx("span",{"aria-hidden":!0,className:"inline-flex shrink-0",children:j.icon}),E.jsxs("span",{className:"min-w-0 flex-1",children:[E.jsx("span",{className:"block truncate",children:j.label}),j.description&&E.jsx("span",{className:"block truncate text-[11px] font-normal text-subtle",children:j.description})]})]},j.value)})]})]}),ak())]})}function qk({open:r}){return E.jsx("svg",{"aria-hidden":!0,width:"10",height:"10",viewBox:"0 0 10 10",className:`absolute right-2.5 top-1/2 -mt-[5px] pointer-events-none text-muted motion-safe:transition-transform ${r?"rotate-180":""}`,children:E.jsx("path",{d:"M2 3.5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vk({checked:r,box:e}){return e?E.jsx("span",{"aria-hidden":!0,className:`inline-flex shrink-0 items-center justify-center w-4 h-4 rounded border ${r?"bg-primary border-primary text-on-primary":"border-border"}`,children:r&&E.jsx(dg,{})}):E.jsx("span",{"aria-hidden":!0,className:"inline-flex shrink-0 w-4 justify-center",children:r&&E.jsx(dg,{})})}function dg(){return E.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",children:E.jsx("path",{d:"M1.5 5.5l2.5 2.5 4.5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qk({title:r,subtitle:e,actions:t}){return E.jsxs("div",{className:"px-4 sm:px-6 py-4 border-b border-border/75 flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[E.jsxs("div",{className:"min-w-0",children:[E.jsx("h2",{className:"text-lg font-semibold text-heading",children:r}),e&&E.jsx("p",{className:"text-xs text-subtle mt-0.5",children:e})]}),t&&E.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t})]})}function Vn({className:r="",style:e}){return E.jsx("div",{"aria-hidden":!0,className:`rounded bg-control ${r}`,style:e})}function my({label:r,className:e="",children:t}){const{t:n}=es();return E.jsxs("div",{role:"status","aria-live":"polite","aria-busy":"true",className:`animate-pulse motion-reduce:animate-none ${e}`,children:[E.jsx("span",{className:"sr-only",children:r??n("loading")}),t]})}const pg=["100%","92%","96%","80%","88%","70%"];function Uk({items:r=4,label:e,className:t=""}){return E.jsx(my,{label:e,className:`space-y-3 ${t}`,children:Array.from({length:r},(n,i)=>E.jsxs("div",{className:"space-y-1.5",children:[E.jsx(Vn,{className:"h-3.5",style:{width:pg[(i+2)%pg.length]}}),E.jsx(Vn,{className:"h-2.5 w-1/3"})]},i))})}function $k(r,e=[]){const[t,n]=oe.useState(null),[i,o]=oe.useState(!0),[a,u]=oe.useState(null),h=oe.useRef(0),d=oe.useCallback(async v=>{const w=++h.current;v!==!0&&(o(!0),u(null));try{const k=await r();w===h.current&&(n(k),u(null))}catch(k){w===h.current&&u(k instanceof Error?k.message:"Failed to fetch")}finally{w===h.current&&o(!1)}},e);oe.useEffect(()=>{d()},[d]);const p=oe.useCallback(()=>{d()},[d]),g=oe.useCallback(()=>{d(!0)},[d]);return{data:t,loading:i,error:a,refetch:p,refresh:g}}const Of="/api/qcli/data-explorer",Kk=["forbidden","rate_limited","read_only","object_not_allowed","masked_column","unknown_source"],Gk=r=>Kk.includes(r);function mg(r){return Ba(r)}function gg(r,e){if(r===403||r===429){const n=typeof e=="string"?mg(e):String((e==null?void 0:e.error)??"");return{kind:"refused",code:r===403?"forbidden":"rate_limited",message:n}}if(r>=200&&r<300&&e&&typeof e=="object"){const n=e;if(n.success!==!1)return{kind:"rows",result:n};const i=typeof n.executedQuery=="string"&&n.executedQuery?{executedQuery:n.executedQuery}:{};return Gk(n.errorCode)?{kind:"refused",code:n.errorCode,message:n.error??"",...i}:{kind:"failed",message:n.error??"",executionTime:n.executionTime,...i}}const t=typeof e=="string"?mg(e):String((e==null?void 0:e.error)??r);return r===404&&/unknown data source/i.test(t)?{kind:"refused",code:"unknown_source",message:t}:{kind:"failed",message:t}}class gy extends Ek{constructor(e,t,n){super(e,t,n),this.name="DataExplorerError"}}async function yy(r,e){const t=await r(e),n=await t.text();if(!t.ok)throw new gy(t.status,gk(t.status,t.statusText,n),n);return n?JSON.parse(n):void 0}function Xk(r){return yy(r,`${Of}/sources`)}async function Yk(r,e){try{return await yy(r,`${Of}/schema?source=${encodeURIComponent(e)}`)}catch(t){if(t instanceof gy&&t.status===404)return null;throw t}}async function Jk(r,e,t){try{const n=await r(`${Of}/execute`,{method:"POST",body:JSON.stringify({source:e,query:t})}),i=await n.text();if(!n.ok)return gg(n.status,i);let o=i;try{o=i?JSON.parse(i):{}}catch{}return gg(n.status,o)}catch(n){return{kind:"failed",message:n instanceof Error?n.message:String(n)}}}const Zk={en:{title:"Data explorer",loadingPage:"Loading…",refresh:"Refresh",subtitle_one:"{count} data source",subtitle_other:"{count} data sources",loading:"Loading data sources…",error:"Error: {message}",noSources:"There are no data sources you may use on this server.",noSourcesHint:"Sources come from source plugins (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): install one, set its connection, then restart the server.",noSourcesFind:"Find a source plugin",sources:"Sources",readOnly:"Read-only",writable:"Writes allowed",canExport:"Export allowed",readOnlyHint:"This source is read-only: the server refuses queries that change data.",templates:"Templates",pickTemplate:"Insert a template…",schema:"Schema",schemaLoading:"Loading schema…",schemaError:"The schema could not be loaded: {message}",schemaUnsupported:"This source does not describe its schema.",schemaEmpty:"No tables.",primaryKey:"Primary key",useTable:"Query this table",query:"Query",queryPlaceholder:"Write a {language} query…",run:"Run",running:"Running…",runHint:"Ctrl+Enter or ⌘+Enter runs the query.",result:"Result",rows_one:"{count} row",rows_other:"{count} rows",time:"{ms} ms",truncated:"Truncated",noRows:"The query returned no rows.",failed:"The query failed",refused_forbidden:"Not allowed",refused_rate_limited:"Too many queries",refused_read_only:"This source is read-only",refused_object_not_allowed:"Object not allowed",refused_unknown_source:"Unknown data source",refusedHint_forbidden:"Your account lacks a permission this source requires.",refusedHint_rate_limited:"This source limits how often you may query it. Wait a moment and run the query again.",refusedHint_read_only:"Only queries that read data are allowed on this source.",refusedHint_object_not_allowed:"The query uses a table, collection or key this source does not expose.",refused_masked_column:"Masked column",refusedHint_masked_column:"This source hides the values of some columns. Select them by their own name or with SELECT *, not in expressions, aliases or filters.",refusedHint_unknown_source:"The server no longer has this source. Refresh the list.",ranAs:"Ran as:",editExecuted:"Edit this query",ranAsHint:"The server quoted names in your query before running it."},es:{title:"Explorador de datos",loadingPage:"Cargando…",refresh:"Actualizar",subtitle_one:"{count} origen de datos",subtitle_other:"{count} orígenes de datos",loading:"Cargando orígenes de datos…",error:"Error: {message}",noSources:"No hay orígenes de datos que puedas usar en este servidor.",noSourcesHint:"Los orígenes vienen de plugins de origen (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): instala uno, configura su conexión y reinicia el servidor.",noSourcesFind:"Buscar un plugin de origen",sources:"Orígenes",readOnly:"Solo lectura",writable:"Permite escrituras",canExport:"Exportación permitida",readOnlyHint:"Este origen es de solo lectura: el servidor rechaza las consultas que modifican datos.",templates:"Plantillas",pickTemplate:"Insertar una plantilla…",schema:"Esquema",schemaLoading:"Cargando esquema…",schemaError:"No se pudo cargar el esquema: {message}",schemaUnsupported:"Este origen no describe su esquema.",schemaEmpty:"No hay tablas.",primaryKey:"Clave primaria",useTable:"Consultar esta tabla",query:"Consulta",queryPlaceholder:"Escribe una consulta {language}…",run:"Ejecutar",running:"Ejecutando…",runHint:"Ctrl+Intro o ⌘+Intro ejecuta la consulta.",result:"Resultado",rows_one:"{count} fila",rows_other:"{count} filas",time:"{ms} ms",truncated:"Truncado",noRows:"La consulta no devolvió filas.",failed:"La consulta falló",refused_forbidden:"No permitido",refused_rate_limited:"Demasiadas consultas",refused_read_only:"Este origen es de solo lectura",refused_object_not_allowed:"Objeto no permitido",refused_unknown_source:"Origen de datos desconocido",refusedHint_forbidden:"A tu cuenta le falta un permiso que este origen requiere.",refusedHint_rate_limited:"Este origen limita la frecuencia de las consultas. Espera un momento y vuelve a ejecutarla.",refusedHint_read_only:"En este origen solo se permiten consultas que leen datos.",refusedHint_object_not_allowed:"La consulta usa una tabla, colección o clave que este origen no expone.",refused_masked_column:"Columna enmascarada",refusedHint_masked_column:"Este origen oculta los valores de algunas columnas. Selecciónalas por su propio nombre o con SELECT *, no en expresiones, alias ni filtros.",refusedHint_unknown_source:"El servidor ya no tiene este origen. Actualiza la lista.",ranAs:"Ejecutada como:",editExecuted:"Editar esta consulta",ranAsHint:"El servidor entrecomilló nombres de tu consulta antes de ejecutarla."},fr:{title:"Explorateur de données",loadingPage:"Chargement…",refresh:"Actualiser",subtitle_one:"{count} source de données",subtitle_other:"{count} sources de données",loading:"Chargement des sources de données…",error:"Erreur : {message}",noSources:"Aucune source de données ne vous est accessible sur ce serveur.",noSourcesHint:"Les sources viennent des plugins de source (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL) : installez-en un, réglez sa connexion, puis redémarrez le serveur.",noSourcesFind:"Trouver un plugin de source",sources:"Sources",readOnly:"Lecture seule",writable:"Écritures autorisées",canExport:"Export autorisé",readOnlyHint:"Cette source est en lecture seule : le serveur refuse les requêtes qui modifient des données.",templates:"Modèles",pickTemplate:"Insérer un modèle…",schema:"Schéma",schemaLoading:"Chargement du schéma…",schemaError:"Impossible de charger le schéma : {message}",schemaUnsupported:"Cette source ne décrit pas son schéma.",schemaEmpty:"Aucune table.",primaryKey:"Clé primaire",useTable:"Interroger cette table",query:"Requête",queryPlaceholder:"Saisissez une requête {language}…",run:"Exécuter",running:"Exécution…",runHint:"Ctrl+Entrée ou ⌘+Entrée exécute la requête.",result:"Résultat",rows_one:"{count} ligne",rows_other:"{count} lignes",time:"{ms} ms",truncated:"Tronqué",noRows:"La requête n’a renvoyé aucune ligne.",failed:"La requête a échoué",refused_forbidden:"Non autorisé",refused_rate_limited:"Trop de requêtes",refused_read_only:"Cette source est en lecture seule",refused_object_not_allowed:"Objet non autorisé",refused_unknown_source:"Source de données inconnue",refusedHint_forbidden:"Il manque à votre compte une autorisation requise par cette source.",refusedHint_rate_limited:"Cette source limite la fréquence des requêtes. Patientez un instant, puis relancez la requête.",refusedHint_read_only:"Seules les requêtes qui lisent des données sont autorisées sur cette source.",refusedHint_object_not_allowed:"La requête utilise une table, une collection ou une clé que cette source n’expose pas.",refused_masked_column:"Colonne masquée",refusedHint_masked_column:"Cette source masque les valeurs de certaines colonnes. Sélectionnez-les par leur propre nom ou avec SELECT *, pas dans des expressions, des alias ou des filtres.",refusedHint_unknown_source:"Le serveur n’a plus cette source. Actualisez la liste.",ranAs:"Exécutée sous la forme :",editExecuted:"Modifier cette requête",ranAsHint:"Le serveur a mis des noms de votre requête entre guillemets avant de l’exécuter."},de:{title:"Daten-Explorer",loadingPage:"Wird geladen…",refresh:"Aktualisieren",subtitle_one:"{count} Datenquelle",subtitle_other:"{count} Datenquellen",loading:"Datenquellen werden geladen…",error:"Fehler: {message}",noSources:"Auf diesem Server gibt es keine Datenquellen, die Sie verwenden dürfen.",noSourcesHint:"Quellen kommen aus Quell-Plugins (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): Installieren Sie eines, legen Sie seine Verbindung fest und starten Sie den Server neu.",noSourcesFind:"Quell-Plugin suchen",sources:"Quellen",readOnly:"Schreibgeschützt",writable:"Schreiben erlaubt",canExport:"Export erlaubt",readOnlyHint:"Diese Quelle ist schreibgeschützt: Der Server lehnt Abfragen ab, die Daten ändern.",templates:"Vorlagen",pickTemplate:"Vorlage einfügen…",schema:"Schema",schemaLoading:"Schema wird geladen…",schemaError:"Das Schema konnte nicht geladen werden: {message}",schemaUnsupported:"Diese Quelle beschreibt ihr Schema nicht.",schemaEmpty:"Keine Tabellen.",primaryKey:"Primärschlüssel",useTable:"Diese Tabelle abfragen",query:"Abfrage",queryPlaceholder:"{language}-Abfrage eingeben…",run:"Ausführen",running:"Wird ausgeführt…",runHint:"Strg+Eingabe oder ⌘+Eingabe führt die Abfrage aus.",result:"Ergebnis",rows_one:"{count} Zeile",rows_other:"{count} Zeilen",time:"{ms} ms",truncated:"Gekürzt",noRows:"Die Abfrage hat keine Zeilen geliefert.",failed:"Die Abfrage ist fehlgeschlagen",refused_forbidden:"Nicht erlaubt",refused_rate_limited:"Zu viele Abfragen",refused_read_only:"Diese Quelle ist schreibgeschützt",refused_object_not_allowed:"Objekt nicht erlaubt",refused_unknown_source:"Unbekannte Datenquelle",refusedHint_forbidden:"Ihrem Konto fehlt eine Berechtigung, die diese Quelle verlangt.",refusedHint_rate_limited:"Diese Quelle begrenzt, wie oft Sie sie abfragen dürfen. Warten Sie kurz und führen Sie die Abfrage erneut aus.",refusedHint_read_only:"Auf dieser Quelle sind nur lesende Abfragen erlaubt.",refusedHint_object_not_allowed:"Die Abfrage verwendet eine Tabelle, Sammlung oder einen Schlüssel, den diese Quelle nicht freigibt.",refused_masked_column:"Maskierte Spalte",refusedHint_masked_column:"Diese Quelle verbirgt die Werte einiger Spalten. Wählen Sie sie mit ihrem eigenen Namen oder mit SELECT * aus, nicht in Ausdrücken, Aliasen oder Filtern.",refusedHint_unknown_source:"Der Server hat diese Quelle nicht mehr. Aktualisieren Sie die Liste.",ranAs:"Ausgeführt als:",editExecuted:"Diese Abfrage bearbeiten",ranAsHint:"Der Server hat Namen in Ihrer Abfrage vor dem Ausführen in Anführungszeichen gesetzt."},pt:{title:"Explorador de dados",loadingPage:"Carregando…",refresh:"Atualizar",subtitle_one:"{count} fonte de dados",subtitle_other:"{count} fontes de dados",loading:"Carregando fontes de dados…",error:"Erro: {message}",noSources:"Não há fontes de dados que você possa usar neste servidor.",noSourcesHint:"As fontes vêm de plugins de fonte (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): instale um, defina a conexão e reinicie o servidor.",noSourcesFind:"Encontrar um plugin de fonte",sources:"Fontes",readOnly:"Somente leitura",writable:"Permite gravações",canExport:"Exportação permitida",readOnlyHint:"Esta fonte é somente leitura: o servidor recusa consultas que alteram dados.",templates:"Modelos",pickTemplate:"Inserir um modelo…",schema:"Esquema",schemaLoading:"Carregando esquema…",schemaError:"Não foi possível carregar o esquema: {message}",schemaUnsupported:"Esta fonte não descreve seu esquema.",schemaEmpty:"Nenhuma tabela.",primaryKey:"Chave primária",useTable:"Consultar esta tabela",query:"Consulta",queryPlaceholder:"Escreva uma consulta {language}…",run:"Executar",running:"Executando…",runHint:"Ctrl+Enter ou ⌘+Enter executa a consulta.",result:"Resultado",rows_one:"{count} linha",rows_other:"{count} linhas",time:"{ms} ms",truncated:"Truncado",noRows:"A consulta não retornou linhas.",failed:"A consulta falhou",refused_forbidden:"Não permitido",refused_rate_limited:"Consultas demais",refused_read_only:"Esta fonte é somente leitura",refused_object_not_allowed:"Objeto não permitido",refused_unknown_source:"Fonte de dados desconhecida",refusedHint_forbidden:"Falta à sua conta uma permissão exigida por esta fonte.",refusedHint_rate_limited:"Esta fonte limita a frequência de consultas. Aguarde um momento e execute a consulta novamente.",refusedHint_read_only:"Nesta fonte só são permitidas consultas que leem dados.",refusedHint_object_not_allowed:"A consulta usa uma tabela, coleção ou chave que esta fonte não expõe.",refused_masked_column:"Coluna mascarada",refusedHint_masked_column:"Esta fonte oculta os valores de algumas colunas. Selecione-as pelo próprio nome ou com SELECT *, não em expressões, aliases ou filtros.",refusedHint_unknown_source:"O servidor não tem mais esta fonte. Atualize a lista.",ranAs:"Executada como:",editExecuted:"Editar esta consulta",ranAsHint:"O servidor colocou nomes da sua consulta entre aspas antes de executá-la."},it:{title:"Esplora dati",loadingPage:"Caricamento…",refresh:"Aggiorna",subtitle_one:"{count} origine dati",subtitle_other:"{count} origini dati",loading:"Caricamento delle origini dati…",error:"Errore: {message}",noSources:"Su questo server non ci sono origini dati che puoi usare.",noSourcesHint:"Le origini arrivano dai plugin di origine (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): installane uno, imposta la connessione e riavvia il server.",noSourcesFind:"Trova un plugin di origine",sources:"Origini",readOnly:"Sola lettura",writable:"Scritture consentite",canExport:"Esportazione consentita",readOnlyHint:"Questa origine è in sola lettura: il server rifiuta le query che modificano i dati.",templates:"Modelli",pickTemplate:"Inserisci un modello…",schema:"Schema",schemaLoading:"Caricamento dello schema…",schemaError:"Impossibile caricare lo schema: {message}",schemaUnsupported:"Questa origine non descrive il proprio schema.",schemaEmpty:"Nessuna tabella.",primaryKey:"Chiave primaria",useTable:"Interroga questa tabella",query:"Query",queryPlaceholder:"Scrivi una query {language}…",run:"Esegui",running:"Esecuzione…",runHint:"Ctrl+Invio o ⌘+Invio esegue la query.",result:"Risultato",rows_one:"{count} riga",rows_other:"{count} righe",time:"{ms} ms",truncated:"Troncato",noRows:"La query non ha restituito righe.",failed:"La query non è riuscita",refused_forbidden:"Non consentito",refused_rate_limited:"Troppe query",refused_read_only:"Questa origine è in sola lettura",refused_object_not_allowed:"Oggetto non consentito",refused_unknown_source:"Origine dati sconosciuta",refusedHint_forbidden:"Al tuo account manca un permesso richiesto da questa origine.",refusedHint_rate_limited:"Questa origine limita la frequenza delle query. Attendi un momento ed esegui di nuovo la query.",refusedHint_read_only:"Su questa origine sono consentite solo query che leggono dati.",refusedHint_object_not_allowed:"La query usa una tabella, una collezione o una chiave che questa origine non espone.",refused_masked_column:"Colonna mascherata",refusedHint_masked_column:"Questa origine nasconde i valori di alcune colonne. Selezionale con il loro nome o con SELECT *, non in espressioni, alias o filtri.",refusedHint_unknown_source:"Il server non ha più questa origine. Aggiorna l’elenco.",ranAs:"Eseguita come:",editExecuted:"Modifica questa query",ranAsHint:"Il server ha messo tra virgolette dei nomi della query prima di eseguirla."},ja:{title:"データエクスプローラー",loadingPage:"読み込み中…",refresh:"更新",subtitle_other:"{count} 件のデータソース",loading:"データソースを読み込んでいます…",error:"エラー: {message}",noSources:"このサーバーで使用できるデータソースはありません。",noSourcesHint:"データソースはソースプラグイン (PostgreSQL、MySQL、SQL Server、MongoDB、Redis、Elasticsearch、SQL) から追加されます。インストールして接続を設定し、サーバーを再起動してください。",noSourcesFind:"ソースプラグインを探す",sources:"ソース",readOnly:"読み取り専用",writable:"書き込み可",canExport:"エクスポート可",readOnlyHint:"このソースは読み取り専用です。データを変更するクエリはサーバーに拒否されます。",templates:"テンプレート",pickTemplate:"テンプレートを挿入…",schema:"スキーマ",schemaLoading:"スキーマを読み込んでいます…",schemaError:"スキーマを読み込めませんでした: {message}",schemaUnsupported:"このソースはスキーマを提供していません。",schemaEmpty:"テーブルはありません。",primaryKey:"主キー",useTable:"このテーブルを照会",query:"クエリ",queryPlaceholder:"{language} クエリを入力…",run:"実行",running:"実行中…",runHint:"Ctrl+Enter または ⌘+Enter でクエリを実行します。",result:"結果",rows_other:"{count} 行",time:"{ms} ms",truncated:"切り捨て",noRows:"クエリの結果は 0 行でした。",failed:"クエリが失敗しました",refused_forbidden:"許可されていません",refused_rate_limited:"クエリが多すぎます",refused_read_only:"このソースは読み取り専用です",refused_object_not_allowed:"許可されていないオブジェクト",refused_unknown_source:"不明なデータソース",refusedHint_forbidden:"このソースに必要な権限がアカウントにありません。",refusedHint_rate_limited:"このソースはクエリの頻度を制限しています。少し待ってからもう一度実行してください。",refusedHint_read_only:"このソースではデータを読み取るクエリだけが許可されています。",refusedHint_object_not_allowed:"このソースが公開していないテーブル、コレクション、またはキーをクエリが使用しています。",refused_masked_column:"マスクされた列",refusedHint_masked_column:"このソースは一部の列の値を隠しています。式、別名、フィルターではなく、列名そのものか SELECT * で選択してください。",refusedHint_unknown_source:"サーバーにこのソースはもうありません。一覧を更新してください。",ranAs:"実行されたクエリ:",editExecuted:"このクエリを編集",ranAsHint:"サーバーは実行前にクエリ内の名前を引用符で囲みました。"},ko:{title:"데이터 탐색기",loadingPage:"불러오는 중…",refresh:"새로 고침",subtitle_other:"데이터 소스 {count}개",loading:"데이터 소스를 불러오는 중…",error:"오류: {message}",noSources:"이 서버에서 사용할 수 있는 데이터 소스가 없습니다.",noSourcesHint:"데이터 소스는 소스 플러그인(PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL)에서 추가됩니다. 하나를 설치하고 연결을 설정한 다음 서버를 다시 시작하세요.",noSourcesFind:"소스 플러그인 찾기",sources:"소스",readOnly:"읽기 전용",writable:"쓰기 허용",canExport:"내보내기 허용",readOnlyHint:"이 소스는 읽기 전용입니다. 데이터를 변경하는 쿼리는 서버가 거부합니다.",templates:"템플릿",pickTemplate:"템플릿 삽입…",schema:"스키마",schemaLoading:"스키마를 불러오는 중…",schemaError:"스키마를 불러오지 못했습니다: {message}",schemaUnsupported:"이 소스는 스키마를 제공하지 않습니다.",schemaEmpty:"테이블이 없습니다.",primaryKey:"기본 키",useTable:"이 테이블 조회",query:"쿼리",queryPlaceholder:"{language} 쿼리 입력…",run:"실행",running:"실행 중…",runHint:"Ctrl+Enter 또는 ⌘+Enter로 쿼리를 실행합니다.",result:"결과",rows_other:"{count}행",time:"{ms}ms",truncated:"잘림",noRows:"쿼리 결과 행이 없습니다.",failed:"쿼리에 실패했습니다",refused_forbidden:"허용되지 않음",refused_rate_limited:"쿼리가 너무 많음",refused_read_only:"이 소스는 읽기 전용입니다",refused_object_not_allowed:"허용되지 않은 개체",refused_unknown_source:"알 수 없는 데이터 소스",refusedHint_forbidden:"이 소스에 필요한 권한이 계정에 없습니다.",refusedHint_rate_limited:"이 소스는 쿼리 빈도를 제한합니다. 잠시 후 다시 실행하세요.",refusedHint_read_only:"이 소스에서는 데이터를 읽는 쿼리만 허용됩니다.",refusedHint_object_not_allowed:"이 소스가 공개하지 않는 테이블, 컬렉션 또는 키를 쿼리가 사용합니다.",refused_masked_column:"마스킹된 열",refusedHint_masked_column:"이 소스는 일부 열의 값을 숨깁니다. 식, 별칭, 필터가 아니라 열 이름 그대로 또는 SELECT *로 선택하세요.",refusedHint_unknown_source:"서버에 이 소스가 더 이상 없습니다. 목록을 새로 고치세요.",ranAs:"실행된 쿼리:",editExecuted:"이 쿼리 편집",ranAsHint:"서버가 실행하기 전에 쿼리의 이름을 따옴표로 묶었습니다."},zh:{title:"数据浏览器",loadingPage:"加载中…",refresh:"刷新",subtitle_other:"{count} 个数据源",loading:"正在加载数据源…",error:"错误:{message}",noSources:"此服务器上没有你可以使用的数据源。",noSourcesHint:"数据源来自源插件(PostgreSQL、MySQL、SQL Server、MongoDB、Redis、Elasticsearch、SQL):安装一个,设置其连接,然后重启服务器。",noSourcesFind:"查找源插件",sources:"数据源",readOnly:"只读",writable:"允许写入",canExport:"允许导出",readOnlyHint:"此数据源为只读:服务器会拒绝修改数据的查询。",templates:"模板",pickTemplate:"插入模板…",schema:"架构",schemaLoading:"正在加载架构…",schemaError:"无法加载架构:{message}",schemaUnsupported:"此数据源不提供架构信息。",schemaEmpty:"没有表。",primaryKey:"主键",useTable:"查询此表",query:"查询",queryPlaceholder:"输入 {language} 查询…",run:"运行",running:"正在运行…",runHint:"按 Ctrl+Enter 或 ⌘+Enter 运行查询。",result:"结果",rows_other:"{count} 行",time:"{ms} 毫秒",truncated:"已截断",noRows:"查询没有返回任何行。",failed:"查询失败",refused_forbidden:"不允许",refused_rate_limited:"查询过于频繁",refused_read_only:"此数据源为只读",refused_object_not_allowed:"不允许的对象",refused_unknown_source:"未知数据源",refusedHint_forbidden:"你的账户缺少此数据源所需的权限。",refusedHint_rate_limited:"此数据源限制了查询频率。请稍候再运行查询。",refusedHint_read_only:"此数据源只允许读取数据的查询。",refusedHint_object_not_allowed:"查询使用了此数据源未公开的表、集合或键。",refused_masked_column:"已屏蔽的列",refusedHint_masked_column:"此数据源会隐藏某些列的值。请按列名本身或使用 SELECT * 选择它们,不要用在表达式、别名或筛选条件中。",refusedHint_unknown_source:"服务器上已没有此数据源。请刷新列表。",ranAs:"实际执行:",editExecuted:"编辑此查询",ranAsHint:"服务器在执行前为查询中的名称加上了引号。"},ru:{title:"Обозреватель данных",loadingPage:"Загрузка…",refresh:"Обновить",subtitle_one:"{count} источник данных",subtitle_few:"{count} источника данных",subtitle_many:"{count} источников данных",subtitle_other:"{count} источника данных",loading:"Загрузка источников данных…",error:"Ошибка: {message}",noSources:"На этом сервере нет доступных вам источников данных.",noSourcesHint:"Источники добавляют плагины источников (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): установите один, задайте подключение и перезапустите сервер.",noSourcesFind:"Найти плагин источника",sources:"Источники",readOnly:"Только чтение",writable:"Запись разрешена",canExport:"Экспорт разрешён",readOnlyHint:"Этот источник доступен только для чтения: сервер отклоняет запросы, изменяющие данные.",templates:"Шаблоны",pickTemplate:"Вставить шаблон…",schema:"Схема",schemaLoading:"Загрузка схемы…",schemaError:"Не удалось загрузить схему: {message}",schemaUnsupported:"Этот источник не описывает свою схему.",schemaEmpty:"Таблиц нет.",primaryKey:"Первичный ключ",useTable:"Запросить эту таблицу",query:"Запрос",queryPlaceholder:"Введите запрос {language}…",run:"Выполнить",running:"Выполняется…",runHint:"Ctrl+Enter или ⌘+Enter выполняет запрос.",result:"Результат",rows_one:"{count} строка",rows_few:"{count} строки",rows_many:"{count} строк",rows_other:"{count} строки",time:"{ms} мс",truncated:"Обрезано",noRows:"Запрос не вернул строк.",failed:"Запрос завершился ошибкой",refused_forbidden:"Нет доступа",refused_rate_limited:"Слишком много запросов",refused_read_only:"Этот источник только для чтения",refused_object_not_allowed:"Объект недоступен",refused_unknown_source:"Неизвестный источник данных",refusedHint_forbidden:"У вашей учётной записи нет разрешения, которое требует этот источник.",refusedHint_rate_limited:"Этот источник ограничивает частоту запросов. Подождите немного и выполните запрос снова.",refusedHint_read_only:"В этом источнике разрешены только запросы на чтение данных.",refusedHint_object_not_allowed:"Запрос обращается к таблице, коллекции или ключу, которые этот источник не открывает.",refused_masked_column:"Скрытый столбец",refusedHint_masked_column:"Этот источник скрывает значения некоторых столбцов. Выбирайте их по собственному имени или через SELECT *, а не в выражениях, псевдонимах или фильтрах.",refusedHint_unknown_source:"На сервере больше нет этого источника. Обновите список.",ranAs:"Выполнен как:",editExecuted:"Изменить этот запрос",ranAsHint:"Сервер заключил имена в вашем запросе в кавычки перед выполнением."},ro:{title:"Explorator de date",loadingPage:"Se încarcă…",refresh:"Reîmprospătează",subtitle_one:"{count} sursă de date",subtitle_few:"{count} surse de date",subtitle_other:"{count} de surse de date",loading:"Se încarcă sursele de date…",error:"Eroare: {message}",noSources:"Nu există surse de date pe care le poți folosi pe acest server.",noSourcesHint:"Sursele vin din pluginuri de sursă (PostgreSQL, MySQL, SQL Server, MongoDB, Redis, Elasticsearch, SQL): instalează unul, setează-i conexiunea, apoi repornește serverul.",noSourcesFind:"Găsește un plugin de sursă",sources:"Surse",readOnly:"Doar citire",writable:"Scrierile sunt permise",canExport:"Exportul este permis",readOnlyHint:"Această sursă este doar pentru citire: serverul refuză interogările care modifică date.",templates:"Șabloane",pickTemplate:"Inserează un șablon…",schema:"Schemă",schemaLoading:"Se încarcă schema…",schemaError:"Schema nu a putut fi încărcată: {message}",schemaUnsupported:"Această sursă nu își descrie schema.",schemaEmpty:"Niciun tabel.",primaryKey:"Cheie primară",useTable:"Interoghează acest tabel",query:"Interogare",queryPlaceholder:"Scrie o interogare {language}…",run:"Rulează",running:"Rulează…",runHint:"Ctrl+Enter sau ⌘+Enter rulează interogarea.",result:"Rezultat",rows_one:"{count} rând",rows_few:"{count} rânduri",rows_other:"{count} de rânduri",time:"{ms} ms",truncated:"Trunchiat",noRows:"Interogarea nu a returnat niciun rând.",failed:"Interogarea a eșuat",refused_forbidden:"Nu este permis",refused_rate_limited:"Prea multe interogări",refused_read_only:"Această sursă este doar pentru citire",refused_object_not_allowed:"Obiect nepermis",refused_unknown_source:"Sursă de date necunoscută",refusedHint_forbidden:"Contului tău îi lipsește o permisiune pe care o cere această sursă.",refusedHint_rate_limited:"Această sursă limitează cât de des o poți interoga. Așteaptă puțin și rulează din nou interogarea.",refusedHint_read_only:"Pe această sursă sunt permise doar interogările care citesc date.",refusedHint_object_not_allowed:"Interogarea folosește un tabel, o colecție sau o cheie pe care această sursă nu le expune.",refused_masked_column:"Coloană mascată",refusedHint_masked_column:"Această sursă ascunde valorile unor coloane. Selectează-le după propriul nume sau cu SELECT *, nu în expresii, aliasuri sau filtre.",refusedHint_unknown_source:"Serverul nu mai are această sursă. Reîmprospătează lista.",ranAs:"A rulat ca:",editExecuted:"Editează această interogare",ranAsHint:"Serverul a pus între ghilimele numele din interogarea ta înainte de a o rula."}},eS={dataExplorer:Zk},yg=[["mssql",/\b(mssql|sql\s*server|sqlserver|t-?sql|azure\s*sql)\b/i],["postgresql",/\b(postgres(ql)?|pg|psql|timescale(db)?|cockroach(db)?|supabase|redshift)\b/i],["mysql",/\b(mysql|maria(db)?|tidb)\b/i],["sqlite",/\b(sqlite3?|libsql|turso)\b/i]],tS=[["sqlite",/\bsqlite_(master|schema)\b|\bPRAGMA\b/i],["postgresql",/\bpg_(catalog|tables|class|namespace)\b|::\s*[a-z]+/i],["mssql",/\bsys\.(tables|objects|columns)\b|\bSELECT\s+TOP\b|\[[^\]\s]+\]/i],["mysql",/\bSHOW\s+(TABLES|DATABASES)\b|`[^`]+`/i]];function Jc(r,e){for(const[t,n]of e)if(n.test(r))return t;return null}function nS(r){const e=r;for(const t of[e.dialect,e.type,e.provider])if(typeof t=="string"){const n=Jc(t,yg);if(n)return n}return Jc(`${r.name} ${r.description??""}`.replace(/[_-]/g," "),yg)??Jc((r.templates??[]).map(t=>t.query).join(`
42
+ `),tS)??"standard"}const rS=/^[a-z_][a-z0-9_]*$/,iS=new Set(["all","and","as","by","case","check","column","constraint","create","default","delete","desc","distinct","drop","else","end","from","group","having","in","index","insert","into","is","join","key","like","limit","not","null","on","or","order","primary","references","select","set","table","then","to","union","unique","update","user","values","when","where","with"]);function ia(r,e){if(rS.test(r)&&!iS.has(r))return r;switch(e){case"mysql":return`\`${r.replace(/`/g,"``")}\``;case"mssql":return`[${r.replace(/]/g,"]]")}]`;default:return`"${r.replace(/"/g,'""')}"`}}function sS(r,e){return r.split(".").map(t=>ia(t,e)).join(".")}function oS(r,e){const t={};for(const n of(r==null?void 0:r.tables)??[]){const i=n.name.split("."),o=i.pop();let a=t;for(const u of i){const h=a[u];if(!h||!h.children){const d={};a[u]={self:{label:u,apply:ia(u,e),type:"namespace"},children:d},a=d}else a=h.children}a[o]={self:{label:o,apply:ia(o,e),type:"type",detail:n.type},children:n.columns.map(u=>({label:u.name,apply:ia(u.name,e),type:"property",detail:`${u.type}${u.nullable?"?":""}${u.primaryKey?" 🔑":""}`,boost:u.primaryKey?1:0}))}}return t}function Zc(r){return r==null?"NULL":typeof r=="object"?JSON.stringify(r):String(r)}function lS(r){const e=Array.isArray(r.rows)?r.rows:[];let t=Array.isArray(r.columns)?r.columns.map(String):[];if(t.length===0){const n=new Set;let i=!1;for(const o of e)o&&typeof o=="object"&&!Array.isArray(o)?Object.keys(o).forEach(a=>n.add(a)):Array.isArray(o)?o.forEach((a,u)=>n.add(String(u+1))):i=!0;t=n.size?[...n]:i?["value"]:[]}return{columns:t,rows:e.map(n=>Array.isArray(n)?t.map((i,o)=>Zc(n[o])):n&&typeof n=="object"?t.map(i=>Zc(n[i])):t.map((i,o)=>o===0?Zc(n):""))}}function aS(r,e,t="standard"){if(r.toLowerCase()!=="sql")return null;const n=t==="standard"?/^[A-Za-z_][A-Za-z0-9_.]*$/.test(e)?e:`"${e.replace(/"/g,'""')}"`:sS(e,t);return t==="mssql"?`SELECT TOP 100 * FROM ${n};`:`SELECT * FROM ${n} LIMIT 100;`}const uS={id:"data-explorer",title:"Data explorer",packages:{node:"@qodalis/cli-server-plugin-data-explorer",python:"qodalis-cli-server-plugin-data-explorer",dotnet:"Qodalis.Cli"},api:"/api/qcli/data-explorer/sources"},cS=oe.lazy(()=>Gw(()=>Promise.resolve().then(()=>yO),void 0)),vg="px-3 py-1.5 text-xs bg-control hover:bg-control-hover text-text rounded-lg transition-colors disabled:opacity-40",xo=()=>Ok(eS);function hS(r){const e=r.split("#")[0].split("?")[1]??"";return new URLSearchParams(e).get("source")}const fS="px-4 py-1.5 text-xs font-medium bg-primary hover:bg-primary-hover text-on-primary rounded-lg transition-colors disabled:opacity-40";function dS({source:r}){const{t:e}=xo();return E.jsxs("span",{className:"flex flex-wrap gap-1",children:[E.jsx(Ni,{variant:"neutral",children:r.language}),r.readOnly===!0&&E.jsx(Ni,{variant:"info",children:e("dataExplorer.readOnly")}),r.readOnly===!1&&E.jsx(Ni,{variant:"warning",children:e("dataExplorer.writable")}),r.canExport===!0&&E.jsx(Ni,{variant:"success",children:e("dataExplorer.canExport")})]})}function pS({label:r}){return E.jsxs(my,{label:r,className:"grid grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] gap-4",children:[E.jsxs("div",{className:"space-y-2",children:[E.jsx(Vn,{className:"h-2.5 w-16"}),[0,1,2].map(e=>E.jsxs("div",{className:"p-3 rounded-xl border border-border bg-surface space-y-2",children:[E.jsx(Vn,{className:"h-3.5 w-32"}),E.jsx(Vn,{className:"h-2.5 w-full"}),E.jsx(Vn,{className:"h-4 w-20 rounded-full"})]},e))]}),E.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3",children:[E.jsx(Vn,{className:"h-4 w-48"}),E.jsx(Vn,{className:"h-36 w-full rounded-lg"}),E.jsx(Vn,{className:"h-7 w-20 rounded-lg ml-auto"})]})]})}function mS({state:r,language:e,dialect:t,onPick:n,onRetry:i}){const{t:o}=xo();return r.status==="loading"?E.jsx(Uk,{items:5,label:o("dataExplorer.schemaLoading")}):r.status==="error"?E.jsx(py,{compact:!0,title:o("dataExplorer.schemaError",{message:r.message}),onRetry:i}):r.schema?r.schema.tables.length===0?E.jsx("div",{className:"text-xs text-subtle",children:o("dataExplorer.schemaEmpty")}):E.jsx("ul",{className:"space-y-1 max-h-80 overflow-y-auto pr-1",children:r.schema.tables.map(a=>{const u=aS(e,a.name,t);return E.jsx("li",{children:E.jsxs("details",{className:"group",children:[E.jsxs("summary",{className:"cursor-pointer text-xs flex items-center gap-1.5 text-text hover:text-accent",children:[E.jsx("span",{className:"font-mono truncate",children:a.name}),E.jsx("span",{className:"text-subtle",children:a.type})]}),E.jsxs("ul",{className:"ml-3 mt-1 mb-2 space-y-0.5",children:[a.columns.map(h=>E.jsxs("li",{className:"text-[11px] font-mono flex gap-2",children:[E.jsxs("span",{className:h.primaryKey?"text-accent":"text-text",title:h.primaryKey?o("dataExplorer.primaryKey"):void 0,children:[h.primaryKey?"🔑 ":"",h.name]}),E.jsxs("span",{className:"text-subtle",children:[h.type,h.nullable?"?":""]})]},h.name)),u&&E.jsx("li",{children:E.jsx("button",{type:"button",onClick:()=>n(u),className:"text-[11px] text-accent hover:underline",children:o("dataExplorer.useTable")})})]})]})},a.name)})}):E.jsx("div",{className:"text-xs text-subtle",children:o("dataExplorer.schemaUnsupported")})}function gS({query:r,onUse:e}){const{t}=xo();return E.jsxs("div",{className:"flex flex-wrap items-start gap-x-2 gap-y-1 px-3 py-2 rounded-lg bg-control/40 border border-border/75 text-xs",title:t("dataExplorer.ranAsHint"),children:[E.jsx("span",{className:"text-subtle shrink-0",children:t("dataExplorer.ranAs")}),E.jsx("code",{className:"font-mono text-muted break-all min-w-0 flex-1 whitespace-pre-wrap",children:r}),E.jsx("button",{type:"button",onClick:()=>e(r),className:"text-accent hover:underline shrink-0",children:t("dataExplorer.editExecuted")})]})}function yS({outcome:r,onUseQuery:e}){const{t,formatNumber:n}=xo(),i=r.kind==="rows"?r.result.executedQuery:r.executedQuery,o=i?E.jsx(gS,{query:i,onUse:e}):null;if(r.kind==="refused")return E.jsxs("div",{className:"space-y-2",children:[o,E.jsxs("div",{role:"alert",className:"p-4 rounded-xl border border-warning/40 bg-warning/10",children:[E.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[E.jsx(Ni,{variant:"warning",children:r.code}),E.jsx("span",{className:"text-sm font-medium text-heading",children:t(`dataExplorer.refused_${r.code}`)})]}),E.jsx("div",{className:"text-xs text-muted",children:t(`dataExplorer.refusedHint_${r.code}`)}),r.message&&E.jsx("div",{className:"mt-2 text-xs font-mono text-text break-words",children:r.message})]})]});if(r.kind==="failed")return E.jsxs("div",{className:"space-y-2",children:[o,E.jsxs("div",{role:"alert",className:"p-4 rounded-xl border border-error/40 bg-error/10",children:[E.jsx("div",{className:"text-sm font-medium text-error mb-1",children:t("dataExplorer.failed")}),E.jsx("div",{className:"text-xs font-mono text-text break-words whitespace-pre-wrap",children:r.message||"—"})]})]});const{result:a}=r,u=lS(a);return E.jsxs("div",{className:"space-y-2",children:[o,E.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted",role:"status",children:[E.jsx("span",{children:t("dataExplorer.rows",{count:a.rowCount??u.rows.length})}),E.jsx("span",{"aria-hidden":!0,children:"·"}),E.jsx("span",{children:t("dataExplorer.time",{ms:n(a.executionTime??0)})}),a.truncated&&E.jsx(Ni,{variant:"warning",children:t("dataExplorer.truncated")})]}),u.columns.length===0||u.rows.length===0?E.jsx("div",{className:"px-4 py-6 text-center text-sm text-subtle bg-surface border border-border rounded-xl",children:t("dataExplorer.noRows")}):E.jsx("div",{className:"bg-surface border border-border rounded-xl overflow-auto max-h-[60vh]",children:E.jsxs("table",{className:"w-full text-xs",children:[E.jsx("thead",{className:"sticky top-0 bg-surface",children:E.jsx("tr",{className:"border-b border-border/75",children:u.columns.map(h=>E.jsx("th",{className:"px-3 py-2 text-left font-mono font-medium text-subtle whitespace-nowrap",children:h},h))})}),E.jsx("tbody",{children:u.rows.map((h,d)=>E.jsx("tr",{className:"border-b border-border/50 last:border-0 hover:bg-control/40",children:h.map((p,g)=>E.jsx("td",{className:`px-3 py-1.5 font-mono whitespace-nowrap max-w-[24rem] truncate ${p==="NULL"?"text-subtle italic":"text-text"}`,title:p,children:p},g))},d))})]})})]})}function vS(){const{t:r}=xo(),{fetch:e,path:t,navigate:n}=dy(),{data:i,loading:o,error:a,refetch:u}=$k(()=>Xk(e),[e]),[h,d]=oe.useState({}),[p,g]=oe.useState({}),[v,w]=oe.useState({}),[k,S]=oe.useState(!1),[C,P]=oe.useState(null),D=Array.isArray(i)?i:[],M=D.find(z=>z.name===hS(t))??D[0]??null,Q=M?h[M.name]??"":"",B=M?p[M.name]:void 0,I=M?v[M.name]:void 0,H=(M==null?void 0:M.language.toLowerCase())==="sql",ie=M&&H?nS(M):"standard",de=(I==null?void 0:I.status)==="loaded"?I.schema:null,Se=oe.useMemo(()=>oS(de,ie),[de,ie]),ge=z=>n(`/?source=${encodeURIComponent(z)}`,{replace:!0}),J=z=>{M&&d(W=>({...W,[M.name]:z}))};async function fe(z){w(W=>({...W,[z]:{status:"loading"}}));try{const W=await Yk(e,z);w(O=>({...O,[z]:{status:"loaded",schema:W}}))}catch(W){w(O=>({...O,[z]:{status:"error",message:W instanceof Error?W.message:String(W)}}))}}function he(){const z=!k;S(z),z&&M&&(!I||I.status==="error")&&fe(M.name)}function xe(z){ge(z.name);const W=v[z.name];k&&(!W||W.status==="error")&&fe(z.name)}oe.useEffect(()=>{M&&H&&!v[M.name]&&fe(M.name)},[M==null?void 0:M.name,H]);async function Ae(){if(!M||!Q.trim()||C)return;const z=M.name;P(z);try{const W=await Jk(e,z,Q);g(O=>({...O,[z]:W}))}finally{P(null)}}const we=z=>{z.key==="Enter"&&(z.ctrlKey||z.metaKey)&&(z.preventDefault(),Ae())},$=M&&E.jsx("textarea",{"aria-label":r("dataExplorer.query"),value:Q,onChange:z=>J(z.target.value),onKeyDown:we,placeholder:r("dataExplorer.queryPlaceholder",{language:M.language}),spellCheck:!1,rows:6,className:"w-full px-3 py-2 font-mono text-xs bg-control border border-border rounded-lg text-text placeholder:text-subtle focus:outline-none focus:border-primary/50 resize-y"});return E.jsxs("div",{children:[E.jsx(Qk,{title:r("dataExplorer.title"),subtitle:i?r("dataExplorer.subtitle",{count:D.length}):r("dataExplorer.loadingPage"),actions:E.jsx("button",{onClick:u,className:vg,children:r("dataExplorer.refresh")})}),E.jsxs("div",{className:"p-4 sm:p-6 space-y-4",children:[o&&!i&&E.jsx(pS,{label:r("dataExplorer.loading")}),a&&E.jsx(py,{error:a,onRetry:u}),i&&D.length===0&&E.jsxs("div",{role:"status",className:"max-w-lg p-4 rounded-lg bg-surface border border-border text-sm text-muted space-y-2",children:[E.jsx("p",{children:r("dataExplorer.noSources")}),E.jsx("p",{className:"text-xs",children:r("dataExplorer.noSourcesHint")}),E.jsx("a",{href:fy("data-explorer"),className:"inline-flex text-xs text-primary hover:underline",children:r("dataExplorer.noSourcesFind")})]}),M&&E.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] gap-4",children:[E.jsxs("nav",{"aria-label":r("dataExplorer.sources"),className:"space-y-2",children:[E.jsx("h3",{className:"text-[10px] text-subtle uppercase tracking-wider font-medium",children:r("dataExplorer.sources")}),E.jsx("ul",{className:"flex lg:flex-col gap-2 overflow-x-auto lg:overflow-visible pb-1",children:D.map(z=>{const W=z.name===M.name;return E.jsx("li",{className:"min-w-[13rem] lg:min-w-0",children:E.jsxs("button",{type:"button",onClick:()=>xe(z),"aria-current":W?"true":void 0,className:`w-full text-left p-3 rounded-xl border transition-colors ${W?"bg-control border-primary/50":"bg-surface border-border hover:bg-control/60"}`,children:[E.jsx("div",{className:"font-mono text-sm text-accent truncate",children:z.name}),z.description&&E.jsx("div",{className:"text-xs text-muted mt-0.5 line-clamp-2",children:z.description}),E.jsx("div",{className:"mt-2",children:E.jsx(dS,{source:z})})]})},z.name)})})]}),E.jsxs("section",{className:"space-y-3 min-w-0","aria-label":M.name,children:[E.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3",children:[E.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[E.jsx("h3",{className:"text-sm font-semibold text-heading font-mono mr-auto",children:M.name}),M.templates&&M.templates.length>0&&E.jsx(Hk,{label:r("dataExplorer.templates"),placeholder:r("dataExplorer.pickTemplate"),options:M.templates.map(z=>({value:z.name,label:z.name,description:z.description})),value:null,onChange:z=>{var O;const W=(O=M.templates)==null?void 0:O.find(R=>R.name===z);W&&J(W.query)},className:"sm:max-w-[14rem]"}),E.jsx("button",{type:"button",onClick:he,"aria-expanded":k,className:vg,children:r("dataExplorer.schema")})]}),M.readOnly===!0&&E.jsx("p",{className:"text-xs text-subtle",children:r("dataExplorer.readOnlyHint")}),E.jsxs("div",{className:k?"grid grid-cols-1 md:grid-cols-[minmax(0,1fr)_14rem] gap-3":"",children:[H?E.jsx(oe.Suspense,{fallback:$,children:E.jsx(cS,{value:Q,onChange:J,onRun:()=>void Ae(),dialect:ie,schema:Se,placeholder:r("dataExplorer.queryPlaceholder",{language:M.language}),ariaLabel:r("dataExplorer.query")})}):$,k&&E.jsxs("div",{className:"bg-control/40 border border-border/75 rounded-lg p-3",children:[E.jsx("div",{className:"text-[10px] text-subtle uppercase tracking-wider font-medium mb-2",children:r("dataExplorer.schema")}),E.jsx(mS,{state:I??{status:"loading"},language:M.language,dialect:ie,onPick:J,onRetry:()=>void fe(M.name)})]})]}),E.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[E.jsx("button",{type:"button",onClick:()=>void Ae(),disabled:!Q.trim()||C!==null,className:fS,children:C===M.name?E.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[E.jsx(Nk,{size:12}),r("dataExplorer.running")]}):r("dataExplorer.run")}),E.jsx("span",{className:"text-xs text-subtle",children:r("dataExplorer.runHint")})]})]}),B&&E.jsx(Rk,{label:r("dataExplorer.result"),resetKeys:[B],children:E.jsx(yS,{outcome:B,onUseQuery:J})})]})]})]})]})}const xO=Ak(vS,{serverPlugin:uS});let Th=[],vy=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?vy:Th).push(t=t+r[e])})();function xS(r){if(r<768)return!1;for(let e=0,t=Th.length;;){let n=e+t>>1;if(r<Th[n])t=n;else if(r>=vy[n])e=n+1;else return!0;if(e==t)return!1}}function xg(r){return r>=127462&&r<=127487}const wg=8205;function wS(r,e,t=!0,n=!0){return(t?xy:kS)(r,e,n)}function xy(r,e,t){if(e==r.length)return e;e&&wy(r.charCodeAt(e))&&ky(r.charCodeAt(e-1))&&e--;let n=eh(r,e);for(e+=kg(n);e<r.length;){let i=eh(r,e);if(n==wg||i==wg||t&&xS(i))e+=kg(i),n=i;else if(xg(i)){let o=0,a=e-2;for(;a>=0&&xg(eh(r,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function kS(r,e,t){for(;e>1;){let n=xy(r,e-2,t);if(n<e)return n;e--}return 0}function eh(r,e){let t=r.charCodeAt(e);if(!ky(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return wy(n)?(t-55296<<10)+(n-56320)+65536:t}function wy(r){return r>=56320&&r<57344}function ky(r){return r>=55296&&r<56320}function kg(r){return r<65536?1:2}class Pe{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,n){[e,t]=Vi(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),Pn.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Pn.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Js(this),o=new Js(e);for(let a=t,u=t;;){if(i.next(a),o.next(a),a=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(u+=i.value.length,i.done||u>=n)return!0}}iter(e=1){return new Js(this,e)}iterRange(e,t=this.length){return new Sy(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new by(n)}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]?Pe.empty:e.length<=32?new Xe(e):Pn.from(Xe.split(e,[]))}}class Xe extends Pe{constructor(e,t=SS(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let o=0;;o++){let a=this.text[o],u=i+a.length;if((t?n:u)>=e)return new bS(i,u,n,a);i=u+1,n++}}decompose(e,t,n,i){let o=e<=0&&t>=this.length?this:new Xe(Sg(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let a=n.pop(),u=sa(o.text,a.text.slice(),0,o.length);if(u.length<=32)n.push(new Xe(u,a.length+o.length));else{let h=u.length>>1;n.push(new Xe(u.slice(0,h)),new Xe(u.slice(h)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof Xe))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let i=sa(this.text,sa(n.text,Sg(this.text,0,e)),t),o=this.length+n.length-(t-e);return i.length<=32?new Xe(i,o):Pn.from(Xe.split(i,[]),o)}sliceString(e,t=this.length,n=`
43
+ `){[e,t]=Vi(this,e,t);let i="";for(let o=0,a=0;o<=t&&a<this.text.length;a++){let u=this.text[a],h=o+u.length;o>e&&a&&(i+=n),e<h&&t>o&&(i+=u.slice(Math.max(0,e-o),t-o)),o=h+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let o of e)n.push(o),i+=o.length+1,n.length==32&&(t.push(new Xe(n,i)),n=[],i=-1);return i>-1&&t.push(new Xe(n,i)),t}}class Pn extends Pe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let o=0;;o++){let a=this.children[o],u=i+a.length,h=n+a.lines-1;if((t?h:u)>=e)return a.lineInner(e,t,n,i);i=u+1,n=h+1}}decompose(e,t,n,i){for(let o=0,a=0;a<=t&&o<this.children.length;o++){let u=this.children[o],h=a+u.length;if(e<=h&&t>=a){let d=i&((a<=e?1:0)|(h>=t?2:0));a>=e&&h<=t&&!d?n.push(u):u.decompose(e-a,t-a,n,d)}a=h+1}}replace(e,t,n){if([e,t]=Vi(this,e,t),n.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let a=this.children[i],u=o+a.length;if(e>=o&&t<=u){let h=a.replace(e-o,t-o,n),d=this.lines-a.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[i]=h,new Pn(p,this.length-(t-e)+n.length)}return super.replace(o,u,h)}o=u+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
44
+ `){[e,t]=Vi(this,e,t);let i="";for(let o=0,a=0;o<this.children.length&&a<=t;o++){let u=this.children[o],h=a+u.length;a>e&&o&&(i+=n),e<h&&t>a&&(i+=u.sliceString(e-a,t-a,n)),a=h+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Pn))return 0;let n=0,[i,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,o+=t){if(i==a||o==u)return n;let h=this.children[i],d=e.children[o];if(h!=d)return n+h.scanIdentical(d,t);n+=h.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let w of e)n+=w.lines;if(n<32){let w=[];for(let k of e)k.flatten(w);return new Xe(w,t)}let i=Math.max(32,n>>5),o=i<<1,a=i>>1,u=[],h=0,d=-1,p=[];function g(w){let k;if(w.lines>o&&w instanceof Pn)for(let S of w.children)g(S);else w.lines>a&&(h>a||!h)?(v(),u.push(w)):w instanceof Xe&&h&&(k=p[p.length-1])instanceof Xe&&w.lines+k.lines<=32?(h+=w.lines,d+=w.length+1,p[p.length-1]=new Xe(k.text.concat(w.text),k.length+1+w.length)):(h+w.lines>i&&v(),h+=w.lines,d+=w.length+1,p.push(w))}function v(){h!=0&&(u.push(p.length==1?p[0]:Pn.from(p,d)),d=-1,h=p.length=0)}for(let w of e)g(w);return v(),u.length==1?u[0]:new Pn(u,t)}}Pe.empty=new Xe([""],0);function SS(r){let e=-1;for(let t of r)e+=t.length+1;return e}function sa(r,e,t=0,n=1e9){for(let i=0,o=0,a=!0;o<r.length&&i<=n;o++){let u=r[o],h=i+u.length;h>=t&&(h>n&&(u=u.slice(0,n-i)),i<t&&(u=u.slice(t-i)),a?(e[e.length-1]+=u,a=!1):e.push(u)),i=h+1}return e}function Sg(r,e,t){return sa(r,[""],e,t)}class Js{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 Xe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],o=this.offsets[n],a=o>>1,u=i instanceof Xe?i.text.length:i.children.length;if(a==(t>0?u:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
45
+ `,this;e--}else if(i instanceof Xe){let h=i.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=i.children[a+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof Xe?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Sy{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Js(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class by{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Pe.prototype[Symbol.iterator]=function(){return this.iter()},Js.prototype[Symbol.iterator]=Sy.prototype[Symbol.iterator]=by.prototype[Symbol.iterator]=function(){return this});class bS{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Vi(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function vt(r,e,t=!0,n=!0){return wS(r,e,t,n)}function CS(r){return r>=56320&&r<57344}function AS(r){return r>=55296&&r<56320}function Qt(r,e){let t=r.charCodeAt(e);if(!AS(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return CS(n)?(t-55296<<10)+(n-56320)+65536:t}function Cy(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Un(r){return r<65536?1:2}const Mh=/\r\n?|\n/;var Dt=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Dt||(Dt={}));class Dn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let o=this.sections[t++],a=this.sections[t++];a<0?(e(n,i,o),i+=o):i+=a,n+=o}}iterChangedRanges(e,t=!1){Lh(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Dn(e)}composeDesc(e){return this.empty?e:e.empty?this:Ay(this,e)}mapDesc(e,t=!1){return e.empty?this:Nh(this,e,t)}mapPos(e,t=-1,n=Dt.Simple){let i=0,o=0;for(let a=0;a<this.sections.length;){let u=this.sections[a++],h=this.sections[a++],d=i+u;if(h<0){if(d>e)return o+(e-i);o+=u}else{if(n!=Dt.Simple&&d>=e&&(n==Dt.TrackDel&&i<e&&d>e||n==Dt.TrackBefore&&i<e||n==Dt.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!u)return e==i||t<0?o:o+h;o+=h}i=d}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let o=this.sections[n++],a=this.sections[n++],u=i+o;if(a>=0&&i<=t&&u>=e)return i<e&&u>t?"cover":!0;i=u}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(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 Dn(e)}static create(e){return new Dn(e)}}class tt extends Dn{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 Lh(this,(t,n,i,o,a)=>e=e.replace(i,i+(n-t),a),!1),e}mapDesc(e,t=!1){return Nh(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,o=0;i<t.length;i+=2){let a=t[i],u=t[i+1];if(u>=0){t[i]=u,t[i+1]=a;let h=i>>1;for(;n.length<h;)n.push(Pe.empty);n.push(a?e.slice(o,o+a):Pe.empty)}o+=a}return new tt(t,n)}compose(e){return this.empty?e:e.empty?this:Ay(this,e,!0)}map(e,t=!1){return e.empty?this:Nh(this,e,t,!0)}iterChanges(e,t=!1){Lh(this,e,t)}get desc(){return Dn.create(this.sections)}filter(e){let t=[],n=[],i=[],o=new so(this);e:for(let a=0,u=0;;){let h=a==e.length?1e9:e[a++];for(;u<h||u==h&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,h-u);yt(i,p,-1);let g=o.ins==-1?-1:o.off==0?o.ins:0;yt(t,p,g),g>0&&kr(n,t,o.text),o.forward(p),u+=p}let d=e[a++];for(;u<d;){if(o.done)break e;let p=Math.min(o.len,d-u);yt(t,p,-1),yt(i,p,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(p),u+=p}}return{changes:new tt(t,n),filtered:Dn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],o=[],a=0,u=null;function h(p=!1){if(!p&&!i.length)return;a<t&&yt(i,t-a,-1);let g=new tt(i,o);u=u?u.compose(g.map(u)):g,i=[],o=[],a=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof tt){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);h(),u=u?u.compose(p.map(u)):p}else{let{from:g,to:v=g,insert:w}=p;if(g>v||g<0||v>t)throw new RangeError(`Invalid change range ${g} to ${v} (in doc of length ${t})`);let k=w?typeof w=="string"?Pe.of(w.split(n||Mh)):w:Pe.empty,S=k.length;if(g==v&&S==0)return;g<a&&h(),g>a&&yt(i,g-a,-1),yt(i,v-g,S),kr(o,i,k),a=v}}return d(e),h(!u),u}static empty(e){return new tt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let o=e[i];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((a,u)=>u&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;n.length<i;)n.push(Pe.empty);n[i]=Pe.of(o.slice(1)),t.push(o[0],n[i].length)}}}return new tt(t,n)}static createSet(e,t){return new tt(e,t)}}function yt(r,e,t,n=!1){if(e==0&&t<=0)return;let i=r.length-2;i>=0&&t<=0&&t==r[i+1]?r[i]+=e:i>=0&&e==0&&r[i]==0?r[i+1]+=t:n?(r[i]+=e,r[i+1]+=t):r.push(e,t)}function kr(r,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<n;)r.push(Pe.empty);r.push(t)}}function Lh(r,e,t){let n=r.inserted;for(let i=0,o=0,a=0;a<r.sections.length;){let u=r.sections[a++],h=r.sections[a++];if(h<0)i+=u,o+=u;else{let d=i,p=o,g=Pe.empty;for(;d+=u,p+=h,h&&n&&(g=g.append(n[a-2>>1])),!(t||a==r.sections.length||r.sections[a+1]<0);)u=r.sections[a++],h=r.sections[a++];e(i,d,o,p,g),i=d,o=p}}}function Nh(r,e,t,n=!1){let i=[],o=n?[]:null,a=new so(r),u=new so(e);for(let h=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);yt(i,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||h==a.i||a.off==0&&(u.len<a.len||u.len==a.len&&!t))){let d=u.len;for(yt(i,u.ins,-1);d;){let p=Math.min(a.len,d);a.ins>=0&&h<a.i&&a.len<=p&&(yt(i,0,a.ins),o&&kr(o,i,a.text),h=a.i),a.forward(p),d-=p}u.next()}else if(a.ins>=0){let d=0,p=a.len;for(;p;)if(u.ins==-1){let g=Math.min(p,u.len);d+=g,p-=g,u.forward(g)}else if(u.ins==0&&u.len<p)p-=u.len,u.next();else break;yt(i,d,h<a.i?a.ins:0),o&&h<a.i&&kr(o,i,a.text),h=a.i,a.forward(a.len-p)}else{if(a.done&&u.done)return o?tt.createSet(i,o):Dn.create(i);throw new Error("Mismatched change set lengths")}}}function Ay(r,e,t=!1){let n=[],i=t?[]:null,o=new so(r),a=new so(e);for(let u=!1;;){if(o.done&&a.done)return i?tt.createSet(n,i):Dn.create(n);if(o.ins==0)yt(n,o.len,0,u),o.next();else if(a.len==0&&!a.done)yt(n,0,a.ins,u),i&&kr(i,n,a.text),a.next();else{if(o.done||a.done)throw new Error("Mismatched change set lengths");{let h=Math.min(o.len2,a.len),d=n.length;if(o.ins==-1){let p=a.ins==-1?-1:a.off?0:a.ins;yt(n,h,p,u),i&&p&&kr(i,n,a.text)}else a.ins==-1?(yt(n,o.off?0:o.len,h,u),i&&kr(i,n,o.textBit(h))):(yt(n,o.off?0:o.len,a.off?0:a.ins,u),i&&!a.off&&kr(i,n,a.text));u=(o.ins>h||a.ins>=0&&a.len>h)&&(u||n.length>d),o.forward2(h),a.forward(h)}}}}class so{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?Pe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Pe.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class xr{constructor(e,t,n,i){this.from=e,this.to=t,this.flags=n,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new xr(n,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return F.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return F.range(this.anchor,i,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return F.range(e.anchor,e.head)}static create(e,t,n,i){return new xr(e,t,n,i)}}class F{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:F.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new F([this.main],0)}addRange(e,t=!0){return F.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,F.create(n,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 F(e.ranges.map(t=>xr.fromJSON(t)),e.main)}static single(e,t=e){return new F([F.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 n=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=n:o.from<n)return F.normalized(e.slice(),t);n=o.to}return new F(e,t)}static cursor(e,t=0,n,i){return xr.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),i)}static range(e,t,n,i,o){let a=i==null?7:Math.min(6,i);return!o&&e!=t&&(o=t<e?1:-1),o&&(a|=o<0?8:16),t<e?xr.create(t,e,a|32,n):xr.create(e,t,a,n)}static undirectionalRange(e,t){return xr.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((i,o)=>i.from-o.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(o.empty?o.from<=a.to:o.from<a.to){let u=a.from,h=Math.max(o.to,a.to);i<=t&&t--,e.splice(--i,2,o.anchor>o.head?F.range(h,u):F.range(u,h))}}return new F(e,t)}}function Ey(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Pf=0;class re{constructor(e,t,n,i,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Pf++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new re(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Tf),!!e.static,e.enables)}of(e){return new oa([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new oa(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new oa(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Tf(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class oa{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Pf++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,h=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?h=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[a]=n(g),1},update(g,v){if(h&&v.docChanged||d&&(v.docChanged||v.selection)||Dh(g,p)){let w=n(g);if(u?!bg(w,g.values[a],i):!i(w,g.values[a]))return g.values[a]=w,1}return 0},reconfigure:(g,v)=>{let w,k=v.config.address[o];if(k!=null){let S=ma(v,k);if(this.dependencies.every(C=>C instanceof re?v.facet(C)===g.facet(C):C instanceof Rn?v.field(C,!1)==g.field(C,!1):!0)||(u?bg(w=n(g),S,i):i(w=n(g),S)))return g.values[a]=S,0}else w=n(g);return g.values[a]=w,1}}}get extension(){return this}}function bg(r,e,t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function Dh(r,e){let t=!1;for(let n of e)Zs(r,n)&1&&(t=!0);return t}function ES(r,e,t){let n=t.map(h=>r[h.id]),i=t.map(h=>h.type),o=n.filter(h=>!(h&1)),a=r[e.id]>>1;function u(h){let d=[];for(let p=0;p<n.length;p++){let g=ma(h,n[p]);if(i[p]==2)for(let v of g)d.push(v);else d.push(g)}return e.combine(d)}return{create(h){for(let d of n)Zs(h,d);return h.values[a]=u(h),1},update(h,d){if(!Dh(h,o))return 0;let p=u(h);return e.compare(p,h.values[a])?0:(h.values[a]=p,1)},reconfigure(h,d){let p=Dh(h,n),g=d.config.facets[e.id],v=d.facet(e);if(g&&!p&&Tf(t,g))return h.values[a]=v,0;let w=u(h);return e.compare(w,v)?(h.values[a]=v,0):(h.values[a]=w,1)}}}const jl=re.define({static:!0});class Rn{constructor(e,t,n,i,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let t=new Rn(Pf++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(jl).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,i)=>{let o=n.values[t],a=this.updateF(o,i);return this.compareF(o,a)?0:(n.values[t]=a,1)},reconfigure:(n,i)=>{let o=n.facet(jl),a=i.facet(jl),u;return(u=o.find(h=>h.field==this))&&u!=a.find(h=>h.field==this)?(n.values[t]=u.create(n),1):i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,jl.of({field:this,create:e})]}get extension(){return this}}const Kr={lowest:4,low:3,default:2,high:1,highest:0};function Qs(r){return e=>new _y(e,r)}const ri={highest:Qs(Kr.highest),high:Qs(Kr.high),default:Qs(Kr.default),low:Qs(Kr.low),lowest:Qs(Kr.lowest)};class _y{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Qi{of(e){return new Rh(this,e)}reconfigure(e){return Qi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Rh{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class pa{constructor(e,t,n,i,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],o=Object.create(null),a=new Map;for(let v of _S(e,t,a))v instanceof Rn?i.push(v):(o[v.facet.id]||(o[v.facet.id]=[])).push(v);let u=Object.create(null),h=[],d=[];for(let v of i)u[v.id]=d.length<<1,d.push(w=>v.slot(w));let p=n==null?void 0:n.config.facets;for(let v in o){let w=o[v],k=w[0].facet,S=p&&p[v]||[];if(w.every(C=>C.type==0))if(u[k.id]=h.length<<1|1,Tf(S,w))h.push(n.facet(k));else{let C=k.combine(w.map(P=>P.value));h.push(n&&k.compare(C,n.facet(k))?n.facet(k):C)}else{for(let C of w)C.type==0?(u[C.id]=h.length<<1|1,h.push(C.value)):(u[C.id]=d.length<<1,d.push(P=>C.dynamicSlot(P)));u[k.id]=d.length<<1,d.push(C=>ES(C,k,w))}}let g=d.map(v=>v(u));return new pa(e,a,g,u,h,o)}}function _S(r,e,t){let n=[[],[],[],[],[]],i=new Map;function o(a,u){let h=i.get(a);if(h!=null){if(h<=u)return;let d=n[h].indexOf(a);d>-1&&n[h].splice(d,1),a instanceof Rh&&t.delete(a.compartment)}if(i.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof Rh){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof _y)o(a.inner,a.prec);else if(a instanceof Rn)n[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof oa)n[u].push(a),a.facet.extensions&&o(a.facet.extensions,Kr.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(r,Kr.default),n.reduce((a,u)=>a.concat(u))}function Zs(r,e){if(e&1)return 2;let t=e>>1,n=r.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[t]=4;let i=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|i}function ma(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Oy=re.define(),Bh=re.define({combine:r=>r.some(e=>e),static:!0}),Py=re.define({combine:r=>r.length?r[0]:void 0,static:!0}),Ty=re.define(),My=re.define(),Ly=re.define(),Ny=re.define({combine:r=>r.length?r[0]:!1});class Xn{constructor(e,t){this.type=e,this.value=t}static define(){return new OS}}class OS{of(e){return new Xn(this,e)}}class PS{constructor(e){this.map=e}of(e){return new je(this,e)}}class je{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 je(this.type,t)}is(e){return this.type==e}static define(e={}){return new PS(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let o=i.map(t);o&&n.push(o)}return n}}je.reconfigure=je.define();je.appendConfig=je.define();class nt{constructor(e,t,n,i,o,a){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,n&&Ey(n,t.newLength),o.some(u=>u.type==nt.time)||(this.annotations=o.concat(nt.time.of(Date.now())))}static create(e,t,n,i,o,a){return new nt(e,t,n,i,o,a)}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(nt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}nt.time=Xn.define();nt.userEvent=Xn.define();nt.addToHistory=Xn.define();nt.remote=Xn.define();function TS(r,e){let t=[];for(let n=0,i=0;;){let o,a;if(n<r.length&&(i==e.length||e[i]>=r[n]))o=r[n++],a=r[n++];else if(i<e.length)o=e[i++],a=e[i++];else return t;!t.length||t[t.length-1]<o?t.push(o,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function Dy(r,e,t){var n;let i,o,a;return t?(i=e.changes,o=tt.empty(e.changes.length),a=r.changes.compose(e.changes)):(i=e.changes.map(r.changes),o=r.changes.mapDesc(e.changes,!0),a=r.changes.compose(i)),{changes:a,selection:e.selection?e.selection.map(o):(n=r.selection)===null||n===void 0?void 0:n.map(i),effects:je.mapEffects(r.effects,i).concat(je.mapEffects(e.effects,o)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Ih(r,e,t){let n=e.selection,i=zi(e.annotations);return e.userEvent&&(i=i.concat(nt.userEvent.of(e.userEvent))),{changes:e.changes instanceof tt?e.changes:tt.of(e.changes||[],t,r.facet(Py)),selection:n&&(n instanceof F?n:F.single(n.anchor,n.head)),effects:zi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Ry(r,e,t){let n=Ih(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let a=!!e[o].sequential;n=Dy(n,Ih(r,e[o],a?n.changes.newLength:r.doc.length),a)}let i=nt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return LS(t?MS(i):i)}function MS(r){let e=r.startState,t=!0;for(let i of e.facet(Ty)){let o=i(r);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:TS(t,o))}if(t!==!0){let i,o;if(t===!1)o=r.changes.invertedDesc,i=tt.empty(e.doc.length);else{let a=r.changes.filter(t);i=a.changes,o=a.filtered.mapDesc(a.changes).invertedDesc}r=nt.create(e,i,r.selection&&r.selection.map(o),je.mapEffects(r.effects,o),r.annotations,r.scrollIntoView)}let n=e.facet(My);for(let i=n.length-1;i>=0;i--){let o=n[i](r);o instanceof nt?r=o:Array.isArray(o)&&o.length==1&&o[0]instanceof nt?r=o[0]:r=Ry(e,zi(o),!1)}return r}function LS(r){let e=r.startState,t=e.facet(Ly),n=r;for(let i=t.length-1;i>=0;i--){let o=t[i](r);o&&Object.keys(o).length&&(n=Dy(n,Ih(e,o,r.changes.newLength),!0))}return n==r?r:nt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const NS=[];function zi(r){return r==null?NS:Array.isArray(r)?r:[r]}var en=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(en||(en={}));const DS=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let zh;try{zh=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function RS(r){if(zh)return zh.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||DS.test(t)))return!0}return!1}function BS(r){return e=>{if(!/\S/.test(e))return en.Space;if(RS(e))return en.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return en.Word;return en.Other}}class Me{constructor(e,t,n,i,o,a){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)Zs(this,u<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Zs(this,n),ma(this,n)}update(...e){return Ry(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let u of e.effects)u.is(Qi.reconfigure)?(t&&(i=new Map,t.compartments.forEach((h,d)=>i.set(d,h)),t=null),i.set(u.value.compartment,u.value.extension)):u.is(je.reconfigure)?(t=null,n=u.value):u.is(je.appendConfig)&&(t=null,n=zi(n).concat(u.value));let o;t?o=e.startState.values.slice():(t=pa.resolve(n,i,this),o=new Me(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let a=e.startState.facet(Bh)?e.newSelection:e.newSelection.asSingle();new Me(t,e.newDoc,a,o,(u,h)=>h.update(u,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:F.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),o=[n.range],a=zi(n.effects);for(let u=1;u<t.ranges.length;u++){let h=e(t.ranges[u]),d=this.changes(h.changes),p=d.map(i);for(let v=0;v<u;v++)o[v]=o[v].map(p);let g=i.mapDesc(d,!0);o.push(h.range.map(g)),i=i.compose(p),a=je.mapEffects(a,p).concat(je.mapEffects(zi(h.effects),g))}return{changes:i,selection:F.create(o,t.mainIndex),effects:a}}changes(e=[]){return e instanceof tt?e:tt.of(e,this.doc.length,this.facet(Me.lineSeparator))}toText(e){return Pe.of(e.split(this.facet(Me.lineSeparator)||Mh))}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:(Zs(this,t),ma(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Rn&&this.config.address[i.id]!=null&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let a=n[o],u=e[o];i.push(a.init(h=>a.spec.fromJSON(u,h)))}}return Me.create({doc:e.doc,selection:F.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=pa.resolve(e.extensions||[],new Map),n=e.doc instanceof Pe?e.doc:Pe.of((e.doc||"").split(t.staticFacet(Me.lineSeparator)||Mh)),i=e.selection?e.selection instanceof F?e.selection:F.single(e.selection.anchor,e.selection.head):F.single(0);return Ey(i,n.length),t.staticFacet(Bh)||(i=i.asSingle()),new Me(t,n,i,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(Me.tabSize)}get lineBreak(){return this.facet(Me.lineSeparator)||`
46
+ `}get readOnly(){return this.facet(Ny)}phrase(e,...t){for(let n of this.facet(Me.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let o=+(i||1);return!o||o>t.length?n:t[o-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let o of this.facet(Oy))for(let a of o(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&i.push(a[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return BS(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-n,u=e-n;for(;a>0;){let h=vt(t,a,!1);if(o(t.slice(h,a))!=en.Word)break;a=h}for(;u<i;){let h=vt(t,u);if(o(t.slice(u,h))!=en.Word)break;u=h}return a==u?null:F.range(a+n,u+n)}}Me.allowMultipleSelections=Bh;Me.tabSize=re.define({combine:r=>r.length?r[0]:4});Me.lineSeparator=Py;Me.readOnly=Ny;Me.phrases=re.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}});Me.languageData=Oy;Me.changeFilter=Ty;Me.transactionFilter=My;Me.transactionExtender=Ly;Qi.reconfigure=je.define();function ts(r,e,t={}){let n={};for(let i of r)for(let o of Object.keys(i)){let a=i[o],u=n[o];if(u===void 0)n[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))n[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class br{eq(e){return this==e}range(e,t=e){return jh.create(e,t,this)}}br.prototype.startSide=br.prototype.endSide=0;br.prototype.point=!1;br.prototype.mapMode=Dt.TrackDel;function Mf(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}let jh=class By{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new By(e,t,n)}};function Fh(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Lf{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return Mi(this.to)}findIndex(e,t,n,i=0){let o=n?this.to:this.from;for(let a=i,u=o.length;;){if(a==u)return a;let h=a+u>>1,d=o[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-t;if(h==a)return d>=0?a:u;d>=0?u=h:a=h+1}}between(e,t,n,i){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,o);o<a;o++)if(i(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,t,n,i,o){let a=[],u=[],h=[],d=-1,p=-1;e:for(let g=0;g<this.value.length;g++){let v=this.value[g],w=this.from[g]+e,k=this.to[g]+e,S,C;if(w==k){let P=t.mapPos(w,v.startSide,v.mapMode);if(P==null||(S=C=P,v.startSide!=v.endSide&&(C=t.mapPos(w,v.endSide),C<S)))continue}else if(S=t.mapPos(w,v.startSide),C=t.mapPos(k,v.endSide),S>C||S==C&&v.startSide>0&&v.endSide<=0)continue;if(!((C-S||v.endSide-v.startSide)<0))if(d<0&&(d=S),v.point&&(p=Math.max(p,C-S)),(S-n||v.startSide-i)>=0)a.push(v),u.push(S-d),h.push(C-d),n=C,i=v.endSide;else{if(S==C)for(let P=a.length;P>0;P--){if((S-(h[P-1]+d)||v.startSide-a[P-1].endSide)>=0){a.splice(P,0,v),u.splice(P,0,S-d),h.splice(P,0,C-d);continue e}if((S-(u[P-1]+d)||v.endSide-a[P-1].startSide)>0)break}o(S,C,v)}}return{mapped:a.length?new Lf(u,h,a,p):null,pos:d}}}class _e{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new _e(e,t,n,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:n=!1,filterFrom:i=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(n&&(t=t.slice().sort(Fh)),this.isEmpty)return t.length?_e.of(t):this;let u=new Iy(this,null,-1).goto(0),h=0,d=[],p=new Yr;for(;u.value||h<t.length;)if(h<t.length&&(u.from-t[h].from||u.startSide-t[h].value.startSide)>=0){let g=t[h++];p.addInner(g.from,g.to,g.value,!1)||d.push(g)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(h==t.length||this.chunkEnd(u.chunkIndex)<t[h].from)&&(!a||i>this.chunkEnd(u.chunkIndex)||o<this.chunkPos[u.chunkIndex])&&p.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!a||i>u.to||o<u.from||a(u.from,u.to,u.value))&&(p.addInner(u.from,u.to,u.value,!1)||d.push(jh.create(u.from,u.to,u.value))),u.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?_e.empty:this.nextLayer.update({add:d,filter:a,filterFrom:i,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1,o,a=(h,d,p)=>{o||(o=new Yr),o.addRange(h,d,p,!1)};for(let h=0;h<this.chunk.length;h++){let d=this.chunkPos[h],p=this.chunk[h],g=e.touchesRange(d,d+p.length);if(g===!1)i=Math.max(i,p.maxPoint),t.push(p),n.push(e.mapPos(d));else if(g===!0){let[v,w]=t.length?[Mi(n)+Mi(t).length,Mi(Mi(t).value).endSide]:[-1,-1],{mapped:k,pos:S}=p.map(d,e,v,w,a);k&&(i=Math.max(i,k.maxPoint),t.push(k),n.push(S))}}let u=this.nextLayer.map(e);return o&&(u=o.finishInner(u)),t.length==0?u:new _e(n,t,u||_e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],a=this.chunk[i];if(t>=o&&e<=o+a.length&&a.between(o,e-o,t-o,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return oo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return oo.from(e).goto(t)}static compare(e,t,n,i,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),h=Cg(a,u,n),d=new Us(a,h,o),p=new Us(u,h,o);n.iterGaps((g,v,w)=>Ag(d,g,p,v,w,i)),n.empty&&n.length==0&&Ag(d,0,p,0,0,i)}static eq(e,t,n=0,i){i==null&&(i=999999999);let o=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),a=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=Cg(o,a),h=new Us(o,u,0).goto(n),d=new Us(a,u,0).goto(n);for(;;){if(h.to!=d.to||!Hh(h.active,d.active)||h.point&&(!d.point||!Mf(h.point,d.point)))return!1;if(h.to>i)return!0;h.next(),d.next()}}static spans(e,t,n,i,o=-1){let a=new Us(e,null,o).goto(t),u=t,h=a.openStart;for(;;){let d=Math.min(a.to,n);if(a.point){let p=a.activeForPoint(a.to),g=a.pointFrom<t?p.length+1:a.point.startSide<0?p.length:Math.min(p.length,h);i.point(u,d,a.point,p,g,a.pointRank),h=Math.min(a.openEnd(d),p.length)}else d>u&&(i.span(u,d,a.active,h),h=a.openEnd(d));if(a.to>n)return h+(a.point&&a.to>n?1:0);u=a.to,a.next()}}static of(e,t=!1){let n=new Yr;for(let i of e instanceof jh?[e]:t?IS(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return _e.empty;let t=Mi(e);for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=_e.empty;i=i.nextLayer)t=new _e(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}_e.empty=new _e([],[],null,-1);function Mi(r){return r[r.length-1]}function IS(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Fh(e,n)>0)return r.slice().sort(Fh);e=n}return r}_e.empty.nextLayer=_e.empty;class Yr{finishChunk(e){this.chunks.push(new Lf(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(e,t,n,i){this.addInner(e,t,n,i)||(this.nextLayer||(this.nextLayer=new Yr)).addRange(e,t,n,i)}addInner(e,t,n,i){let o=e-this.lastTo||n.startSide-this.last.endSide;if(i&&o<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(_e.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=_e.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Cg(r,e,t){let n=new Map;for(let o of r)for(let a=0;a<o.chunk.length;a++)o.chunk[a].maxPoint<=0&&n.set(o.chunk[a],o.chunkPos[a]);let i=new Set;for(let o of e)for(let a=0;a<o.chunk.length;a++){let u=n.get(o.chunk[a]);u!=null&&(t?t.mapPos(u):u)==o.chunkPos[a]&&!(t!=null&&t.touchesRange(u,u+o.chunk[a].length))&&i.add(o.chunk[a])}return i}class Iy{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,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,n){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++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||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],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class oo{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let o=0;o<e.length;o++)for(let a=e[o];!a.isEmpty;a=a.nextLayer)a.maxPoint>=n&&i.push(new Iy(a,t,n,o));return i.length==1?i[0]:new oo(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)th(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)th(this.heap,n);(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(),th(this.heap,0)}}}function th(r,e){for(let t=r[e];;){let n=(e<<1)+1;if(n>=r.length)break;let i=r[n];if(n+1<r.length&&i.compare(r[n+1])>=0&&(i=r[n+1],n++),t.compare(i)<0)break;r[n]=t,r[e]=i,e=n}}class Us{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=oo.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Fl(this.active,e),Fl(this.activeTo,e),Fl(this.activeRank,e),this.minActive=Eg(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Hl(this.active,t,n),Hl(this.activeTo,t,i),Hl(this.activeRank,t,o),e&&Hl(e,t,this.cursor.from),this.minActive=Eg(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=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),n&&Fl(n,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Ag(r,e,t,n,i,o){r.goto(e),t.goto(n);let a=n+i,u=n,h=n-e,d=!!o.boundChange;for(let p=!1;;){let g=r.to+h-t.to,v=g||r.endSide-t.endSide,w=v<0?r.to+h:t.to,k=Math.min(w,a);if(r.point||t.point?(r.point&&t.point&&Mf(r.point,t.point)&&Hh(r.activeForPoint(r.to),t.activeForPoint(t.to))||o.comparePoint(u,k,r.point,t.point),p=!1):(p&&(o.boundChange(u),p=!1),k>u&&!Hh(r.active,t.active)&&o.compareRange(u,k,r.active,t.active),d&&k<a&&(g||r.openEnd(w)!=t.openEnd(w))&&(p=!0)),w>a)break;u=w,v<=0&&r.next(),v>=0&&t.next()}}function Hh(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t]&&!Mf(r[t],e[t]))return!1;return!0}function Fl(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function Hl(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function Eg(r,e){let t=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||r[i].endSide-r[t].endSide)<0&&(t=i,n=e[i]);return t}function wo(r,e,t=r.length){let n=0;for(let i=0;i<t&&i<r.length;)r.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=vt(r,i));return n}function zS(r,e,t,n){for(let i=0,o=0;;){if(o>=e)return i;if(i==r.length)break;o+=r.charCodeAt(i)==9?t-o%t:1,i=vt(r,i)}return r.length}const Wh="ͼ",_g=typeof Symbol>"u"?"__"+Wh:Symbol.for(Wh),qh=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Og=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Cr{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,h,d){let p=[],g=/^@(\w+)\b/.exec(a[0]),v=g&&g[1]=="keyframes";if(g&&u==null)return h.push(a[0]+";");for(let w in u){let k=u[w];if(/&/.test(w))o(w.split(/,\s*/).map(S=>a.map(C=>S.replace(/&/,C))).reduce((S,C)=>S.concat(C)),k,h);else if(k&&typeof k=="object"){if(!g)throw new RangeError("The value of a property ("+w+") should be a primitive value.");o(i(w),k,p,v)}else k!=null&&p.push(w.replace(/_.*/,"").replace(/[A-Z]/g,S=>"-"+S.toLowerCase())+": "+k+";")}(p.length||v)&&h.push((n&&!g&&!d?a.map(n):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(i(a),e[a],this.rules)}getRules(){return this.rules.join(`
47
+ `)}static newName(){let e=Og[_g]||1;return Og[_g]=e+1,Wh+e.toString(36)}static mount(e,t,n){let i=e[qh],o=n&&n.nonce;i?o&&i.setNonce(o):i=new jS(e,o),i.mount(Array.isArray(t)?t:[t],e)}}let Pg=new Map;class jS{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let o=Pg.get(n);if(o)return e[qh]=o;this.sheet=new i.CSSStyleSheet,Pg.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[qh]=this}mount(e,t){let n=this.sheet,i=0,o=0,a=!1;for(let u=0;u<e.length;u++){let h=e[u],d=this.modules.indexOf(h);if(d<o&&d>-1&&(this.modules.splice(d,1),a=!0,o--,d=-1),d==-1){if(this.modules.splice(o++,0,h),a=!0,n)for(let p=0;p<h.rules.length;p++)n.insertRule(h.rules[p],i++)}else{for(;o<d;)i+=this.modules[o++].rules.length;i+=h.rules.length,o++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let h="";for(let d=0;d<this.modules.length;d++)h+=this.modules[d].getRules()+`
48
+ `;this.styleTag.textContent=h}let u=t.head||t;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Ar={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:"'"},lo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},FS=typeof navigator<"u"&&/Mac/.test(navigator.platform),HS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ht=0;ht<10;ht++)Ar[48+ht]=Ar[96+ht]=String(ht);for(var ht=1;ht<=24;ht++)Ar[ht+111]="F"+ht;for(var ht=65;ht<=90;ht++)Ar[ht]=String.fromCharCode(ht+32),lo[ht]=String.fromCharCode(ht);for(var nh in Ar)lo.hasOwnProperty(nh)||(lo[nh]=Ar[nh]);function WS(r){var e=FS&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||HS&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?lo:Ar)[r.keyCode]||r.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}let St=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Vh=typeof document<"u"?document:{documentElement:{style:{}}};const Qh=/Edge\/(\d+)/.exec(St.userAgent),zy=/MSIE \d/.test(St.userAgent),Uh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(St.userAgent),za=!!(zy||Uh||Qh),Tg=!za&&/gecko\/(\d+)/i.test(St.userAgent),rh=!za&&/Chrome\/(\d+)/.exec(St.userAgent),Mg="webkitFontSmoothing"in Vh.documentElement.style,$h=!za&&/Apple Computer/.test(St.vendor),Lg=$h&&(/Mobile\/\w+/.test(St.userAgent)||St.maxTouchPoints>2);var Y={mac:Lg||/Mac/.test(St.platform),windows:/Win/.test(St.platform),linux:/Linux|X11/.test(St.platform),ie:za,ie_version:zy?Vh.documentMode||6:Uh?+Uh[1]:Qh?+Qh[1]:0,gecko:Tg,gecko_version:Tg?+(/Firefox\/(\d+)/.exec(St.userAgent)||[0,0])[1]:0,chrome:!!rh,chrome_version:rh?+rh[1]:0,ios:Lg,android:/Android\b/.test(St.userAgent),webkit:Mg,webkit_version:Mg?+(/\bAppleWebKit\/(\d+)/.exec(St.userAgent)||[0,0])[1]:0,safari:$h,safari_version:$h?+(/\bVersion\/(\d+(\.\d+)?)/.exec(St.userAgent)||[0,0])[1]:0,tabSize:Vh.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Nf(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}const ga=Object.create(null);function Df(r,e,t){if(r==e)return!0;r||(r=ga),e||(e=ga);let n=Object.keys(r),i=Object.keys(e);if(n.length-0!=i.length-0)return!1;for(let o of n)if(o!=t&&(i.indexOf(o)==-1||r[o]!==e[o]))return!1;return!0}function qS(r,e){for(let t=r.attributes.length-1;t>=0;t--){let n=r.attributes[t].name;e[n]==null&&r.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?r.style.cssText=n:r.getAttribute(t)!=n&&r.setAttribute(t,n)}}function Ng(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function VS(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}class ii{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ft=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(ft||(ft={}));class Le extends br{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new ko(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ti(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:o,end:a}=jy(e,t);n=(o?t?-3e8:-1:5e8)-1,i=(a?t?2e8:1:-6e8)+1}return new ti(e,n,i,t,e.widget||null,!0)}static line(e){return new So(e)}static set(e,t=!1){return _e.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Le.none=_e.empty;class ko extends Le{constructor(e){let{start:t,end:n}=jy(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Nf(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ga}eq(e){return this==e||e instanceof ko&&this.tagName==e.tagName&&Df(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)}}ko.prototype.point=!1;class So extends Le{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof So&&this.spec.class==e.spec.class&&Df(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)}}So.prototype.mapMode=Dt.TrackBefore;So.prototype.point=!0;class ti extends Le{constructor(e,t,n,i,o,a){super(t,n,o,e),this.block=i,this.isReplace=a,this.mapMode=i?t<=0?Dt.TrackBefore:Dt.TrackAfter:Dt.TrackDel}get type(){return this.startSide!=this.endSide?ft.WidgetRange:this.startSide<=0?ft.WidgetBefore:ft.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ti&&QS(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)}}ti.prototype.point=!0;function jy(r,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=r;return t==null&&(t=r.inclusive),n==null&&(n=r.inclusive),{start:t??e,end:n??e}}function QS(r,e){return r==e||!!(r&&e&&r.compare(e))}function ji(r,e,t,n=0){let i=t.length-1;i>=0&&t[i]+n>=r?t[i]=Math.max(t[i],e):t.push(r,e)}class ao extends br{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof ao&&this.tagName==e.tagName&&Df(this.attributes,e.attributes)}static create(e){return new ao(e.tagName,e.attributes||ga,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return _e.of(e,t)}}ao.prototype.startSide=ao.prototype.endSide=-1;const lt=r=>r.nodeType==1,Ui=r=>r.nodeType==3;function uo(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function Kh(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function eo(r,e){if(!e.anchorNode)return!1;try{return Kh(r,e.anchorNode)}catch{return!1}}function to(r){return Ui(r)?ho(r,0,r.nodeValue.length).getClientRects():lt(r)?r.getClientRects():[]}function no(r,e,t,n){return t?Dg(r,e,t,n,-1)||Dg(r,e,t,n,1):!1}function Er(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function ya(r){return lt(r)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}function Dg(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Gn(r))){if(r.nodeName=="DIV")return!1;let o=r.parentNode;if(!o||!lt(o))return!1;e=Er(r)+(i<0?0:1),r=o}else if(lt(r)){if(r=r.childNodes[e+(i<0?-1:0)],lt(r)&&(r.nodeName=="IMG"||r.nodeName=="BR"||r.contentEditable=="false"))return!1;e=i<0?Gn(r):0}else return!1}}function Gn(r){return Ui(r)?r.nodeValue.length:r.childNodes.length}function co(r,e){let{left:t,right:n}=r;if(t==n)return r;let i=e?t:n;return{left:i,right:i,top:r.top,bottom:r.bottom}}function US(r){let e=r.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Fy(r,e){let t=e.width/r.offsetWidth,n=e.height/r.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-r.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-r.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function $S(r,e,t,n,i,o,a,u){let h=r.ownerDocument,d=h.defaultView||window;for(let p=r,g=!1;p&&!g;)if(lt(p)){let v,w=p==h.body,k=1,S=1,C=!0,P=!0;if(w)v=US(d);else{let Q=getComputedStyle(p);if(/^(fixed|sticky)$/.test(Q.position)&&(g=!0),(p.scrollHeight<=p.clientHeight||!/auto|scroll/.test(Q.overflowY))&&(P=!1),(p.scrollWidth<=p.clientWidth||!/auto|scroll/.test(Q.overflowX))&&(C=!1),!C&&!P){p=p.assignedSlot||p.parentNode;continue}let B=p.getBoundingClientRect();({scaleX:k,scaleY:S}=Fy(p,B)),v={left:B.left,right:B.left+p.clientWidth*k,top:B.top,bottom:B.top+p.clientHeight*S}}let D=0,M=0;if(P)if(i=="nearest")e.top<v.top+a?(M=e.top-(v.top+a),t>0&&e.bottom>v.bottom+M&&(M=e.bottom-v.bottom+a)):e.bottom>v.bottom-a&&(M=e.bottom-v.bottom+a,t<0&&e.top-M<v.top&&(M=e.top-(v.top+a)));else{let Q=e.bottom-e.top,B=v.bottom-v.top;M=(i=="center"&&Q<=B?e.top+Q/2-B/2:i=="start"||i=="center"&&t<0?e.top-a:e.bottom-B+a)-v.top}if(C&&(n=="nearest"?e.left<v.left+o?(D=e.left-(v.left+o),t>0&&e.right>v.right+D&&(D=e.right-v.right+o)):e.right>v.right-o&&(D=e.right-v.right+o,t<0&&e.left<v.left+D&&(D=e.left-(v.left+o))):D=(n=="center"?e.left+(e.right-e.left)/2-(v.right-v.left)/2:n=="start"==u?e.left-o:e.right-(v.right-v.left)+o)-v.left),D||M)if(w)d.scrollBy(D,M);else{let Q=0,B=0;if(M){let I=p.scrollTop;p.scrollTop+=M/S,B=(p.scrollTop-I)*S}if(D){let I=p.scrollLeft;p.scrollLeft+=D/k,Q=(p.scrollLeft-I)*k}e={left:e.left-Q,top:e.top-B,right:e.right-Q,bottom:e.bottom-B},Q&&Math.abs(Q-D)<1&&(n="nearest"),B&&Math.abs(B-M)<1&&(i="nearest")}if(w)break;(e.top<v.top||e.bottom>v.bottom||e.left<v.left||e.right>v.right)&&(e={left:Math.max(e.left,v.left),right:Math.min(e.right,v.right),top:Math.max(e.top,v.top),bottom:Math.min(e.bottom,v.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function Hy(r,e=!0){let t=r.ownerDocument,n=null,i=null;for(let o=r.parentNode;o&&!(o==t.body||(!e||n)&&i);)if(lt(o))!i&&o.scrollHeight>o.clientHeight&&/scroll|auto/.test(getComputedStyle(o).overflowY)&&(i=o),e&&!n&&o.scrollWidth>o.clientWidth&&/scroll|auto/.test(getComputedStyle(o).overflowX)&&(n=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:n,y:i}}class KS{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Gn(t):0),n,Math.min(e.focusOffset,n?Gn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}function Wy(r){let e=[];for(let t=r;t;t=t.nodeType==11?t.host:t.parentNode)lt(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function qy(r,e=!0){for(let{node:t,left:n,top:i}of r)e&&t.scrollTop!=i&&(t.scrollTop=i),t.scrollLeft!=n&&(t.scrollLeft=n)}let Ur=null;Y.safari&&Y.safari_version>=26&&(Ur=!1);function Vy(r){if(r.setActive)return r.setActive();if(Ur)return r.focus(Ur);let e=Wy(r);r.focus(Ur==null?{get preventScroll(){return Ur={preventScroll:!0},!0}}:void 0),Ur||(Ur=!1,qy(e))}let Rg;function ho(r,e,t=e){let n=Rg||(Rg=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function Fi(r,e,t,n){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=n);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,r.dispatchEvent(o);let a=new KeyboardEvent("keyup",i);return a.synthetic=!0,r.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function GS(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function XS(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,Gn(t));;)if(n){if(!lt(t))return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=Gn(t))}else{if(t==r)return!0;n=Er(t),t=t.parentNode}}function Qy(r){return r instanceof Window?r.pageYOffset>Math.max(0,r.document.documentElement.scrollHeight-r.innerHeight-4):r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}function Uy(r,e){for(let t=r,n=e;;){if(Ui(t)&&n>0)return{node:t,offset:n};if(lt(t)&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=Gn(t)}else if(t.parentNode&&!ya(t))n=Er(t),t=t.parentNode;else return null}}function $y(r,e){for(let t=r,n=e;;){if(Ui(t)&&n<t.nodeValue.length)return{node:t,offset:n};if(lt(t)&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!ya(t))n=Er(t)+1,t=t.parentNode;else return null}}class mn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new mn(e.parentNode,Er(e),t)}static after(e,t){return new mn(e.parentNode,Er(e)+1,t)}}var Be=(function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r})(Be||(Be={}));const $i=Be.LTR,Rf=Be.RTL;function Ky(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const YS=Ky("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),JS=Ky("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Gh=Object.create(null),An=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);Gh[e]=t,Gh[t]=-e}function Gy(r){return r<=247?YS[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?JS[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1}const ZS=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Mn{get dir(){return this.level%2?Rf:$i}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let o=-1;for(let a=0;a<e.length;a++){let u=e[a];if(u.from<=t&&u.to>=t){if(u.level==n)return a;(o<0||(i!=0?i<0?u.from<t:u.to>t:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function Xy(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!Xy(n.inner,i.inner))return!1}return!0}const Re=[];function eb(r,e,t,n,i){for(let o=0;o<=n.length;o++){let a=o?n[o-1].to:e,u=o<n.length?n[o].from:t,h=o?256:i;for(let d=a,p=h,g=h;d<u;d++){let v=Gy(r.charCodeAt(d));v==512?v=p:v==8&&g==4&&(v=16),Re[d]=v==4?2:v,v&7&&(g=v),p=v}for(let d=a,p=h,g=h;d<u;d++){let v=Re[d];if(v==128)d<u-1&&p==Re[d+1]&&p&24?v=Re[d]=p:Re[d]=256;else if(v==64){let w=d+1;for(;w<u&&Re[w]==64;)w++;let k=d&&p==8||w<t&&Re[w]==8?g==1?1:8:256;for(let S=d;S<w;S++)Re[S]=k;d=w-1}else v==8&&g==1&&(Re[d]=1);p=v,v&7&&(g=v)}}}function tb(r,e,t,n,i){let o=i==1?2:1;for(let a=0,u=0,h=0;a<=n.length;a++){let d=a?n[a-1].to:e,p=a<n.length?n[a].from:t;for(let g=d,v,w,k;g<p;g++)if(w=Gh[v=r.charCodeAt(g)])if(w<0){for(let S=u-3;S>=0;S-=3)if(An[S+1]==-w){let C=An[S+2],P=C&2?i:C&4?C&1?o:i:0;P&&(Re[g]=Re[An[S]]=P),u=S;break}}else{if(An.length==189)break;An[u++]=g,An[u++]=v,An[u++]=h}else if((k=Re[g])==2||k==1){let S=k==i;h=S?0:1;for(let C=u-3;C>=0;C-=3){let P=An[C+2];if(P&2)break;if(S)An[C+2]|=2;else{if(P&4)break;An[C+2]|=4}}}}}function nb(r,e,t,n){for(let i=0,o=n;i<=t.length;i++){let a=i?t[i-1].to:r,u=i<t.length?t[i].from:e;for(let h=a;h<u;){let d=Re[h];if(d==256){let p=h+1;for(;;)if(p==u){if(i==t.length)break;p=t[i++].to,u=i<t.length?t[i].from:e}else if(Re[p]==256)p++;else break;let g=o==1,v=(p<e?Re[p]:n)==1,w=g==v?g?1:2:n;for(let k=p,S=i,C=S?t[S-1].to:r;k>h;)k==C&&(k=t[--S].from,C=S?t[S-1].to:r),Re[--k]=w;h=p}else o=d,h++}}}function Xh(r,e,t,n,i,o,a){let u=n%2?2:1;if(n%2==i%2)for(let h=e,d=0;h<t;){let p=!0,g=!1;if(d==o.length||h<o[d].from){let S=Re[h];S!=u&&(p=!1,g=S==16)}let v=!p&&u==1?[]:null,w=p?n:n+1,k=h;e:for(;;)if(d<o.length&&k==o[d].from){if(g)break e;let S=o[d];if(!p)for(let C=S.to,P=d+1;;){if(C==t)break e;if(P<o.length&&o[P].from==C)C=o[P++].to;else{if(Re[C]==u)break e;break}}if(d++,v)v.push(S);else{S.from>h&&a.push(new Mn(h,S.from,w));let C=S.direction==$i!=!(w%2);Yh(r,C?n+1:n,i,S.inner,S.from,S.to,a),h=S.to}k=S.to}else{if(k==t||(p?Re[k]!=u:Re[k]==u))break;k++}v?Xh(r,h,k,n+1,i,v,a):h<k&&a.push(new Mn(h,k,w)),h=k}else for(let h=t,d=o.length;h>e;){let p=!0,g=!1;if(!d||h>o[d-1].to){let S=Re[h-1];S!=u&&(p=!1,g=S==16)}let v=!p&&u==1?[]:null,w=p?n:n+1,k=h;e:for(;;)if(d&&k==o[d-1].to){if(g)break e;let S=o[--d];if(!p)for(let C=S.from,P=d;;){if(C==e)break e;if(P&&o[P-1].to==C)C=o[--P].from;else{if(Re[C-1]==u)break e;break}}if(v)v.push(S);else{S.to<h&&a.push(new Mn(S.to,h,w));let C=S.direction==$i!=!(w%2);Yh(r,C?n+1:n,i,S.inner,S.from,S.to,a),h=S.from}k=S.from}else{if(k==e||(p?Re[k-1]!=u:Re[k-1]==u))break;k--}v?Xh(r,k,h,n+1,i,v,a):k<h&&a.push(new Mn(k,h,w)),h=k}}function Yh(r,e,t,n,i,o,a){let u=e%2?2:1;eb(r,i,o,n,u),tb(r,i,o,n,u),nb(i,o,n,u),Xh(r,i,o,e,t,n,a)}function rb(r,e,t){if(!r)return[new Mn(0,0,e==Rf?1:0)];if(e==$i&&!t.length&&!ZS.test(r))return Yy(r.length);if(t.length)for(;r.length>Re.length;)Re[Re.length]=256;let n=[],i=e==$i?0:1;return Yh(r,i,i,t,0,r.length,n),n}function Yy(r){return[new Mn(0,r,0)]}let Jy="";function ib(r,e,t,n,i){var o;if(!r.length)return null;let a=n.head-r.from,u;if(n.head==r.from&&n.assoc<0){if(!i)return null;a=e[u=0].side(!1,t)}else if(n.head==r.to&&n.assoc>0){if(i)return null;a=e[u=e.length-1].side(!0,t)}else u=Mn.find(e,a,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc);let h=e[u],d=h.side(i,t);if(a==d){let v=u+=i?1:-1;if(v<0||v>=e.length)return null;h=e[u=v],a=h.side(!i,t),d=h.side(i,t)}let p=vt(r.text,a,h.forward(i,t));(p<h.from||p>h.to)&&(p=d),Jy=r.text.slice(Math.min(a,p),Math.max(a,p));let g=u==(i?e.length-1:0)?null:e[u+(i?1:-1)];if(p==d){if(!g)return i?F.cursor(r.to,1):F.cursor(r.from,-1);if(g.level+(i?0:1)<h.level)return F.cursor(g.side(!i,t)+r.from,g.forward(i,t)?1:-1,g.level)}return F.cursor(p+r.from,h.forward(i,t)?-1:1,h.level)}function sb(r,e,t){for(let n=e;n<t;n++){let i=Gy(r.charCodeAt(n));if(i==1)return $i;if(i==2||i==4)return Rf}}const Zy=re.define(),ev=re.define(),tv=re.define(),nv=re.define(),Jh=re.define(),rv=re.define(),iv=re.define(),Bf=re.define(),If=re.define(),sv=re.define({combine:r=>r.some(e=>e)}),ov=re.define({combine:r=>r.some(e=>e)}),lv=re.define();class Hi{constructor(e,t,n,i,o,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new Hi(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 Hi(F.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Wl=je.define({map:(r,e)=>r.map(e)}),av=je.define();function Ut(r,e,t){let n=r.facet(nv);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const $n=re.define({combine:r=>r.length?r[0]:!0});let ob=0;const Di=re.define({combine(r){return r.filter((e,t)=>{for(let n=0;n<t;n++)if(r[n].plugin==e.plugin)return!1;return!0})}});class Ct{constructor(e,t,n,i,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Di.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Di.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:o,decorations:a}=t||{};return new Ct(ob++,e,n,i,u=>{let h=[];return a&&h.push(ja.of(d=>{let p=d.plugin(u);return p?a(p):Le.none})),o&&h.push(o(u)),h})}static fromClass(e,t){return Ct.define((n,i)=>new e(n,i),t)}}class ih{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(n){if(Ut(t.state,n,"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){Ut(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(n){Ut(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const uv=re.define(),zf=re.define(),ja=re.define(),cv=re.define(),jf=re.define(),bo=re.define(),hv=re.define();function Bg(r,e){let t=r.state.facet(hv);if(!t.length)return t;let n=t.map(o=>o instanceof Function?o(r):o),i=[];return _e.spans(n,e.from,e.to,{point(){},span(o,a,u,h){let d=o-e.from,p=a-e.from,g=i;for(let v=u.length-1;v>=0;v--,h--){let w=u[v].spec.bidiIsolate,k;if(h>0&&g.length&&(k=g[g.length-1]).to==d&&k.direction==w)k.to=p,g=k.inner;else{let S={from:d,to:p,direction:w,inner:[]};g.push(S),g=S.inner}}}}),fv(e.text,i)}function fv(r,e){for(let t of e){if(t.direction==null){for(let n=t.from,i=0;n<t.to;i++){let o=i<t.inner.length?t.inner[i]:null,a=sb(r,n,o?o.from:t.to);if(a){t.direction=a;break}if(!o)break;n=o.to}t.direction==null&&(t.direction=Be.LTR)}fv(r,t.inner)}return e}const dv=re.define();function Ff(r){let e=0,t=0,n=0,i=0;for(let o of r.state.facet(dv)){let a=o(r);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(n=Math.max(n,a.top)),a.bottom!=null&&(i=Math.max(i,a.bottom)))}return{left:e,right:t,top:n,bottom:i}}const Xs=re.define();class tn{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new tn(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,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,o=0,a=0;;){let u=i<e.length?e[i].fromB:1e9,h=o<t.length?t[o]:1e9,d=Math.min(u,h);if(d==1e9)break;let p=d+a,g=d,v=p;for(;;)if(o<t.length&&t[o]<=g){let w=t[o+1];o+=2,g=Math.max(g,w);for(let k=i;k<e.length&&e[k].fromB<=g;k++)a=e[k].toA-e[k].toB;v=Math.max(v,w+a)}else if(i<e.length&&e[i].fromB<=g){let w=e[i++];g=Math.max(g,w.toB),v=Math.max(v,w.toA),a=w.toA-w.toB}else break;n.push(new tn(p,v,d,g))}return n}}class va{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=tt.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let i=[];this.changes.iterChangedRanges((o,a,u,h)=>i.push(new tn(o,a,u,h))),this.changedRanges=i}static create(e,t,n){return new va(e,t,n)}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 lb=[];class $e{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return lb}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&&qS(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 n=t;for(let i of this.children){if(i==e)return n;n+=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,n){return null}domPosFor(e,t){let n=Er(this.dom),i=this.length?e>0:t>0;return new mn(this.parent.dom,n+(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 Ha)return e;return null}static get(e){return e.cmTile}}class Fa extends $e{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,i,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,i=n?n.nextSibling:t.firstChild,o&&i!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;i&&i!=u.dom;)i=Ig(i);else t.insertBefore(u.dom,i);n=u.dom}for(i=n?n.nextSibling:t.firstChild,o&&i&&(o.written=!0);i;)i=Ig(i);this.length=a}}function Ig(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Ha extends Fa{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=$e.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,o=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&o++,i=t.pop()}else{let a=n.children[i++];if(a instanceof Kn)t.push(i),n=a,i=0;else{let u=o+a.length,h=e(a,o);if(h!==void 0)return h;o=u+a.breakAfter}}}resolveBlock(e,t){let n,i=-1,o,a=-1;if(this.blockTiles((u,h)=>{let d=h+u.length;if(e>=h&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(n=void 0)}(h<e||e==d&&(t<-1?u.length:u.covers(1)))&&(!n||!u.isWidget()&&n.isWidget())&&(n=u,i=e-h),(d>e||e==h&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-h)}}),!n&&!o)throw new Error("No tile at position "+e);return n&&t<0||!o?{tile:n,offset:i}:{tile:o,offset:a}}}class Kn extends Fa{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 n=new Kn(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Ki extends Fa{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new Ki(t||document.createElement("div"),e);return(!t||!n)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let i=null,o=-1,a=null,u=-1;function h(p,g){for(let v=0,w=0;v<p.children.length&&w<=g;v++){let k=p.children[v],S=w+k.length;S>=g&&(k.isComposite()?h(k,g-w):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&ub(a,k)))&&(S>g||k.flags&32&&t<=1)?(a=k,u=g-w):(w<g||k.flags&16&&!(n&&k.isHidden)&&t>=-1)&&(i=k,o=g-w)),w=S}}h(this,e);let d=(t<0?i:a)||i||a;return d?{tile:d,offset:d==i?o:u}:null}coordsIn(e,t,n){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t,n):ab(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:i,offset:o}=n;if(this.dom.contains(i.dom))return i.isText()?new mn(i.dom,Math.min(i.dom.nodeValue.length,o)):i.domPosFor(o,i.flags&16?1:i.flags&32?-1:t);let a=n.tile.parent,u=!1;for(let h of a.children){if(u)return new mn(h.dom,0);h==n.tile&&(u=!0)}}return new mn(this.dom,0)}}function ab(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=to(e);return t[t.length-1]||null}function ub(r,e){let t=r.coordsIn(0,1),n=e.coordsIn(0,1);return t&&n&&n.top<t.bottom}class Rt extends Fa{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new Rt(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Gr extends $e{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let i=this.dom.nodeValue.length;e>i&&(e=i);let o=e,a=e,u=0;e==0&&t<0||e==i&&t>=0?Y.chrome||Y.gecko||(e?(o--,u=1):a<i&&(a++,u=-1)):t<0?o--:a<i&&a++;let h=ho(this.dom,o,a).getClientRects();if(!h.length)return null;let d=h[(u?u<0:t>=0)?0:h.length-1];return Y.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(h,p=>p.width)||d),n==null?d:co(d,(u?u>0:t<0)==n)}static of(e,t){let n=new Gr(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class ni extends $e{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return co(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=u?o.length-1:0;a=o[h],!(e>0?h==0:h==o.length-1||a.top<a.bottom);h+=u?-1:1);return co(a,!u)}}get overrideDOMText(){if(!this.length)return Pe.empty;let{root:e}=this;if(!e)return Pe.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,n,i,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new ni(o,n,e,i)}}class xa extends $e{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 Pe.empty}coordsIn(e,t,n){let i=this.dom.getBoundingClientRect();return n==null?i:co(i,t>0==n)}}class cb{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(i.isComposite())if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(o==i.children.length){if(!e&&!u.length)break;n&&n.leave(i),a=!!i.breakAfter,{tile:i,index:o}=u.pop(),o++}else{let h=i.children[o],d=h.breakAfter;(t>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(a=!!d,o++,e-=h.length):(u.push({tile:i,index:o}),i=h,o=0,n&&h.isComposite()&&n.enter(h))}else{let h=i.length;if(o<h&&e){let d=Math.min(e,h-o);n&&n.skip(i,o,o+d),e-=d,o+=d}if(o==h)a=!!i.breakAfter,{tile:i,index:o}=u.pop(),o++;else if(!e)break}return this.tile=i,this.index=o,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class hb{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class fb{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var o;this.flushBuffer();let a=this.ensureMarks(t,n),u=a.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let h=a.children[a.children.length-1]=new Gr(u.dom,u.text+e);h.parent=a}else a.append(i||Gr.of(e,(o=this.cache.find(Gr))===null||o===void 0?void 0:o.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?sh(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let u=t.marks.length-1;u>=0;u--){let h=t.marks[u],d=i.lastChild;if(d instanceof Rt&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(sh(h.dom)),i=d;else{let{dom:p}=h;this.cache.reused.get(h)&&$e.get(h.dom)&&(p=sh(h.dom));let g=Rt.of(h.mark,p);i.append(g),i=g}this.cache.reused.set(h,2)}let o=$e.get(e.text);o&&this.cache.reused.set(o,2);let a=new Gr(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,i.append(a)}addInlineWidget(e,t,n){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let o=this.ensureMarks(t,n);!i&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=pv);let i=Ki.start(e,t||((n=this.cache.find(Ki))===null||n===void 0?void 0:n.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 n;let i=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=i.lastChild)&&u instanceof Rt&&u.mark.eq(a))i=u,t--;else{let h=Rt.of(a,(n=this.cache.find(Rt,d=>d.mark.eq(a)))===null||n===void 0?void 0:n.dom);i.append(h),i=h,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!zg(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Y.ios&&zg(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(oh,0,32)||new ni(oh.toDOM(),0,oh,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new hb(e.from,e.to,e.value,t),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-n.rank||this.wrappers[i-1].to-n.to)<0;)i--;this.wrappers.splice(i,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof Kn&&i.wrapper.eq(n.wrapper))t=i;else{let o=Kn.of(n.wrapper,(e=this.cache.find(Kn,a=>a.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}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),n=this.cache.find(xa,void 0,1);return n&&(n.flags=t),n||new xa(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class db{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:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=i;let u=this.textOff=Math.min(e,i.length);return o?null:i.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const wa=[ni,Ki,Gr,Rt,xa,Kn,Ha];for(let r=0;r<wa.length;r++)wa[r].bucket=r;class pb{constructor(e){this.view=e,this.buckets=wa.map(()=>[]),this.index=wa.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,o=this.buckets[i],a=this.index[i];for(let u=0;u<o.length;u++){let h=(u+a)%o.length,d=o[h];if((!t||t(d))&&!this.reused.has(d))return o.splice(h,1),h<a&&this.index[i]--,this.reused.set(d,n),d}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let o=0,a=0;;o++){if(o==i.length){if(a)return null;a=1,o=0}let u=i[o];if(!this.reused.has(u)&&(a==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return i.splice(o,1),o<this.index[0]&&this.index[0]--,u.widget==e&&u.length==t&&(u.flags&497)==n?(this.reused.set(u,1),u):(this.reused.set(u,2),new ni(u.dom,t,e,u.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class mb{constructor(e,t,n,i,o){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new pb(e),this.text=new db(e.state.doc),this.builder=new fb(this.cache,new Ha(e,e.contentDOM),_e.iter(n)),this.cache.reused.set(t,2),this.old=new cb(t),this.reuseWalker={skip:(a,u,h)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,o=0,a=0;;){let u=a<e.length?e[a++]:null,h=u?u.fromA:this.old.root.length;if(h>i){let d=h-i;this.preserve(d,!a,!u),i=h,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,u.toA),this.emit(t.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(o,u.toB)),o=u.toB,i=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=vb(this.old),o=this.openMarks;this.old.advance(e,n?1:-1,{skip:(a,u,h)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(h-u);else{let d=h>0||u<a.length?ni.of(a.widget,this.view,h-u,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,i,o),o=i.length)}else if(a.isText())this.builder.ensureLine(null),!u&&h==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,i,o,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(u,h),i,o)),o=i.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof xa)this.cache.add(a);else if(a instanceof Rt)this.builder.ensureLine(null),this.builder.addMark(a,i,o),this.cache.reused.set(a,1),o=i.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Rt&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=o=0):a instanceof Rt&&(i.shift(),o=Math.min(o,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,o=-1,a=_e.spans(this.decorations,e,t,{point:(u,h,d,p,g,v)=>{if(d instanceof ti){if(this.disallowBlockEffectsFor[v]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=p.length,g>p.length)i.continueWidget(h-u);else{let w=d.widget||(d.block?Gi.block:Gi.inline),k=gb(d),S=this.cache.findWidget(w,h-u,k)||ni.of(w,this.view,h-u,k);d.block?(d.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(S)):(i.ensureLine(n),i.addInlineWidget(S,p,g))}n=null}else n=yb(n,d);h>u&&this.text.skip(h-u)},span:(u,h,d,p)=>{for(let g=u;g<h;){let v=this.text.next(Math.min(512,h-g));v==null?(i.addLineStartIfNotCovered(n),i.addBreak(),g++):(i.ensureLine(n),i.addText(v,d,g==u?p:d.length),g+=v.length),n=null}o=d.length}});o>-1&&(this.openWidget=a>o),this.openWidget||i.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let o=$e.get(i);if(i==this.view.contentDOM)break;o instanceof Rt?t.push(o):o!=null&&o.isLine()?n=o:o instanceof Kn||(i.nodeName=="DIV"&&!n?n=new Ki(i,pv):n||t.push(Rt.of(new ko({tagName:i.nodeName.toLowerCase(),attributes:VS(i)}),i)))}return n?{line:n,marks:t}:null}}function zg(r,e){let t=n=>{for(let i of n.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(r)}function gb(r){let e=r.isReplace?(r.startSide<0?64:0)|(r.endSide>0?128:0):r.startSide>0?32:16;return r.block&&(e|=256),e}const pv={class:"cm-line"};function yb(r,e){let t=e.spec.attributes,n=e.spec.class;return!t&&!n||(r||(r={class:"cm-line"}),t&&Nf(t,r),n&&(r.class+=" "+n)),r}function vb(r){let e=[];for(let t=r.parents.length;t>1;t--){let n=t==r.parents.length?r.tile:r.parents[t].tile;n instanceof Rt&&e.push(n.mark)}return e}function sh(r){let e=$e.get(r);return e&&e.setDOM(r.cloneNode()),r}class Gi extends ii{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}}Gi.inline=new Gi("span");Gi.block=new Gi("div");const oh=new class extends ii{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class jg{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Le.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 Ha(e,e.contentDOM),this.updateInner([new tn(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:p,toA:g})=>g<this.minWidthFrom||p>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:!_b(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let o=i>-1?wb(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;n=new tn(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Y.ie||Y.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let h=bb(a,this.decorations,e.changes);h.length&&(n=tn.extendWithRanges(n,h));let d=Ab(u,this.blockWrappers,e.changes);return d.length&&(n=tn.extendWithRanges(n,d)),o&&!n.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(n=o.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let a=this.tile,u=new mb(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&$e.get(t.text)&&u.cache.reused.set($e.get(t.text),2),this.tile=u.run(e,t),Zh(a,u.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 o=Y.chrome||Y.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||n.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.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 o of this.tile.children)o.isWidget()&&o.widget instanceof lh&&i.push(o.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(av)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,o=i==n,a=!o&&!(this.view.state.facet($n)||n.tabIndex>-1)&&eo(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,d,p;if(h.empty?p=d=this.inlineDOMNearPos(h.anchor,h.assoc||1):(p=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),d=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),Y.gecko&&h.empty&&!this.hasComposition&&xb(d)){let v=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(v,d.node.childNodes[d.offset]||null)),d=p=new mn(v,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!no(d.node,d.offset,g.anchorNode,g.anchorOffset)||!no(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,h))&&(this.view.observer.ignore(()=>{Y.android&&Y.chrome&&n.contains(g.focusNode)&&Eb(g.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let v=uo(this.view.root);if(v)if(h.empty){if(Y.gecko){let w=kb(d.node,d.offset);if(w&&w!=3){let k=(w==1?Uy:$y)(d.node,d.offset);k&&(d=new mn(k.node,k.offset))}}v.collapse(d.node,d.offset),h.bidiLevel!=null&&v.caretBidiLevel!==void 0&&(v.caretBidiLevel=h.bidiLevel)}else if(v.extend){v.collapse(d.node,d.offset);try{v.extend(p.node,p.offset)}catch{}}else{let w=document.createRange();h.anchor>h.head&&([d,p]=[p,d]),w.setEnd(p.node,p.offset),w.setStart(d.node,d.offset),v.removeAllRanges(),v.addRange(w)}a&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new mn(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new mn(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&no(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=uo(e.root),{anchorNode:i,anchorOffset:o}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let h=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!h||!d||h.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(p.node,p.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&n.collapse(i,o)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=n.posAtStart;if(n.isComposite()){let o;if(e==n.dom)o=n.dom.childNodes[t];else{let a=Gn(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==n.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==n.dom.firstChild)return i;for(;o&&!$e.get(o);)o=o.nextSibling;if(!o)return i+n.length;for(let a=0,u=i;;a++){let h=n.children[a];if(h.dom==o)return u;u+=h.length+h.breakAfter}}else return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(i,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i=-1,o=!1,a,u=-1,h=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let g=p+d.length;if(p<=e&&(n=d,i=e-p,o=g<e),g>=e&&!a&&(a=d,u=e-p,h=p>e),p>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(o&&a?n=null:h&&n&&(a=null),n&&t<0||!a?n.domIn(i,t):a.domIn(u,t))}coordsAt(e,t,n){let{tile:i,offset:o}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof lh?null:i.coordsInWidget(o,t,!0):i.coordsIn(o,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let h=i(u,a);if(h)return h}if(a-=u.length,a<0)break}else if(o.isText()&&a<o.length){let u=vt(o.text,a);if(u==a)return null;let h=ho(o.dom,a,u).getClientRects();for(let d=0;d<h.length;d++){let p=h[d];if(d==h.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return i(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,o=this.view.contentDOM.clientWidth,a=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,h=this.view.textDirection==Be.LTR,d=0,p=(g,v,w)=>{for(let k=0;k<g.children.length&&!(v>i);k++){let S=g.children[k],C=v+S.length,P=S.dom.getBoundingClientRect(),{height:D}=P;if(w&&!k&&(d+=P.top-w.top),S instanceof Kn)C>n&&p(S,v,P);else if(v>=n&&(d>0&&t.push(-d),t.push(D+d),d=0,a)){let M=S.dom.lastChild,Q=M?to(M):[];if(Q.length){let B=Q[Q.length-1],I=h?B.right-P.left:P.right-B.left;I>u&&(u=I,this.minWidth=o,this.minWidthFrom=v,this.minWidthTo=C)}}w&&k==g.children.length-1&&(d+=w.bottom-P.bottom),v=C+S.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Be.RTL:Be.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,h;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=to(d.dom);if(p.length!=1)return;u+=p[0].width,h=p[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:h}}});if(e)return e;let t=document.createElement("div"),n,i,o;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 a=to(t.firstChild)[0];n=t.getBoundingClientRect().height,i=a&&a.width?a.width/27:7,o=a&&a.height?a.height:n,t.remove()}),{lineHeight:n,charWidth:i,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let o=i==t.viewports.length?null:t.viewports[i],a=o?o.from-1:this.view.state.doc.length;if(a>n){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Le.replace({widget:new lh(u),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!o)break;n=o.to+1}return Le.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ja).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,i=this.view.state.facet(jf).map((o,a)=>{let u=typeof o=="function";return u&&(n=!0),u?o(this.view):o});for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(_e.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(cv).map(o=>typeof o=="function"?o(this.view):o)}scrollIntoView(e){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(lv))try{if(d(this.view,e.range,e))return!0}catch(p){Ut(this.view.state,p,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),i;if(!n)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let o=Ff(this.view),a={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:u,offsetHeight:h}=this.view.scrollDOM;if($S(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==Be.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(t.head,1);if(d){let p=Wy(d.dom);d.dom.scrollIntoView({block:"nearest"}),qy(p,!1)}}}lineHasWidget(e){let t=n=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Zh(this.tile)}}function Zh(r,e){let t=e==null?void 0:e.get(r);if(t!=1){t==null&&r.destroy();for(let n of r.children)Zh(n,e)}}function xb(r){return lt(r.node)&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}function mv(r,e){let t=r.observer.selectionRange;if(!t.focusNode)return null;let n=Uy(t.focusNode,t.focusOffset),i=$y(t.focusNode,t.focusOffset),o=n||i;if(i&&n&&i.node!=n.node){let u=$e.get(i.node);if(!u||u.isText()&&u.text!=i.node.nodeValue)o=i;else if(r.docView.lastCompositionAfterCursor){let h=$e.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(o=i)}}if(r.docView.lastCompositionAfterCursor=o!=n,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function wb(r,e,t){let n=mv(r,t);if(!n)return null;let{node:i,from:o,to:a}=n,u=i.nodeValue;if(/[\n\r]/.test(u)||r.state.doc.sliceString(n.from,n.to)!=u)return null;let h=e.invertedDesc;return{range:new tn(h.mapPos(o),h.mapPos(a),o,a),text:i}}function kb(r,e){return lt(r)?(e&&r.childNodes[e-1].contentEditable=="false"?1:0)|(e<r.childNodes.length&&r.childNodes[e].contentEditable=="false"?2:0):0}let Sb=class{constructor(){this.changes=[]}compareRange(e,t){ji(e,t,this.changes)}comparePoint(e,t){ji(e,t,this.changes)}boundChange(e){ji(e,e,this.changes)}};function bb(r,e,t){let n=new Sb;return _e.compare(r,e,t,n),n.changes}class Cb{constructor(){this.changes=[]}compareRange(e,t){ji(e,t,this.changes)}comparePoint(){}boundChange(e){ji(e,e,this.changes)}}function Ab(r,e,t){let n=new Cb;return _e.compare(r,e,t,n),n.changes}function Eb(r,e){for(let t=r;t&&t!=e;t=t.assignedSlot||t.parentNode)if(lt(t)&&t.contentEditable=="false")return!0;return!1}function _b(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}class lh extends ii{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 Ob(r,e,t=1){let n=r.charCategorizer(e),i=r.doc.lineAt(e),o=e-i.from;if(i.length==0)return F.cursor(e);o==0?t=1:o==i.length&&(t=-1);let a=o,u=o;t<0?a=vt(i.text,o,!1):u=vt(i.text,o);let h=n(i.text.slice(a,u));for(;a>0;){let d=vt(i.text,a,!1);if(n(i.text.slice(d,a))!=h)break;a=d}for(;u<i.length;){let d=vt(i.text,u);if(n(i.text.slice(u,d))!=h)break;u=d}return F.undirectionalRange(a+i.from,u+i.from)}function Pb(r,e,t,n,i){let o=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let u=r.viewState.heightOracle.textHeight,h=Math.floor((i-t.top-(r.defaultLineHeight-u)*.5)/u);o+=h*r.viewState.heightOracle.lineLength}let a=r.state.sliceDoc(t.from,t.to);return t.from+zS(a,o,r.state.tabSize)}function ef(r,e,t){let n=r.lineBlockAt(e);if(Array.isArray(n.type)){let i;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!i||o.type==ft.Text&&(i.type!=o.type||(t<0?o.from<e:o.to>e)))&&(i=o)}}return i||n}return n}function Tb(r,e,t,n){let i=ef(r,e.head,e.assoc||-1),o=!n||i.type!=ft.Text||!(r.lineWrapping||i.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(o){let a=r.dom.getBoundingClientRect(),u=r.textDirectionAt(i.from),h=r.posAndSideAtCoords({x:t==(u==Be.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(h)return F.cursor(h.pos,h.assoc)}return F.cursor(t?i.to:i.from,t?1:-1)}function Fg(r,e,t,n){let i=r.state.doc.lineAt(e.head),o=r.bidiSpans(i),a=r.textDirectionAt(i.from);for(let u=e,h=null;;){let d=ib(i,o,a,u,t),p=Jy;if(!d){if(i.number==(t?r.state.doc.lines:1))return u;p=`
49
+ `,i=r.state.doc.line(i.number+(t?1:-1)),o=r.bidiSpans(i),d=t?F.cursor(i.from,-1):F.cursor(i.to,1)}if(h){if(!h(p))return u}else{if(!n)return d;h=n(p)}u=d}}function Mb(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return o=>{let a=n(o);return i==en.Space&&(i=a),i==a}}function Lb(r,e,t,n){let i=e.head,o=t?1:-1;if(i==(t?r.state.doc.length:0))return F.cursor(i,e.assoc);let a=e.goalColumn,u,h=r.contentDOM.getBoundingClientRect(),d=r.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=r.documentTop;if(d)a==null&&(a=d.left-h.left),u=o<0?d.top:d.bottom;else{let k=r.viewState.lineBlockAt(i);a==null&&(a=Math.min(h.right-h.left,r.defaultCharacterWidth*(i-k.from))),u=(o<0?k.top:k.bottom)+p}let g=h.left+a,v=r.viewState.heightOracle.textHeight>>1,w=n??v;for(let k=0;;k+=v){let S=u+(w+k)*o,C=tf(r,{x:g,y:S},!1,o);if(t?S>h.bottom:S<h.top)return F.cursor(C.pos,C.assoc);let P=r.coordsAtPos(C.pos,C.assoc),D=P?(P.top+P.bottom)/2:0;if(!P||(t?D>u:D<u))return F.cursor(C.pos,C.assoc,void 0,a)}}function ro(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(o,a,u)=>{if(e>o&&e<a){let h=n||t||(e-o<a-e?-1:1);e=h<0?o:a,n=h}});if(!n)return e}}function gv(r,e){let t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],o=null;if(i.empty){let a=ro(r,i.from,0);a!=i.from&&(o=F.cursor(a,-1))}else{let a=ro(r,i.from,-1),u=ro(r,i.to,1);(a!=i.from||u!=i.to)&&(i.undirectional?o=F.undirectionalRange(i.from,i.to):o=F.range(i.from==i.anchor?a:u,i.from==i.head?a:u))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?F.create(t,e.mainIndex):e}function ah(r,e,t){let n=ro(r.state.facet(bo).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:F.cursor(n,n<t.from?1:-1)}class Tn{constructor(e,t){this.pos=e,this.assoc=t}}function tf(r,e,t,n){let i=r.contentDOM.getBoundingClientRect(),o=i.top+r.viewState.paddingTop,{x:a,y:u}=e,h=u-o,d;for(;;){if(h<0)return new Tn(0,1);if(h>r.viewState.docHeight)return new Tn(r.state.doc.length,-1);if(d=r.elementAtHeight(h),n==null)break;if(d.type==ft.Text){if(n<0?d.to<r.viewport.from:d.from>r.viewport.to)break;let v=r.docView.coordsAt(n<0?d.from:d.to,n>0?-1:1);if(v&&(n<0?v.top<=h+o:v.bottom>=h+o))break}let g=r.viewState.heightOracle.textHeight/2;h=n>0?d.bottom+g:d.top-g}if(r.viewport.from>=d.to||r.viewport.to<=d.from){if(t)return null;if(d.type==ft.Text){let g=Pb(r,i,d,a,u);return new Tn(g,g==d.from?1:-1)}}if(d.type!=ft.Text)return h<(d.top+d.bottom)/2?new Tn(d.from,1):new Tn(d.to,-1);let p=r.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=r.docView.lineAt(d.from,-2)),new Nb(r,a,u,r.textDirectionAt(d.from)).scanTile(p,d.from)}class Nb{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,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:n,spans:i}=this.bidiSpansAt(e);return i[Mn.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[Mn.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,o=e.length-1,a=new Set,u=this.bidiIn(e[0],e[o]),h,d,p=-1,g=1e9,v;e:for(;i<o;){let k=o-i,S=i+o>>1;t:if(a.has(S)){for(let D=1;D<k;D++){let M=S+D;if(M>=o&&(M-=k),!a.has(M)){S=M;break t}}break e}a.add(S);let C=t(S),P=0;if(C)for(let D=0;D<C.length;D++){let M=C[D];if(!(M.width==0&&C.length>1))if(M.bottom<this.y)(!h||h.bottom<M.bottom)&&(h=M),P=1;else if(M.top>this.y)(!d||d.top>M.top)&&(d=M),P=-1;else{let Q=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,B=Math.abs(Q);B<g&&(p=S,g=B,v=M),Q&&(P=Q<0==(this.baseDir==Be.LTR)?-1:1)}}P==-1&&(!u||this.baseDirAt(e[S],1))?o=S:P==1&&(!u||this.baseDirAt(e[S+1],-1))&&(i=S+1)}if(!v){if(!d&&!h)return{i:0,after:!1};let k=h&&(!d||this.y-h.bottom<d.top-this.y)?h:d;return this.y=(k.top+k.bottom)/2,this.scan(e,t,!0)}if(g&&!n){let{top:k,bottom:S}=v;if(h&&h.bottom>(k+k+S)/3)return this.y=h.bottom-1,this.scan(e,t,!0);if(d&&d.top<(k+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let w=(u?this.dirAt(e[p],1):this.baseDir)==Be.LTR;return{i:p,after:this.x>(v.left+v.right)/2==w}}scanText(e,t){let n=[];for(let o=0;o<e.length;o=vt(e.text,o))n.push(t+o);n.push(t+e.length);let i=this.scan(n,o=>{let a=n[o]-t,u=n[o+1]-t;return ho(e.dom,a,u).getClientRects()});return i.after?new Tn(n[i.i+1],-1):new Tn(n[i.i],1)}scanTile(e,t){if(!e.length)return new Tn(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let n=[t];for(let u=0,h=t;u<e.children.length;u++)n.push(h+=e.children[u].length);let i=this.scan(n,u=>{let h=e.children[u];return h.flags&48?null:(lt(h.dom)?h.dom:ho(h.dom,0,h.length)).getClientRects()}),o=e.children[i.i],a=n[i.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):i.after?new Tn(n[i.i+1],-1):new Tn(a,1)}}const Li="￿";class Db{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Me.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Li}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let o=this.text.length;this.readNode(i);let a=$e.get(i),u=i.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&n!=this.view.contentDOM&&this.lineBreak();break}let h=$e.get(u);(a&&h?a.breakAfter:(a?a.breakAfter:ya(i))||ya(u)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!Bb(u,t)&&this.lineBreak(),i=u}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(u=i.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=a-1);n=o+a}}readNode(e){let t=$e.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else Ui(e)?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():lt(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Ui(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Rb(e,n.node,n.offset)?t:0))}}function Rb(r,e,t){for(;;){if(!e||t<Gn(e))return!1;if(e==r)return!0;t=Er(e)+1,e=e.parentNode}}function Bb(r,e){let t;for(;!(r==e||!r);r=r.nextSibling){let n=$e.get(r);if(!(n!=null&&n.isWidget()))return!1;n&&(t||(t=[])).push(n)}if(t)for(let n of t){let i=n.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class Hg{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Ib{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=yv(e.docView.tile,t,n,0))){let h=o||a?[]:jb(e),d=new Db(h,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Fb(h,this.bounds.from)}else{let h=e.observer.selectionRange,d=o&&o.node==h.focusNode&&o.offset==h.focusOffset||!Kh(e.contentDOM,h.focusNode)?u.main.head:e.docView.posFromDOM(h.focusNode,h.focusOffset),p=a&&a.node==h.anchorNode&&a.offset==h.anchorOffset||!Kh(e.contentDOM,h.anchorNode)?u.main.anchor:e.docView.posFromDOM(h.anchorNode,h.anchorOffset),g=e.viewport;if((Y.ios||Y.chrome)&&d!=p&&Math.min(d,p)<=u.main.from&&Math.max(d,p)>=u.main.to&&(g.from>0||g.to<e.state.doc.length)){let v=Math.min(d,p),w=Math.max(d,p),k=g.from-v,S=g.to-w;(k==0||k==1||v==0)&&(S==0||S==-1||w==e.state.doc.length)&&(d=0,p=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(F.range(p,d));else if(e.lineWrapping&&p==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let v=e.coordsAtPos(d,-1),w=0;v&&(w=e.inputState.lastTouchY<=v.bottom?-1:1),this.newSel=F.create([F.cursor(d,w)])}else this.newSel=F.single(p,d)}}}function yv(r,e,t,n){if(r.isComposite()){let i=-1,o=-1,a=-1,u=-1;for(let h=0,d=n,p=n;h<r.children.length;h++){let g=r.children[h],v=d+g.length;if(d<e&&v>t)return yv(g,e,t,d);if(v>=e&&i==-1&&(i=h,o=d),d>t&&g.dom.parentNode==r.dom){a=h,u=p;break}p=v,d=v+g.breakAfter}return{from:o,to:u<0?n+r.length:u,startDOM:(i?r.children[i-1].dom.nextSibling:null)||r.dom.firstChild,endDOM:a<r.children.length&&a>=0?r.children[a].dom:null}}else return r.isText()?{from:n,to:n+r.length,startDOM:r.dom,endDOM:r.dom.nextSibling}:null}function vv(r,e){let t,{newSel:n}=e,{state:i}=r,o=i.selection.main,a=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:h}=e.bounds,d=o.from,p=null;(a===8||Y.android&&e.text.length<h-u)&&(d=o.to,p="end");let g=i.doc.sliceString(u,h,Li),v,w;!o.empty&&o.from>=u&&o.to<=h&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(v=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:Pe.of(e.text.slice(o.from-u,v).split(Li))}:(w=xv(g,e.text,d-u,p))&&(Y.chrome&&a==13&&w.toB==w.from+2&&e.text.slice(w.from,w.toB)==Li+Li&&w.toB--,t={from:u+w.from,to:u+w.toA,insert:Pe.of(e.text.slice(w.from,w.toB).split(Li))})}else n&&(!r.hasFocus&&i.facet($n)||nf(n,o))&&(n=null);if(!t&&!n)return!1;if((Y.mac||Y.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=F.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:Pe.of([t.insert.toString().replace("."," ")])}):i.doc.lineAt(o.from).to<o.to&&r.docView.lineHasWidget(o.to)&&r.inputState.insertingTextAt>Date.now()-50?t={from:o.from,to:o.to,insert:i.toText(r.inputState.insertingText)}:Y.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==`
50
+ `&&r.lineWrapping&&(n&&(n=F.single(n.main.anchor-1,n.main.head-1)),t={from:o.from,to:o.to,insert:Pe.of([" "])}),t)return Hf(r,t,n,a);if(n&&!nf(n,o)){let u=!1,h="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(u=!0),h=r.inputState.lastSelectionOrigin,h=="select.pointer"&&(n=gv(i.facet(bo).map(d=>d(r)),n))),r.dispatch({selection:n,scrollIntoView:u,userEvent:h}),!0}else return!1}function Hf(r,e,t,n=-1){if(Y.ios&&r.inputState.flushIOSKey(e))return!0;let i=r.state.selection.main;if(Y.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&r.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Fi(r.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Fi(r.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Fi(r.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let a,u=()=>a||(a=zb(r,e,t));return r.state.facet(rv).some(h=>h(r,e.from,e.to,o,u))||r.dispatch(u()),!0}function zb(r,e,t){let n,i=r.state,o=i.selection.main,a=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let h=e.from<o.from?-1:1,d=h<0?o.from:o.to,p=ro(i.facet(bo).map(g=>g(r)),d,h);e.from==p&&(a=p)}if(a>-1)n={changes:e,selection:F.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let h=o.from<e.from?i.sliceDoc(o.from,e.from):"",d=o.to>e.to?i.sliceDoc(e.to,o.to):"";n=i.replaceSelection(r.state.toText(h+e.insert.sliceString(0,void 0,r.state.lineBreak)+d))}else{let h=i.changes(e),d=t&&t.main.to<=h.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let p=r.state.sliceDoc(e.from,e.to),g,v=t&&mv(r,t.main.head);if(v){let k=e.insert.length-(e.to-e.from);g={from:v.from,to:v.to-k}}else g=r.state.doc.lineAt(o.head);let w=o.to-e.to;n=i.changeByRange(k=>{if(k.from==o.from&&k.to==o.to)return{changes:h,range:d||k.map(h)};let S=k.to-w,C=S-p.length;if(r.state.sliceDoc(C,S)!=p||S>=g.from&&C<=g.to)return{range:k};let P=i.changes({from:C,to:S,insert:e.insert}),D=k.to-o.to;return{changes:P,range:d?F.range(Math.max(0,d.anchor+D),Math.max(0,d.head+D)):k.map(P)}})}else n={changes:h,selection:d&&i.selection.replaceRange(d)}}let u="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,u+=".compose",r.inputState.compositionFirstChange&&(u+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:u,scrollIntoView:!0})}function xv(r,e,t,n){let i=Math.min(r.length,e.length),o=0;for(;o<i&&r.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==i&&r.length==e.length)return null;let a=r.length,u=e.length;for(;a>0&&u>0&&r.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(n=="end"){let h=Math.max(0,o-Math.min(a,u));t-=a+h-o}if(a<o&&r.length<e.length){let h=t<=o&&t>=a?o-t:0;o-=h,u=o+(u-a),a=o}else if(u<o){let h=t<=o&&t>=u?o-t:0;o-=h,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function jb(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:o}=r.observer.selectionRange;return t&&(e.push(new Hg(t,n)),(i!=t||o!=n)&&e.push(new Hg(i,o))),e}function Fb(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t<0||n<0?null:t==n?F.create([F.cursor(n+e,-1)]):F.single(t+e,n+e)}function nf(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}class Hb{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Y.safari&&e.contentDOM.addEventListener("input",()=>null),Y.gecko&&rC(e.contentDOM.ownerDocument)}handleEvent(e){!Xb(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 n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=qb(e),n=this.handlers,i=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=n[o];u&&a!=!u.handlers.length&&(i.removeEventListener(o,this.handleEvent),u=null),u||i.addEventListener(o,this.handleEvent,{passive:a})}for(let o in n)o!="scroll"&&!t[o]&&i.removeEventListener(o,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&&kv.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Y.android&&Y.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(wv.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Vb.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Y.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Wb(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Fi(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Y.safari&&!Y.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 Wb(r){return r.visualViewport?r.visualViewport.height*r.visualViewport.scale/r.document.documentElement.clientHeight<.85:!1}function Wg(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){Ut(t.state,i)}}}function qb(r){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of r){let i=n.spec,o=i&&i.plugin.domEventHandlers,a=i&&i.plugin.domEventObservers;if(o)for(let u in o){let h=o[u];h&&t(u).handlers.push(Wg(n.value,h))}if(a)for(let u in a){let h=a[u];h&&t(u).observers.push(Wg(n.value,h))}}for(let n in yn)t(n).handlers.push(yn[n]);for(let n in At)t(n).observers.push(At[n]);return e}const wv=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vb="dthko",kv=[16,17,18,20,91,92,224,225],ql=6;function Vl(r){return Math.max(0,r)*.7+8}function Qb(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class Ub{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Hy(e.contentDOM),this.atoms=e.state.facet(bo).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Me.allowMultipleSelections)&&$b(e,t),this.dragging=Gb(e,t)&&Cv(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&&Qb(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let h=Ff(this.view);e.clientX-h.left<=i+ql?t=-Vl(i-e.clientX):e.clientX+h.right>=a-ql&&(t=Vl(e.clientX-a)),e.clientY-h.top<=o+ql?n=-Vl(o-e.clientY):e.clientY+h.bottom>=u-ql&&(n=Vl(e.clientY-u)),this.setScrollSpeed(t,n)}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,n=gv(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function $b(r,e){let t=r.state.facet(Zy);return t.length?t[0](e):Y.mac?e.metaKey:e.ctrlKey}function Kb(r,e){let t=r.state.facet(ev);return t.length?t[0](e):Y.mac?!e.altKey:!e.ctrlKey}function Gb(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=uo(r.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let o=0;o<i.length;o++){let a=i[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Xb(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=$e.get(t))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const yn=Object.create(null),At=Object.create(null),Sv=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function Yb(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),bv(r,t.value)},50)}function Wa(r,e,t){for(let n of r.facet(e))t=n(t,r);return t}function bv(r,e){e=Wa(r.state,Bf,e);let{state:t}=r,n,i=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(rf!=null&&t.selection.ranges.every(h=>h.empty)&&rf==o.toString()){let h=-1;n=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==h)return{range:d};h=p.from;let g=t.toText((a?o.line(i++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:g},range:F.cursor(d.from+g.length,-1)}})}else a?n=t.changeByRange(h=>{let d=o.line(i++);return{changes:{from:h.from,to:h.to,insert:d.text},range:F.cursor(h.from+d.length,-1)}}):n=t.replaceSelection(o);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}At.scroll=r=>{let e=r.inputState;e.lastScrollTop=r.scrollDOM.scrollTop,e.lastScrollLeft=r.scrollDOM.scrollLeft,Y.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};At.wheel=At.mousewheel=r=>{r.inputState.lastWheelEvent=Date.now()};yn.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&r.inputState.tabFocusMode!=0&&(r.inputState.tabFocusMode=Date.now()+2e3),!1);At.touchstart=(r,e)=>{let t=r.inputState,n=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),n&&(t.lastTouchX=n.clientX,t.lastTouchY=n.clientY),t.setSelectionOrigin("select.pointer")};At.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")};At.touchend=(r,e)=>{r.inputState.touchActive=!1};yn.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of r.state.facet(tv))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=Zb(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new Ub(r,e,t,n)),n&&r.observer.ignore(()=>{Vy(r.contentDOM);let o=r.root.activeElement;o&&!o.contains(r.contentDOM)&&o.blur()});let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else r.inputState.setSelectionOrigin("select.pointer");return!1};function qg(r,e,t,n){if(n==1)return F.cursor(e,t);if(n==2)return Ob(r.state,e,t);{let i=r.docView.lineAt(e,t),o=r.state.doc.lineAt(i?i.posAtEnd:e),a=i?i.posAtStart:o.from,u=i?i.posAtEnd:o.to;return u<r.state.doc.length&&u==o.to&&u++,F.undirectionalRange(a,u)}}const Jb=Y.ie&&Y.ie_version<=11;let Vg=null,Qg=0,Ug=0;function Cv(r){if(!Jb)return r.detail;let e=Vg,t=Ug;return Vg=r,Ug=Date.now(),Qg=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(Qg+1)%3:1}function Zb(r,e){let t=r.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=Cv(e),i=r.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),i=i.map(o.changes))},get(o,a,u){let h=r.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=qg(r,h.pos,h.assoc,n);if(t.pos!=h.pos&&!a){let g=qg(r,t.pos,t.assoc,n),v=Math.min(g.from,p.from),w=Math.max(g.to,p.to);p=v<p.from?F.range(v,w,p.assoc):F.range(w,v,p.assoc)}return a?i.replaceRange(i.main.extend(p.from,p.to,p.assoc)):u&&n==1&&i.ranges.length>1&&(d=eC(i,h.pos))?d:u?i.addRange(p):F.create([p])}}}function eC(r,e){for(let t=0;t<r.ranges.length;t++){let{from:n,to:i}=r.ranges[t];if(n<=e&&i>=e)return F.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}yn.dragstart=(r,e)=>{let{selection:{main:t}}=r.state;if(e.target.draggable){let i=r.docView.tile.nearest(e.target);if(i&&i.isWidget()){let o=i.posAtStart,a=o+i.length;(o>=t.to||a<=t.from)&&(t=F.undirectionalRange(o,a))}}let{inputState:n}=r;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wa(r.state,If,r.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};yn.dragend=r=>(r.inputState.draggedContent=null,!1);function $g(r,e,t,n){if(t=Wa(r.state,Bf,t),!t)return;let i=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=r.inputState,a=n&&o&&Kb(r,e)?{from:o.from,to:o.to}:null,u={from:i,insert:t},h=r.state.changes(a?[a,u]:u);r.focus(),r.dispatch({changes:h,selection:{anchor:h.mapPos(i,-1),head:h.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"}),r.inputState.draggedContent=null}yn.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),i=0,o=()=>{++i==t.length&&$g(r,e,n.filter(a=>a!=null).join(r.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let u=new FileReader;u.onerror=o,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(n[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return $g(r,e,n,!0),!0}return!1};yn.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=Sv?null:e.clipboardData;return t?(bv(r,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Yb(r),!1)};function tC(r,e){let t=r.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function nC(r){let e=[],t=[],n=!1;for(let i of r.selection.ranges)i.empty||(e.push(r.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:o}of r.selection.ranges){let a=r.doc.lineAt(o);a.number>i&&(e.push(a.text),t.push({from:a.from,to:Math.min(r.doc.length,a.to+1)})),i=a.number}n=!0}return{text:Wa(r,If,e.join(r.lineBreak)),ranges:t,linewise:n}}let rf=null;yn.copy=yn.cut=(r,e)=>{if(!eo(r.contentDOM,r.observer.selectionRange))return!1;let{text:t,ranges:n,linewise:i}=nC(r.state);if(!t&&!i)return!1;rf=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Sv?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(tC(r,t),!1)};const Av=Xn.define();function Ev(r,e){let t=[];for(let n of r.facet(iv)){let i=n(r,e);i&&t.push(i)}return t.length?r.update({effects:t,annotations:Av.of(!0)}):null}function _v(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=Ev(r.state,e);t?r.dispatch(t):r.update([])}},10)}At.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),_v(r)};At.blur=r=>{r.observer.clearSelectionRange(),_v(r)};At.compositionstart=At.compositionupdate=(r,e)=>{if(!r.observer.editContext&&(r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0)){let{main:t}=r.state.selection;!t.empty&&r.lineBlockAt(t.from).from!=r.lineBlockAt(t.to).from&&!r.state.readOnly&&r.dispatch({changes:r.state.selection.ranges.filter(n=>!n.empty).map(n=>({from:n.from,to:n.to})),userEvent:"input"}),r.inputState.composing=0}};At.compositionend=r=>{r.observer.editContext||(r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,Y.chrome&&Y.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50))};At.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()};yn.beforeinput=(r,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(r.inputState.insertingText=e.data,r.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&r.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],h=r.posAtDOM(u.startContainer,u.startOffset),d=r.posAtDOM(u.endContainer,u.endOffset);return Hf(r,{from:h,to:d,insert:r.state.toText(o)},null),!0}}let i;if(Y.chrome&&Y.android&&(i=wv.find(o=>o.inputType==e.inputType))&&(r.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return Y.ios&&e.inputType=="deleteContentForward"&&r.observer.flushSoon(),Y.safari&&e.inputType=="insertText"&&r.inputState.composing>=0&&setTimeout(()=>At.compositionend(r,e),20),!1};const Kg=new Set;function rC(r){Kg.has(r)||(Kg.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Gg=["pre-wrap","normal","pre-line","break-spaces"];let Xi=!1;function Xg(){Xi=!1}class iC{constructor(e){this.lineWrapping=e,this.doc=Pe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Gg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,n,i,o,a){let u=Gg.indexOf(e)>-1,h=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=o,h){this.heightSamples={};for(let d=0;d<a.length;d++){let p=a[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return h}}class sC{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class pn{constructor(e,t,n,i,o){this.from=e,this.length=t,this.top=n,this.height=i,this._content=o}get type(){return typeof this._content=="number"?ft.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 ti?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 pn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ze=(function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r})(ze||(ze={}));const la=.001;class bt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>la&&(Xi=!0),this.height=e)}replace(e,t,n){return bt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let o=this,a=n.doc;for(let u=i.length-1;u>=0;u--){let{fromA:h,toA:d,fromB:p,toB:g}=i[u],v=o.lineAt(h,ze.ByPosNoHeight,n.setDoc(t),0,0),w=v.to>=d?v:o.lineAt(d,ze.ByPosNoHeight,n,0,0);for(g+=w.to-d,d=w.to;u>0&&v.from<=i[u-1].toA;)h=i[u-1].fromA,p=i[u-1].fromB,u--,h<v.from&&(v=o.lineAt(h,ze.ByPosNoHeight,n,0,0));p+=v.from-h,h=v.from;let k=Wf.build(n.setDoc(a),e,p,g);o=ka(o,o.replace(h,d,k))}return o.updateHeight(n,0)}static empty(){return new Vt(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,o=0;for(;;)if(t==n)if(i>o*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),n+=1+u.break,i-=u.size}else if(o>i*2){let u=e[n];u.break?e.splice(n,1,u.left,null,u.right):e.splice(n,1,u.left,u.right),n+=2+u.break,o-=u.size}else break;else if(i<o){let u=e[t++];u&&(i+=u.size)}else{let u=e[--n];u&&(o+=u.size)}let a=!1;return e[t-1]==null?(a=!0,t--):e[t]==null&&(a=!0,n++),new lC(bt.of(e.slice(0,t)),a,bt.of(e.slice(n)))}}function ka(r,e){return r==e?r:(r.constructor!=e.constructor&&(Xi=!0),e)}bt.prototype.size=1;const oC=Le.replace({});class Ov extends bt{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new pn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new pn(i,0,n,this.spaceAbove,oC):this.mainBlock(n,i)}lineAt(e,t,n,i,o){let a=this.mainBlock(i,o);return this.spaceAbove?this.blockAt(0,n,i,o).join(a):a}forEachLine(e,t,n,i,o,a){e<=o+this.length&&t>=o&&a(this.lineAt(0,ze.ByPos,n,i,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Vt extends Ov{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new pn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof Vt||i instanceof ct&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof ct?i=new Vt(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):bt.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ct extends bt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-n+1,a,u=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*o);a=h/o,this.length>o+1&&(u=(this.height-h)/(this.length-o-1))}else a=this.height/o;return{firstLine:n,lastLine:i,perLine:a,perChar:u}}blockAt(e,t,n,i){let{firstLine:o,lastLine:a,perLine:u,perChar:h}=this.heightMetrics(t,i);if(t.lineWrapping){let d=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),p=t.doc.lineAt(d),g=u+p.length*h,v=Math.max(n,e-g/2);return new pn(p.from,p.length,v,g,0)}else{let d=Math.max(0,Math.min(a-o,Math.floor((e-n)/u))),{from:p,length:g}=t.doc.line(o+d);return new pn(p,g,n+u*d,u,0)}}lineAt(e,t,n,i,o){if(t==ze.ByHeight)return this.blockAt(e,n,i,o);if(t==ze.ByPosNoHeight){let{from:w,to:k}=n.doc.lineAt(e);return new pn(w,k-w,0,0,0)}let{firstLine:a,perLine:u,perChar:h}=this.heightMetrics(n,o),d=n.doc.lineAt(e),p=u+d.length*h,g=d.number-a,v=i+u*g+h*(d.from-o-g);return new pn(d.from,d.length,Math.max(i,Math.min(v,i+this.height-p)),p,0)}forEachLine(e,t,n,i,o,a){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:u,perLine:h,perChar:d}=this.heightMetrics(n,o);for(let p=e,g=i;p<=t;){let v=n.doc.lineAt(p);if(p==e){let k=v.number-u;g+=h*k+d*(e-o-k)}let w=h+d*v.length;a(new pn(v.from,v.length,g,w,0)),g+=w,p=v.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let o=n[n.length-1];o instanceof ct?n[n.length-1]=new ct(o.length+i):n.push(null,new ct(i-1))}if(e>0){let o=n[0];o instanceof ct?n[0]=new ct(e+o.length):n.unshift(new ct(e-1),null)}return bt.of(n)}decomposeLeft(e,t){t.push(new ct(e-1),null)}decomposeRight(e,t){t.push(null,new ct(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let o=t+this.length;if(i&&i.from<=t+this.length&&i.more){let a=[],u=Math.max(t,i.from),h=-1;for(i.from>t&&a.push(new ct(i.from-t-1).updateHeight(e,t));u<=o&&i.more;){let p=e.doc.lineAt(u).length;a.length&&a.push(null);let g=i.heights[i.index++],v=0;g<0&&(v=-g,g=i.heights[i.index++]),h==-1?h=g:Math.abs(g-h)>=la&&(h=-2);let w=new Vt(p,g,v);w.outdated=!1,a.push(w),u+=p+1}u<=o&&a.push(null,new ct(o-u).updateHeight(e,u));let d=bt.of(a);return(h<0||Math.abs(d.height-this.height)>=la||Math.abs(h-this.heightMetrics(e,t).perLine)>=la)&&(Xi=!0),ka(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class lC extends bt{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,o,i+this.left.length+this.break)}lineAt(e,t,n,i,o){let a=i+this.left.height,u=o+this.left.length+this.break,h=t==ze.ByHeight?e<a:e<u,d=h?this.left.lineAt(e,t,n,i,o):this.right.lineAt(e,t,n,a,u);if(this.break||(h?d.to<u:d.from>u))return d;let p=t==ze.ByPosNoHeight?ze.ByPosNoHeight:ze.ByPos;return h?d.join(this.right.lineAt(u,p,n,a,u)):this.left.lineAt(u,p,n,i,o).join(d)}forEachLine(e,t,n,i,o,a){let u=i+this.left.height,h=o+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,t,n,i,o,a),t>=h&&this.right.forEachLine(e,t,n,u,h,a);else{let d=this.lineAt(h,ze.ByPos,n,i,o);e<d.from&&this.left.forEachLine(e,Math.min(t,d.from-1),n,i,o,a),d.to>=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,n,u,h,a)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of n)o.push(u);if(e>0&&Yg(o,a-1),t<this.length){let u=o.length;this.decomposeRight(t,o),Yg(o,u)}return bt.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&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?bt.of(this.break?[e,null,t]:[e,t]):(this.left=ka(this.left,e),this.right=ka(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:o,right:a}=this,u=t+o.length+this.break,h=null;return i&&i.from<=t+o.length&&i.more?h=o=o.updateHeight(e,t,n,i):o.updateHeight(e,t,n),i&&i.from<=u+a.length&&i.more?h=a=a.updateHeight(e,u,n,i):a.updateHeight(e,u,n),h?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Yg(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof ct&&(n=r[e+1])instanceof ct&&r.splice(e-1,3,new ct(t.length+1+n.length))}const aC=5;class Wf{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 n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Vt?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Vt(n-this.pos,-1,0)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new Ov(a,i,n)):(a||o||i>=aC)&&this.addLineDeco(i,o,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Vt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new ct(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Vt)return e;let t=new Vt(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,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Vt)&&!this.isCovered?this.nodes.push(new Vt(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof Vt&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let o=new Wf(n,e);return _e.spans(t,n,i,o,0),o.finish(n)}}function uC(r,e,t){let n=new cC;return _e.compare(r,e,t,n,0),n.changes}class cC{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&ji(e,t,this.changes,5)}}function hC(r,e){let t=r.getBoundingClientRect(),n=r.ownerDocument,i=n.defaultView||window,o=Math.max(0,t.left),a=Math.min(i.innerWidth,t.right),u=Math.max(0,t.top),h=Math.min(i.innerHeight,t.bottom);for(let d=r.parentNode;d&&d!=n.body;)if(lt(d)){let p=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let g=d.getBoundingClientRect();o=Math.max(o,g.left),a=Math.min(a,g.right),u=Math.max(u,g.top),h=Math.min(d==r.parentNode?i.innerHeight:h,g.bottom)}d=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,h)-(t.top+e)}}function fC(r){let e=r.getBoundingClientRect(),t=r.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function dC(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class uh{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e,t){return Le.replace({widget:new pC(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class pC extends ii{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 Jg{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=sf,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Be.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(zf).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new iC(n),this.stateDeco=Zg(t),this.heightMap=bt.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle.setDoc(t.doc),[new tn(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=Le.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 n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:o,to:a})=>i>=o&&i<=a)){let{from:o,to:a}=this.lineBlockAt(i);e.push(new Ql(o,a))}}return this.viewports=e.sort((n,i)=>n.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sf:Sa.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ys(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Zg(this.state);let i=e.changedRanges,o=tn.extendWithRanges(i,uC(n,this.stateDeco,e?e.changes:tt.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Xg(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Xi)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let h=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<h.from||t.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,t));let d=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,e.flags|=this.updateForViewport(),(d||!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(ov)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Be.RTL:Be.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),h=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,p=0;if(u.width&&u.height){let{scaleX:B,scaleY:I}=Fy(t,u);(B>.005&&Math.abs(this.scaleX-B)>.005||I>.005&&Math.abs(this.scaleY-I)>.005)&&(this.scaleX=B,this.scaleY=I,d|=16,a=h=!0)}let g=(parseInt(n.paddingTop)||0)*this.scaleY,v=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=v)&&(this.paddingTop=g,this.paddingBottom=v,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let w=Hy(this.view.contentDOM,!1).y;w!=this.scrollParent&&(this.scrollParent=w,this.scrollAnchorHeight=-1,this.scrollOffset=0);let k=this.getScrollOffset();this.scrollOffset!=k&&(this.scrollAnchorHeight=-1,this.scrollOffset=k),this.scrolledToBottom=Qy(this.scrollParent||e.win);let S=(this.printing?dC:hC)(t,this.paddingTop),C=S.top-this.pixelViewport.top,P=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let D=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(D!=this.inView&&(this.inView=D,D&&(h=!0)),!this.inView&&!this.scrollTarget&&!fC(e.dom))return 0;let M=u.width;if((this.contentDOMWidth!=M||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),h){let B=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(B)&&(a=!0),a||i.lineWrapping&&Math.abs(M-this.contentDOMWidth)>i.charWidth){let{lineHeight:I,charWidth:H,textHeight:ie}=e.docView.measureTextSize();a=I>0&&i.refresh(o,I,H,ie,Math.max(5,M/H),B),a&&(e.docView.minWidth=0,d|=16)}C>0&&P>0?p=Math.max(C,P):C<0&&P<0&&(p=Math.min(C,P)),Xg();for(let I of this.viewports){let H=I.from==this.viewport.from?B:e.docView.measureVisibleLineHeights(I);this.heightMap=(a?bt.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle,[new tn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new sC(I.from,H))}Xi&&(d|=2)}let Q=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return Q&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||Q)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,h=new Ql(i.lineAt(a-n*1e3,ze.ByHeight,o,0,0).from,i.lineAt(u+(1-n)*1e3,ze.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(d<h.from||d>h.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=i.lineAt(d,ze.ByPos,o,0,0),v;t.y=="center"?v=(g.top+g.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<h.from?v=g.top:v=g.bottom-p,h=new Ql(i.lineAt(v-1e3/2,ze.ByHeight,o,0,0).from,i.lineAt(v+p+1e3/2,ze.ByHeight,o,0,0).to)}}return h}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Ql(this.heightMap.lineAt(n,ze.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ze.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,ze.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,ze.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:u}=this;return(e==0||i<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=u+Math.max(10,Math.min(n,250)))&&i>a-2*1e3&&o<u+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new uh(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,o=i>>1,a=i<<1;if(this.defaultTextDirection!=Be.LTR&&!n)return[];let u=[],h=(p,g,v,w)=>{if(g-p<o)return;let k=this.state.selection.main,S=[k.from];k.empty||S.push(k.to);for(let P of S)if(P>p&&P<g){h(p,P-10,v,w),h(P+10,g,v,w);return}let C=gC(e,P=>P.from>=v.from&&P.to<=v.to&&Math.abs(P.from-p)<o&&Math.abs(P.to-g)<o&&!S.some(D=>P.from<D&&P.to>D));if(!C){if(g<v.to&&t&&n&&t.visibleRanges.some(M=>M.from<=g&&M.to>=g)){let M=t.moveToLineBoundary(F.cursor(g),!1,!0).head;M>p&&(g=M)}let P=this.gapSize(v,p,g,w),D=n||P<2e6?P:2e6;C=new uh(p,g,P,D)}u.push(C)},d=p=>{if(p.length<a||p.type!=ft.Text)return;let g=mC(p.from,p.to,this.stateDeco);if(g.total<a)return;let v=this.scrollTarget?this.scrollTarget.range.head:null,w,k;if(n){let S=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,P;if(v!=null){let D=$l(g,v),M=((this.visibleBottom-this.visibleTop)/2+S)/p.height;C=D-M,P=D+M}else C=(this.visibleTop-p.top-S)/p.height,P=(this.visibleBottom-p.top+S)/p.height;w=Ul(g,C),k=Ul(g,P)}else{let S=g.total*this.heightOracle.charWidth,C=i*this.heightOracle.charWidth,P=0;if(S>2e6)for(let I of e)I.from>=p.from&&I.from<p.to&&I.size!=I.displaySize&&I.from*this.heightOracle.charWidth+P<this.pixelViewport.left&&(P=I.size-I.displaySize);let D=this.pixelViewport.left+P,M=this.pixelViewport.right+P,Q,B;if(v!=null){let I=$l(g,v),H=((M-D)/2+C)/S;Q=I-H,B=I+H}else Q=(D-C)/S,B=(M+C)/S;w=Ul(g,Q),k=Ul(g,B)}w>p.from&&h(p.from,w,p,g),k<p.to&&h(k,p.to,p,g)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return u}gapSize(e,t,n,i){let o=$l(i,n)-$l(i,t);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){uh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Le.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 n=[];_e.spans(t,this.viewport.from,this.viewport.to,{span(o,a){n.push({from:o,to:a})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let o=0;o<n.length&&!(i&8);o++){let a=this.visibleRanges[o],u=n[o];(a.from!=u.from||a.to!=u.to)&&(i|=4,e&&e.mapPos(a.from,-1)==u.from&&e.mapPos(a.to,1)==u.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ys(this.heightMap.lineAt(e,ze.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)||Ys(this.heightMap.lineAt(this.scaler.fromDOM(e),ze.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ys(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 Ql{constructor(e,t){this.from=e,this.to=t}}function mC(r,e,t){let n=[],i=r,o=0;return _e.spans(t,r,e,{span(){},point(a,u){a>i&&(n.push({from:i,to:a}),o+=a-i),i=u}},20),i<e&&(n.push({from:i,to:e}),o+=e-i),{total:o,ranges:n}}function Ul({total:r,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(r*t);for(let i=0;;i++){let{from:o,to:a}=e[i],u=a-o;if(n<=u)return o+n;n-=u}}function $l(r,e){let t=0;for(let{from:n,to:i}of r.ranges){if(e<=i){t+=e-n;break}t+=i-n}return t/r.total}function gC(r,e){for(let t of r)if(e(t))return t}const sf={toDOM(r){return r},fromDOM(r){return r},scale:1,eq(r){return r==this}};function Zg(r){let e=r.facet(ja).filter(n=>typeof n!="function"),t=r.facet(jf).filter(n=>typeof n!="function");return t.length&&e.push(_e.join(t)),e}class Sa{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,n){let i=0,o=0,a=0,u=n.map(({from:d,to:p})=>{let g=t.lineAt(d,ze.ByPos,e,0,0).top,v=t.lineAt(p,ze.ByPos,e,0,0).bottom;return i+=v-g,{from:d,to:p,top:g,bottom:v,domTop:0,domBottom:0}});if(t.height-i<10)return sf;let h=(7e6-i)/(t.height-i);for(let d of u)d.domTop=a+(d.top-o)*h,a=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom;return new Sa(h,u)}toDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return i+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,i=o.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,i=o.domBottom}}eq(e){return e instanceof Sa?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Ys(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new pn(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>Ys(i,e)):r._content)}const Kl=re.define({combine:r=>r.join(" ")}),of=re.define({combine:r=>r.indexOf(!0)>-1}),lf=Cr.newName(),Pv=Cr.newName(),Tv=Cr.newName(),Mv={"&light":"."+Pv,"&dark":"."+Tv};function af(r,e,t){return new Cr(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return r;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):r+" "+n}})}const yC=af("."+lf,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Mv),vC={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ch=Y.ie&&Y.ie_version<=11;class xC{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new KS,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 n of t)this.queue.push(n);(Y.ie&&Y.ie_version<=11||Y.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Y.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Y.chrome&&Y.chrome_version<126)&&(this.editContext=new kC(e),e.state.facet($n)&&(e.contentDOM.editContext=this.editContext.editContext)),ch&&(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(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet($n)?n.root.activeElement!=this.dom:!eo(this.dom,i))return;let o=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Y.ie&&Y.ie_version<=11||Y.android&&Y.chrome)&&!n.state.selection.main.empty&&i.focusNode&&no(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=uo(e.root);if(!t)return!1;let n=Y.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&wC(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=eo(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&XS(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),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 n=this.dom;n;)if(lt(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.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,vC),ch&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ch&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Fi(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(i=!0),t==-1?{from:t,to:n}=a:(t=Math.min(a.from,t),n=Math.max(a.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&eo(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 o=new Ib(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,o=vv(this.view,n);return this.view.state==i&&(n.domChanged||t)&&this.view.update([]),o}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=e0(t,e.previousSibling||e.target.previousSibling,-1),i=e0(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):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($n)!=e.state.facet($n)&&(e.view.contentDOM.editContext=e.state.facet($n)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.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 e0(r,e,t){for(;e;){let n=$e.get(e);if(n&&n.parent==r)return n;let i=e.parentNode;e=i!=r.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function t0(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,o=e.endOffset,a=r.docView.domAtPos(r.state.selection.main.anchor,1);return no(a.node,a.offset,i,o)&&([t,n,i,o]=[i,o,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:o}}function wC(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return t0(r,i)}let t=null;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.contentDOM.addEventListener("beforeinput",n,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",n,!0),t?t0(r,t):null}class kC{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:o,head:a}=i,u=this.toEditorPos(n.updateRangeStart),h=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:u,drifted:!1});let d=h-u>n.text.length;u==this.from&&o<this.from?u=o:h==this.to&&o>this.to&&(h=o);let p=xv(e.state.sliceDoc(u,h),n.text,(d?i.from:i.to)-u,d?"end":null);if(!p){let v=F.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));nf(v,i)||e.dispatch({selection:v,userEvent:"select"});return}let g={from:p.from+u,to:p.toA+u,insert:Pe.of(n.text.slice(p.from,p.toB).split(`
51
+ `))};if((Y.mac||Y.android)&&g.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:h,insert:Pe.of([n.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let v=this.to-this.from+(g.to-g.from+g.insert.length);Hf(e,g,F.single(this.toEditorPos(n.selectionStart,v),this.toEditorPos(n.selectionEnd,v)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],o=null;for(let a=this.toEditorPos(n.rangeStart),u=this.toEditorPos(n.rangeEnd);a<u;a++){let h=e.coordsForChar(a);o=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||o||new DOMRect,i.push(o)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=n=>{let i=[];for(let o of n.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let h=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;i.push(Le.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:av.of(Le.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:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{let i=uo(n.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((o,a,u,h,d)=>{if(n)return;let p=d.length-(a-o);if(i&&a>=i.to)if(i.from==o&&i.to==a&&i.insert.eq(d)){i=this.pendingContextChange=null,t+=p,this.to+=p;return}else i=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=p,this.to+=p;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}t+=p}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(n,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 n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ce{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.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(i=>i.forEach(o=>n(o,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||GS(e.parent)||document,this.viewState=new Jg(this,e.state||Me.create(e)),e.scrollTo&&e.scrollTo.is(Wl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Di).map(i=>new ih(i));for(let i of this.plugins)i.update(this);this.observer=new xC(this),this.inputState=new Hb(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jg(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 nt?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,n=!1,i,o=this.state;for(let v of e){if(v.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=v.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,h=null;e.some(v=>v.annotation(Av))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,h=Ev(o,a),h||(u=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(Me.phrases)!=this.state.facet(Me.phrases))return this.setState(o);i=va.create(this,o,e),i.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let v of e){if(g&&(g=g.map(v.changes)),v.scrollIntoView){let{main:w}=v.state.selection,{x:k,y:S}=this.state.facet(ce.cursorScrollMargin);g=new Hi(w.empty?w:F.cursor(w.head,w.head>w.anchor?-1:1),"nearest","nearest",S,k)}for(let w of v.effects)w.is(Wl)&&(g=w.value.clip(this.state))}this.viewState.update(i,g),this.bidiCache=ba.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(Xs)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(v=>v.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Kl)!=i.state.facet(Kl)&&(this.viewState.mustMeasureContent=!0),(t||n||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let v of this.state.facet(Jh))try{v(i)}catch(w){Ut(this.state,w,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!vv(this,p)&&d.force&&Fi(this.contentDOM,d.key,d.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 n of this.plugins)n.destroy(this);this.viewState=new Jg(this,e),this.plugins=e.facet(Di).map(n=>new ih(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new jg(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(Di),n=e.state.facet(Di);if(t!=n){let i=[];for(let o of n){let a=t.indexOf(o);if(a<0)i.push(new ih(o));else{let u=this.plugins[a];u.mustUpdate=e,i.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.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!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Ut(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a,scaleY:u}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let h=0;;h++){if(a<0){if(Qy(n||this.win))o=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let k=this.viewState.scrollAnchorAt(i);o=k.from,a=k.top}u=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(h>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let p=[];d&4||([this.measureRequests,p]=[p,this.measureRequests]);let g=p.map(k=>{try{return k.read(this)}catch(S){return Ut(this.state,S),n0}}),v=va.create(this,this.state,[]),w=!1;v.flags|=d,t?t.flags|=d:t=v,this.updateState=2,v.empty||(this.updatePlugins(v),this.inputState.update(v),this.updateAttrs(),w=this.docView.update(v),w&&this.docViewUpdate());for(let k=0;k<p.length;k++)if(g[k]!=n0)try{let S=p[k];S.write&&S.write(g[k],this)}catch(S){Ut(this.state,S)}if(w&&this.docView.updateSelection(!0),!v.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let S=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)/this.viewState.scaleY-a/u;if((S>1||S<-1)&&!(Y.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+S,n?o<0?n.scrollTop=n.scrollHeight:n.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let h of this.state.facet(Jh))h(t)}get themeClasses(){return lf+" "+(this.state.facet(of)?Tv:Pv)+" "+this.state.facet(Kl)}updateAttrs(){let e=r0(this,uv,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet($n)?"true":"false",class:"cm-content",style:`${Y.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),r0(this,zf,t);let n=this.observer.ignore(()=>{let i=Ng(this.contentDOM,this.contentAttrs,t),o=Ng(this.dom,this.editorAttrs,e);return i||o});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(ce.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Xs);let e=this.state.facet(ce.cspNonce);Cr.mount(this.root,this.styleModules.concat(yC).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(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return ah(this,e,Fg(this,e,t,n))}moveByGroup(e,t){return ah(this,e,Fg(this,e,t,n=>Mb(this,e.head,n)))}visualLineSide(e,t){return t?F.cursor(e.to,1):F.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return Tb(this,e,t,n)}moveVertically(e,t,n){return ah(this,e,Lb(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=tf(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),tf(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),i=this.bidiSpans(n),o=i[Mn.find(i,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&o.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+o.from,t=1):(e=n.from+o.to,t=-1)),this.docView.coordsAt(e,t,o.dir==Be.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(sv)||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>SC)return Yy(e.length);let t=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||Xy(o.isolates,n=Bg(this,e))))return o.order;n||(n=Bg(this,e));let i=rb(e.text,t,n);return this.bidiCache.push(new ba(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Y.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vy(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var n,i,o,a;return Wl.of(new Hi(typeof e=="number"?F.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Wl.of(new Hi(F.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ct.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ct.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Cr.newName(),i=[Kl.of(n),Xs.of(af(`.${n}`,e))];return t&&t.dark&&i.push(of.of(!0)),i}static baseTheme(e){return ri.lowest(Xs.of(af("."+lf,e,Mv)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&$e.get(n)||$e.get(e);return((t=i==null?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}ce.styleModule=Xs;ce.inputHandler=rv;ce.clipboardInputFilter=Bf;ce.clipboardOutputFilter=If;ce.scrollHandler=lv;ce.focusChangeEffect=iv;ce.perLineTextDirection=sv;ce.exceptionSink=nv;ce.updateListener=Jh;ce.editable=$n;ce.mouseSelectionStyle=tv;ce.dragMovesSelection=ev;ce.clickAddsSelectionRange=Zy;ce.decorations=ja;ce.blockWrappers=cv;ce.outerDecorations=jf;ce.atomicRanges=bo;ce.bidiIsolatedRanges=hv;ce.cursorScrollMargin=re.define({combine:r=>{let e=5,t=5;for(let n of r)typeof n=="number"?e=t=n:{x:e,y:t}=n;return{x:e,y:t}}});ce.scrollMargins=dv;ce.darkTheme=of;ce.cspNonce=re.define({combine:r=>r.length?r[0]:""});ce.contentAttributes=zf;ce.editorAttributes=uv;ce.lineWrapping=ce.contentAttributes.of({class:"cm-lineWrapping"});ce.announce=je.define();const SC=4096,n0={};class ba{constructor(e,t,n,i,o,a){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Be.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==i&&!t.touchesRange(a.from,a.to)&&n.push(new ba(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return n}}function r0(r,e,t){for(let n=r.state.facet(e),i=n.length-1;i>=0;i--){let o=n[i],a=typeof o=="function"?o(r):o;a&&Nf(a,t)}return t}const bC=Y.mac?"mac":Y.windows?"win":Y.linux?"linux":"key";function CC(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let i,o,a,u;for(let h=0;h<t.length-1;++h){const d=t[h];if(/^(cmd|meta|m)$/i.test(d))u=!0;else if(/^a(lt)?$/i.test(d))i=!0;else if(/^(c|ctrl|control)$/i.test(d))o=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?u=!0:o=!0;else throw new Error("Unrecognized modifier name: "+d)}return i&&(n="Alt-"+n),o&&(n="Ctrl-"+n),u&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function Gl(r,e,t){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t!==!1&&e.shiftKey&&(r="Shift-"+r),r}const AC=ri.default(ce.domEventHandlers({keydown(r,e){return PC(EC(e.state),r,e,"editor")}})),Ca=re.define({enables:AC}),i0=new WeakMap;function EC(r){let e=r.facet(Ca),t=i0.get(e);return t||i0.set(e,t=OC(e.reduce((n,i)=>n.concat(i),[]))),t}let wr=null;const _C=4e3;function OC(r,e=bC){let t=Object.create(null),n=Object.create(null),i=(a,u)=>{let h=n[a];if(h==null)n[a]=u;else if(h!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,h,d,p)=>{var g,v;let w=t[a]||(t[a]=Object.create(null)),k=u.split(/ (?!$)/).map(P=>CC(P,e));for(let P=1;P<k.length;P++){let D=k.slice(0,P).join(" ");i(D,!0),w[D]||(w[D]={preventDefault:!0,stopPropagation:!1,run:[M=>{let Q=wr={view:M,prefix:D,scope:a};return setTimeout(()=>{wr==Q&&(wr=null)},_C),!0}]})}let S=k.join(" ");i(S,!1);let C=w[S]||(w[S]={preventDefault:!1,stopPropagation:!1,run:((v=(g=w._any)===null||g===void 0?void 0:g.run)===null||v===void 0?void 0:v.slice())||[]});h&&C.run.push(h),d&&(C.preventDefault=!0),p&&(C.stopPropagation=!0)};for(let a of r){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let v in p)p[v].run.push(w=>g(w,uf))}let h=a[e]||a.key;if(h)for(let d of u)o(d,h,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+h,a.shift,a.preventDefault,a.stopPropagation)}return t}let uf=null;function PC(r,e,t,n){uf=e;let i=WS(e),o=Qt(i,0),a=Un(o)==i.length&&i!=" ",u="",h=!1,d=!1,p=!1;wr&&wr.view==t&&wr.scope==n&&(u=wr.prefix+" ",kv.indexOf(e.keyCode)<0&&(d=!0,wr=null));let g=new Set,v=C=>{if(C){for(let P of C.run)if(!g.has(P)&&(g.add(P),P(t)))return C.stopPropagation&&(p=!0),!0;C.preventDefault&&(C.stopPropagation&&(p=!0),d=!0)}return!1},w=r[n],k,S;return w&&(v(w[u+Gl(i,e,!a)])?h=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Y.windows&&e.ctrlKey&&e.altKey)&&!(Y.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(k=Ar[e.keyCode])&&k!=i?(v(w[u+Gl(k,e,!0)])||e.shiftKey&&(S=lo[e.keyCode])!=i&&S!=k&&v(w[u+Gl(S,e,!1)]))&&(h=!0):a&&e.shiftKey&&v(w[u+Gl(i,e,!0)])&&(h=!0),!h&&v(w._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),uf=null,h}class Jr{constructor(e,t,n,i,o){this.className=e,this.left=t,this.top=n,this.width=i,this.height=o}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,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let o=Lv(e);return[new Jr(t,i.left-o.left,i.top-o.top,null,i.bottom-i.top)]}else return TC(e,t,n)}}function Lv(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==Be.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function s0(r,e,t,n){let i=r.coordsAtPos(e,t*2);if(!i)return n;let o=r.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,u=r.posAtCoords({x:o.left+1,y:a}),h=r.posAtCoords({x:o.right-1,y:a});return u==null||h==null?n:{from:Math.max(n.from,Math.min(u,h)),to:Math.min(n.to,Math.max(u,h))}}function TC(r,e,t){if(t.to<=r.viewport.from||t.from>=r.viewport.to)return[];let n=Math.max(t.from,r.viewport.from),i=Math.min(t.to,r.viewport.to),o=r.textDirection==Be.LTR,a=r.contentDOM,u=a.getBoundingClientRect(),h=Lv(r),d=a.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),g=u.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),v=u.right-(p?parseInt(p.paddingRight):0),w=ef(r,n,1),k=ef(r,i,-1),S=w.type==ft.Text?w:null,C=k.type==ft.Text?k:null;if(S&&(r.lineWrapping||w.widgetLineBreaks)&&(S=s0(r,n,1,S)),C&&(r.lineWrapping||k.widgetLineBreaks)&&(C=s0(r,i,-1,C)),S&&C&&S.from==C.from&&S.to==C.to)return D(M(t.from,t.to,S));{let B=S?M(t.from,null,S):Q(w,!1),I=C?M(null,t.to,C):Q(k,!0),H=[];return(S||w).to<(C||k).from-(S&&C?1:0)||w.widgetLineBreaks>1&&B.bottom+r.defaultLineHeight/2<I.top?H.push(P(g,B.bottom,v,I.top)):B.bottom<I.top&&r.elementAtHeight((B.bottom+I.top)/2).type==ft.Text&&(B.bottom=I.top=(B.bottom+I.top)/2),D(B).concat(H).concat(D(I))}function P(B,I,H,ie){return new Jr(e,B-h.left,I-h.top,Math.max(0,H-B),ie-I)}function D({top:B,bottom:I,horizontal:H}){let ie=[];for(let de=0;de<H.length;de+=2)ie.push(P(H[de],B,H[de+1],I));return ie}function M(B,I,H){let ie=1e9,de=-1e9,Se=[];function ge(he,xe,Ae,we,$){let z=r.coordsAtPos(he,he==H.to?-2:2),W=r.coordsAtPos(Ae,Ae==H.from?2:-2);!z||!W||(ie=Math.min(z.top,W.top,ie),de=Math.max(z.bottom,W.bottom,de),$==Be.LTR?Se.push(o&&xe?g:z.left,o&&we?v:W.right):Se.push(!o&&we?g:W.left,!o&&xe?v:z.right))}let J=B??H.from,fe=I??H.to;for(let he of r.visibleRanges)if(he.to>J&&he.from<fe)for(let xe=Math.max(he.from,J),Ae=Math.min(he.to,fe);;){let we=r.state.doc.lineAt(xe);for(let $ of r.bidiSpans(we)){let z=$.from+we.from,W=$.to+we.from;if(z>=Ae)break;W>xe&&ge(Math.max(z,xe),B==null&&z<=J,Math.min(W,Ae),I==null&&W>=fe,$.dir)}if(xe=we.to+1,xe>=Ae)break}return Se.length==0&&ge(J,B==null,fe,I==null,r.textDirection),{top:ie,bottom:de,horizontal:Se}}function Q(B,I){let H=u.top+(I?B.top:B.bottom);return{top:H,bottom:H,horizontal:[]}}}function MC(r,e){return r.constructor==e.constructor&&r.eq(e)}class LC{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(aa)!=e.state.facet(aa)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(aa);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!MC(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,Y.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const aa=re.define();function Nv(r){return[Ct.define(e=>new LC(e,r)),aa.of(r)]}const cf=!Y.ios,Yi=re.define({combine(r){return ts(r,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function NC(r={}){return[Yi.of(r),DC,RC,IC,ov.of(!0)]}function Dv(r){return r.startState.facet(Yi)!=r.state.facet(Yi)}const DC=Nv({above:!0,markers(r){let{state:e}=r,t=e.facet(Yi),n=[];for(let i of e.selection.ranges){let o=i==e.selection.main;if(i.empty||t.drawRangeCursor&&!(o&&Y.ios&&t.iosSelectionHandles)){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=i.empty?i:F.cursor(i.head,i.assoc);for(let h of Jr.forRange(r,a,u))n.push(h)}}return n},update(r,e){r.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Dv(r);return t&&o0(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){o0(e.state,r)},class:"cm-cursorLayer"});function o0(r,e){e.style.animationDuration=r.facet(Yi).cursorBlinkRate+"ms"}const RC=Nv({above:!1,markers(r){let e=[],{main:t,ranges:n}=r.state.selection;for(let i of n)if(!i.empty&&(cf||i!=t))for(let o of Jr.forRange(r,"cm-selectionBackground",i))e.push(o);if(Y.ios&&!t.empty&&r.state.facet(Yi).iosSelectionHandles){for(let i of Jr.forRange(r,"cm-selectionHandle cm-selectionHandle-start",F.cursor(t.from,1)))e.push(i);for(let i of Jr.forRange(r,"cm-selectionHandle cm-selectionHandle-end",F.cursor(t.to,1)))e.push(i)}return e},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||Dv(r)},class:"cm-selectionLayer"}),BC=Y.gecko&&Y.gecko_version==153?"#ffffff01":"transparent",IC=ri.highest(ce.theme({".cm-line":{...cf?{"& ::selection, &::selection":{backgroundColor:`${BC} !important`}}:{},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important",...cf?{"&::selection, & ::selection":{backgroundColor:"Highlight !important"}}:{}}}}));function l0(r,e,t,n,i){e.lastIndex=0;for(let o=r.iterRange(t,n),a=t,u;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;u=e.exec(o.value);)i(a+u.index,u)}function zC(r,e){let t=r.visibleRanges;if(t.length==1&&t[0].from==r.viewport.from&&t[0].to==r.viewport.to)return t;let n=[];for(let{from:i,to:o}of t)i=Math.max(r.state.doc.lineAt(i).from,i-e),o=Math.min(r.state.doc.lineAt(o).to,o+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=o:n.push({from:i,to:o});return n}class jC{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:o,maxLength:a=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=(u,h,d,p)=>i(p,d,d+u[0].length,u,h);else if(typeof n=="function")this.addMatch=(u,h,d,p)=>{let g=n(u,h,d);g&&p(d,d+u[0].length,g)};else if(n)this.addMatch=(u,h,d,p)=>p(d,d+u[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let t=new Yr,n=t.add.bind(t);for(let{from:i,to:o}of zC(e,this.maxLength))l0(e.state.doc,this.regexp,i,o,(a,u)=>this.addMatch(u,e,a,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((o,a,u,h)=>{h>=e.view.viewport.from&&u<=e.view.viewport.to&&(n=Math.min(u,n),i=Math.max(h,i))}),e.viewportMoved||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let o of e.visibleRanges){let a=Math.max(o.from,n),u=Math.min(o.to,i);if(u>=a){let h=e.state.doc.lineAt(a),d=h.to<u?e.state.doc.lineAt(u):h,p=Math.max(o.from,h.from),g=Math.min(o.to,d.to);if(this.boundary){for(;a>h.from;a--)if(this.boundary.test(h.text[a-1-h.from])){p=a;break}for(;u<d.to;u++)if(this.boundary.test(d.text[u-d.from])){g=u;break}}let v=[],w,k=(S,C,P)=>v.push(P.range(S,C));if(h==d)for(this.regexp.lastIndex=p-h.from;(w=this.regexp.exec(h.text))&&w.index<g-h.from;)this.addMatch(w,e,w.index+h.from,k);else l0(e.state.doc,this.regexp,p,g,(S,C)=>this.addMatch(C,e,S,k));t=t.update({filterFrom:p,filterTo:g,filter:(S,C)=>S<p||C>g,add:v})}}return t}}const hf=/x/.unicode!=null?"gu":"g",FC=new RegExp(`[\0-\b
52
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,hf),HC={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 hh=null;function WC(){var r;if(hh==null&&typeof document<"u"&&document.body){let e=document.body.style;hh=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return hh||!1}const ua=re.define({combine(r){let e=ts(r,{render:null,specialChars:FC,addSpecialChars:null});return(e.replaceTabs=!WC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,hf)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,hf)),e}});function qC(r={}){return[ua.of(r),VC()]}let a0=null;function VC(){return a0||(a0=Ct.fromClass(class{constructor(r){this.view=r,this.decorations=Le.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(ua)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new jC({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,o=Qt(e[0],0);if(o==9){let a=i.lineAt(n),u=t.state.tabSize,h=wo(a.text,u,n-a.from);return Le.replace({widget:new KC((u-h%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Le.replace({widget:new $C(r,o)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(ua);r.startState.facet(ua)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}const QC="•";function UC(r){return r>=32?QC:r==10?"␤":String.fromCharCode(9216+r)}class $C extends ii{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=UC(this.code),n=e.state.phrase("Control character")+" "+(HC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let o=document.createElement("span");return o.textContent=t,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class KC extends ii{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 GC(){return YC}const XC=Le.line({class:"cm-activeLine"}),YC=Ct.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(XC.range(i.from)),e=i.from)}return Le.set(t)}},{decorations:r=>r.decorations});class JC extends ii{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?to(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=co(t[0],n.direction!="rtl"),o=parseInt(n.lineHeight);return i.bottom-i.top>o*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+o}:i}ignoreEvent(){return!1}}function u0(r){let e=Ct.fromClass(class{constructor(t){this.view=t,this.placeholder=r?Le.set([Le.widget({widget:new JC(r),side:1}).range(0)]):Le.none}get decorations(){return this.view.state.doc.length?Le.none:this.placeholder}},{decorations:t=>t.decorations});return typeof r=="string"?[e,ce.contentAttributes.of({"aria-placeholder":r})]:e}const Xl="-10000px";class ZC{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=n(a,o))}update(e,t){var n;let i=e.state.facet(this.facet),o=i.filter(h=>h);if(i===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let a=[],u=t?[]:null;for(let h=0;h<o.length;h++){let d=o[h],p=-1;if(d){for(let g=0;g<this.tooltips.length;g++){let v=this.tooltips[g];v&&v.create==d.create&&(p=g)}if(p<0)a[h]=this.createTooltipView(d,h?a[h-1]:null),u&&(u[h]=!!d.above);else{let g=a[h]=this.tooltipViews[p];u&&(u[h]=t[p]),g.update&&g.update(e)}}}for(let h of this.tooltipViews)a.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return t&&(u.forEach((h,d)=>t[d]=h),t.length=u.length),this.input=i,this.tooltips=o,this.tooltipViews=a,!0}}function Rv(r){let e=r.dom.ownerDocument.documentElement,t=e.clientWidth,n=getComputedStyle(e);if(!/stable/.test(n.scrollbarGutter||""))return{left:0,right:t};let i=e.getBoundingClientRect(),o=r.win.scrollX;return{left:Math.max(0,i.left+o-parseFloat(n.marginLeft)),right:Math.min(t,i.right+o+parseFloat(n.marginRight))}}function e2(r){let{left:e,right:t}=Rv(r);return{top:0,left:e,right:t,bottom:r.dom.ownerDocument.documentElement.clientHeight}}const fh=re.define({combine:r=>{var e,t,n;return{position:Y.ios?"absolute":((e=r.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=r.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=r.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||e2}}}),c0=new WeakMap,Bv=Ct.fromClass(class{constructor(r){this.view=r,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=r.state.facet(fh);this.position=e.position,this.parent=e.parent,this.classes=r.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 ZC(r,Iv,(t,n)=>this.createTooltip(t,n),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(),r.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 r of this.manager.tooltipViews)this.intersectionObserver.observe(r.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(r){r.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(r,this.above);e&&this.observeIntersection();let t=e||r.geometryChanged,n=r.state.facet(fh);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.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(r,e){let t=r.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),r.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=Xl,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var r,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(r=n.destroy)===null||r===void 0||r.call(n);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 r=1,e=1,t=!1,n=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(Y.safari){let u=a.getBoundingClientRect();t=Math.abs(u.top+1e4)>1||Math.abs(u.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(r=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:r,scaleY:e}=this.view.viewState);else n=Rv(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),o=Ff(this.view);return{visible:{left:i.left+o.left,top:i.top+o.top,right:i.right-o.right,bottom:i.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,u)=>{let h=this.manager.tooltipViews[u];return h.getCoords?h.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(fh).tooltipSpace(this.view),scaleX:r,scaleY:e,makeAbsolute:t,fixedLeft:n}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:n,scaleX:i,scaleY:o}=r,a=[];for(let u=0;u<this.manager.tooltips.length;u++){let h=this.manager.tooltips[u],d=this.manager.tooltipViews[u],{dom:p}=d,g=r.pos[u],v=r.size[u];if(!g||h.clip!==!1&&(g.bottom<=Math.max(t.top,n.top)||g.top>=Math.min(t.bottom,n.bottom)||g.right<Math.max(t.left,n.left)-.1||g.left>Math.min(t.right,n.right)+.1)){p.style.top=Xl;continue}let w=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,k=w?7:0,S=v.right-v.left,C=(e=c0.get(d))!==null&&e!==void 0?e:v.bottom-v.top,P=d.offset||n2,D=this.view.textDirection==Be.LTR,M=v.width>n.right-n.left?D?n.left:n.right-v.width:D?Math.max(n.left,Math.min(g.left-(w?14:0)+P.x,n.right-S)):Math.min(Math.max(n.left,g.left-S+(w?14:0)-P.x),n.right-S),Q=this.above[u];!h.strictSide&&(Q?g.top-C-k-P.y<n.top:g.bottom+C+k+P.y>n.bottom)&&Q==n.bottom-g.bottom>g.top-n.top&&(Q=this.above[u]=!Q);let B=(Q?g.top-n.top:n.bottom-g.bottom)-k;if(B<C&&d.resize!==!1){if(B<this.view.defaultLineHeight){p.style.top=Xl;continue}c0.set(d,C),p.style.height=(C=B)/o+"px"}else p.style.height&&(p.style.height="");let I=Q?g.top-C-k-P.y:g.bottom+k+P.y,H=M+S;if(d.overlap!==!0)for(let ie of a)ie.left<H&&ie.right>M&&ie.top<I+C&&ie.bottom>I&&(I=Q?ie.top-C-2-k:ie.bottom+k+2);if(this.position=="absolute"?(p.style.top=(I-r.parent.top)/o+"px",h0(p,(M-r.parent.left)/i)):(p.style.top=I/o+"px",h0(p,(M-r.fixedLeft)/i)),w){let ie=g.left+(D?P.x:-P.x)-(M+14-7);w.style.left=ie/i+"px"}d.overlap!==!0&&a.push({left:M,top:I,right:H,bottom:I+C}),p.classList.toggle("cm-tooltip-above",Q),p.classList.toggle("cm-tooltip-below",!Q),d.positioned&&d.positioned(r.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 r of this.manager.tooltipViews)r.dom.style.top=Xl}},{eventObservers:{scroll(){this.maybeMeasure()}}});function h0(r,e){let t=parseInt(r.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(r.style.left=e+"px")}const t2=ce.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"}}}),n2={x:0,y:0},Iv=re.define({enables:[Bv,t2]});function zv(r,e){let t=r.plugin(Bv);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}class _r extends br{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}_r.prototype.elementClass="";_r.prototype.toDOM=void 0;_r.prototype.mapMode=Dt.TrackBefore;_r.prototype.startSide=_r.prototype.endSide=-1;_r.prototype.point=!0;const ca=re.define(),r2=re.define(),ha=re.define(),f0=re.define({combine:r=>r.some(e=>e)});function i2(r){return[s2]}const s2=Ct.fromClass(class{constructor(r){this.view=r,this.domAfter=null,this.prevViewport=r.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=r.state.facet(ha).map(e=>new p0(r,e)),this.fixed=!r.state.facet(f0);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),r.scrollDOM.insertBefore(this.dom,r.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(r){if(this.updateGutters(r)){let e=this.prevViewport,t=r.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(r.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(f0)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=r.view.viewport}syncGutters(r){let e=this.dom.nextSibling;r&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=_e.iter(this.view.state.facet(ca),this.view.viewport.from),n=[],i=this.gutters.map(o=>new o2(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==ft.Text&&a){ff(t,n,u.from);for(let h of i)h.line(this.view,u,n);a=!1}else if(u.widget)for(let h of i)h.widget(this.view,u)}else if(o.type==ft.Text){ff(t,n,o.from);for(let a of i)a.line(this.view,o,n)}else if(o.widget)for(let a of i)a.widget(this.view,o);for(let o of i)o.finish();r&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(r){let e=r.startState.facet(ha),t=r.state.facet(ha),n=r.docChanged||r.heightChanged||r.viewportChanged||!_e.eq(r.startState.facet(ca),r.state.facet(ca),r.view.viewport.from,r.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(r)&&(n=!0);else{n=!0;let i=[];for(let o of t){let a=e.indexOf(o);a<0?i.push(new p0(this.view,o)):(this.gutters[a].update(r),i.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),i.indexOf(o)<0&&o.destroy();for(let o of i)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=i}return n}destroy(){for(let r of this.gutters)r.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:r=>ce.scrollMargins.of(e=>{let t=e.plugin(r);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Be.LTR?{left:n,right:i}:{right:n,left:i}})});function d0(r){return Array.isArray(r)?r:[r]}function ff(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class o2{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=_e.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==i.elements.length){let u=new jv(e,a,o,n);i.elements.push(u),i.dom.appendChild(u.dom)}else i.elements[this.i].update(e,a,o,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];ff(this.cursor,i,t.from),n.length&&(i=i.concat(n));let o=this.gutter.config.lineMarker(e,t,i);o&&i.unshift(o);let a=this.gutter;i.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let o of e.state.facet(r2)){let a=o(e,t.widget,t);a&&(i||(i=[])).push(a)}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 p0{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let o=i.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let h=o.getBoundingClientRect();a=(h.top+h.bottom)/2}else a=i.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,u,i)&&i.preventDefault()});this.markers=d0(t.markers(e)),t.initialSpacer&&(this.spacer=new jv(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=d0(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 n=e.view.viewport;return!_e.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class jv{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),l2(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let o=0,a=0;;){let u=a,h=o<t.length?t[o++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let g=a;g<this.markers.length;g++)if(this.markers[g].compare(h)){u=g,d=!0;break}}else u=this.markers.length;for(;a<u;){let p=this.markers[a++];if(p.toDOM){p.destroy(i);let g=i.nextSibling;i.remove(),i=g}}if(!h)break;h.toDOM&&(d?i=i.nextSibling:this.dom.insertBefore(h.toDOM(e),i)),d&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function l2(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}const a2=re.define(),u2=re.define(),Ri=re.define({combine(r){return ts(r,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let i in t){let o=n[i],a=t[i];n[i]=o?(u,h,d)=>o(u,h,d)||a(u,h,d):a}return n}})}});class dh extends _r{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function ph(r,e){return r.state.facet(Ri).formatNumber(e,r.state)}const c2=ha.compute([Ri],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(a2)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new dh(ph(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let i of e.state.facet(u2)){let o=i(e,t,n);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(Ri)!=e.state.facet(Ri),initialSpacer(e){return new dh(ph(e,m0(e.state.doc.lines)))},updateSpacer(e,t){let n=ph(t.view,m0(t.view.state.doc.lines));return n==e.number?e:new dh(n)},domEventHandlers:r.facet(Ri).domEventHandlers,side:"before"}));function h2(r={}){return[Ri.of(r),i2(),c2]}function m0(r){let e=9;for(;e<r;)e=e*10+9;return e}const f2=new class extends _r{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},d2=ca.compute(["selection"],r=>{let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.head).from;i>t&&(t=i,e.push(f2.range(i)))}return _e.of(e)});function p2(){return d2}const Fv=1024;let m2=0;class mh{constructor(e,t){this.from=e,this.to=t}}class Ce{constructor(e={}){this.id=m2++,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=It.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Ce.closedBy=new Ce({deserialize:r=>r.split(" ")});Ce.openedBy=new Ce({deserialize:r=>r.split(" ")});Ce.group=new Ce({deserialize:r=>r.split(" ")});Ce.isolate=new Ce({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});Ce.contextHash=new Ce({perNode:!0});Ce.lookAhead=new Ce({perNode:!0});Ce.mounted=new Ce({perNode:!0});class io{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[Ce.mounted.id]}}const g2=Object.create(null);class It{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):g2,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new It(e.name||"",t,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[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(Ce.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(Ce.group),o=-1;o<(i?i.length:0);o++){let a=t[o<0?n.name:i[o]];if(a)return a}}}}It.none=new It("",Object.create(null),0,8);class qf{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 n of this.types){let i=null;for(let o of e){let a=o(n);if(a){i||(i=Object.assign({},n.props));let u=a[1],h=a[0];h.combine&&h.id in i&&(u=h.combine(i[h.id],u)),i[h.id]=u}}t.push(i?new It(n.name,i,n.id,n.flags):n)}return new qf(t)}}const Yl=new WeakMap,g0=new WeakMap;var Ue;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(Ue||(Ue={}));class Je{constructor(e,t,n,i,o){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,u]of o)this.props[typeof a=="number"?a:a.id]=u}}toString(){let e=io.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.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 pf(this.topNode,e)}cursorAt(e,t=0,n=0){let i=Yl.get(this)||this.topNode,o=new pf(i);return o.moveTo(e,t),Yl.set(this,o._tree),o}get topNode(){return new sn(this,0,0,null)}resolve(e,t=0){let n=fo(Yl.get(this)||this.topNode,e,t,!1);return Yl.set(this,n),n}resolveInner(e,t=0){let n=fo(g0.get(this)||this.topNode,e,t,!0);return g0.set(this,n),n}resolveStack(e,t=0){return x2(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:o=this.length}=e,a=e.mode||0,u=(a&Ue.IncludeAnonymous)>0;for(let h=this.cursor(a|Ue.IncludeAnonymous);;){let d=!1;if(h.from<=o&&h.to>=i&&(!u&&h.type.isAnonymous||t(h)!==!1)){if(h.firstChild())continue;d=!0}for(;d&&n&&(u||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.parent())return;d=!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:Uf(It.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new Je(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new Je(It.none,t,n,i)))}static build(e){return w2(e)}}Je.empty=new Je(It.none,[],[],0);class Vf{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 Vf(this.buffer,this.index)}}class Or{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return It.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,t,n,i,o){let{buffer:a}=this,u=-1;for(let h=e;h!=t&&!(Hv(o,i,a[h+1],a[h+2])&&(u=h,n>0));h=a[h+3]);return u}slice(e,t,n){let i=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,h=0;u<t;){o[h++]=i[u++],o[h++]=i[u++]-n;let d=o[h++]=i[u++]-n;o[h++]=i[u++]-e,a=Math.max(a,d)}return new Or(o,a,this.set)}}function Hv(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function fo(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let a=!n&&r instanceof sn&&r.index<0?null:r.parent;if(!a)return r;r=a}let o=n?0:Ue.IgnoreOverlays;if(n)for(let a=r,u=a.parent;u;a=u,u=a.parent)a instanceof sn&&a.index<0&&((i=u.enter(e,t,o))===null||i===void 0?void 0:i.from)!=a.from&&(r=u);for(;;){let a=r.enter(e,t,o);if(!a)return r;r=a}}class Wv{cursor(e=0){return new pf(this,e)}getChild(e,t=null,n=null){let i=y0(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return y0(this,e,t,n)}resolve(e,t=0){return fo(this,e,t,!1)}resolveInner(e,t=0){return fo(this,e,t,!0)}matchContext(e){return df(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}}class sn extends Wv{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,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,n,i,o=0){for(let a=this;;){for(let{children:u,positions:h}=a._tree,d=t>0?u.length:-1;e!=d;e+=t){let p=u[e],g=h[e]+a.from,v;if(!(!(o&Ue.EnterBracketed&&p instanceof Je&&(v=io.get(p))&&!v.overlay&&v.bracketed&&n>=g&&n<=g+p.length)&&!Hv(i,n,g,g+p.length))){if(p instanceof Or){if(o&Ue.ExcludeBuffers)continue;let w=p.findChild(0,p.buffer.length,t,n-g,i);if(w>-1)return new Sr(new y2(a,p,e,g),null,w)}else if(o&Ue.IncludeAnonymous||!p.type.isAnonymous||Qf(p)){let w;if(!(o&Ue.IgnoreMounts)&&(w=io.get(p))&&!w.overlay)return new sn(w.tree,g,e,a);let k=new sn(p,g,e,a);return o&Ue.IncludeAnonymous||!k.type.isAnonymous?k:k.nextChild(t<0?p.children.length-1:0,t,n,i,o)}}}if(o&Ue.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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,n=0){let i;if(!(n&Ue.IgnoreOverlays)&&(i=io.get(this._tree))&&i.overlay){let o=e-this.from,a=n&Ue.EnterBracketed&&i.bracketed;for(let{from:u,to:h}of i.overlay)if((t>0||a?u<=o:u<o)&&(t<0||a?h>=o:h>o))return new sn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 y0(r,e,t,n){let i=r.cursor(),o=[];if(!i.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=i.type.is(t),!i.nextSibling())return o}for(;;){if(n!=null&&i.type.is(n))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return n==null?o:[]}}function df(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class y2{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Sr extends Wv{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new Sr(this.context,this,o)}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,n=0){if(n&Ue.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Sr(this.context,this,o)}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 Sr(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 Sr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,o=n.buffer[this.index+3];if(o>i){let a=n.buffer[this.index+1];e.push(n.slice(i,o,a)),t.push(0)}return new Je(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function qv(r){if(!r.length)return null;let e=0,t=r[0];for(let o=1;o<r.length;o++){let a=r[o];(a.from>t.from||a.to<t.to)&&(t=a,e=o)}let n=t instanceof sn&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new v2(i,t)}class v2{constructor(e,t){this.heads=e,this.node=t}get next(){return qv(this.heads)}}function x2(r,e,t){let n=r.resolveInner(e,t),i=null;for(let o=n instanceof sn?n:n.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(i||(i=[n])).push(a.resolve(e,t)),o=a}else{let a=io.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let u=new sn(a.tree,a.overlay[0].from+o.from,-1,o);(i||(i=[n])).push(fo(u,e,t,!1))}}return i?qv(i):n}class pf{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&~Ue.EnterBracketed,e instanceof sn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof sn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Ue.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ue.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ue.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+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<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(i.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let o=t+e,a=e<0?-1:n._tree.children.length;o!=a;o+=e){let u=n._tree.children[o];if(this.mode&Ue.IncludeAnonymous||u instanceof Or||!u.type.isAnonymous||Qf(u))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==i){if(i==this.index)return a;t=a,n=o+1;break e}i=this.stack[--o]}for(let i=n;i<this.stack.length;i++)t=new Sr(this.buffer,t,this.stack[i]);return this.bufferNode=new Sr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return df(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return df(this._tree,e,i);let a=n[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[i]&&e[i]!=a.name)return!1;i--}}return!0}}function Qf(r){return r.children.some(e=>e instanceof Or||!e.type.isAnonymous||Qf(e))}function w2(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=Fv,reused:o=[],minRepeatType:a=n.types.length}=r,u=Array.isArray(t)?new Vf(t,t.length):t,h=n.types,d=0,p=0;function g(B,I,H,ie,de,Se){let{id:ge,start:J,end:fe,size:he}=u,xe=p,Ae=d;if(he<0)if(u.next(),he==-1){let O=o[ge];H.push(O),ie.push(J-B);return}else if(he==-3){d=ge;return}else if(he==-4){p=ge;return}else throw new RangeError(`Unrecognized record size: ${he}`);let we=h[ge],$,z,W=J-B;if(fe-J<=i&&(z=C(u.pos-I,de))){let O=new Uint16Array(z.size-z.skip),R=u.pos-z.size,ue=O.length;for(;u.pos>R;)ue=P(z.start,O,ue);$=new Or(O,fe-z.start,n),W=z.start-B}else{let O=u.pos-he;u.next();let R=[],ue=[],ye=ge>=a?ge:-1,j=0,ee=fe,le=xe;for(;u.pos>O;)ye>=0&&u.id==ye&&u.size>=0?(u.end<=ee-i&&(k(R,ue,J,j,u.end,ee,ye,le,Ae),j=R.length,ee=u.end,le=p),u.next()):Se>2500?v(J,O,R,ue):(ye>=0&&u.size==-1&&o[u.id].type==n.types[ye]&&(j<R.length&&k(R,ue,J,j,u.end,ee,ye,le,Ae),j=R.length+1,ee=u.start,le=p),g(J,O,R,ue,ye,Se+1));if(ye>=0&&j>0&&j<R.length&&k(R,ue,J,j,J,ee,ye,le,Ae),R.reverse(),ue.reverse(),ye>-1&&j>0){let ve=w(we,Ae);$=Uf(we,R,ue,0,R.length,0,fe-J,ve,ve)}else $=S(we,R,ue,fe-J,xe-fe,Ae)}H.push($),ie.push(W)}function v(B,I,H,ie){let de=[],Se=0,ge=-1;for(;u.pos>I;){let{id:J,start:fe,end:he,size:xe}=u;if(xe>4)u.next();else{if(ge>-1&&fe<ge)break;ge<0&&(ge=he-i),de.push(J,fe,he),Se++,u.next()}}if(Se){let J=new Uint16Array(Se*4),fe=de[de.length-2];for(let he=de.length-3,xe=0;he>=0;he-=3)J[xe++]=de[he],J[xe++]=de[he+1]-fe,J[xe++]=de[he+2]-fe,J[xe++]=xe;H.push(new Or(J,de[2]-fe,n)),ie.push(fe-B)}}function w(B,I){return(H,ie,de)=>{let Se=0,ge=H.length-1,J,fe;if(ge>=0&&(J=H[ge])instanceof Je){if(!ge&&J.type==B&&J.length==de)return J;(fe=J.prop(Ce.lookAhead))&&(Se=ie[ge]+J.length+fe-de)}return S(B,H,ie,de,Se,I)}}function k(B,I,H,ie,de,Se,ge,J,fe){let he=[],xe=[];for(;B.length>ie;)he.push(B.pop()),xe.push(I.pop()+H-de);B.push(S(n.types[ge],he,xe,Se-de,J-Se,fe)),I.push(de-H)}function S(B,I,H,ie,de,Se,ge){if(Se){let J=[Ce.contextHash,Se];ge=ge?[J].concat(ge):[J]}if(de>25){let J=[Ce.lookAhead,de];ge=ge?[J].concat(ge):[J]}return new Je(B,I,H,ie,ge)}function C(B,I){let H=u.fork(),ie=0,de=0,Se=0,ge=H.end-i,J={size:0,start:0,skip:0};e:for(let fe=H.pos-B;H.pos>fe;){let he=H.size;if(H.id==I&&he>=0){J.size=ie,J.start=de,J.skip=Se,Se+=4,ie+=4,H.next();continue}let xe=H.pos-he;if(he<0||xe<fe||H.start<ge)break;let Ae=H.id>=a?4:0,we=H.start;for(H.next();H.pos>xe;){if(H.size<0)if(H.size==-3||H.size==-4)Ae+=4;else break e;else H.id>=a&&(Ae+=4);H.next()}de=we,ie+=he,Se+=Ae}return(I<0||ie==B)&&(J.size=ie,J.start=de,J.skip=Se),J.size>4?J:void 0}function P(B,I,H){let{id:ie,start:de,end:Se,size:ge}=u;if(u.next(),ge>=0&&ie<a){let J=H;if(ge>4){let fe=u.pos-(ge-4);for(;u.pos>fe;)H=P(B,I,H)}I[--H]=J,I[--H]=Se-B,I[--H]=de-B,I[--H]=ie}else ge==-3?d=ie:ge==-4&&(p=ie);return H}let D=[],M=[];for(;u.pos>0;)g(r.start||0,r.bufferStart||0,D,M,-1,0);let Q=(e=r.length)!==null&&e!==void 0?e:D.length?M[0]+D[0].length:0;return new Je(h[r.topID],D.reverse(),M.reverse(),Q)}const v0=new WeakMap;function fa(r,e){if(!r.isAnonymous||e instanceof Or||e.type!=r)return 1;let t=v0.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof Je)){t=1;break}t+=fa(r,n)}v0.set(e,t)}return t}function Uf(r,e,t,n,i,o,a,u,h){let d=0;for(let k=n;k<i;k++)d+=fa(r,e[k]);let p=Math.ceil(d*1.5/8),g=[],v=[];function w(k,S,C,P,D){for(let M=C;M<P;){let Q=M,B=S[M],I=fa(r,k[M]);for(M++;M<P;M++){let H=fa(r,k[M]);if(I+H>=p)break;I+=H}if(M==Q+1){if(I>p){let H=k[Q];w(H.children,H.positions,0,H.children.length,S[Q]+D);continue}g.push(k[Q])}else{let H=S[M-1]+k[M-1].length-B;g.push(Uf(r,k,S,Q,M,B,H,null,h))}v.push(B+D-o)}}return w(e,t,n,i,0),(u||h)(g,v,a)}class Zr{constructor(e,t,n,i,o=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new Zr(0,e.length,e,0,!1,n)];for(let o of t)o.to>e.length&&i.push(o);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],o=1,a=e.length?e[0]:null;for(let u=0,h=0,d=0;;u++){let p=u<t.length?t[u]:null,g=p?p.fromA:1e9;if(g-h>=n)for(;a&&a.from<g;){let v=a;if(h>=v.from||g<=v.to||d){let w=Math.max(v.from,h)-d,k=Math.min(v.to,g)-d;v=w>=k?null:new Zr(w,k,v.tree,v.offset+d,u>0,!!p)}if(v&&i.push(v),a.to>g)break;a=o<e.length?e[o++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return i}}class Vv{startParse(e,t,n){return typeof e=="string"&&(e=new k2(e)),n=n?n.length?n.map(i=>new mh(i.from,i.to)):[new mh(0,0)]:[new mh(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let o=i.advance();if(o)return o}}}class k2{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 Ce({perNode:!0});let S2=0;class Zt{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=S2++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Zt&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new Zt(n,[],null,[]);if(i.set.push(i),t)for(let o of t.set)i.set.push(o);return i}static defineModifier(e){let t=new Aa(e);return n=>n.modified.indexOf(t)>-1?n:Aa.get(n.base||n,n.modified.concat(t).sort((i,o)=>i.id-o.id))}}let b2=0;class Aa{constructor(e){this.name=e,this.instances=[],this.id=b2++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(u=>u.base==e&&C2(t,u.modified));if(n)return n;let i=[],o=new Zt(e.name,i,e,t);for(let u of t)u.instances.push(o);let a=A2(t);for(let u of e.set)if(!u.modified.length)for(let h of a)i.push(Aa.get(u,h));return o}}function C2(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function A2(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function Qv(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let o=[],a=2,u=i;for(let g=0;;){if(u=="..."&&g>0&&g+3==i.length){a=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!v)throw new RangeError("Invalid path: "+i);if(o.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),g+=v[0].length,g==i.length)break;let w=i[g++];if(g==i.length&&w=="!"){a=0;break}if(w!="/")throw new RangeError("Invalid path: "+i);u=i.slice(g)}let h=o.length-1,d=o[h];if(!d)throw new RangeError("Invalid path: "+i);let p=new po(n,a,h>0?o.slice(0,h):null);e[d]=p.sort(e[d])}}return Uv.add(e)}const Uv=new Ce({combine(r,e){let t,n,i;for(;r||e;){if(!r||e&&r.depth<=e.depth?(i=e,e=e.next):(i=r,r=r.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let o=new po(i.tags,i.mode,i.context);t?t.next=o:n=o,t=o}return n}});class po{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,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}}po.empty=new po([],2,null);function $v(r,e){let t=Object.create(null);for(let o of r)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let a of o.tag)t[a.id]=o.class;let{scope:n,all:i=null}=e||{};return{style:o=>{let a=i;for(let u of o)for(let h of u.set){let d=t[h.id];if(d){a=a?a+" "+d:d;break}}return a},scope:n}}function E2(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function _2(r,e,t,n=0,i=r.length){let o=new O2(n,Array.isArray(e)?e:[e],t);o.highlightRange(r.cursor(),n,i,"",o.highlighters),o.flush(i)}class O2{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,o){let{type:a,from:u,to:h}=e;if(u>=n||h<=t)return;a.isTop&&(o=this.highlighters.filter(w=>!w.scope||w.scope(a)));let d=i,p=P2(e)||po.empty,g=E2(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(i+=(i?" ":"")+g)),this.startSpan(Math.max(t,u),d),p.opaque)return;let v=e.tree&&e.tree.prop(Ce.mounted);if(v&&v.overlay){let w=e.node.enter(v.overlay[0].from+u,1),k=this.highlighters.filter(C=>!C.scope||C.scope(v.tree.type)),S=e.firstChild();for(let C=0,P=u;;C++){let D=C<v.overlay.length?v.overlay[C]:null,M=D?D.from+u:h,Q=Math.max(t,P),B=Math.min(n,M);if(Q<B&&S)for(;e.from<B&&(this.highlightRange(e,Q,B,i,o),this.startSpan(Math.min(B,e.to),d),!(e.to>=M||!e.nextSibling())););if(!D||M>n)break;P=D.to+u,P>t&&(this.highlightRange(w.cursor(),Math.max(t,D.from+u),Math.min(n,P),"",k),this.startSpan(Math.min(n,P),d))}S&&e.parent()}else if(e.firstChild()){v&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,o),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function P2(r){let e=r.type.prop(Uv);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const X=Zt.define,Jl=X(),yr=X(),x0=X(yr),w0=X(yr),vr=X(),Zl=X(vr),gh=X(vr),On=X(),Vr=X(On),En=X(),_n=X(),mf=X(),$s=X(mf),ea=X(),G={comment:Jl,lineComment:X(Jl),blockComment:X(Jl),docComment:X(Jl),name:yr,variableName:X(yr),typeName:x0,tagName:X(x0),propertyName:w0,attributeName:X(w0),className:X(yr),labelName:X(yr),namespace:X(yr),macroName:X(yr),literal:vr,string:Zl,docString:X(Zl),character:X(Zl),attributeValue:X(Zl),number:gh,integer:X(gh),float:X(gh),bool:X(vr),regexp:X(vr),escape:X(vr),color:X(vr),url:X(vr),keyword:En,self:X(En),null:X(En),atom:X(En),unit:X(En),modifier:X(En),operatorKeyword:X(En),controlKeyword:X(En),definitionKeyword:X(En),moduleKeyword:X(En),operator:_n,derefOperator:X(_n),arithmeticOperator:X(_n),logicOperator:X(_n),bitwiseOperator:X(_n),compareOperator:X(_n),updateOperator:X(_n),definitionOperator:X(_n),typeOperator:X(_n),controlOperator:X(_n),punctuation:mf,separator:X(mf),bracket:$s,angleBracket:X($s),squareBracket:X($s),paren:X($s),brace:X($s),content:On,heading:Vr,heading1:X(Vr),heading2:X(Vr),heading3:X(Vr),heading4:X(Vr),heading5:X(Vr),heading6:X(Vr),contentSeparator:X(On),list:X(On),quote:X(On),emphasis:X(On),strong:X(On),link:X(On),monospace:X(On),strikethrough:X(On),inserted:X(),deleted:X(),changed:X(),invalid:X(),meta:ea,documentMeta:X(ea),annotation:X(ea),processingInstruction:X(ea),definition:Zt.defineModifier("definition"),constant:Zt.defineModifier("constant"),function:Zt.defineModifier("function"),standard:Zt.defineModifier("standard"),local:Zt.defineModifier("local"),special:Zt.defineModifier("special")};for(let r in G){let e=G[r];e instanceof Zt&&(e.name=r)}$v([{tag:G.link,class:"tok-link"},{tag:G.heading,class:"tok-heading"},{tag:G.emphasis,class:"tok-emphasis"},{tag:G.strong,class:"tok-strong"},{tag:G.keyword,class:"tok-keyword"},{tag:G.atom,class:"tok-atom"},{tag:G.bool,class:"tok-bool"},{tag:G.url,class:"tok-url"},{tag:G.labelName,class:"tok-labelName"},{tag:G.inserted,class:"tok-inserted"},{tag:G.deleted,class:"tok-deleted"},{tag:G.literal,class:"tok-literal"},{tag:G.string,class:"tok-string"},{tag:G.number,class:"tok-number"},{tag:[G.regexp,G.escape,G.special(G.string)],class:"tok-string2"},{tag:G.variableName,class:"tok-variableName"},{tag:G.local(G.variableName),class:"tok-variableName tok-local"},{tag:G.definition(G.variableName),class:"tok-variableName tok-definition"},{tag:G.special(G.variableName),class:"tok-variableName2"},{tag:G.definition(G.propertyName),class:"tok-propertyName tok-definition"},{tag:G.typeName,class:"tok-typeName"},{tag:G.namespace,class:"tok-namespace"},{tag:G.className,class:"tok-className"},{tag:G.macroName,class:"tok-macroName"},{tag:G.propertyName,class:"tok-propertyName"},{tag:G.operator,class:"tok-operator"},{tag:G.comment,class:"tok-comment"},{tag:G.meta,class:"tok-meta"},{tag:G.invalid,class:"tok-invalid"},{tag:G.punctuation,class:"tok-punctuation"}]);var yh;const Bi=new Ce;function T2(r){return re.define({combine:r?e=>e.concat(r):void 0})}const M2=new Ce;class gn{constructor(e,t,n=[],i=""){this.data=e,this.name=i,Me.prototype.hasOwnProperty("tree")||Object.defineProperty(Me.prototype,"tree",{get(){return Et(this)}}),this.parser=t,this.extension=[Zi.of(this),Me.languageData.of((o,a,u)=>{let h=k0(o,a,u),d=h.type.prop(Bi);if(!d)return[];let p=o.facet(d),g=h.type.prop(M2);if(g){let v=h.resolve(a-h.from,u);for(let w of g)if(w.test(v,o)){let k=o.facet(w.facet);return w.type=="replace"?k:k.concat(p)}}return p})].concat(n)}isActiveAt(e,t,n=-1){return k0(e,t,n).type.prop(Bi)==this.data}findRegions(e){let t=e.facet(Zi);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(o,a)=>{if(o.prop(Bi)==this.data){n.push({from:a,to:a+o.length});return}let u=o.prop(Ce.mounted);if(u){if(u.tree.prop(Bi)==this.data){if(u.overlay)for(let h of u.overlay)n.push({from:h.from+a,to:h.to+a});else n.push({from:a,to:a+o.length});return}else if(u.overlay){let h=n.length;if(i(u.tree,u.overlay[0].from+a),n.length>h)return}}for(let h=0;h<o.children.length;h++){let d=o.children[h];d instanceof Je&&i(d,o.positions[h]+a)}};return i(Et(e),0),n}get allowsNesting(){return!0}}gn.setState=je.define();function k0(r,e,t){let n=r.facet(Zi),i=Et(r).topNode;if(!n||n.allowsNesting)for(let o=i;o;o=o.enter(e,t,Ue.ExcludeBuffers|Ue.EnterBracketed))o.type.isTop&&(i=o);return i}class Ea extends gn{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=T2(e.languageData);return new Ea(t,e.parser.configure({props:[Bi.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ea(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Et(r){let e=r.field(gn.state,!1);return e?e.tree:Je.empty}class L2{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Ks=null;class _a{constructor(e,t,n=[],i,o,a,u,h){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new _a(e,t,[],Je.empty,0,n,[],null)}startParse(){return this.parser.startParse(new L2(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Je.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;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(Zr.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n: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(Zr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ks;Ks=this;try{return e()}finally{Ks=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=S0(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((d,p,g,v)=>h.push({fromA:d,toA:p,fromB:g,toB:v})),n=Zr.applyChanges(n,h),i=Je.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);p<g&&u.push({from:p,to:g})}}}return new _a(this.parser,t,n,i,o,a,u,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 n=0;n<this.skipped.length;n++){let{from:i,to:o}=this.skipped[n];i<e.to&&o>e.from&&(this.fragments=S0(this.fragments,i,o),this.skipped.splice(n--,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 Vv{createParse(t,n,i){let o=i[0].from,a=i[i.length-1].to;return{parsedPos:o,advance(){let h=Ks;if(h){for(let d of i)h.tempSkipped.push(d);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=a,new Je(It.none,[],[],a-o)},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 Ks}}function S0(r,e,t){return Zr.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ji{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ji(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=_a.create(e.facet(Zi).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ji(n)}}gn.state=Rn.define({create:Ji.init,update(r,e){for(let t of e.effects)if(t.is(gn.setState))return t.value;return e.startState.facet(Zi)!=e.state.facet(Zi)?Ji.init(e.state):r.apply(e)}});let Kv=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Kv=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const vh=typeof navigator<"u"&&(!((yh=navigator.scheduling)===null||yh===void 0)&&yh.isInputPending)?()=>navigator.scheduling.isInputPending():null,N2=Ct.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(gn.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(gn.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Kv(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,o=n.field(gn.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!vh?Math.max(25,e.timeRemaining()-5):1e9),u=o.context.treeLen<i&&n.doc.length>i+1e3,h=o.context.work(()=>vh&&vh()||Date.now()>a,i+(u?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:gn.setState.of(new Ji(o.context))})),this.chunkBudget>0&&!(h&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ut(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()}}}),Zi=re.define({combine(r){return r.length?r[0]:null},enables:r=>[gn.state,N2,ce.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class D2{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const R2=re.define(),$f=re.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function Oa(r){let e=r.facet($f);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function mo(r,e){let t="",n=r.tabSize,i=r.facet($f)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let o=0;o<e;o++)t+=i;return t}function Kf(r,e){r instanceof Me&&(r=new qa(r));for(let n of r.state.facet(R2)){let i=n(r,e);if(i!==void 0)return i}let t=Et(r.state);return t.length>=e?B2(r,t,e):null}class qa{constructor(e,t={}){this.state=e,this.options=t,this.unit=Oa(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return i!=null&&i>=n.from&&i<=n.to?o&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.countColumn(n,e-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(o+=a-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,t=e.length){return wo(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(i);if(a>-1)return a}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Gv=new Ce;function B2(r,e,t){let n=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=n.node){let o=[];for(let a=i;a&&!(a.from<n.node.from||a.to>n.node.to||a.from==n.node.from&&a.type==n.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)n={node:o[a],next:n}}return Xv(n,r,t)}function Xv(r,e,t){for(let n=r;n;n=n.next){let i=z2(n.node);if(i)return i(Gf.create(e,t,n))}return 0}function I2(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function z2(r){let e=r.type.prop(Gv);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(Ce.closedBy))){let i=r.lastChild,o=i&&n.indexOf(i.name)>-1;return a=>W2(a,!0,1,void 0,o&&!I2(a)?i.from:void 0)}return r.parent==null?j2:null}function j2(){return 0}class Gf extends qa{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Gf(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(F2(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Xv(this.context.next,this.base,this.pos)}}function F2(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function H2(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,o=r.state.doc.lineAt(t.from),a=i==null||i<=o.from?o.to:Math.min(o.to,i);for(let u=t.to;;){let h=e.childAfter(u);if(!h||h==n)return null;if(!h.type.isSkipped){if(h.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=h.to}}function W2(r,e,t,n,i){let o=r.textAfter,a=o.match(/^\s*/)[0].length,u=n&&o.slice(a,a+n.length)==n||i==r.pos+a,h=H2(r);return h?u?r.column(h.from):r.column(h.to):r.baseIndent+(u?0:r.unit*t)}function q2({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const V2=200;function Q2(){return Me.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+V2)return r;let o=t.sliceString(i.from,n);if(!e.some(d=>d.test(o)))return r;let{state:a}=r,u=-1,h=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==u)continue;u=p.from;let g=Kf(a,p.from);if(g==null)continue;let v=/^\s*/.exec(p.text)[0],w=mo(a,g);v!=w&&h.push({from:p.from,to:p.from+v.length,insert:w})}return h.length?[r,{changes:h,sequential:!0}]:r})}const U2=new Ce;class Va{constructor(e,t){this.specs=e;let n;function i(u){let h=Cr.newName();return(n||(n=Object.create(null)))["."+h]=u,h}const o=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,a=t.scope;this.scope=a instanceof gn?u=>u.prop(Bi)==a.data:a?u=>u==a:void 0,this.style=$v(e.map(u=>({tag:u.tag,class:u.class||i(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=n?new Cr(n):null,this.themeType=t.themeType}static define(e,t){return new Va(e,t||{})}}const gf=re.define(),$2=re.define({combine(r){return r.length?[r[0]]:null}});function xh(r){let e=r.facet(gf);return e.length?e:r.facet($2)}function K2(r,e){let t=[X2],n;return r instanceof Va&&(r.module&&t.push(ce.styleModule.of(r.module)),n=r.themeType),n?t.push(gf.computeN([ce.darkTheme],i=>i.facet(ce.darkTheme)==(n=="dark")?[r]:[])):t.push(gf.of(r)),t}class G2{constructor(e){this.markCache=Object.create(null),this.tree=Et(e.state),this.decorations=this.buildDeco(e,xh(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Et(e.state),n=xh(e.state),i=n!=xh(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!i&&t.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Le.none;let n=new Yr;for(let{from:i,to:o}of e.visibleRanges)_2(this.tree,t,(a,u,h)=>{n.add(a,u,this.markCache[h]||(this.markCache[h]=Le.mark({class:h})))},i,o);return n.finish()}}const X2=ri.high(Ct.fromClass(G2,{decorations:r=>r.decorations})),Y2=ce.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Yv=1e4,Jv="()[]{}",Zv=re.define({combine(r){return ts(r,{afterCursor:!0,brackets:Jv,maxScanDistance:Yv,renderMatch:eA})}}),J2=Le.mark({class:"cm-matchingBracket"}),Z2=Le.mark({class:"cm-nonmatchingBracket"});function eA(r){let e=[],t=r.matched?J2:Z2;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}function b0(r){let e=[],t=r.facet(Zv);for(let n of r.selection.ranges){if(!n.empty)continue;let i=Ln(r,n.head,-1,t)||n.head>0&&Ln(r,n.head-1,1,t)||t.afterCursor&&(Ln(r,n.head,1,t)||n.head<r.doc.length&&Ln(r,n.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,r)))}return Le.set(e,!0)}const tA=Ct.fromClass(class{constructor(r){this.paused=!1,this.decorations=b0(r.state)}update(r){(r.docChanged||r.selectionSet||this.paused)&&(r.view.composing?(this.decorations=this.decorations.map(r.changes),this.paused=!0):(this.decorations=b0(r.state),this.paused=!1))}},{decorations:r=>r.decorations}),nA=[tA,Y2];function rA(r={}){return[Zv.of(r),nA]}const iA=new Ce;function yf(r,e,t){let n=r.prop(e<0?Ce.openedBy:Ce.closedBy);if(n)return n;if(r.name.length==1){let i=t.indexOf(r.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function vf(r){let e=r.type.prop(iA);return e?e(r.node):r}function Ln(r,e,t,n={}){let i=n.maxScanDistance||Yv,o=n.brackets||Jv,a=Et(r),u=a.resolveInner(e,t);for(let h=u;h;h=h.parent){let d=yf(h.type,t,o);if(d&&h.from<h.to){let p=vf(h);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return sA(r,e,t,h,p,d,o)}}return oA(r,e,t,a,u.type,i,o)}function sA(r,e,t,n,i,o,a){let u=n.parent,h={from:i.from,to:i.to},d=0,p=u==null?void 0:u.cursor();if(p&&(t<0?p.childBefore(n.from):p.childAfter(n.to)))do if(t<0?p.to<=n.from:p.from>=n.to){if(d==0&&o.indexOf(p.type.name)>-1&&p.from<p.to){let g=vf(p);return{start:h,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(yf(p.type,t,a))d++;else if(yf(p.type,-t,a)){if(d==0){let g=vf(p);return{start:h,end:g&&g.from<g.to?{from:g.from,to:g.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:h,matched:!1}}function oA(r,e,t,n,i,o,a){if(t<0?!e:e==r.doc.length)return null;let u=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),h=a.indexOf(u);if(h<0||h%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=r.doc.iterRange(e,t>0?r.doc.length:0),g=0;for(let v=0;!p.next().done&&v<=o;){let w=p.value;t<0&&(v+=w.length);let k=e+v*t;for(let S=t>0?0:w.length-1,C=t>0?w.length:-1;S!=C;S+=t){let P=a.indexOf(w[S]);if(!(P<0||n.resolveInner(k+S,1).type!=i))if(P%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:k+S,to:k+S+1},matched:P>>1==h>>1};g--}}t>0&&(v+=w.length)}return p.done?{start:d,matched:!1}:null}const lA=Object.create(null),C0=[It.none],A0=[],E0=Object.create(null),aA=Object.create(null);for(let[r,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"]])aA[r]=uA(lA,e);function wh(r,e){A0.indexOf(r)>-1||(A0.push(r),console.warn(e))}function uA(r,e){let t=[];for(let u of e.split(" ")){let h=[];for(let d of u.split(".")){let p=r[d]||G[d];p?typeof p=="function"?h.length?h=h.map(p):wh(d,`Modifier ${d} used at start of tag`):h.length?wh(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:wh(d,`Unknown highlighting tag ${d}`)}for(let d of h)t.push(d)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(u=>u.id),o=E0[i];if(o)return o.id;let a=E0[i]=It.define({id:C0.length,name:n,props:[Qv({[n]:t})]});return C0.push(a),a.id}Be.RTL,Be.LTR;const cA=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=Yf(r.state,t.from);return n.line?hA(r):n.block?dA(r):!1};function Xf(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}const hA=Xf(gA,0),fA=Xf(ex,0),dA=Xf((r,e)=>ex(r,e,mA(e)),0);function Yf(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Gs=50;function pA(r,{open:e,close:t},n,i){let o=r.sliceDoc(n-Gs,n),a=r.sliceDoc(i,i+Gs),u=/\s*$/.exec(o)[0].length,h=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(h,h+t.length)==t)return{open:{pos:n-u,margin:u&&1},close:{pos:i+h,margin:h&&1}};let p,g;i-n<=2*Gs?p=g=r.sliceDoc(n,i):(p=r.sliceDoc(n,n+Gs),g=r.sliceDoc(i-Gs,i));let v=/^\s*/.exec(p)[0].length,w=/\s*$/.exec(g)[0].length,k=g.length-w-t.length;return p.slice(v,v+e.length)==e&&g.slice(k,k+t.length)==t?{open:{pos:n+v+e.length,margin:/\s/.test(p.charAt(v+e.length))?1:0},close:{pos:i-w-t.length,margin:/\s/.test(g.charAt(k-1))?1:0}}:null}function mA(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to);i.from>n.from&&i.from==t.to&&(i=t.to==n.to+1?n:r.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>n.from?e[o].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function ex(r,e,t=e.selection.ranges){let n=t.map(o=>Yf(e,o.from).block);if(!n.every(o=>o))return null;let i=t.map((o,a)=>pA(e,n[a],o.from,o.to));if(r!=2&&!i.every(o=>o))return{changes:e.changes(t.map((o,a)=>i[a]?[]:[{from:o.from,insert:n[a].open+" "},{from:o.to,insert:" "+n[a].close}]))};if(r!=1&&i.some(o=>o)){let o=[];for(let a=0,u;a<i.length;a++)if(u=i[a]){let h=n[a],{open:d,close:p}=u;o.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:o}}return null}function gA(r,e,t=e.selection.ranges){let n=[],i=-1;e:for(let{from:o,to:a}of t){let u=n.length,h=1e9,d;for(let p=o;p<=a;){let g=e.doc.lineAt(p);if(d==null&&(d=Yf(e,g.from).line,!d))continue e;if(g.from>i&&(o==a||a>g.from)){i=g.from;let v=/^\s*/.exec(g.text)[0].length,w=v==g.length,k=g.text.slice(v,v+d.length)==d?v:-1;v<g.text.length&&v<h&&(h=v),n.push({line:g,comment:k,token:d,indent:v,empty:w,single:!1})}p=g.to+1}if(h<1e9)for(let p=u;p<n.length;p++)n[p].indent<n[p].line.text.length&&(n[p].indent=h);n.length==u+1&&(n[u].single=!0)}if(r!=2&&n.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:h,indent:d,empty:p,single:g}of n)(g||!p)&&o.push({from:u.from+d,insert:h+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(r!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:h}of n)if(u>=0){let d=a.from+u,p=d+h.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const xf=Xn.define(),yA=Xn.define(),vA=re.define(),tx=re.define({combine(r){return ts(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}}),nx=Rn.define({create(){return Nn.empty},update(r,e){let t=e.state.facet(tx),n=e.annotation(xf);if(n){let h=Bt.fromTransaction(e,n.selection),d=n.side,p=d==0?r.undone:r.done;return h?p=Pa(p,p.length,t.minDepth,h):p=sx(p,e.startState.selection),new Nn(d==0?n.rest:p,d==0?p:n.rest)}let i=e.annotation(yA);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(nt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let o=Bt.fromTransaction(e),a=e.annotation(nt.time),u=e.annotation(nt.userEvent);return o?r=r.addChanges(o,a,u,t,e):e.selection&&(r=r.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new Nn(r.done.map(Bt.fromJSON),r.undone.map(Bt.fromJSON))}});function xA(r={}){return[nx,tx.of(r),ce.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?rx:e.inputType=="historyRedo"?wf:null;return n?(e.preventDefault(),n(t)):!1}})]}function Qa(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(nx,!1);if(!i)return!1;let o=i.pop(r,t,e);return o?(n(o),!0):!1}}const rx=Qa(0,!1),wf=Qa(1,!1),wA=Qa(0,!0),kA=Qa(1,!0);class Bt{constructor(e,t,n,i,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=o}setSelAfter(e){return new Bt(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;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:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Bt(e.changes&&tt.fromJSON(e.changes),[],e.mapped&&Dn.fromJSON(e.mapped),e.startSelection&&F.fromJSON(e.startSelection),e.selectionsAfter.map(F.fromJSON))}static fromTransaction(e,t){let n=nn;for(let i of e.startState.facet(vA)){let o=i(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new Bt(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,nn)}static selection(e){return new Bt(void 0,nn,void 0,void 0,e)}}function Pa(r,e,t,n){let i=e+1>t+20?e-t-1:0,o=r.slice(i,e);return o.push(n),o}function SA(r,e){let t=[],n=!1;return r.iterChangedRanges((i,o)=>t.push(i,o)),e.iterChangedRanges((i,o,a,u)=>{for(let h=0;h<t.length;){let d=t[h++],p=t[h++];u>=d&&a<=p&&(n=!0)}}),n}function bA(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function ix(r,e){return r.length?e.length?r.concat(e):r:e}const nn=[],CA=200;function sx(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-CA));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),Pa(r,r.length-1,1e9,t.setSelAfter(n)))}else return[Bt.selection([e])]}function AA(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function kh(r,e){if(!r.length)return r;let t=r.length,n=nn;for(;t;){let i=EA(r[t-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let o=r.slice(0,t);return o[t-1]=i,o}else e=i.mapped,t--,n=i.selectionsAfter}return n.length?[Bt.selection(n)]:nn}function EA(r,e,t){let n=ix(r.selectionsAfter.length?r.selectionsAfter.map(u=>u.map(e)):nn,t);if(!r.changes)return Bt.selection(n);let i=r.changes.map(e),o=e.mapDesc(r.changes,!0),a=r.mapped?r.mapped.composeDesc(o):o;return new Bt(i,je.mapEffects(r.effects,e),a,r.startSelection.map(o),n)}const _A=/^(input\.type|delete)($|\.)/;class Nn{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Nn(this.done,this.undone):this}addChanges(e,t,n,i,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!n||_A.test(n))&&(!u.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,SA(u.changes,e.changes))||n=="input.type.compose")?a=Pa(a,a.length-1,i.minDepth,new Bt(e.changes.compose(u.changes),ix(je.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,nn)):a=Pa(a,a.length,i.minDepth,e),new Nn(a,nn,t,n)}addSelection(e,t,n,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:nn;return o.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&bA(o[o.length-1],e)?this:new Nn(sx(this.done,e),this.undone,t,n)}addMapping(e){return new Nn(kh(this.done,e),kh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let o=i[i.length-1],a=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:xf.of({side:e,rest:AA(i),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let u=i.length==1?nn:i.slice(0,i.length-1);return o.mapped&&(u=kh(u,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:xf.of({side:e,rest:u,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Nn.empty=new Nn(nn,nn);const OA=[{key:"Mod-z",run:rx,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wf,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wf,preventDefault:!0},{key:"Mod-u",run:wA,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:kA,preventDefault:!0}];function ns(r,e){return F.create(r.ranges.map(e),r.mainIndex)}function vn(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function xn({state:r,dispatch:e},t){let n=ns(r.selection,t);return n.eq(r.selection,!0)?!1:(e(vn(r,n)),!0)}function Ua(r,e){return F.cursor(e?r.to:r.from)}function ox(r,e){return xn(r,t=>t.empty?r.moveByChar(t,e):Ua(t,e))}function xt(r){return r.textDirectionAt(r.state.selection.main.head)==Be.LTR}const lx=r=>ox(r,!xt(r)),ax=r=>ox(r,xt(r));function ux(r,e){return xn(r,t=>t.empty?r.moveByGroup(t,e):Ua(t,e))}const PA=r=>ux(r,!xt(r)),TA=r=>ux(r,xt(r));function MA(r,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(r.sliceDoc(e.from,e.to)))||e.firstChild}function $a(r,e,t){let n=Et(r).resolveInner(e.head),i=t?Ce.closedBy:Ce.openedBy;for(let h=e.head;;){let d=t?n.childAfter(h):n.childBefore(h);if(!d)break;MA(r,d,i)?n=d:h=t?d.to:d.from}let o=n.type.prop(i),a,u;return o&&(a=t?Ln(r,n.from,1):Ln(r,n.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?n.to:n.from,F.cursor(u,t?-1:1)}const LA=r=>xn(r,e=>$a(r.state,e,!xt(r))),NA=r=>xn(r,e=>$a(r.state,e,xt(r)));function cx(r,e){return xn(r,t=>{if(!t.empty)return Ua(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const hx=r=>cx(r,!1),fx=r=>cx(r,!0);function dx(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let o of r.state.facet(ce.scrollMargins)){let a=o(r);a!=null&&a.top&&(t=Math.max(a==null?void 0:a.top,t)),a!=null&&a.bottom&&(n=Math.max(a==null?void 0:a.bottom,n))}i=r.scrollDOM.clientHeight-t-n}else i=(r.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(r.defaultLineHeight,i-5)}}function px(r,e){let t=dx(r),{state:n}=r,i=ns(n.selection,a=>a.empty?r.moveVertically(a,e,t.height):Ua(a,e));if(i.eq(n.selection))return!1;let o;if(t.selfScroll){let a=r.coordsAtPos(n.selection.main.head),u=r.scrollDOM.getBoundingClientRect(),h=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>h&&a.bottom<d&&(o=ce.scrollIntoView(i.main.head,{y:"start",yMargin:a.top-h}))}return r.dispatch(vn(n,i),{effects:o}),!0}const _0=r=>px(r,!1),kf=r=>px(r,!0);function Tr(r,e,t){let n=r.lineBlockAt(e.head),i=r.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?n.to:n.from)&&(i=r.moveToLineBoundary(e,t,!1)),!t&&i.head==n.from&&n.length){let o=/^\s*/.exec(r.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&e.head!=n.from+o&&(i=F.cursor(n.from+o))}return i}const DA=r=>xn(r,e=>Tr(r,e,!0)),RA=r=>xn(r,e=>Tr(r,e,!1)),BA=r=>xn(r,e=>Tr(r,e,!xt(r))),IA=r=>xn(r,e=>Tr(r,e,xt(r))),zA=r=>xn(r,e=>r.moveToLineBoundary(e,!1,!1)),jA=r=>xn(r,e=>r.moveToLineBoundary(e,!0,!1));function FA(r,e,t){let n=!1,i=ns(r.selection,o=>{let a=Ln(r,o.head,-1)||Ln(r,o.head,1)||o.head>0&&Ln(r,o.head-1,1)||o.head<r.doc.length&&Ln(r,o.head+1,-1);if(!a||!a.end)return o;n=!0;let u=a.start.from==o.head?a.end.to:a.end.from;return F.cursor(u)});return n?(e(vn(r,i)),!0):!1}const HA=({state:r,dispatch:e})=>FA(r,e);function on(r,e,t){let n=ns(r.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=F.range(i.head,i.anchor));let o=t(i);return F.range(i.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return n.eq(r.state.selection)?!1:(r.dispatch(vn(r.state,n)),!0)}function mx(r,e){return on(r,e,t=>r.moveByChar(t,e))}const gx=r=>mx(r,!xt(r)),yx=r=>mx(r,xt(r));function vx(r,e){return on(r,e,t=>r.moveByGroup(t,e))}const WA=r=>vx(r,!xt(r)),qA=r=>vx(r,xt(r)),VA=r=>{let e=!xt(r);return on(r,e,t=>$a(r.state,t,e))},QA=r=>{let e=xt(r);return on(r,e,t=>$a(r.state,t,e))};function xx(r,e){return on(r,e,t=>r.moveVertically(t,e))}const wx=r=>xx(r,!1),kx=r=>xx(r,!0);function Sx(r,e){return on(r,e,t=>r.moveVertically(t,e,dx(r).height))}const O0=r=>Sx(r,!1),P0=r=>Sx(r,!0),UA=r=>on(r,!0,e=>Tr(r,e,!0)),$A=r=>on(r,!1,e=>Tr(r,e,!1)),KA=r=>{let e=!xt(r);return on(r,e,t=>Tr(r,t,e))},GA=r=>{let e=xt(r);return on(r,e,t=>Tr(r,t,e))},XA=r=>on(r,!1,e=>F.cursor(r.lineBlockAt(e.head).from)),YA=r=>on(r,!0,e=>F.cursor(r.lineBlockAt(e.head).to)),T0=({state:r,dispatch:e})=>(e(vn(r,{anchor:0})),!0),M0=({state:r,dispatch:e})=>(e(vn(r,{anchor:r.doc.length})),!0),L0=({state:r,dispatch:e})=>(e(vn(r,{anchor:r.selection.main.anchor,head:0})),!0),N0=({state:r,dispatch:e})=>(e(vn(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),JA=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),ZA=({state:r,dispatch:e})=>{let t=Ka(r).map(({from:n,to:i})=>F.undirectionalRange(n,Math.min(i+1,r.doc.length)));return e(r.update({selection:F.create(t),userEvent:"select"})),!0},eE=({state:r,dispatch:e})=>{let t=ns(r.selection,n=>{let i=Et(r),o=i.resolveStack(n.from,1);if(n.empty){let a=i.resolveStack(n.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from<n.from&&u.to>=n.to||u.to>n.to&&u.from<=n.from)&&a.next)return F.undirectionalRange(u.from,u.to)}return n});return t.eq(r.selection)?!1:(e(vn(r,t)),!0)};function bx(r,e){let{state:t}=r,n=t.selection,i=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to<r.state.doc.length:a.from>0)for(let u=o;;){let h=r.moveVertically(u,e);if(h.head<a.from||h.head>a.to){i.some(d=>d.head==h.head)||i.push(h);break}else{if(h.head==u.head)break;u=h}}}return i.length==n.ranges.length?!1:(r.dispatch(vn(t,F.create(i,i.length-1))),!0)}const tE=r=>bx(r,!1),nE=r=>bx(r,!0),rE=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=F.create([t.main]):t.main.empty||(n=F.create([F.cursor(t.main.head)])),n?(e(vn(r,n)),!0):!1};function Co(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,i=n.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let h=e(o);h<a?(t="delete.backward",h=ta(r,h,!1)):h>a&&(t="delete.forward",h=ta(r,h,!0)),a=Math.min(a,h),u=Math.max(u,h)}else a=ta(r,a,!1),u=ta(r,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:F.cursor(a,a<o.head?-1:1)}});return i.changes.empty?!1:(r.dispatch(n.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?ce.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ta(r,e,t){if(r instanceof ce)for(let n of r.state.facet(ce.atomicRanges).map(i=>i(r)))n.between(e,e,(i,o)=>{i<e&&o>e&&(e=t?o:i)});return e}const Cx=(r,e,t)=>Co(r,n=>{let i=n.from,{state:o}=r,a=o.doc.lineAt(i),u,h;if(t&&!e&&i>a.from&&i<a.from+200&&!/[^ \t]/.test(u=a.text.slice(0,i-a.from))){if(u[u.length-1]==" ")return i-1;let d=wo(u,o.tabSize),p=d%Oa(o)||Oa(o);for(let g=0;g<p&&u[u.length-1-g]==" ";g++)i--;h=i}else h=vt(a.text,i-a.from,e,e)+a.from,h==i&&a.number!=(e?o.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(h-a.from,i-a.from))&&(h=vt(a.text,h-a.from,!1,!1)+a.from);return h}),Sf=r=>Cx(r,!1,!0),Ax=r=>Cx(r,!0,!1),Ex=(r,e)=>Co(r,t=>{let n=t.head,{state:i}=r,o=i.doc.lineAt(n),a=i.charCategorizer(n);for(let u=null;;){if(n==(e?o.to:o.from)){n==t.head&&o.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let h=vt(o.text,n-o.from,e)+o.from,d=o.text.slice(Math.min(n,h)-o.from,Math.max(n,h)-o.from),p=a(d);if(u!=null&&p!=u)break;(d!=" "||n!=t.head)&&(u=p),n=h}return n}),_x=r=>Ex(r,!1),iE=r=>Ex(r,!0),sE=r=>Co(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),oE=r=>Co(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),lE=r=>Co(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),aE=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Pe.of(["",""])},range:F.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},uE=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>{if(!n.empty||n.from==0||n.from==r.doc.length)return{range:n};let i=n.from,o=r.doc.lineAt(i),a=i==o.from?i-1:vt(o.text,i-o.from,!1)+o.from,u=i==o.to?i+1:vt(o.text,i-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:r.doc.slice(i,u).append(r.doc.slice(a,i))},range:F.cursor(u)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ka(r){let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.from),o=r.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=r.doc.lineAt(n.to-1)),t>=i.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(n)}else e.push({from:i.from,to:o.to,ranges:[n]});t=o.number+1}return e}function Ox(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let o of Ka(r)){if(t?o.to==r.doc.length:o.from==0)continue;let a=r.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){n.push({from:o.to,to:a.to},{from:o.from,insert:a.text+r.lineBreak});for(let h of o.ranges)i.push(F.range(Math.min(r.doc.length,h.anchor+u),Math.min(r.doc.length,h.head+u)))}else{n.push({from:a.from,to:o.from},{from:o.to,insert:r.lineBreak+a.text});for(let h of o.ranges)i.push(F.range(h.anchor-u,h.head-u))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:F.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const cE=({state:r,dispatch:e})=>Ox(r,e,!1),hE=({state:r,dispatch:e})=>Ox(r,e,!0);function Px(r,e,t){if(r.readOnly)return!1;let n=[];for(let o of Ka(r))t?n.push({from:o.from,insert:r.doc.slice(o.from,o.to)+r.lineBreak}):n.push({from:o.to,insert:r.lineBreak+r.doc.slice(o.from,o.to)});let i=r.changes(n);return e(r.update({changes:i,selection:r.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const fE=({state:r,dispatch:e})=>Px(r,e,!1),dE=({state:r,dispatch:e})=>Px(r,e,!0),pE=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(Ka(e).map(({from:i,to:o})=>(i>0?i--:o<e.doc.length&&o++,{from:i,to:o}))),n=ns(e.selection,i=>{let o;if(r.lineWrapping){let a=r.lineBlockAt(i.head),u=r.coordsAtPos(i.head,i.assoc||1);u&&(o=a.bottom+r.documentTop-u.bottom+r.defaultLineHeight/2)}return r.moveVertically(i,!0,o)}).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function mE(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Et(r).resolveInner(e),n=t.childBefore(e),i=t.childAfter(e),o;return n&&i&&n.to<=e&&i.from>=e&&(o=n.type.prop(Ce.closedBy))&&o.indexOf(i.name)>-1&&r.doc.lineAt(n.to).from==r.doc.lineAt(i.from).from&&!/\S/.test(r.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const D0=Tx(!1),gE=Tx(!0);function Tx(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:o,to:a}=i,u=e.doc.lineAt(o),h=!r&&o==a&&mE(e,o);r&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new qa(e,{simulateBreak:o,simulateDoubleBreak:!!h}),p=Kf(d,o);for(p==null&&(p=wo(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<u.to&&/\s/.test(u.text[a-u.from]);)a++;h?{from:o,to:a}=h:o>u.from&&o<u.from+100&&!/\S/.test(u.text.slice(0,o))&&(o=u.from);let g=["",mo(e,p)];return h&&g.push(mo(e,d.lineIndent(u.from,-1))),{changes:{from:o,to:a,insert:Pe.of(g)},range:F.cursor(o+1+g[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Jf(r,e){let t=-1;return r.changeByRange(n=>{let i=[];for(let a=n.from;a<=n.to;){let u=r.doc.lineAt(a);u.number>t&&(n.empty||n.to>u.from)&&(e(u,i,n),t=u.number),a=u.to+1}let o=r.changes(i);return{changes:i,range:F.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const yE=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new qa(r,{overrideIndentation:o=>{let a=t[o];return a??-1}}),i=Jf(r,(o,a,u)=>{let h=Kf(n,o.from);if(h==null)return;/\S/.test(o.text)||(h=0);let d=/^\s*/.exec(o.text)[0],p=mo(r,h);(d!=p||u.from<o.from+d.length)&&(t[o.from]=h,a.push({from:o.from,to:o.from+d.length,insert:p}))});return i.changes.empty||e(r.update(i,{userEvent:"indent"})),!0},Mx=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Jf(r,(t,n)=>{n.push({from:t.from,insert:r.facet($f)})}),{userEvent:"input.indent"})),!0),Lx=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Jf(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=wo(i,r.tabSize),a=0,u=mo(r,Math.max(0,o-Oa(r)));for(;a<i.length&&a<u.length&&i.charCodeAt(a)==u.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+i.length,insert:u.slice(a)})}),{userEvent:"delete.dedent"})),!0),vE=r=>(r.setTabFocusMode(),!0),xE=[{key:"Ctrl-b",run:lx,shift:gx,preventDefault:!0},{key:"Ctrl-f",run:ax,shift:yx},{key:"Ctrl-p",run:hx,shift:wx},{key:"Ctrl-n",run:fx,shift:kx},{key:"Ctrl-a",run:zA,shift:XA},{key:"Ctrl-e",run:jA,shift:YA},{key:"Ctrl-d",run:Ax},{key:"Ctrl-h",run:Sf},{key:"Ctrl-k",run:sE},{key:"Ctrl-Alt-h",run:_x},{key:"Ctrl-o",run:aE},{key:"Ctrl-t",run:uE},{key:"Ctrl-v",run:kf}],wE=[{key:"ArrowLeft",run:lx,shift:gx,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:PA,shift:WA,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:BA,shift:KA,preventDefault:!0},{key:"ArrowRight",run:ax,shift:yx,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:TA,shift:qA,preventDefault:!0},{mac:"Cmd-ArrowRight",run:IA,shift:GA,preventDefault:!0},{key:"ArrowUp",run:hx,shift:wx,preventDefault:!0},{mac:"Cmd-ArrowUp",run:T0,shift:L0},{mac:"Ctrl-ArrowUp",run:_0,shift:O0},{key:"ArrowDown",run:fx,shift:kx,preventDefault:!0},{mac:"Cmd-ArrowDown",run:M0,shift:N0},{mac:"Ctrl-ArrowDown",run:kf,shift:P0},{key:"PageUp",run:_0,shift:O0},{key:"PageDown",run:kf,shift:P0},{key:"Home",run:RA,shift:$A,preventDefault:!0},{key:"Mod-Home",run:T0,shift:L0},{key:"End",run:DA,shift:UA,preventDefault:!0},{key:"Mod-End",run:M0,shift:N0},{key:"Enter",run:D0,shift:D0},{key:"Mod-a",run:JA},{key:"Backspace",run:Sf,shift:Sf,preventDefault:!0},{key:"Delete",run:Ax,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_x,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:iE,preventDefault:!0},{mac:"Mod-Backspace",run:oE,preventDefault:!0},{mac:"Mod-Delete",run:lE,preventDefault:!0}].concat(xE.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),kE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:LA,shift:VA},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:NA,shift:QA},{key:"Alt-ArrowUp",run:cE},{key:"Shift-Alt-ArrowUp",run:fE},{key:"Alt-ArrowDown",run:hE},{key:"Shift-Alt-ArrowDown",run:dE},{key:"Mod-Alt-ArrowUp",run:tE},{key:"Mod-Alt-ArrowDown",run:nE},{key:"Escape",run:rE},{key:"Mod-Enter",run:gE},{key:"Alt-l",mac:"Ctrl-l",run:ZA},{key:"Mod-i",run:eE,preventDefault:!0},{key:"Mod-[",run:Lx},{key:"Mod-]",run:Mx},{key:"Mod-Alt-\\",run:yE},{key:"Shift-Mod-k",run:pE},{key:"Shift-Mod-\\",run:HA},{key:"Mod-/",run:cA},{key:"Alt-A",mac:"Ctrl-A",run:fA},{key:"Ctrl-m",mac:"Shift-Alt-m",run:vE}].concat(wE),SE={key:"Tab",run:Mx,shift:Lx};class Nx{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Et(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),o=i.search(Rx(e,!1));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function R0(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function bE(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let o=1;o<i.length;o++)t[i[o]]=!0}let n=R0(e)+R0(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Dx(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:bE(e);return i=>{let o=i.matchBefore(n);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:t}:null}}function CE(r,e){return t=>{for(let n=Et(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class B0{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ei(r){return r.selection.main.from}function Rx(r,e){var t;let{source:n}=r,i=e&&n[0]!="^",o=n[n.length-1]!="$";return!i&&!o?r:new RegExp(`${i?"^":""}(?:${n})${o?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}const Bx=Xn.define();function AE(r,e,t,n){let{main:i}=r.selection,o=t-i.from,a=n-i.from;return{...r.changeByRange(u=>{if(u!=i&&t!=n&&r.sliceDoc(u.from+o,u.from+a)!=r.sliceDoc(t,n))return{range:u};let h=r.toText(e);return{changes:{from:u.from+o,to:n==i.from?u.to:u.from+a,insert:h},range:F.cursor(u.from+o+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const I0=new WeakMap;function EE(r){if(!Array.isArray(r))return r;let e=I0.get(r);return e||I0.set(r,e=Dx(r)),e}const Ta=je.define(),go=je.define();class _E{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Qt(e,t),i=Un(n);this.chars.push(n);let o=e.slice(t,t+i),a=o.toUpperCase();this.folded.push(Qt(a==o?o.toLowerCase():a,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:n,any:i,precise:o,byWord:a}=this;if(t.length==1){let D=Qt(e,0),M=Un(D),Q=M==e.length?0:-100;if(D!=t[0])if(D==n[0])Q+=-200;else return null;return this.ret(Q,[0,M])}let u=e.indexOf(this.pattern);if(u==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let h=t.length,d=0;if(u<0){for(let D=0,M=Math.min(e.length,200);D<M&&d<h;){let Q=Qt(e,D);(Q==t[d]||Q==n[d])&&(i[d++]=D),D+=Un(Q)}if(d<h)return null}let p=0,g=0,v=!1,w=0,k=-1,S=-1,C=/[a-z]/.test(e),P=!0;for(let D=0,M=Math.min(e.length,200),Q=0;D<M&&g<h;){let B=Qt(e,D);u<0&&(p<h&&B==t[p]&&(o[p++]=D),w<h&&(B==t[w]||B==n[w]?(w==0&&(k=D),S=D+1,w++):w=0));let I,H=B<255?B>=48&&B<=57||B>=97&&B<=122?2:B>=65&&B<=90?1:0:(I=Cy(B))!=I.toLowerCase()?1:I!=I.toUpperCase()?2:0;(!D||H==1&&C||Q==0&&H!=0)&&(t[g]==B||n[g]==B&&(v=!0)?a[g++]=D:a.length&&(P=!1)),Q=H,D+=Un(B)}return g==h&&a[0]==0&&P?this.result(-100+(v?-200:0),a,e):w==h&&k==0?this.ret(-200-e.length+(S==e.length?0:-100),[0,S]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):w==h?this.ret(-900-e.length,[k,S]):g==h?this.result(-100+(v?-200:0)+-700+(P?0:-1100),a,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],o=0;for(let a of t){let u=a+(this.astral?Un(Qt(n,a)):1);o&&i[o-1]==a?i[o-1]=u:(i[o++]=a,i[o++]=u)}return this.ret(e-n.length,i)}}class OE{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const ot=re.define({combine(r){return ts(r,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:PE,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>z0(e(n),t(n)),optionClass:(e,t)=>n=>z0(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function z0(r,e){return r?e?r+" "+e:r:e}function PE(r,e,t,n,i,o){let a=r.textDirection==Be.RTL,u=a,h=!1,d="top",p,g,v=e.left-i.left,w=i.right-e.right,k=n.right-n.left,S=n.bottom-n.top;if(u&&v<Math.min(k,w)?u=!1:!u&&w<Math.min(k,v)&&(u=!0),k<=(u?v:w))p=Math.max(i.top,Math.min(t.top,i.bottom-S))-e.top,g=Math.min(400,u?v:w);else{h=!0,g=Math.min(400,(a?e.right:i.right-e.left)-30);let D=i.bottom-e.bottom;D>=S||D>e.top?p=t.bottom-e.top:(d="bottom",p=e.bottom-t.top)}let C=(e.bottom-e.top)/o.offsetHeight,P=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${g/P}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":u?"left":"right")}}const Zf=je.define();function TE(r){let e=r.addToOptions.slice();return r.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,i,o){let a=document.createElement("span");a.className="cm-completionLabel";let u=t.displayLabel||t.label,h=0;for(let d=0;d<o.length;){let p=o[d++],g=o[d++];p>h&&a.appendChild(document.createTextNode(u.slice(h,p)));let v=a.appendChild(document.createElement("span"));v.appendChild(document.createTextNode(u.slice(p,g))),v.className="cm-completionMatchedText",h=g}return h<u.length&&a.appendChild(document.createTextNode(u.slice(h))),a},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function Sh(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let n=Math.ceil((r-e)/t);return{from:r-n*t,to:r-(n-1)*t}}class ME{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:o,selected:a}=i.open,u=e.state.facet(ot);this.optionContent=TE(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=Sh(o.length,a,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{let{options:d}=e.state.field(t).open;for(let p=h.target,g;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(g=/-(\d+)$/.exec(p.id))&&+g[1]<d.length){this.applyCompletion(e,d[+g[1]]),h.preventDefault();return}if(h.target==this.list){let p=this.list.classList.contains("cm-completionListIncompleteTop")&&h.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&h.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(e.dispatch({effects:Zf.of(p)}),h.preventDefault())}}),this.dom.addEventListener("focusout",h=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(ot).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:go.of(null)})}),this.showOptions(o,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 n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:o,selected:a,disabled:u}=n.open;(!i.open||i.open.options!=o)&&(this.range=Sh(o.length,a,e.state.facet(ot).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),u!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!u)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);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=Sh(t.options.length,t.selected,this.view.state.facet(ot).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:o}=i;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(i);if(!a)return;"then"in a?a.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,i)}).catch(u=>Ut(this.view.state,u,"completion info")):(this.addInfoPane(a,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:o}=e;n.appendChild(i),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&NE(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(ot).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){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",a=>{a.target==i&&a.preventDefault()});let o=null;for(let a=n.from;a<n.to;a++){let{completion:u,match:h}=e[a],{section:d}=u;if(d){let v=typeof d=="string"?d:d.name;if(v!=o&&(a>n.from||n.from==0))if(o=v,typeof d!="string"&&d.header)i.appendChild(d.header(d));else{let w=i.appendChild(document.createElement("completion-section"));w.textContent=v}}const p=i.appendChild(document.createElement("li"));p.id=t+"-"+a,p.setAttribute("role","option");let g=this.optionClass(u);g&&(p.className=g);for(let v of this.optionContent){let w=v(u,this.view.state,this.view,h);w&&p.appendChild(w)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.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 LE(r,e){return t=>new ME(t,r,e)}function NE(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.height/r.offsetHeight;n.top<t.top?r.scrollTop-=(t.top-n.top)/i:n.bottom>t.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/i)}function j0(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function DE(r,e){let t=[],n=null,i=null,o=p=>{t.push(p);let{section:g}=p.completion;if(g){n||(n=[]);let v=typeof g=="string"?g:g.name;n.some(w=>w.name==v)||n.push(typeof g=="string"?{name:v}:g)}},a=e.facet(ot);for(let p of r)if(p.hasResult()){let g=p.result.getMatch;if(p.result.filter===!1)for(let v of p.result.options)o(new B0(v,p.source,g?g(v):[],1e9-t.length));else{let v=e.sliceDoc(p.from,p.to),w,k=a.filterStrict?new OE(v):new _E(v);for(let S of p.result.options)if(w=k.match(S.label)){let C=S.displayLabel?g?g(S,w.matched):[]:w.matched,P=w.score+(S.boost||0);if(o(new B0(S,p.source,C,P)),typeof S.section=="object"&&S.section.rank==="dynamic"){let{name:D}=S.section;i||(i=Object.create(null)),i[D]=Math.max(P,i[D]||-1e9)}}}}if(n){let p=Object.create(null),g=0,v=(w,k)=>(w.rank==="dynamic"&&k.rank==="dynamic"?i[k.name]-i[w.name]:0)||(typeof w.rank=="number"?w.rank:1e9)-(typeof k.rank=="number"?k.rank:1e9)||(w.name<k.name?-1:1);for(let w of n.sort(v))g-=1e5,p[w.name]=g;for(let w of t){let{section:k}=w.completion;k&&(w.score+=p[typeof k=="string"?k:k.name])}}let u=[],h=null,d=a.compareCompletions;for(let p of t.sort((g,v)=>v.score-g.score||d(g.completion,v.completion))){let g=p.completion;!h||h.label!=g.label||h.detail!=g.detail||h.type!=null&&g.type!=null&&h.type!=g.type||h.apply!=g.apply||h.boost!=g.boost?u.push(p):j0(p.completion)>j0(h)&&(u[u.length-1]=p),h=p.completion}return u}class Ii{constructor(e,t,n,i,o,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=o,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ii(this.options,F0(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o,a){if(i&&!a&&e.some(d=>d.isPending))return i.setDisabled();let u=DE(e,t);if(!u.length)return i&&e.some(d=>d.isPending)?i.setDisabled():null;let h=t.facet(ot).selectOnOpen?0:-1;if(i&&i.selected!=h&&i.selected!=-1){let d=i.options[i.selected].completion;for(let p=0;p<u.length;p++)if(u[p].completion==d){h=p;break}}return new Ii(u,F0(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:FE,above:o.aboveCursor},i?i.timestamp:Date.now(),h,!1)}map(e){return new Ii(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ii(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ma{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Ma(zE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(ot),o=(n.override||t.languageDataAt("autocomplete",ei(t)).map(EE)).map(h=>(this.active.find(p=>p.source==h)||new rn(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((h,d)=>h==this.active[d])&&(o=this.active);let a=this.open,u=e.effects.some(h=>h.is(ed));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!RE(o,this.active)||u?a=Ii.build(o,t,this.id,a,n,u):a&&a.disabled&&!o.some(h=>h.isPending)&&(a=null),!a&&o.every(h=>!h.isPending)&&o.some(h=>h.hasResult())&&(o=o.map(h=>h.hasResult()?new rn(h.source,0):h));for(let h of e.effects)h.is(Zf)&&(a=a&&a.setSelected(h.value,this.id));return o==this.active&&a==this.open?this:new Ma(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?BE:IE}}function RE(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t<r.length&&!r[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let i=t==r.length,o=n==e.length;if(i||o)return i==o;if(r[t++].result!=e[n++].result)return!1}}const BE={"aria-autocomplete":"list"},IE={};function F0(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const zE=[];function Ix(r,e){if(r.isUserEvent("input.complete")){let n=r.annotation(Bx);if(n&&e.activateOnCompletion(n))return 12}let t=r.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:r.isUserEvent("delete.backward")?2:r.selection?8:r.docChanged?16:0}class rn{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Ix(e,t),i=this;(n&8||n&16&&this.touches(e))&&(i=new rn(i.source,0)),n&4&&i.state==0&&(i=new rn(this.source,1)),i=i.updateFor(e,n);for(let o of e.effects)if(o.is(Ta))i=new rn(i.source,1,o.value);else if(o.is(go))i=new rn(i.source,0);else if(o.is(ed))for(let a of o.value)a.source==i.source&&(i=a);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ei(e.state))}}class Wi extends rn{constructor(e,t,n,i,o,a){super(e,3,t),this.limit=n,this.result=i,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),u=ei(e.state);if(u>a||!i||t&2&&(ei(e.startState)==this.from||u<this.limit))return new rn(this.source,t&4?1:0);let h=e.changes.mapPos(this.limit);return jE(i.validFor,e.state,o,a)?new Wi(this.source,this.explicit,h,i,o,a):i.update&&(i=i.update(i,o,a,new Nx(e.state,u,!1)))?new Wi(this.source,this.explicit,h,i,i.from,(n=i.to)!==null&&n!==void 0?n:ei(e.state)):new rn(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new Wi(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new rn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function jE(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):Rx(r,!0).test(i)}const ed=je.define({map(r,e){return r.map(t=>t.map(e))}}),Nt=Rn.define({create(){return Ma.start()},update(r,e){return r.update(e)},provide:r=>[Iv.from(r,e=>e.tooltip),ce.contentAttributes.from(r,e=>e.attrs)]});function td(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field(Nt).active.find(i=>i.source==e.source);return n instanceof Wi?(typeof t=="string"?r.dispatch({...AE(r.state,t,n.from,n.to),annotations:Bx.of(e.completion)}):t(r,e.completion,n.from,n.to),!0):!1}const FE=LE(Nt,td);function na(r,e="option"){return t=>{let n=t.state.field(Nt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(ot).interactionDelay)return!1;let i=1,o;e=="page"&&(o=zv(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=n.open.options,u=n.open.selected>-1?n.open.selected+i*(r?1:-1):r?0:a-1;return u<0?u=e=="page"?0:a-1:u>=a&&(u=e=="page"?a-1:0),t.dispatch({effects:Zf.of(u)}),!0}}const HE=r=>{let e=r.state.field(Nt,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(ot).interactionDelay?!1:td(r,e.open.options[e.open.selected])},bh=r=>r.state.field(Nt,!1)?(r.dispatch({effects:Ta.of(!0)}),!0):!1,WE=r=>{let e=r.state.field(Nt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:go.of(null)}),!0)};class qE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const VE=50,QE=1e3,UE=Ct.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of r.state.field(Nt).active)e.isPending&&this.startQuery(e)}update(r){let e=r.state.field(Nt),t=r.state.facet(ot);if(!r.selectionSet&&!r.docChanged&&r.startState.field(Nt)==e)return;let n=r.transactions.some(o=>{let a=Ix(o,t);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;o<this.running.length;o++){let a=this.running[o];if(n||a.context.abortOnDocChange&&r.docChanged||a.updates.length+r.transactions.length>VE&&Date.now()-a.time>QE){for(let u of a.context.abortListeners)try{u()}catch(h){Ut(this.view.state,h)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...r.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),r.transactions.some(o=>o.effects.some(a=>a.is(Ta)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let o of r.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:r}=this.view,e=r.field(Nt);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}startQuery(r){let{state:e}=this.view,t=ei(e),n=new Nx(e,t,r.explicit,this.view),i=new qE(r,n);this.running.push(i),Promise.resolve(r.source(n)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:go.of(null)}),Ut(this.view.state,o)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ot).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(ot),n=this.view.state.field(Nt);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(o.done===void 0)continue;if(this.running.splice(i--,1),o.done){let u=ei(o.updates.length?o.updates[0].startState:this.view.state),h=Math.min(u,o.done.from+(o.active.explicit?0:1)),d=new Wi(o.active.source,o.active.explicit,h,o.done,o.done.from,(r=o.done.to)!==null&&r!==void 0?r:u);for(let p of o.updates)d=d.update(p,t);if(d.hasResult()){e.push(d);continue}}let a=n.active.find(u=>u.source==o.active.source);if(a&&a.isPending)if(o.done==null){let u=new rn(o.active.source,0);for(let h of o.updates)u=u.update(h,t);u.isPending||e.push(u)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ed.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(Nt,!1);if(e&&e.tooltip&&this.view.state.facet(ot).closeOnBlur){let t=e.open&&zv(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:go.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ta.of(!1)}),20),this.composing=0}}}),$E=typeof navigator=="object"&&/Win/.test(navigator.platform),KE=ri.highest(ce.domEventHandlers({keydown(r,e){let t=e.state.field(Nt,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!r.key||r.key.length>1||r.ctrlKey&&!($E&&r.altKey)||r.metaKey)return!1;let n=t.open.options[t.open.selected],i=t.active.find(a=>a.source==n.source),o=n.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(r.key)>-1&&td(e,n),!1}})),GE=ce.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"}}}),yo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Xr=je.define({map(r,e){let t=e.mapPos(r,-1,Dt.TrackAfter);return t??void 0}}),nd=new class extends br{};nd.startSide=1;nd.endSide=-1;const zx=Rn.define({create(){return _e.empty},update(r,e){if(r=r.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);r=r.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(Xr)&&(r=r.update({add:[nd.range(t.value,t.value+1)]}));return r}});function XE(){return[JE,zx]}const Ch="()[]{}<>«»»«[]{}";function jx(r){for(let e=0;e<Ch.length;e+=2)if(Ch.charCodeAt(e)==r)return Ch.charAt(e+1);return Cy(r<128?r:r+1)}function Fx(r,e){return r.languageDataAt("closeBrackets",e)[0]||yo}const YE=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),JE=ce.inputHandler.of((r,e,t,n)=>{if((YE?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Un(Qt(n,0))==1||e!=i.from||t!=i.to)return!1;let o=t_(r.state,n);return o?(r.dispatch(o),!0):!1}),ZE=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Fx(r,r.selection.main.head).brackets||yo.brackets,i=null,o=r.changeByRange(a=>{if(a.empty){let u=n_(r.doc,a.head);for(let h of n)if(h==u&&Ga(r.doc,a.head)==jx(Qt(h,0)))return{changes:{from:a.head-h.length,to:a.head+h.length},range:F.cursor(a.head-h.length)}}return{range:i=a}});return i||e(r.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},e_=[{key:"Backspace",run:ZE}];function t_(r,e){let t=Fx(r,r.selection.main.head),n=t.brackets||yo.brackets;for(let i of n){let o=jx(Qt(i,0));if(e==i)return o==i?s_(r,i,n.indexOf(i+i+i)>-1,t):r_(r,i,o,t.before||yo.before);if(e==o&&Hx(r,r.selection.main.from))return i_(r,i,o)}return null}function Hx(r,e){let t=!1;return r.field(zx).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Ga(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Un(Qt(t,0)))}function n_(r,e){let t=r.sliceString(e-2,e);return Un(Qt(t,0))==t.length?t:t.slice(1)}function r_(r,e,t,n){let i=null,o=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:Xr.of(a.to+e.length),range:F.range(a.anchor+e.length,a.head+e.length)};let u=Ga(r.doc,a.head);return!u||/\s/.test(u)||n.indexOf(u)>-1?{changes:{insert:e+t,from:a.head},effects:Xr.of(a.head+e.length),range:F.cursor(a.head+e.length)}:{range:i=a}});return i?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function i_(r,e,t){let n=null,i=r.changeByRange(o=>o.empty&&Ga(r.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:F.cursor(o.head+t.length)}:n={range:o});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function s_(r,e,t,n){let i=n.stringPrefixes||yo.stringPrefixes,o=null,a=r.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:Xr.of(u.to+e.length),range:F.range(u.anchor+e.length,u.head+e.length)};let h=u.head,d=Ga(r.doc,h),p;if(d==e){if(H0(r,h))return{changes:{insert:e+e,from:h},effects:Xr.of(h+e.length),range:F.cursor(h+e.length)};if(Hx(r,h)){let v=t&&r.sliceDoc(h,h+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:h,to:h+v.length,insert:v},range:F.cursor(h+v.length)}}}else{if(t&&r.sliceDoc(h-2*e.length,h)==e+e&&(p=W0(r,h-2*e.length,i))>-1&&H0(r,p))return{changes:{insert:e+e+e+e,from:h},effects:Xr.of(h+e.length),range:F.cursor(h+e.length)};if(r.charCategorizer(h)(d)!=en.Word&&W0(r,h,i)>-1&&!o_(r,h,e,i))return{changes:{insert:e+e,from:h},effects:Xr.of(h+e.length),range:F.cursor(h+e.length)}}return{range:o=u}});return o?null:r.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function H0(r,e){let t=Et(r).resolveInner(e+1);return t.parent&&t.from==e}function o_(r,e,t,n){let i=Et(r).resolveInner(e,-1),o=n.reduce((a,u)=>Math.max(a,u.length),0);for(let a=0;a<5;a++){let u=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+o)),h=u.indexOf(t);if(!h||h>-1&&n.indexOf(u.slice(0,h))>-1){let p=i.firstChild;for(;p&&p.from==i.from&&p.to-p.from>t.length+h;){if(r.sliceDoc(p.to-t.length,p.to)==t)return!1;p=p.firstChild}return!0}let d=i.to==e&&i.parent;if(!d)break;i=d}return!1}function W0(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=en.Word)return e;for(let i of t){let o=e-i.length;if(r.sliceDoc(o,e)==i&&n(r.sliceDoc(o-1,o))!=en.Word)return o}return-1}function l_(r={}){return[KE,Nt,ot.of(r),UE,a_,GE]}const Wx=[{key:"Ctrl-Space",run:bh},{mac:"Alt-`",run:bh},{mac:"Alt-i",run:bh},{key:"Escape",run:WE},{key:"ArrowDown",run:na(!0)},{key:"ArrowUp",run:na(!1)},{key:"PageDown",run:na(!0,"page")},{key:"PageUp",run:na(!1,"page")},{key:"Enter",run:HE}],a_=ri.highest(Ca.computeN([ot],r=>r.facet(ot).defaultKeymap?[Wx]:[]));var q0={};class La{constructor(e,t,n,i,o,a,u,h,d,p=0,g){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=h,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new La(e,[],t,n,n,0,[],0,i?new V0(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 n=e>>19,i=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),u=o.dynamicPrecedence(i);if(u&&(this.score+=u),n==0){i<o.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(i,this.reducePos);return}let h=this.stack.length-(n-1)*3-(e&262144?6:0),d=h?this.stack[h-2]:this.p.ranges[0].from;i<o.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let p=this.reducePos-d;p>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=h?this.stack[h-1]:0,v=this.bufferBase+this.buffer.length-g;if(i<o.minRepeatTerm||e&131072){let w=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,d,w,v+4,!0)}if(e&262144)this.state=this.stack[h];else{let w=this.stack[h-3];this.state=o.getGoto(w,i,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(i,d)}storeNode(e,t,n,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this.buffer.length;if(a>0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==n)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,t,n,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let h=a;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=n,this.buffer[a+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=i;let u=a.stateFlag(o,1);!u&&(i>n||t<=a.maxNode)&&(this.reducePos=i),this.pushState(o,u?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let o=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(i,n,o,-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 n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new La(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new u_(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let o=0,a;o<t.length;o+=2)(a=t[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&i.push(t[o],a);if(this.stack.length<120)for(let o=0;i.length<8&&o<t.length;o+=2){let a=t[o+1];i.some((u,h)=>h&1&&u==a)||i.push(t[o],a)}t=i}let n=[];for(let i=0;i<t.length&&n.length<4;i+=2){let o=t[i+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[i],this.pos),a.reducePos=this.pos,a.score-=200,n.push(a)}return n}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 n=t>>19,i=t&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,o)=>{if(!t.includes(i))return t.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let h=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],h,!1)>=0)return u<<19|65536|h}}else{let u=n(a,o+1);if(u!=null)return u}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new V0(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 V0{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class u_{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Na{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Na(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 Na(this.stack,this.pos,this.index)}}function ra(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n<r.length;){let o=0;for(;;){let a=r.charCodeAt(n++),u=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let h=a-32;if(h>=46&&(h-=46,u=!0),o+=h,u)break;o*=46}t?t[i++]=o:t=new e(o)}return t}class da{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Q0=new da;class c_{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Q0,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!i)return null;let a=this.ranges[--i];o-=n.from-a.to,n=a}for(;t<0?o>n.to:o>=n.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];o+=a.from-n.to,n=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,i;if(t>=0&&t<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let a=this.rangeIndex,u=this.range;for(;u.to<=n;)u=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>u.to&&(this.chunk2=this.chunk2.slice(0,u.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.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=Q0,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class qi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;f_(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}qi.prototype.contextual=qi.prototype.fallback=qi.prototype.extend=!1;qi.prototype.fallback=qi.prototype.extend=!1;class h_{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function f_(r,e,t,n,i,o){let a=0,u=1<<n,{dialect:h}=t.p.parser;e:for(;(u&r[a])!=0;){let d=r[a+1];for(let w=a+3;w<d;w+=2)if((r[w+1]&u)>0){let k=r[w];if(h.allows(k)&&(e.token.value==-1||e.token.value==k||d_(k,e.token.value,i,o))){e.acceptToken(k);break}}let p=e.next,g=0,v=r[a+2];if(e.next<0&&v>g&&r[d+v*3-3]==65535){a=r[d+v*3-1];continue e}for(;g<v;){let w=g+v>>1,k=d+w+(w<<1),S=r[k],C=r[k+1]||65536;if(p<S)v=w;else if(p>=C)g=w+1;else{a=r[k+2],e.advance();continue e}}break}}function U0(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function d_(r,e,t,n){let i=U0(t,n,e);return i<0||U0(t,n,r)<i}const qt=typeof process<"u"&&q0&&/\bparse\b/.test(q0.LOG);let Ah=null;function $0(r,e,t){let n=r.cursor(Ue.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}class p_{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?$0(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?$0(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;if(e<this.safeFrom)return null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],a=this.start[t]+n.positions[i];if(a>e)return this.nextStart=a,null;if(o instanceof Je){let u=a>this.lastRepeatPos&&o.type.id>=this.minRepeat;if(a==e||u){let h=a+o.length,d;if(a>=this.safeFrom&&h<=this.safeTo&&(!(d=o.prop(Ce.lookAhead))||h+d<this.fragment.to)&&(u&&(this.lastRepeat=o,this.lastRepeatPos=a),a==e))return o}this.index[t]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class m_{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new da)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:o}=i,a=i.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<o.length;d++){if((1<<d&a)==0)continue;let p=o[d],g=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=a||g.context!=u)&&(this.updateCachedToken(g,p,e),g.mask=a,g.context=u),g.lookAhead>g.end+25&&(h=Math.max(g.lookAhead,h)),g.value!=0)){let v=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!p.extend&&(n=g,t>v))break}}for(;this.actions.length>t;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new da,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new da,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:o}=n.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let u=o.specializers[a](this.stream.read(e.start,e.end),n);if(u>=0&&n.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:o}=e,{parser:a}=e.p,{data:u}=a;for(let h=0;h<2;h++)for(let d=a.stateSlot(o,h?2:1);;d+=3){if(u[d]==65535)if(u[d+1]==1)d=Qn(u,d+2);else{i==0&&u[d+1]==2&&(i=this.putAction(Qn(u,d+2),t,n,i));break}u[d]==t&&(i=this.putAction(Qn(u,d+1),t,n,i))}return i}}class g_{constructor(e,t,n,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 c_(t,i),this.tokens=new m_(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[La.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new p_(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let u=e[a];for(;;){if(this.tokens.mainToken=null,u.pos>t)n.push(u);else{if(this.advanceStack(u,n,e))continue;{i||(i=[],o=[]),i.push(u);let h=this.tokens.getMainToken(u);o.push(h.value,h.end)}}break}}if(!n.length){let a=i&&v_(i);if(a)return qt&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw qt&&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 a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,n);if(a)return qt&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((u,h)=>h.score-u.score);n.length>a;)n.pop();n.some(u=>u.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let a=0;a<n.length-1;a++){let u=n[a];for(let h=a+1;h<n.length;h++){let d=n[h];if(u.sameState(d)||u.buffer.length>500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)n.splice(h--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,u)=>u.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a<n.length;a++)n[a].pos<this.minStackPos&&(this.minStackPos=n[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}tryReuse(e,t,n,i){if(!n)return null;let o=e.curContext&&e.curContext.tracker.strict,a=o?e.curContext.hash:0;for(;n;){let u=this.parser.nodeSet.types[n.type.id]!=n.type?-1:this.parser.getGoto(e.state,n.type.id);if(u>-1&&n.length&&(!o||(n.prop(Ce.contextHash)||0)==a))return e.useNode(n,u,t),n;if(n.children.length==0||n.positions[0]>0)break;let h=n.children[0];if(h instanceof Je&&(!i||h.type.id>=this.parser.minRepeatTerm))n=h;else break}return null}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,a=qt?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos<i&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,i,this.fragments.nodeAt(i),!1);if(d)return qt&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0}let u=o.stateSlot(e.state,4);if(u>0)return e.reduce(u),qt&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let d=0;d<h.length;){let p=h[d++],g=h[d++],v=h[d++],w=d==h.length||!n,k=w?e:e.split(),S=this.tokens.mainToken;if(k.apply(p,g,S?S.start:k.pos,v),qt&&console.log(a+this.stackID(k)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${i}${k==e?"":", split"})`),w)return!0;k.pos>i?t.push(k):n.push(k)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return K0(e,t),!0}}runRecovery(e,t,n){let i=null,o=!1;for(let a=0;a<e.length;a++){let u=e[a],h=t[a<<1],d=t[(a<<1)+1],p=qt?this.stackID(u)+" -> ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),qt&&console.log(p+this.stackID(u)+" (restarted)"),this.advanceFully(u,n))))continue;let g=u.split(),v=p;for(let w=0;w<10&&g.forceReduce()&&(qt&&console.log(v+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,n));w++)qt&&(v=this.stackID(g)+" -> ");for(let w of u.recoverByInsert(h))qt&&console.log(p+this.stackID(w)+" (via recover-insert)"),this.advanceFully(w,n);this.stream.end>u.pos?(d==u.pos&&(d++,h=0),u.recoverByDelete(h,d),qt&&console.log(p+this.stackID(u)+` (via recover-delete ${this.parser.getName(h)})`),K0(u,n)):(!i||i.score<g.score)&&(i=g)}return i}stackToTree(e){return e.close(),Je.build({buffer:Na.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=(Ah||(Ah=new WeakMap)).get(e);return t||Ah.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function K0(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class y_{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Da extends Vv{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 u=0;u<e.repeatNodeCount;u++)t.push("");let n=Object.keys(e.topRules).map(u=>e.topRules[u][1]),i=[];for(let u=0;u<t.length;u++)i.push([]);function o(u,h,d){i[u].push([h,h.deserialize(String(d))])}if(e.nodeProps)for(let u of e.nodeProps){let h=u[0];typeof h=="string"&&(h=Ce[h]);for(let d=1;d<u.length;){let p=u[d++];if(p>=0)o(p,h,u[d++]);else{let g=u[d+-p];for(let v=-p;v>0;v--)o(u[d++],h,g);d++}}}this.nodeSet=new qf(t.map((u,h)=>It.define({name:h>=this.minRepeatTerm?void 0:u,id:h,props:i[h],top:n.indexOf(h)>-1,error:h==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(h)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Fv;let a=ra(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;u<this.specializerSpecs.length;u++)this.specialized[u]=this.specializerSpecs[u].term;this.specializers=this.specializerSpecs.map(G0),this.states=ra(e.states,Uint32Array),this.data=ra(e.stateData),this.goto=ra(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(u=>typeof u=="number"?new qi(a,u):u),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new g_(this,e,t,n);for(let o of this.wrappers)i=o(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let o=i[t+1];;){let a=i[o++],u=a&1,h=i[o++];if(u&&n)return h;for(let d=o+(a>>1);o<d;o++)if(i[o]==e)return h;if(u)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),a;;o+=3){if((a=n[o])==65535)if(n[o+1]==1)a=n[o=Qn(n,o+2)];else{if(n[o+1]==2)return Qn(n,o+2);break}if(a==t||a==0)return Qn(n,o+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,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Qn(this.data,o+2);else break;i=t(Qn(this.data,o+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Qn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];t.some((o,a)=>a&1&&o==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(Da.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(o=>o.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let o=e.specializers.find(u=>u.from==n.external);if(!o)return n;let a=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[i]=G0(a),a})),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),n=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(n[a]=!0)}let i=null;for(let o=0;o<t.length;o++)if(!n[o])for(let a=this.dialects[t[o]],u;(u=this.data[a++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[u]=1;return new y_(e,n,i)}static deserialize(e){return new Da(e)}}function Qn(r,e){return r[e]|r[e+1]<<16}function v_(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function G0(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}const x_=36,X0=1,w_=2,Ti=3,Eh=4,k_=5,S_=6,b_=7,C_=8,A_=9,E_=10,__=11,O_=12,P_=13,T_=14,M_=15,L_=16,N_=17,Y0=18,D_=19,qx=20,Vx=21,J0=22,R_=23,B_=24;function bf(r){return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57}function I_(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70}function $r(r,e,t){for(let n=!1;;){if(r.next<0)return;if(r.next==e&&!n){r.advance();return}n=t&&!n&&r.next==92,r.advance()}}function z_(r,e){e:for(;;){if(r.next<0)return;if(r.next==36){r.advance();for(let t=0;t<e.length;t++){if(r.next!=e.charCodeAt(t))continue e;r.advance()}if(r.next==36){r.advance();return}}else r.advance()}}function j_(r,e){let t="[{<(".indexOf(String.fromCharCode(e)),n=t<0?e:"]}>)".charCodeAt(t);for(;;){if(r.next<0)return;if(r.next==n&&r.peek(1)==39){r.advance(2);return}r.advance()}}function Cf(r,e){for(;!(r.next!=95&&!bf(r.next));)e!=null&&(e+=String.fromCharCode(r.next)),r.advance();return e}function F_(r){if(r.next==39||r.next==34||r.next==96){let e=r.next;r.advance(),$r(r,e,!1)}else Cf(r)}function Z0(r,e){for(;r.next==48||r.next==49;)r.advance();e&&r.next==e&&r.advance()}function ey(r,e){for(;;){if(r.next==46){if(e)break;e=!0}else if(r.next<48||r.next>57)break;r.advance()}if(r.next==69||r.next==101)for(r.advance(),(r.next==43||r.next==45)&&r.advance();r.next>=48&&r.next<=57;)r.advance()}function ty(r){for(;!(r.next<0||r.next==10);)r.advance()}function Qr(r,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==r)return!0;return!1}const _h=` \r
53
+ `;function Qx(r,e,t){let n=Object.create(null);n.true=n.false=k_,n.null=n.unknown=S_;for(let i of r.split(" "))i&&(n[i]=qx);for(let i of e.split(" "))i&&(n[i]=Vx);for(let i of(t||"").split(" "))i&&(n[i]=B_);return n}const Ao="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 ",Eo="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 ",Af={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:Qx(Eo,Ao)};function H_(r,e,t,n){let i={};for(let o in Af)i[o]=(r.hasOwnProperty(o)?r:Af)[o];return e&&(i.words=Qx(e,t||"",n)),i}function Ux(r){return new h_(e=>{var t;let{next:n}=e;if(e.advance(),Qr(n,_h)){for(;Qr(e.next,_h);)e.advance();e.acceptToken(x_)}else if(n==36&&r.doubleDollarQuotedStrings){let i=Cf(e,"");e.next==36&&(e.advance(),z_(e,i),e.acceptToken(Ti))}else if(n==39||n==34&&r.doubleQuotedStrings)$r(e,n,r.backslashEscapes),e.acceptToken(Ti);else if(n==35&&r.hashComments||n==47&&e.next==47&&r.slashComments)ty(e),e.acceptToken(X0);else if(n==45&&e.next==45&&(!r.spaceAfterDashes||e.peek(1)==32))ty(e),e.acceptToken(X0);else if(n==47&&e.next==42){e.advance();for(let i=1;;){let o=e.next;if(e.next<0)break;if(e.advance(),o==42&&e.next==47){if(i--,e.advance(),!i)break}else o==47&&e.next==42&&(i++,e.advance())}e.acceptToken(w_)}else if((n==101||n==69)&&e.next==39)e.advance(),$r(e,39,!0),e.acceptToken(Ti);else if((n==110||n==78)&&e.next==39&&r.charSetCasts)e.advance(),$r(e,39,r.backslashEscapes),e.acceptToken(Ti);else if(n==95&&r.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),$r(e,39,r.backslashEscapes),e.acceptToken(Ti);break}if(!bf(e.next))break;e.advance()}else if(r.plsqlQuotingMechanism&&(n==113||n==81)&&e.next==39&&e.peek(1)>0&&!Qr(e.peek(1),_h)){let i=e.peek(1);e.advance(2),j_(e,i),e.acceptToken(Ti)}else if(Qr(n,r.identifierQuotes)){const i=n==91?93:n;$r(e,i,!1),e.acceptToken(D_)}else if(n==40)e.acceptToken(b_);else if(n==41)e.acceptToken(C_);else if(n==123)e.acceptToken(A_);else if(n==125)e.acceptToken(E_);else if(n==91)e.acceptToken(__);else if(n==93)e.acceptToken(O_);else if(n==59)e.acceptToken(P_);else if(r.unquotedBitLiterals&&n==48&&e.next==98)e.advance(),Z0(e),e.acceptToken(J0);else if((n==98||n==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),r.treatBitsAsBytes?($r(e,i,r.backslashEscapes),e.acceptToken(R_)):(Z0(e,i),e.acceptToken(J0))}else if(n==48&&(e.next==120||e.next==88)||(n==120||n==88)&&e.next==39){let i=e.next==39;for(e.advance();I_(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(Eh)}else if(n==46&&e.next>=48&&e.next<=57)ey(e,!0),e.acceptToken(Eh);else if(n==46)e.acceptToken(T_);else if(n>=48&&n<=57)ey(e,!1),e.acceptToken(Eh);else if(Qr(n,r.operatorChars)){for(;Qr(e.next,r.operatorChars);)e.advance();e.acceptToken(M_)}else if(Qr(n,r.specialVar))e.next==n&&e.advance(),F_(e),e.acceptToken(N_);else if(n==58||n==44)e.acceptToken(L_);else if(bf(n)){let i=Cf(e,String.fromCharCode(n));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?Y0:(t=r.words[i.toLowerCase()])!==null&&t!==void 0?t:Y0)}})}const $x=Ux(Af),W_=Da.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,$x],topRules:{Script:[0,25]},tokenPrec:0});function Ef(r){let e=r.cursor().moveTo(r.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function vo(r,e){let t=r.sliceString(e.from,e.to),n=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return n?n[2]:t}function Ra(r){return r&&(r.name=="Identifier"||r.name=="QuotedIdentifier")}function q_(r,e){if(e.name=="CompositeIdentifier"){let t=[];for(let n=e.firstChild;n;n=n.nextSibling)Ra(n)&&t.push(vo(r,n));return t}return[vo(r,e)]}function ny(r,e){for(let t=[];;){if(!e||e.name!=".")return t;let n=Ef(e);if(!Ra(n))return t;t.unshift(vo(r,n)),e=Ef(n)}}function V_(r,e){let t=Et(r).resolveInner(e,-1),n=U_(r.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?r.doc.sliceString(t.from,t.from+1):null,parents:ny(r.doc,Ef(t)),aliases:n}:t.name=="."?{from:e,quoted:null,parents:ny(r.doc,t),aliases:n}:{from:e,quoted:null,parents:[],empty:!0,aliases:n}}const Q_=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function U_(r,e){let t;for(let i=e;!t;i=i.parent){if(!i)return null;i.name=="Statement"&&(t=i)}let n=null;for(let i=t.firstChild,o=!1,a=null;i;i=i.nextSibling){let u=i.name=="Keyword"?r.sliceString(i.from,i.to).toLowerCase():null,h=null;if(!o)o=u=="from";else if(u=="as"&&a&&Ra(i.nextSibling))h=vo(r,i.nextSibling);else{if(u&&Q_.has(u))break;a&&Ra(i)&&(h=vo(r,i))}h&&(n||(n=Object.create(null)),n[h]=q_(r,a)),a=/Identifier$/.test(i.name)?i:null}return n}function $_(r,e,t){return t.map(n=>({...n,label:n.label[0]==r?n.label:r+n.label+e,apply:void 0}))}const K_=/^\w*$/,G_=/^[`'"\[]?\w*[`'"\]]?$/;function ry(r){return r.self&&typeof r.self.label=="string"}class rd{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)),n=t[e];return n||(e&&!this.list.some(i=>i.label==e)&&this.list.push(iy(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new rd(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(n=>n.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"?iy(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):ry(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],i=null,o=t.replace(/\\?\./g,u=>u=="."?"\0":u).split("\0"),a=this;ry(n)&&(i=n.self,n=n.children);for(let u=0;u<o.length;u++)i&&u==o.length-1&&a.addCompletion(i),a=a.child(o[u].replace(/\\\./g,"."));a.addNamespace(n)}}}function iy(r,e,t,n){return new RegExp("^[a-z_][a-z_\\d]*$",n?"i":"").test(r)?{label:r,type:e}:{label:r,type:e,apply:t+r+Kx(t)}}function Kx(r){return r==="["?"]":r}function X_(r,e,t,n,i,o){var a;let u=((a=o==null?void 0:o.spec.identifierQuotes)===null||a===void 0?void 0:a[0])||'"',h=new rd(u,!!(o!=null&&o.spec.caseInsensitiveIdentifiers)),d=i?h.child(i):null;return h.addNamespace(r),e&&(d||h).addCompletions(e),t&&h.addCompletions(t),d&&h.addCompletions(d.list),n&&h.addCompletions((d||h).child(n).list),p=>{let{parents:g,from:v,quoted:w,empty:k,aliases:S}=V_(p.state,p.pos);if(k&&!p.explicit)return null;S&&g.length==1&&(g=S[g[0]]||g);let C=h;for(let D of g){for(;!C.children||!C.children[D];)if(C==h&&d)C=d;else if(C==d&&n)C=C.child(n);else return null;let M=C.maybeChild(D);if(!M)return null;C=M}let P=C.list;if(C==h&&S&&(P=P.concat(Object.keys(S).map(D=>({label:D,type:"constant"})))),w){let D=w[0],M=Kx(D),Q=p.state.sliceDoc(p.pos,p.pos+1)==M;return{from:v,to:Q?p.pos+1:void 0,options:$_(D,M,P),validFor:G_}}else return{from:v,options:P,validFor:K_}}}function Y_(r){return r==Vx?"type":r==qx?"keyword":"variable"}function J_(r,e,t){let n=Object.keys(r).map(i=>t(e?i.toUpperCase():i,Y_(r[i])));return CE(["QuotedIdentifier","String","LineComment","BlockComment","."],Dx(n))}let Z_=W_.configure({props:[Gv.add({Statement:q2()}),U2.add({Statement(r,e){return{from:Math.min(r.from+100,e.doc.lineAt(r.from).to),to:r.to}},BlockComment(r){return{from:r.from+2,to:r.to-2}}}),Qv({Keyword:G.keyword,Type:G.typeName,Builtin:G.standard(G.name),Bits:G.number,Bytes:G.string,Bool:G.bool,Null:G.null,Number:G.number,String:G.string,Identifier:G.name,QuotedIdentifier:G.special(G.string),SpecialVar:G.special(G.name),LineComment:G.lineComment,BlockComment:G.blockComment,Operator:G.operator,"Semi Punctuation":G.punctuation,"( )":G.paren,"{ }":G.brace,"[ ]":G.squareBracket})]});class Pr{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(e,t){return new Pr(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=H_(e,e.keywords,e.types,e.builtin),n=Ea.define({name:"sql",parser:Z_.configure({tokenizers:[{from:$x,to:Ux(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new Pr(t,n,e)}}function eO(r,e){return{label:r,type:e,boost:-1}}function tO(r,e=!1,t){return J_(r.dialect.words,e,t||eO)}function nO(r){return r.schema?X_(r.schema,r.tables,r.schemas,r.defaultTable,r.defaultSchema,r.dialect||Xa):()=>null}function rO(r){return r.schema?(r.dialect||Xa).language.data.of({autocomplete:nO(r)}):[]}function iO(r={}){let e=r.dialect||Xa;return new D2(e.language,[rO(r),e.language.data.of({autocomplete:tO(e,r.upperCaseKeywords,r.keywordCompletion)})])}const Xa=Pr.define({}),sO=Pr.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:"",keywords:Eo+"abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes",types:Ao+"bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml"}),oO="accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill",lO=Ao+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed",aO="charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee",uO=Pr.define({operatorChars:"*+-%<>!=&|^",charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:"@?",identifierQuotes:"`",keywords:Eo+"group_concat "+oO,types:lO,builtin:aO});let cO="approx_count_distinct approx_percentile_cont approx_percentile_disc avg checksum_agg count count_big grouping grouping_id max min product stdev stdevp sum var varp ai_generate_embeddings ai_generate_chunks cume_dist first_value lag last_value lead percentile_cont percentile_disc percent_rank left_shift right_shift bit_count get_bit set_bit collationproperty tertiary_weights @@datefirst @@dbts @@langid @@language @@lock_timeout @@max_connections @@max_precision @@nestlevel @@options @@remserver @@servername @@servicename @@spid @@textsize @@version cast convert parse try_cast try_convert try_parse asymkey_id asymkeyproperty certproperty cert_id crypt_gen_random decryptbyasymkey decryptbycert decryptbykey decryptbykeyautoasymkey decryptbykeyautocert decryptbypassphrase encryptbyasymkey encryptbycert encryptbykey encryptbypassphrase hashbytes is_objectsigned key_guid key_id key_name signbyasymkey signbycert symkeyproperty verifysignedbycert verifysignedbyasymkey @@cursor_rows @@fetch_status cursor_status datalength ident_current ident_incr ident_seed identity sql_variant_property @@datefirst current_timestamp current_timezone current_timezone_id date_bucket dateadd datediff datediff_big datefromparts datename datepart datetime2fromparts datetimefromparts datetimeoffsetfromparts datetrunc day eomonth getdate getutcdate isdate month smalldatetimefromparts switchoffset sysdatetime sysdatetimeoffset sysutcdatetime timefromparts todatetimeoffset year edit_distance edit_distance_similarity jaro_winkler_distance jaro_winkler_similarity edge_id_from_parts graph_id_from_edge_id graph_id_from_node_id node_id_from_parts object_id_from_edge_id object_id_from_node_id json isjson json_array json_contains json_modify json_object json_path_exists json_query json_value regexp_like regexp_replace regexp_substr regexp_instr regexp_count regexp_matches regexp_split_to_table abs acos asin atan atn2 ceiling cos cot degrees exp floor log log10 pi power radians rand round sign sin sqrt square tan choose greatest iif least @@procid app_name applock_mode applock_test assemblyproperty col_length col_name columnproperty databasepropertyex db_id db_name file_id file_idex file_name filegroup_id filegroup_name filegroupproperty fileproperty filepropertyex fulltextcatalogproperty fulltextserviceproperty index_col indexkey_property indexproperty next value for object_definition object_id object_name object_schema_name objectproperty objectpropertyex original_db_name parsename schema_id schema_name scope_identity serverproperty stats_date type_id type_name typeproperty dense_rank ntile rank row_number publishingservername certenclosed certprivatekey current_user database_principal_id has_dbaccess has_perms_by_name is_member is_rolemember is_srvrolemember loginproperty original_login permissions pwdencrypt pwdcompare session_user sessionproperty suser_id suser_name suser_sid suser_sname system_user user user_id user_name ascii char charindex concat concat_ws difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim soundex space str string_agg string_escape stuff substring translate trim unicode upper $partition @@error @@identity @@pack_received @@rowcount @@trancount binary_checksum checksum compress connectionproperty context_info current_request_id current_transaction_id decompress error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big session_context xact_state @@connections @@cpu_busy @@idle @@io_busy @@pack_sent @@packet_errors @@timeticks @@total_errors @@total_read @@total_write textptr textvalid columns_updated eventdata trigger_nestlevel vector_distance vectorproperty vector_search generate_series opendatasource openjson openquery openrowset openxml predict string_split coalesce nullif apply catch filter force include keep keepfixed modify optimize parameterization parameters partition recompile sequence set";const hO=Pr.define({keywords:Eo+"add external procedure all fetch public alter file raiserror and fillfactor read any for readtext as foreign reconfigure asc freetext references authorization freetexttable replication backup from restore begin full restrict between function return break goto revert browse grant revoke bulk group right by having rollback cascade holdlock rowcount case identity rowguidcol check identity_insert rule checkpoint identitycol save close if schema clustered in securityaudit coalesce index select collate inner semantickeyphrasetable column insert semanticsimilaritydetailstable commit intersect semanticsimilaritytable compute into session_user constraint is set contains join setuser containstable key shutdown continue kill some convert left statistics create like system_user cross lineno table current load tablesample current_date merge textsize current_time national then current_timestamp nocheck to current_user nonclustered top cursor not tran database null transaction dbcc nullif trigger deallocate of truncate declare off try_convert default offsets tsequal delete on union deny open unique desc opendatasource unpivot disk openquery update distinct openrowset updatetext distributed openxml use double option user drop or values dump order varying else outer view end over waitfor errlvl percent when escape pivot where except plan while exec precision with execute primary within group exists print writetext exit proc noexpand index forceseek forcescan holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot spatial_window_max_cells tablock tablockx updlock xlock keepidentity keepdefaults ignore_constraints ignore_triggers",types:Ao+"smalldatetime datetimeoffset datetime2 datetime bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml",builtin:cO,operatorChars:"*+-%<>!=^&|/",specialVar:"@",identifierQuotes:'"['}),fO=Pr.define({keywords:Eo+"abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual",types:Ao+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real",builtin:"auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),dO={postgresql:sO,mysql:uO,sqlite:fO,mssql:hO,standard:Xa},De=r=>`var(--qcli-${r})`,pO=ce.theme({"&":{color:De("text"),backgroundColor:De("control"),borderRadius:"0.5rem",border:`1px solid ${De("border")}`,fontSize:"0.75rem"},"&.cm-focused":{outline:"none",borderColor:`color-mix(in srgb, ${De("primary")} 50%, transparent)`},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",lineHeight:"1.6",minHeight:"9rem",maxHeight:"50vh"},".cm-content":{padding:"0.5rem 0",caretColor:De("heading")},".cm-cursor, .cm-dropCursor":{borderLeftColor:De("heading")},".cm-gutters":{backgroundColor:"transparent",color:De("subtle"),border:"none",borderRight:`1px solid color-mix(in srgb, ${De("border")} 75%, transparent)`},".cm-activeLine":{backgroundColor:`color-mix(in srgb, ${De("controlHover")} 60%, transparent)`},".cm-activeLineGutter":{backgroundColor:"transparent",color:De("muted")},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`color-mix(in srgb, ${De("primary")} 30%, transparent) !important`},".cm-matchingBracket":{backgroundColor:`color-mix(in srgb, ${De("accent")} 25%, transparent)`,outline:"none"},".cm-placeholder":{color:De("subtle")},".cm-tooltip":{backgroundColor:De("popover"),color:De("text"),border:`1px solid ${De("border")}`,borderRadius:"0.5rem",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",maxHeight:"14rem"},".cm-tooltip-autocomplete > ul > li":{padding:"0.15rem 0.5rem !important"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:`color-mix(in srgb, ${De("primary")} 25%, transparent)`,color:De("heading")},".cm-completionDetail":{color:De("subtle"),fontStyle:"normal",marginLeft:"0.75rem"},".cm-completionMatchedText":{color:De("accent"),textDecoration:"none"}}),mO=Va.define([{tag:[G.keyword,G.operatorKeyword,G.modifier],color:De("primary"),fontWeight:"600"},{tag:[G.string,G.special(G.string)],color:De("success")},{tag:[G.number,G.bool,G.null],color:De("warning")},{tag:[G.comment,G.lineComment,G.blockComment],color:De("subtle"),fontStyle:"italic"},{tag:[G.typeName,G.standard(G.name)],color:De("info")},{tag:[G.special(G.name),G.quote],color:De("accent")},{tag:[G.operator,G.punctuation,G.bracket],color:De("muted")}]);function sy(r,e){return iO({dialect:dO[r],schema:e,upperCaseKeywords:!0})}function gO({value:r,onChange:e,onRun:t,dialect:n,schema:i,placeholder:o,ariaLabel:a}){const u=oe.useRef(null),h=oe.useRef(null),d=oe.useRef(new Qi),p=oe.useRef(new Qi),g=oe.useRef({onChange:e,onRun:t});return oe.useLayoutEffect(()=>{g.current={onChange:e,onRun:t}}),oe.useEffect(()=>{const v=()=>(g.current.onRun(),!0),w=new ce({parent:u.current,state:Me.create({doc:r,extensions:[h2(),p2(),qC(),xA(),NC(),Q2(),rA(),XE(),l_({icons:!1}),GC(),ce.lineWrapping,ri.highest(Ca.of([{key:"Mod-Enter",run:v,preventDefault:!0}])),Ca.of([...e_,...kE,...OA,...Wx,SE]),K2(mO),pO,d.current.of(sy(n,i)),p.current.of(o?u0(o):[]),ce.contentAttributes.of({"aria-label":a,"aria-multiline":"true",role:"textbox",autocapitalize:"off",autocorrect:"off",spellcheck:"false",enterkeyhint:"enter"}),ce.updateListener.of(k=>{k.docChanged&&g.current.onChange(k.state.doc.toString())})]})});return h.current=w,()=>{w.destroy(),h.current=null}},[]),oe.useEffect(()=>{const v=h.current;if(!v)return;const w=v.state.doc.toString();w!==r&&v.dispatch({changes:{from:0,to:w.length,insert:r}})},[r]),oe.useEffect(()=>{var v;(v=h.current)==null||v.dispatch({effects:d.current.reconfigure(sy(n,i))})},[n,i]),oe.useEffect(()=>{var v;(v=h.current)==null||v.dispatch({effects:p.current.reconfigure(o?u0(o):[])})},[o]),E.jsx("div",{ref:u,className:"qcli-sql-editor min-w-0","data-dialect":n})}const yO=Object.freeze(Object.defineProperty({__proto__:null,default:gO},Symbol.toStringTag,{value:"Module"}));export{xO as default,hS as sourceOf};