@i14ks/ccv 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +91 -5
- package/bundle/ccv.mjs +936 -60
- package/package.json +2 -1
- package/web/apple-touch-icon.png +0 -0
- package/web/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/web/assets/addon-fit-CevVMrUA.js +1 -0
- package/web/assets/addon-web-links-CnB65OV_.js +1 -0
- package/web/assets/codemirror-DNwOY4Od.js +1 -0
- package/web/assets/index--X3c59oq.js +7 -0
- package/web/assets/index-1vcRYewd.js +1 -0
- package/web/assets/index-6JwHpeCk.js +1 -0
- package/web/assets/index-891wE-Rj.js +7 -0
- package/web/assets/index-9FU2NRHn.js +13 -0
- package/web/assets/index-9FstbMxt.js +1 -0
- package/web/assets/{index-1iYnLw7q.js → index-AptXdWK3.js} +1 -1
- package/web/assets/index-BFn7R550.js +1 -0
- package/web/assets/index-BFoyQq0x.js +1 -0
- package/web/assets/index-BHot-lnj.js +5 -0
- package/web/assets/index-Bh-gxu6Z.js +1 -0
- package/web/assets/index-Bj3bZRgw.js +2 -0
- package/web/assets/index-BvcLb1wh.js +1 -0
- package/web/assets/index-C9MQTTvT.js +1 -0
- package/web/assets/{index-D-buiUaW.js → index-CKclwUJ-.js} +2 -2
- package/web/assets/index-Cfccn-Ob.js +1 -0
- package/web/assets/index-Cvz4rtnD.js +1 -0
- package/web/assets/{index-C9vrRfhW.js → index-CzlH_Mh9.js} +3 -3
- package/web/assets/index-D9UhxKGI.js +126 -0
- package/web/assets/index-DB9ZVtJ8.js +1 -0
- package/web/assets/index-DmJcZf8t.css +1 -0
- package/web/assets/index-DtcfXsIX.js +3 -0
- package/web/assets/index-r40StboH.js +1 -0
- package/web/assets/xterm-D6Mng-DB.js +9 -0
- package/web/assets/xterm-DYP7pi_n.css +32 -0
- package/web/favicon.ico +0 -0
- package/web/favicon.png +0 -0
- package/web/favicon.svg +4 -0
- package/web/index.html +12 -2
- package/web/assets/index-7poo-d50.js +0 -1
- package/web/assets/index-BMMMWgeR.js +0 -13
- package/web/assets/index-BW8WtNtA.js +0 -1
- package/web/assets/index-C7CZdm1C.js +0 -3
- package/web/assets/index-CVP8I8tU.js +0 -1
- package/web/assets/index-CpwLxLdo.js +0 -1
- package/web/assets/index-DCtzpGvd.js +0 -133
- package/web/assets/index-DDnDtQl5.js +0 -1
- package/web/assets/index-DKwcT9vY.js +0 -1
- package/web/assets/index-DYr0npzc.css +0 -1
- package/web/assets/index-DcGWR_5B.js +0 -1
- package/web/assets/index-PCsjZn72.js +0 -1
- package/web/assets/index-XBmPtinY.js +0 -7
- package/web/assets/index-gDk09Gbz.js +0 -1
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BMMMWgeR.js","./index-1iYnLw7q.js","./index-DcGWR_5B.js","./index-CpwLxLdo.js","./index-7poo-d50.js","./index-C9vrRfhW.js","./index-C7CZdm1C.js","./index-PCsjZn72.js","./index-DDnDtQl5.js","./index-BW8WtNtA.js","./index-DKwcT9vY.js","./index-XBmPtinY.js","./index-gDk09Gbz.js","./index-D-buiUaW.js","./index-CVP8I8tU.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var d2=Object.defineProperty;var mv=n=>{throw TypeError(n)};var p2=(n,e,t)=>e in n?d2(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Et=(n,e,t)=>p2(n,typeof e!="symbol"?e+"":e,t),ag=(n,e,t)=>e.has(n)||mv("Cannot "+t);var Ue=(n,e,t)=>(ag(n,e,"read from private field"),t?t.call(n):e.get(n)),Kt=(n,e,t)=>e.has(n)?mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),bt=(n,e,t,i)=>(ag(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),hn=(n,e,t)=>(ag(n,e,"access private method"),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(l){if(l.ep)return;l.ep=!0;const a=t(l);fetch(l.href,a)}})();var og={exports:{}},ru={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and 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 gv;function m2(){if(gv)return ru;gv=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,a){var o=null;if(a!==void 0&&(o=""+a),l.key!==void 0&&(o=""+l.key),"key"in l){a={};for(var u in l)u!=="key"&&(a[u]=l[u])}else a=l;return l=a.ref,{$$typeof:n,type:i,key:o,ref:l!==void 0?l:null,props:a}}return ru.Fragment=e,ru.jsx=t,ru.jsxs=t,ru}var yv;function g2(){return yv||(yv=1,og.exports=m2()),og.exports}var y=g2(),cg={exports:{}},Pe={};/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and 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 bv;function y2(){if(bv)return Pe;bv=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.iterator;function v(N){return N===null||typeof N!="object"?null:(N=x&&N[x]||N["@@iterator"],typeof N=="function"?N:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function E(N,F,se){this.props=N,this.context=F,this.refs=A,this.updater=se||w}E.prototype.isReactComponent={},E.prototype.setState=function(N,F){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,F,"setState")},E.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function D(){}D.prototype=E.prototype;function B(N,F,se){this.props=N,this.context=F,this.refs=A,this.updater=se||w}var H=B.prototype=new D;H.constructor=B,C(H,E.prototype),H.isPureReactComponent=!0;var z=Array.isArray;function L(){}var R={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function fe(N,F,se){var ae=se.ref;return{$$typeof:n,type:N,key:F,ref:ae!==void 0?ae:null,props:se}}function Te(N,F){return fe(N.type,F,N.props)}function he(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function le(N){var F={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(se){return F[se]})}var Me=/\/+/g;function Ae(N,F){return typeof N=="object"&&N!==null&&N.key!=null?le(""+N.key):F.toString(36)}function Se(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(L,L):(N.status="pending",N.then(function(F){N.status==="pending"&&(N.status="fulfilled",N.value=F)},function(F){N.status==="pending"&&(N.status="rejected",N.reason=F)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function q(N,F,se,ae,de){var _e=typeof N;(_e==="undefined"||_e==="boolean")&&(N=null);var Re=!1;if(N===null)Re=!0;else switch(_e){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(N.$$typeof){case n:case e:Re=!0;break;case p:return Re=N._init,q(Re(N._payload),F,se,ae,de)}}if(Re)return de=de(N),Re=ae===""?"."+Ae(N,0):ae,z(de)?(se="",Re!=null&&(se=Re.replace(Me,"$&/")+"/"),q(de,F,se,"",function(xt){return xt})):de!=null&&(he(de)&&(de=Te(de,se+(de.key==null||N&&N.key===de.key?"":(""+de.key).replace(Me,"$&/")+"/")+Re)),F.push(de)),1;Re=0;var ft=ae===""?".":ae+":";if(z(N))for(var ht=0;ht<N.length;ht++)ae=N[ht],_e=ft+Ae(ae,ht),Re+=q(ae,F,se,_e,de);else if(ht=v(N),typeof ht=="function")for(N=ht.call(N),ht=0;!(ae=N.next()).done;)ae=ae.value,_e=ft+Ae(ae,ht++),Re+=q(ae,F,se,_e,de);else if(_e==="object"){if(typeof N.then=="function")return q(Se(N),F,se,ae,de);throw F=String(N),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return Re}function J(N,F,se){if(N==null)return N;var ae=[],de=0;return q(N,ae,"","",function(_e){return F.call(se,_e,de++)}),ae}function W(N){if(N._status===-1){var F=N._result;F=F(),F.then(function(se){(N._status===0||N._status===-1)&&(N._status=1,N._result=se)},function(se){(N._status===0||N._status===-1)&&(N._status=2,N._result=se)}),N._status===-1&&(N._status=0,N._result=F)}if(N._status===1)return N._result.default;throw N._result}var Ee=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},Ne={map:J,forEach:function(N,F,se){J(N,function(){F.apply(this,arguments)},se)},count:function(N){var F=0;return J(N,function(){F++}),F},toArray:function(N){return J(N,function(F){return F})||[]},only:function(N){if(!he(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Pe.Activity=b,Pe.Children=Ne,Pe.Component=E,Pe.Fragment=t,Pe.Profiler=l,Pe.PureComponent=B,Pe.StrictMode=i,Pe.Suspense=f,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(N){return R.H.useMemoCache(N)}},Pe.cache=function(N){return function(){return N.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(N,F,se){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var ae=C({},N.props),de=N.key;if(F!=null)for(_e in F.key!==void 0&&(de=""+F.key),F)!te.call(F,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&F.ref===void 0||(ae[_e]=F[_e]);var _e=arguments.length-2;if(_e===1)ae.children=se;else if(1<_e){for(var Re=Array(_e),ft=0;ft<_e;ft++)Re[ft]=arguments[ft+2];ae.children=Re}return fe(N.type,de,ae)},Pe.createContext=function(N){return N={$$typeof:o,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:a,_context:N},N},Pe.createElement=function(N,F,se){var ae,de={},_e=null;if(F!=null)for(ae in F.key!==void 0&&(_e=""+F.key),F)te.call(F,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(de[ae]=F[ae]);var Re=arguments.length-2;if(Re===1)de.children=se;else if(1<Re){for(var ft=Array(Re),ht=0;ht<Re;ht++)ft[ht]=arguments[ht+2];de.children=ft}if(N&&N.defaultProps)for(ae in Re=N.defaultProps,Re)de[ae]===void 0&&(de[ae]=Re[ae]);return fe(N,_e,de)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(N){return{$$typeof:u,render:N}},Pe.isValidElement=he,Pe.lazy=function(N){return{$$typeof:p,_payload:{_status:-1,_result:N},_init:W}},Pe.memo=function(N,F){return{$$typeof:d,type:N,compare:F===void 0?null:F}},Pe.startTransition=function(N){var F=R.T,se={};R.T=se;try{var ae=N(),de=R.S;de!==null&&de(se,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(L,Ee)}catch(_e){Ee(_e)}finally{F!==null&&se.types!==null&&(F.types=se.types),R.T=F}},Pe.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Pe.use=function(N){return R.H.use(N)},Pe.useActionState=function(N,F,se){return R.H.useActionState(N,F,se)},Pe.useCallback=function(N,F){return R.H.useCallback(N,F)},Pe.useContext=function(N){return R.H.useContext(N)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(N,F){return R.H.useDeferredValue(N,F)},Pe.useEffect=function(N,F){return R.H.useEffect(N,F)},Pe.useEffectEvent=function(N){return R.H.useEffectEvent(N)},Pe.useId=function(){return R.H.useId()},Pe.useImperativeHandle=function(N,F,se){return R.H.useImperativeHandle(N,F,se)},Pe.useInsertionEffect=function(N,F){return R.H.useInsertionEffect(N,F)},Pe.useLayoutEffect=function(N,F){return R.H.useLayoutEffect(N,F)},Pe.useMemo=function(N,F){return R.H.useMemo(N,F)},Pe.useOptimistic=function(N,F){return R.H.useOptimistic(N,F)},Pe.useReducer=function(N,F,se){return R.H.useReducer(N,F,se)},Pe.useRef=function(N){return R.H.useRef(N)},Pe.useState=function(N){return R.H.useState(N)},Pe.useSyncExternalStore=function(N,F,se){return R.H.useSyncExternalStore(N,F,se)},Pe.useTransition=function(){return R.H.useTransition()},Pe.version="19.2.8",Pe}var xv;function ny(){return xv||(xv=1,cg.exports=y2()),cg.exports}var M=ny(),ug={exports:{}},au={},fg={exports:{}},hg={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Meta Platforms, Inc. and 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 vv;function b2(){return vv||(vv=1,(function(n){function e(q,J){var W=q.length;q.push(J);e:for(;0<W;){var Ee=W-1>>>1,Ne=q[Ee];if(0<l(Ne,J))q[Ee]=J,q[W]=Ne,W=Ee;else break e}}function t(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var J=q[0],W=q.pop();if(W!==J){q[0]=W;e:for(var Ee=0,Ne=q.length,N=Ne>>>1;Ee<N;){var F=2*(Ee+1)-1,se=q[F],ae=F+1,de=q[ae];if(0>l(se,W))ae<Ne&&0>l(de,se)?(q[Ee]=de,q[ae]=W,Ee=ae):(q[Ee]=se,q[F]=W,Ee=F);else if(ae<Ne&&0>l(de,W))q[Ee]=de,q[ae]=W,Ee=ae;else break e}}return J}function l(q,J){var W=q.sortIndex-J.sortIndex;return W!==0?W:q.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;n.unstable_now=function(){return a.now()}}else{var o=Date,u=o.now();n.unstable_now=function(){return o.now()-u}}var f=[],d=[],p=1,b=null,x=3,v=!1,w=!1,C=!1,A=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function H(q){for(var J=t(d);J!==null;){if(J.callback===null)i(d);else if(J.startTime<=q)i(d),J.sortIndex=J.expirationTime,e(f,J);else break;J=t(d)}}function z(q){if(C=!1,H(q),!w)if(t(f)!==null)w=!0,L||(L=!0,le());else{var J=t(d);J!==null&&Se(z,J.startTime-q)}}var L=!1,R=-1,te=5,fe=-1;function Te(){return A?!0:!(n.unstable_now()-fe<te)}function he(){if(A=!1,L){var q=n.unstable_now();fe=q;var J=!0;try{e:{w=!1,C&&(C=!1,D(R),R=-1),v=!0;var W=x;try{t:{for(H(q),b=t(f);b!==null&&!(b.expirationTime>q&&Te());){var Ee=b.callback;if(typeof Ee=="function"){b.callback=null,x=b.priorityLevel;var Ne=Ee(b.expirationTime<=q);if(q=n.unstable_now(),typeof Ne=="function"){b.callback=Ne,H(q),J=!0;break t}b===t(f)&&i(f),H(q)}else i(f);b=t(f)}if(b!==null)J=!0;else{var N=t(d);N!==null&&Se(z,N.startTime-q),J=!1}}break e}finally{b=null,x=W,v=!1}J=void 0}}finally{J?le():L=!1}}}var le;if(typeof B=="function")le=function(){B(he)};else if(typeof MessageChannel<"u"){var Me=new MessageChannel,Ae=Me.port2;Me.port1.onmessage=he,le=function(){Ae.postMessage(null)}}else le=function(){E(he,0)};function Se(q,J){R=E(function(){q(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(q){q.callback=null},n.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<q?Math.floor(1e3/q):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(q){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var W=x;x=J;try{return q()}finally{x=W}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(q,J){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var W=x;x=q;try{return J()}finally{x=W}},n.unstable_scheduleCallback=function(q,J,W){var Ee=n.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Ee+W:Ee):W=Ee,q){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=W+Ne,q={id:p++,callback:J,priorityLevel:q,startTime:W,expirationTime:Ne,sortIndex:-1},W>Ee?(q.sortIndex=W,e(d,q),t(f)===null&&q===t(d)&&(C?(D(R),R=-1):C=!0,Se(z,W-Ee))):(q.sortIndex=Ne,e(f,q),w||v||(w=!0,L||(L=!0,le()))),q},n.unstable_shouldYield=Te,n.unstable_wrapCallback=function(q){var J=x;return function(){var W=x;x=J;try{return q.apply(this,arguments)}finally{x=W}}}})(hg)),hg}var Sv;function x2(){return Sv||(Sv=1,fg.exports=b2()),fg.exports}var dg={exports:{}},ei={};/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and 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 wv;function v2(){if(wv)return ei;wv=1;var n=ny();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},l=Symbol.for("react.portal");function a(f,d,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:f,containerInfo:d,implementation:p}}var o=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ei.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(f,d,null,p)},ei.flushSync=function(f){var d=o.T,p=i.p;try{if(o.T=null,i.p=2,f)return f()}finally{o.T=d,i.p=p,i.d.f()}},ei.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(f,d))},ei.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},ei.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,b=u(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:v}):p==="script"&&i.d.X(f,{crossOrigin:b,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},ei.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);i.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(f)},ei.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,b=u(p,d.crossOrigin);i.d.L(f,p,{crossOrigin:b,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},ei.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=u(d.as,d.crossOrigin);i.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(f)},ei.requestFormReset=function(f){i.d.r(f)},ei.unstable_batchedUpdates=function(f,d){return f(d)},ei.useFormState=function(f,d,p){return o.H.useFormState(f,d,p)},ei.useFormStatus=function(){return o.H.useHostTransitionStatus()},ei.version="19.2.8",ei}var kv;function S2(){if(kv)return dg.exports;kv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),dg.exports=v2(),dg.exports}/**
|
|
35
|
-
* @license React
|
|
36
|
-
* react-dom-client.production.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Av;function w2(){if(Av)return au;Av=1;var n=x2(),e=ny(),t=S2();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var r=s,c=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(c=r.return),s=r.return;while(s)}return r.tag===3?c:null}function o(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function u(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(a(s)!==s)throw Error(i(188))}function d(s){var r=s.alternate;if(!r){if(r=a(s),r===null)throw Error(i(188));return r!==s?null:s}for(var c=s,h=r;;){var m=c.return;if(m===null)break;var g=m.alternate;if(g===null){if(h=m.return,h!==null){c=h;continue}break}if(m.child===g.child){for(g=m.child;g;){if(g===c)return f(m),s;if(g===h)return f(m),r;g=g.sibling}throw Error(i(188))}if(c.return!==h.return)c=m,h=g;else{for(var S=!1,_=m.child;_;){if(_===c){S=!0,c=m,h=g;break}if(_===h){S=!0,h=m,c=g;break}_=_.sibling}if(!S){for(_=g.child;_;){if(_===c){S=!0,c=g,h=m;break}if(_===h){S=!0,h=g,c=m;break}_=_.sibling}if(!S)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:r}function p(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=p(s),r!==null)return r;s=s.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),B=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),Te=Symbol.for("react.memo_cache_sentinel"),he=Symbol.iterator;function le(s){return s===null||typeof s!="object"?null:(s=he&&s[he]||s["@@iterator"],typeof s=="function"?s:null)}var Me=Symbol.for("react.client.reference");function Ae(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Me?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case E:return"Profiler";case A:return"StrictMode";case z:return"Suspense";case L:return"SuspenseList";case fe:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case B:return s.displayName||"Context";case D:return(s._context.displayName||"Context")+".Consumer";case H:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case R:return r=s.displayName||null,r!==null?r:Ae(s.type)||"Memo";case te:r=s._payload,s=s._init;try{return Ae(s(r))}catch{}}return null}var Se=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},Ee=[],Ne=-1;function N(s){return{current:s}}function F(s){0>Ne||(s.current=Ee[Ne],Ee[Ne]=null,Ne--)}function se(s,r){Ne++,Ee[Ne]=s.current,s.current=r}var ae=N(null),de=N(null),_e=N(null),Re=N(null);function ft(s,r){switch(se(_e,r),se(de,s),se(ae,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?H1(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=H1(r),s=I1(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}F(ae),se(ae,s)}function ht(){F(ae),F(de),F(_e)}function xt(s){s.memoizedState!==null&&se(Re,s);var r=ae.current,c=I1(r,s.type);r!==c&&(se(de,s),se(ae,c))}function Ye(s){de.current===s&&(F(ae),F(de)),Re.current===s&&(F(Re),nu._currentValue=W)}var Sn,Je;function we(s){if(Sn===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);Sn=r&&r[1]||"",Je=-1<c.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+Sn+s+Je}var xe=!1;function Gt(s,r){if(!s||xe)return"";xe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(r){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch($){var P=$}Reflect.construct(s,[],ne)}else{try{ne.call()}catch($){P=$}s.call(ne.prototype)}}else{try{throw Error()}catch($){P=$}(ne=s())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch($){if($&&P&&typeof $.stack=="string")return[$.stack,P.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=h.DetermineComponentFrameRoot(),S=g[0],_=g[1];if(S&&_){var O=S.split(`
|
|
45
|
-
`),G=_.split(`
|
|
46
|
-
`);for(m=h=0;h<O.length&&!O[h].includes("DetermineComponentFrameRoot");)h++;for(;m<G.length&&!G[m].includes("DetermineComponentFrameRoot");)m++;if(h===O.length||m===G.length)for(h=O.length-1,m=G.length-1;1<=h&&0<=m&&O[h]!==G[m];)m--;for(;1<=h&&0<=m;h--,m--)if(O[h]!==G[m]){if(h!==1||m!==1)do if(h--,m--,0>m||O[h]!==G[m]){var X=`
|
|
47
|
-
`+O[h].replace(" at new "," at ");return s.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",s.displayName)),X}while(1<=h&&0<=m);break}}}finally{xe=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?we(c):""}function wn(s,r){switch(s.tag){case 26:case 27:case 5:return we(s.type);case 16:return we("Lazy");case 13:return s.child!==r&&r!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return Gt(s.type,!1);case 11:return Gt(s.type.render,!1);case 1:return Gt(s.type,!0);case 31:return we("Activity");default:return""}}function qe(s){try{var r="",c=null;do r+=wn(s,c),c=s,s=s.return;while(s);return r}catch(h){return`
|
|
48
|
-
Error generating stack: `+h.message+`
|
|
49
|
-
`+h.stack}}var jn=Object.prototype.hasOwnProperty,Kn=n.unstable_scheduleCallback,ce=n.unstable_cancelCallback,Ve=n.unstable_shouldYield,vt=n.unstable_requestPaint,$e=n.unstable_now,gn=n.unstable_getCurrentPriorityLevel,K=n.unstable_ImmediatePriority,ue=n.unstable_UserBlockingPriority,Le=n.unstable_NormalPriority,dt=n.unstable_LowPriority,Wt=n.unstable_IdlePriority,Wi=n.log,Kl=n.unstable_setDisableYieldValue,ds=null,kn=null;function Ei(s){if(typeof Wi=="function"&&Kl(s),kn&&typeof kn.setStrictMode=="function")try{kn.setStrictMode(ds,s)}catch{}}var yn=Math.clz32?Math.clz32:An,Is=Math.log,Xn=Math.LN2;function An(s){return s>>>=0,s===0?32:31-(Is(s)/Xn|0)|0}var Xt=256,Us=262144,ps=4194304;function Qn(s){var r=s&42;if(r!==0)return r;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function yl(s,r,c){var h=s.pendingLanes;if(h===0)return 0;var m=0,g=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var _=h&134217727;return _!==0?(h=_&~g,h!==0?m=Qn(h):(S&=_,S!==0?m=Qn(S):c||(c=_&~s,c!==0&&(m=Qn(c))))):(_=h&~g,_!==0?m=Qn(_):S!==0?m=Qn(S):c||(c=h&~s,c!==0&&(m=Qn(c)))),m===0?0:r!==0&&r!==m&&(r&g)===0&&(g=m&-m,c=r&-r,g>=c||g===32&&(c&4194048)!==0)?r:m}function li(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Xl(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ln(){var s=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),s}function ri(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function mi(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Bn(s,r,c,h,m,g){var S=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var _=s.entanglements,O=s.expirationTimes,G=s.hiddenUpdates;for(c=S&~c;0<c;){var X=31-yn(c),ne=1<<X;_[X]=0,O[X]=-1;var P=G[X];if(P!==null)for(G[X]=null,X=0;X<P.length;X++){var $=P[X];$!==null&&($.lane&=-536870913)}c&=~ne}h!==0&&qs(s,h,0),g!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=g&~(S&~r))}function qs(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var h=31-yn(r);s.entangledLanes|=r,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function Ni(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var h=31-yn(c),m=1<<h;m&r|s[h]&r&&(s[h]|=r),c&=~m}}function Ki(s,r){var c=r&-r;return c=(c&42)!==0?1:ms(c),(c&(s.suspendedLanes|r))!==0?0:c}function ms(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Xi(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Vs(){var s=J.p;return s!==0?s:(s=window.event,s===void 0?32:ov(s.type))}function _n(s,r){var c=J.p;try{return J.p=s,r()}finally{J.p=c}}var ai=Math.random().toString(36).slice(2),Dt="__reactFiber$"+ai,Qe="__reactProps$"+ai,tn="__reactContainer$"+ai,gs="__reactEvents$"+ai,bl="__reactListeners$"+ai,ys="__reactHandles$"+ai,Gs="__reactResources$"+ai,Ps="__reactMarker$"+ai;function xl(s){delete s[Dt],delete s[Qe],delete s[gs],delete s[bl],delete s[ys]}function Di(s){var r=s[Dt];if(r)return r;for(var c=s.parentNode;c;){if(r=c[tn]||c[Dt]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=F1(s);s!==null;){if(c=s[Dt])return c;s=F1(s)}return r}s=c,c=s.parentNode}return null}function bs(s){if(s=s[Dt]||s[tn]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Qi(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function Cn(s){var r=s[Gs];return r||(r=s[Gs]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function kt(s){s[Ps]=!0}var Zn=new Set,Ha={};function oi(s,r){Oi(s,r),Oi(s+"Capture",r)}function Oi(s,r){for(Ha[s]=r,s=0;s<r.length;s++)Zn.add(r[s])}var Ql=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Zl={},Zi={};function xs(s){return jn.call(Zi,s)?!0:jn.call(Zl,s)?!1:Ql.test(s)?Zi[s]=!0:(Zl[s]=!0,!1)}function Ri(s,r,c){if(xs(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var h=r.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+c)}}function gi(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+c)}}function an(s,r,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,""+h)}}function zt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function vl(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ji(s,r,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,g=h.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.call(this)},set:function(S){c=""+S,g.call(this,S)}}),Object.defineProperty(s,r,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function vs(s){if(!s._valueTracker){var r=vl(s)?"checked":"value";s._valueTracker=ji(s,r,""+s[r])}}function Ss(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var c=r.getValue(),h="";return s&&(h=vl(s)?s.checked?"true":"false":s.value),s=h,s!==c?(r.setValue(s),!0):!1}function yi(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}}var Ys=/[\n"\\]/g;function Ot(s){return s.replace(Ys,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Tn(s,r,c,h,m,g,S,_){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),r!=null?S==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+zt(r)):s.value!==""+zt(r)&&(s.value=""+zt(r)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),r!=null?Mn(s,S,zt(r)):c!=null?Mn(s,S,zt(c)):h!=null&&s.removeAttribute("value"),m==null&&g!=null&&(s.defaultChecked=!!g),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+zt(_):s.removeAttribute("name")}function Jl(s,r,c,h,m,g,S,_){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),r!=null||c!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){vs(s);return}c=c!=null?""+zt(c):"",r=r!=null?""+zt(r):c,_||r===s.value||(s.value=r),s.defaultValue=r}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=_?s.checked:!!h,s.defaultChecked=!!h,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),vs(s)}function Mn(s,r,c){r==="number"&&yi(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function Li(s,r,c,h){if(s=s.options,r){r={};for(var m=0;m<c.length;m++)r["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=r.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&h&&(s[c].defaultSelected=!0)}else{for(c=""+zt(c),r=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function oe(s,r,c){if(r!=null&&(r=""+zt(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+zt(c):""}function T(s,r,c,h){if(r==null){if(h!=null){if(c!=null)throw Error(i(92));if(Se(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),r=c}c=zt(r),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),vs(s)}function U(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var ie=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ke(s,r,c){var h=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":h?s.setProperty(r,c):typeof c!="number"||c===0||ie.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function Oe(s,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||r!=null&&r.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in r)h=r[m],r.hasOwnProperty(m)&&c[m]!==h&&ke(s,m,h)}else for(var g in r)r.hasOwnProperty(g)&&ke(s,g,r[g])}function Be(s){if(s.indexOf("-")===-1)return!1;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 St=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Pt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bn(s){return Pt.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ht(){}var re=null;function pe(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var er=null,tr=null;function lf(s){var r=bs(s);if(r&&(s=r.stateNode)){var c=s[Qe]||null;e:switch(s=r.stateNode,r.type){case"input":if(Tn(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Ot(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var h=c[r];if(h!==s&&h.form===s.form){var m=h[Qe]||null;if(!m)throw Error(i(90));Tn(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<c.length;r++)h=c[r],h.form===s.form&&Ss(h)}break e;case"textarea":oe(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&Li(s,!!c.multiple,r,!1)}}}var mc=!1;function rf(s,r,c){if(mc)return s(r,c);mc=!0;try{var h=s(r);return h}finally{if(mc=!1,(er!==null||tr!==null)&&(nh(),er&&(r=er,s=tr,tr=er=null,lf(r),s)))for(r=0;r<s.length;r++)lf(s[r])}}function ws(s,r){var c=s.stateNode;if(c===null)return null;var h=c[Qe]||null;if(h===null)return null;c=h[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var ks=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gc=!1;if(ks)try{var Fr={};Object.defineProperty(Fr,"passive",{get:function(){gc=!0}}),window.addEventListener("test",Fr,Fr),window.removeEventListener("test",Fr,Fr)}catch{gc=!1}var Fs=null,Ia=null,$r=null;function af(){if($r)return $r;var s,r=Ia,c=r.length,h,m="value"in Fs?Fs.value:Fs.textContent,g=m.length;for(s=0;s<c&&r[s]===m[s];s++);var S=c-s;for(h=1;h<=S&&r[c-h]===m[g-h];h++);return $r=m.slice(s,1<h?1-h:void 0)}function Wr(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function nr(){return!0}function of(){return!1}function Jn(s){function r(c,h,m,g,S){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=g,this.target=S,this.currentTarget=null;for(var _ in s)s.hasOwnProperty(_)&&(c=s[_],this[_]=c?c(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?nr:of,this.isPropagationStopped=of,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=nr)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=nr)},persist:function(){},isPersistent:nr}),r}var Sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ua=Jn(Sl),As=b({},Sl,{view:0,detail:0}),cf=Jn(As),yc,qa,Kr,Va=b({},As,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sc,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!==Kr&&(Kr&&s.type==="mousemove"?(yc=s.screenX-Kr.screenX,qa=s.screenY-Kr.screenY):qa=yc=0,Kr=s),yc)},movementY:function(s){return"movementY"in s?s.movementY:qa}}),uf=Jn(Va),sp=b({},Va,{dataTransfer:0}),ff=Jn(sp),lp=b({},As,{relatedTarget:0}),bc=Jn(lp),rp=b({},Sl,{animationName:0,elapsedTime:0,pseudoElement:0}),ap=Jn(rp),xc=b({},Sl,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),vc=Jn(xc),Ga=b({},Sl,{data:0}),hf=Jn(Ga),op={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cp={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"},up={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fp(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=up[s])?!!r[s]:!1}function Sc(){return fp}var hp=b({},As,{key:function(s){if(s.key){var r=op[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Wr(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?cp[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sc,charCode:function(s){return s.type==="keypress"?Wr(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Wr(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),dp=Jn(hp),pp=b({},Va,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),df=Jn(pp),mp=b({},As,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sc}),pf=Jn(mp),mf=b({},Sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pa=Jn(mf),_s=b({},Va,{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}),$s=Jn(_s),wc=b({},Sl,{newState:0,oldState:0}),gf=Jn(wc),Ya=[9,13,27,32],Fa=ks&&"CompositionEvent"in window,Xr=null;ks&&"documentMode"in document&&(Xr=document.documentMode);var Qr=ks&&"TextEvent"in window&&!Xr,kc=ks&&(!Fa||Xr&&8<Xr&&11>=Xr),yf=" ",$a=!1;function bf(s,r){switch(s){case"keyup":return Ya.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ir(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var wl=!1;function xf(s,r){switch(s){case"compositionend":return ir(r);case"keypress":return r.which!==32?null:($a=!0,yf);case"textInput":return s=r.data,s===yf&&$a?null:s;default:return null}}function vf(s,r){if(wl)return s==="compositionend"||!Fa&&bf(s,r)?(s=af(),$r=Ia=Fs=null,wl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return kc&&r.locale!=="ko"?null:r.data;default:return null}}var Ac={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 _c(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!Ac[s.type]:r==="textarea"}function k(s,r,c,h){er?tr?tr.push(h):tr=[h]:er=h,r=ch(r,"onChange"),0<r.length&&(c=new Ua("onChange","change",null,c,h),s.push({event:c,listeners:r}))}var Z=null,ve=null;function We(s){O1(s,0)}function Yt(s){var r=Qi(s);if(Ss(r))return s}function He(s,r){if(s==="change")return r}var Ke=!1;if(ks){var Ze;if(ks){var Qt="oninput"in document;if(!Qt){var ci=document.createElement("div");ci.setAttribute("oninput","return;"),Qt=typeof ci.oninput=="function"}Ze=Qt}else Ze=!1;Ke=Ze&&(!document.documentMode||9<document.documentMode)}function Zr(){Z&&(Z.detachEvent("onpropertychange",Sf),ve=Z=null)}function Sf(s){if(s.propertyName==="value"&&Yt(ve)){var r=[];k(r,ve,s,pe(s)),rf(We,r)}}function qC(s,r,c){s==="focusin"?(Zr(),Z=r,ve=c,Z.attachEvent("onpropertychange",Sf)):s==="focusout"&&Zr()}function VC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Yt(ve)}function GC(s,r){if(s==="click")return Yt(r)}function PC(s,r){if(s==="input"||s==="change")return Yt(r)}function YC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Bi=typeof Object.is=="function"?Object.is:YC;function Cc(s,r){if(Bi(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),h=Object.keys(r);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!jn.call(r,m)||!Bi(s[m],r[m]))return!1}return!0}function nb(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function ib(s,r){var c=nb(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=r&&h>=r)return{node:c,offset:r-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=nb(c)}}function sb(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?sb(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function lb(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=yi(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=yi(s.document)}return r}function gp(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var FC=ks&&"documentMode"in document&&11>=document.documentMode,Wa=null,yp=null,Tc=null,bp=!1;function rb(s,r,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;bp||Wa==null||Wa!==yi(h)||(h=Wa,"selectionStart"in h&&gp(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Tc&&Cc(Tc,h)||(Tc=h,h=ch(yp,"onSelect"),0<h.length&&(r=new Ua("onSelect","select",null,r,c),s.push({event:r,listeners:h}),r.target=Wa)))}function Jr(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}var Ka={animationend:Jr("Animation","AnimationEnd"),animationiteration:Jr("Animation","AnimationIteration"),animationstart:Jr("Animation","AnimationStart"),transitionrun:Jr("Transition","TransitionRun"),transitionstart:Jr("Transition","TransitionStart"),transitioncancel:Jr("Transition","TransitionCancel"),transitionend:Jr("Transition","TransitionEnd")},xp={},ab={};ks&&(ab=document.createElement("div").style,"AnimationEvent"in window||(delete Ka.animationend.animation,delete Ka.animationiteration.animation,delete Ka.animationstart.animation),"TransitionEvent"in window||delete Ka.transitionend.transition);function ea(s){if(xp[s])return xp[s];if(!Ka[s])return s;var r=Ka[s],c;for(c in r)if(r.hasOwnProperty(c)&&c in ab)return xp[s]=r[c];return s}var ob=ea("animationend"),cb=ea("animationiteration"),ub=ea("animationstart"),$C=ea("transitionrun"),WC=ea("transitionstart"),KC=ea("transitioncancel"),fb=ea("transitionend"),hb=new Map,vp="abort auxClick beforeToggle 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(" ");vp.push("scrollEnd");function Cs(s,r){hb.set(s,r),oi(r,[s])}var wf=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ji=[],Xa=0,Sp=0;function kf(){for(var s=Xa,r=Sp=Xa=0;r<s;){var c=Ji[r];Ji[r++]=null;var h=Ji[r];Ji[r++]=null;var m=Ji[r];Ji[r++]=null;var g=Ji[r];if(Ji[r++]=null,h!==null&&m!==null){var S=h.pending;S===null?m.next=m:(m.next=S.next,S.next=m),h.pending=m}g!==0&&db(c,m,g)}}function Af(s,r,c,h){Ji[Xa++]=s,Ji[Xa++]=r,Ji[Xa++]=c,Ji[Xa++]=h,Sp|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function wp(s,r,c,h){return Af(s,r,c,h),_f(s)}function ta(s,r){return Af(s,null,null,r),_f(s)}function db(s,r,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var m=!1,g=s.return;g!==null;)g.childLanes|=c,h=g.alternate,h!==null&&(h.childLanes|=c),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(m=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,m&&r!==null&&(m=31-yn(c),s=g.hiddenUpdates,h=s[m],h===null?s[m]=[r]:h.push(r),r.lane=c|536870912),g):null}function _f(s){if(50<Kc)throw Kc=0,Dm=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var Qa={};function XC(s,r,c,h){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zi(s,r,c,h){return new XC(s,r,c,h)}function kp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function kl(s,r){var c=s.alternate;return c===null?(c=zi(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function pb(s,r){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Cf(s,r,c,h,m,g){var S=0;if(h=s,typeof s=="function")kp(s)&&(S=1);else if(typeof s=="string")S=t2(s,c,ae.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case fe:return s=zi(31,c,r,m),s.elementType=fe,s.lanes=g,s;case C:return na(c.children,m,g,r);case A:S=8,m|=24;break;case E:return s=zi(12,c,r,m|2),s.elementType=E,s.lanes=g,s;case z:return s=zi(13,c,r,m),s.elementType=z,s.lanes=g,s;case L:return s=zi(19,c,r,m),s.elementType=L,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case B:S=10;break e;case D:S=9;break e;case H:S=11;break e;case R:S=14;break e;case te:S=16,h=null;break e}S=29,c=Error(i(130,s===null?"null":typeof s,"")),h=null}return r=zi(S,c,r,m),r.elementType=s,r.type=h,r.lanes=g,r}function na(s,r,c,h){return s=zi(7,s,h,r),s.lanes=c,s}function Ap(s,r,c){return s=zi(6,s,null,r),s.lanes=c,s}function mb(s){var r=zi(18,null,null,0);return r.stateNode=s,r}function _p(s,r,c){return r=zi(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var gb=new WeakMap;function es(s,r){if(typeof s=="object"&&s!==null){var c=gb.get(s);return c!==void 0?c:(r={value:s,source:r,stack:qe(r)},gb.set(s,r),r)}return{value:s,source:r,stack:qe(r)}}var Za=[],Ja=0,Tf=null,Mc=0,ts=[],ns=0,sr=null,Ws=1,Ks="";function Al(s,r){Za[Ja++]=Mc,Za[Ja++]=Tf,Tf=s,Mc=r}function yb(s,r,c){ts[ns++]=Ws,ts[ns++]=Ks,ts[ns++]=sr,sr=s;var h=Ws;s=Ks;var m=32-yn(h)-1;h&=~(1<<m),c+=1;var g=32-yn(r)+m;if(30<g){var S=m-m%5;g=(h&(1<<S)-1).toString(32),h>>=S,m-=S,Ws=1<<32-yn(r)+m|c<<m|h,Ks=g+s}else Ws=1<<g|c<<m|h,Ks=s}function Cp(s){s.return!==null&&(Al(s,1),yb(s,1,0))}function Tp(s){for(;s===Tf;)Tf=Za[--Ja],Za[Ja]=null,Mc=Za[--Ja],Za[Ja]=null;for(;s===sr;)sr=ts[--ns],ts[ns]=null,Ks=ts[--ns],ts[ns]=null,Ws=ts[--ns],ts[ns]=null}function bb(s,r){ts[ns++]=Ws,ts[ns++]=Ks,ts[ns++]=sr,Ws=r.id,Ks=r.overflow,sr=s}var zn=null,Ut=null,rt=!1,lr=null,is=!1,Mp=Error(i(519));function rr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ec(es(r,s)),Mp}function xb(s){var r=s.stateNode,c=s.type,h=s.memoizedProps;switch(r[Dt]=s,r[Qe]=h,c){case"dialog":tt("cancel",r),tt("close",r);break;case"iframe":case"object":case"embed":tt("load",r);break;case"video":case"audio":for(c=0;c<Qc.length;c++)tt(Qc[c],r);break;case"source":tt("error",r);break;case"img":case"image":case"link":tt("error",r),tt("load",r);break;case"details":tt("toggle",r);break;case"input":tt("invalid",r),Jl(r,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":tt("invalid",r);break;case"textarea":tt("invalid",r),T(r,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||h.suppressHydrationWarning===!0||B1(r.textContent,c)?(h.popover!=null&&(tt("beforetoggle",r),tt("toggle",r)),h.onScroll!=null&&tt("scroll",r),h.onScrollEnd!=null&&tt("scrollend",r),h.onClick!=null&&(r.onclick=Ht),r=!0):r=!1,r||rr(s,!0)}function vb(s){for(zn=s.return;zn;)switch(zn.tag){case 5:case 31:case 13:is=!1;return;case 27:case 3:is=!0;return;default:zn=zn.return}}function eo(s){if(s!==zn)return!1;if(!rt)return vb(s),rt=!0,!1;var r=s.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Fm(s.type,s.memoizedProps)),c=!c),c&&Ut&&rr(s),vb(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ut=Y1(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ut=Y1(s)}else r===27?(r=Ut,vr(s.type)?(s=Qm,Qm=null,Ut=s):Ut=r):Ut=zn?ls(s.stateNode.nextSibling):null;return!0}function ia(){Ut=zn=null,rt=!1}function Ep(){var s=lr;return s!==null&&(Si===null?Si=s:Si.push.apply(Si,s),lr=null),s}function Ec(s){lr===null?lr=[s]:lr.push(s)}var Np=N(null),sa=null,_l=null;function ar(s,r,c){se(Np,r._currentValue),r._currentValue=c}function Cl(s){s._currentValue=Np.current,F(Np)}function Dp(s,r,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,h!==null&&(h.childLanes|=r)):h!==null&&(h.childLanes&r)!==r&&(h.childLanes|=r),s===c)break;s=s.return}}function Op(s,r,c,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var g=m.dependencies;if(g!==null){var S=m.child;g=g.firstContext;e:for(;g!==null;){var _=g;g=m;for(var O=0;O<r.length;O++)if(_.context===r[O]){g.lanes|=c,_=g.alternate,_!==null&&(_.lanes|=c),Dp(g.return,c,s),h||(S=null);break e}g=_.next}}else if(m.tag===18){if(S=m.return,S===null)throw Error(i(341));S.lanes|=c,g=S.alternate,g!==null&&(g.lanes|=c),Dp(S,c,s),S=null}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===s){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}}function to(s,r,c,h){s=null;for(var m=r,g=!1;m!==null;){if(!g){if((m.flags&524288)!==0)g=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var _=m.type;Bi(m.pendingProps.value,S.value)||(s!==null?s.push(_):s=[_])}}else if(m===Re.current){if(S=m.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(nu):s=[nu])}m=m.return}s!==null&&Op(r,s,c,h),r.flags|=262144}function Mf(s){for(s=s.firstContext;s!==null;){if(!Bi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function la(s){sa=s,_l=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Hn(s){return Sb(sa,s)}function Ef(s,r){return sa===null&&la(s),Sb(s,r)}function Sb(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},_l===null){if(s===null)throw Error(i(308));_l=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else _l=_l.next=r;return c}var QC=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},ZC=n.unstable_scheduleCallback,JC=n.unstable_NormalPriority,on={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rp(){return{controller:new QC,data:new Map,refCount:0}}function Nc(s){s.refCount--,s.refCount===0&&ZC(JC,function(){s.controller.abort()})}var Dc=null,jp=0,no=0,io=null;function eT(s,r){if(Dc===null){var c=Dc=[];jp=0,no=zm(),io={status:"pending",value:void 0,then:function(h){c.push(h)}}}return jp++,r.then(wb,wb),r}function wb(){if(--jp===0&&Dc!==null){io!==null&&(io.status="fulfilled");var s=Dc;Dc=null,no=0,io=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function tT(s,r){var c=[],h={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){h.status="fulfilled",h.value=r;for(var m=0;m<c.length;m++)(0,c[m])(r)},function(m){for(h.status="rejected",h.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),h}var kb=q.S;q.S=function(s,r){r1=$e(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&eT(s,r),kb!==null&&kb(s,r)};var ra=N(null);function Lp(){var s=ra.current;return s!==null?s:Rt.pooledCache}function Nf(s,r){r===null?se(ra,ra.current):se(ra,r.pool)}function Ab(){var s=Lp();return s===null?null:{parent:on._currentValue,pool:s}}var so=Error(i(460)),Bp=Error(i(474)),Df=Error(i(542)),Of={then:function(){}};function _b(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Cb(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(Ht,Ht),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Mb(s),s;default:if(typeof r.status=="string")r.then(Ht,Ht);else{if(s=Rt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(h){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=h}},function(h){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=h}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Mb(s),s}throw oa=r,so}}function aa(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(oa=c,so):c}}var oa=null;function Tb(){if(oa===null)throw Error(i(459));var s=oa;return oa=null,s}function Mb(s){if(s===so||s===Df)throw Error(i(483))}var lo=null,Oc=0;function Rf(s){var r=Oc;return Oc+=1,lo===null&&(lo=[]),Cb(lo,s,r)}function Rc(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function jf(s,r){throw r.$$typeof===x?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Eb(s){function r(I,j){if(s){var V=I.deletions;V===null?(I.deletions=[j],I.flags|=16):V.push(j)}}function c(I,j){if(!s)return null;for(;j!==null;)r(I,j),j=j.sibling;return null}function h(I){for(var j=new Map;I!==null;)I.key!==null?j.set(I.key,I):j.set(I.index,I),I=I.sibling;return j}function m(I,j){return I=kl(I,j),I.index=0,I.sibling=null,I}function g(I,j,V){return I.index=V,s?(V=I.alternate,V!==null?(V=V.index,V<j?(I.flags|=67108866,j):V):(I.flags|=67108866,j)):(I.flags|=1048576,j)}function S(I){return s&&I.alternate===null&&(I.flags|=67108866),I}function _(I,j,V,ee){return j===null||j.tag!==6?(j=Ap(V,I.mode,ee),j.return=I,j):(j=m(j,V),j.return=I,j)}function O(I,j,V,ee){var je=V.type;return je===C?X(I,j,V.props.children,ee,V.key):j!==null&&(j.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===te&&aa(je)===j.type)?(j=m(j,V.props),Rc(j,V),j.return=I,j):(j=Cf(V.type,V.key,V.props,null,I.mode,ee),Rc(j,V),j.return=I,j)}function G(I,j,V,ee){return j===null||j.tag!==4||j.stateNode.containerInfo!==V.containerInfo||j.stateNode.implementation!==V.implementation?(j=_p(V,I.mode,ee),j.return=I,j):(j=m(j,V.children||[]),j.return=I,j)}function X(I,j,V,ee,je){return j===null||j.tag!==7?(j=na(V,I.mode,ee,je),j.return=I,j):(j=m(j,V),j.return=I,j)}function ne(I,j,V){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=Ap(""+j,I.mode,V),j.return=I,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case v:return V=Cf(j.type,j.key,j.props,null,I.mode,V),Rc(V,j),V.return=I,V;case w:return j=_p(j,I.mode,V),j.return=I,j;case te:return j=aa(j),ne(I,j,V)}if(Se(j)||le(j))return j=na(j,I.mode,V,null),j.return=I,j;if(typeof j.then=="function")return ne(I,Rf(j),V);if(j.$$typeof===B)return ne(I,Ef(I,j),V);jf(I,j)}return null}function P(I,j,V,ee){var je=j!==null?j.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return je!==null?null:_(I,j,""+V,ee);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case v:return V.key===je?O(I,j,V,ee):null;case w:return V.key===je?G(I,j,V,ee):null;case te:return V=aa(V),P(I,j,V,ee)}if(Se(V)||le(V))return je!==null?null:X(I,j,V,ee,null);if(typeof V.then=="function")return P(I,j,Rf(V),ee);if(V.$$typeof===B)return P(I,j,Ef(I,V),ee);jf(I,V)}return null}function $(I,j,V,ee,je){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return I=I.get(V)||null,_(j,I,""+ee,je);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return I=I.get(ee.key===null?V:ee.key)||null,O(j,I,ee,je);case w:return I=I.get(ee.key===null?V:ee.key)||null,G(j,I,ee,je);case te:return ee=aa(ee),$(I,j,V,ee,je)}if(Se(ee)||le(ee))return I=I.get(V)||null,X(j,I,ee,je,null);if(typeof ee.then=="function")return $(I,j,V,Rf(ee),je);if(ee.$$typeof===B)return $(I,j,V,Ef(j,ee),je);jf(j,ee)}return null}function Ce(I,j,V,ee){for(var je=null,mt=null,De=j,Xe=j=0,lt=null;De!==null&&Xe<V.length;Xe++){De.index>Xe?(lt=De,De=null):lt=De.sibling;var gt=P(I,De,V[Xe],ee);if(gt===null){De===null&&(De=lt);break}s&&De&>.alternate===null&&r(I,De),j=g(gt,j,Xe),mt===null?je=gt:mt.sibling=gt,mt=gt,De=lt}if(Xe===V.length)return c(I,De),rt&&Al(I,Xe),je;if(De===null){for(;Xe<V.length;Xe++)De=ne(I,V[Xe],ee),De!==null&&(j=g(De,j,Xe),mt===null?je=De:mt.sibling=De,mt=De);return rt&&Al(I,Xe),je}for(De=h(De);Xe<V.length;Xe++)lt=$(De,I,Xe,V[Xe],ee),lt!==null&&(s&<.alternate!==null&&De.delete(lt.key===null?Xe:lt.key),j=g(lt,j,Xe),mt===null?je=lt:mt.sibling=lt,mt=lt);return s&&De.forEach(function(_r){return r(I,_r)}),rt&&Al(I,Xe),je}function Ie(I,j,V,ee){if(V==null)throw Error(i(151));for(var je=null,mt=null,De=j,Xe=j=0,lt=null,gt=V.next();De!==null&&!gt.done;Xe++,gt=V.next()){De.index>Xe?(lt=De,De=null):lt=De.sibling;var _r=P(I,De,gt.value,ee);if(_r===null){De===null&&(De=lt);break}s&&De&&_r.alternate===null&&r(I,De),j=g(_r,j,Xe),mt===null?je=_r:mt.sibling=_r,mt=_r,De=lt}if(gt.done)return c(I,De),rt&&Al(I,Xe),je;if(De===null){for(;!gt.done;Xe++,gt=V.next())gt=ne(I,gt.value,ee),gt!==null&&(j=g(gt,j,Xe),mt===null?je=gt:mt.sibling=gt,mt=gt);return rt&&Al(I,Xe),je}for(De=h(De);!gt.done;Xe++,gt=V.next())gt=$(De,I,Xe,gt.value,ee),gt!==null&&(s&>.alternate!==null&&De.delete(gt.key===null?Xe:gt.key),j=g(gt,j,Xe),mt===null?je=gt:mt.sibling=gt,mt=gt);return s&&De.forEach(function(h2){return r(I,h2)}),rt&&Al(I,Xe),je}function Mt(I,j,V,ee){if(typeof V=="object"&&V!==null&&V.type===C&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case v:e:{for(var je=V.key;j!==null;){if(j.key===je){if(je=V.type,je===C){if(j.tag===7){c(I,j.sibling),ee=m(j,V.props.children),ee.return=I,I=ee;break e}}else if(j.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===te&&aa(je)===j.type){c(I,j.sibling),ee=m(j,V.props),Rc(ee,V),ee.return=I,I=ee;break e}c(I,j);break}else r(I,j);j=j.sibling}V.type===C?(ee=na(V.props.children,I.mode,ee,V.key),ee.return=I,I=ee):(ee=Cf(V.type,V.key,V.props,null,I.mode,ee),Rc(ee,V),ee.return=I,I=ee)}return S(I);case w:e:{for(je=V.key;j!==null;){if(j.key===je)if(j.tag===4&&j.stateNode.containerInfo===V.containerInfo&&j.stateNode.implementation===V.implementation){c(I,j.sibling),ee=m(j,V.children||[]),ee.return=I,I=ee;break e}else{c(I,j);break}else r(I,j);j=j.sibling}ee=_p(V,I.mode,ee),ee.return=I,I=ee}return S(I);case te:return V=aa(V),Mt(I,j,V,ee)}if(Se(V))return Ce(I,j,V,ee);if(le(V)){if(je=le(V),typeof je!="function")throw Error(i(150));return V=je.call(V),Ie(I,j,V,ee)}if(typeof V.then=="function")return Mt(I,j,Rf(V),ee);if(V.$$typeof===B)return Mt(I,j,Ef(I,V),ee);jf(I,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,j!==null&&j.tag===6?(c(I,j.sibling),ee=m(j,V),ee.return=I,I=ee):(c(I,j),ee=Ap(V,I.mode,ee),ee.return=I,I=ee),S(I)):c(I,j)}return function(I,j,V,ee){try{Oc=0;var je=Mt(I,j,V,ee);return lo=null,je}catch(De){if(De===so||De===Df)throw De;var mt=zi(29,De,null,I.mode);return mt.lanes=ee,mt.return=I,mt}finally{}}}var ca=Eb(!0),Nb=Eb(!1),or=!1;function zp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hp(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function cr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ur(s,r,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(yt&2)!==0){var m=h.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),h.pending=r,r=_f(s),db(s,null,c),r}return Af(s,h,r,c),_f(s)}function jc(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var h=r.lanes;h&=s.pendingLanes,c|=h,r.lanes=c,Ni(s,c)}}function Ip(s,r){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var m=null,g=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};g===null?m=g=S:g=g.next=S,c=c.next}while(c!==null);g===null?m=g=r:g=g.next=r}else m=g=r;c={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var Up=!1;function Lc(){if(Up){var s=io;if(s!==null)throw s}}function Bc(s,r,c,h){Up=!1;var m=s.updateQueue;or=!1;var g=m.firstBaseUpdate,S=m.lastBaseUpdate,_=m.shared.pending;if(_!==null){m.shared.pending=null;var O=_,G=O.next;O.next=null,S===null?g=G:S.next=G,S=O;var X=s.alternate;X!==null&&(X=X.updateQueue,_=X.lastBaseUpdate,_!==S&&(_===null?X.firstBaseUpdate=G:_.next=G,X.lastBaseUpdate=O))}if(g!==null){var ne=m.baseState;S=0,X=G=O=null,_=g;do{var P=_.lane&-536870913,$=P!==_.lane;if($?(st&P)===P:(h&P)===P){P!==0&&P===no&&(Up=!0),X!==null&&(X=X.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ce=s,Ie=_;P=r;var Mt=c;switch(Ie.tag){case 1:if(Ce=Ie.payload,typeof Ce=="function"){ne=Ce.call(Mt,ne,P);break e}ne=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Ie.payload,P=typeof Ce=="function"?Ce.call(Mt,ne,P):Ce,P==null)break e;ne=b({},ne,P);break e;case 2:or=!0}}P=_.callback,P!==null&&(s.flags|=64,$&&(s.flags|=8192),$=m.callbacks,$===null?m.callbacks=[P]:$.push(P))}else $={lane:P,tag:_.tag,payload:_.payload,callback:_.callback,next:null},X===null?(G=X=$,O=ne):X=X.next=$,S|=P;if(_=_.next,_===null){if(_=m.shared.pending,_===null)break;$=_,_=$.next,$.next=null,m.lastBaseUpdate=$,m.shared.pending=null}}while(!0);X===null&&(O=ne),m.baseState=O,m.firstBaseUpdate=G,m.lastBaseUpdate=X,g===null&&(m.shared.lanes=0),mr|=S,s.lanes=S,s.memoizedState=ne}}function Db(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function Ob(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Db(c[s],r)}var ro=N(null),Lf=N(0);function Rb(s,r){s=Ll,se(Lf,s),se(ro,r),Ll=s|r.baseLanes}function qp(){se(Lf,Ll),se(ro,ro.current)}function Vp(){Ll=Lf.current,F(ro),F(Lf)}var Hi=N(null),ss=null;function fr(s){var r=s.alternate;se(nn,nn.current&1),se(Hi,s),ss===null&&(r===null||ro.current!==null||r.memoizedState!==null)&&(ss=s)}function Gp(s){se(nn,nn.current),se(Hi,s),ss===null&&(ss=s)}function jb(s){s.tag===22?(se(nn,nn.current),se(Hi,s),ss===null&&(ss=s)):hr()}function hr(){se(nn,nn.current),se(Hi,Hi.current)}function Ii(s){F(Hi),ss===s&&(ss=null),F(nn)}var nn=N(0);function Bf(s){for(var r=s;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Km(c)||Xm(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Tl=0,Fe=null,Ct=null,cn=null,zf=!1,ao=!1,ua=!1,Hf=0,zc=0,oo=null,nT=0;function Zt(){throw Error(i(321))}function Pp(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!Bi(s[c],r[c]))return!1;return!0}function Yp(s,r,c,h,m,g){return Tl=g,Fe=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,q.H=s===null||s.memoizedState===null?yx:rm,ua=!1,g=c(h,m),ua=!1,ao&&(g=Bb(r,c,h,m)),Lb(s),g}function Lb(s){q.H=Uc;var r=Ct!==null&&Ct.next!==null;if(Tl=0,cn=Ct=Fe=null,zf=!1,zc=0,oo=null,r)throw Error(i(300));s===null||un||(s=s.dependencies,s!==null&&Mf(s)&&(un=!0))}function Bb(s,r,c,h){Fe=s;var m=0;do{if(ao&&(oo=null),zc=0,ao=!1,25<=m)throw Error(i(301));if(m+=1,cn=Ct=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}q.H=bx,g=r(c,h)}while(ao);return g}function iT(){var s=q.H,r=s.useState()[0];return r=typeof r.then=="function"?Hc(r):r,s=s.useState()[0],(Ct!==null?Ct.memoizedState:null)!==s&&(Fe.flags|=1024),r}function Fp(){var s=Hf!==0;return Hf=0,s}function $p(s,r,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}function Wp(s){if(zf){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}zf=!1}Tl=0,cn=Ct=Fe=null,ao=!1,zc=Hf=0,oo=null}function ui(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Fe.memoizedState=cn=s:cn=cn.next=s,cn}function sn(){if(Ct===null){var s=Fe.alternate;s=s!==null?s.memoizedState:null}else s=Ct.next;var r=cn===null?Fe.memoizedState:cn.next;if(r!==null)cn=r,Ct=s;else{if(s===null)throw Fe.alternate===null?Error(i(467)):Error(i(310));Ct=s,s={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},cn===null?Fe.memoizedState=cn=s:cn=cn.next=s}return cn}function If(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hc(s){var r=zc;return zc+=1,oo===null&&(oo=[]),s=Cb(oo,s,r),r=Fe,(cn===null?r.memoizedState:cn.next)===null&&(r=r.alternate,q.H=r===null||r.memoizedState===null?yx:rm),s}function Uf(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Hc(s);if(s.$$typeof===B)return Hn(s)}throw Error(i(438,String(s)))}function Kp(s){var r=null,c=Fe.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var h=Fe.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(r={data:h.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=If(),Fe.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),h=0;h<s;h++)c[h]=Te;return r.index++,c}function Ml(s,r){return typeof r=="function"?r(s):r}function qf(s){var r=sn();return Xp(r,Ct,s)}function Xp(s,r,c){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var m=s.baseQueue,g=h.pending;if(g!==null){if(m!==null){var S=m.next;m.next=g.next,g.next=S}r.baseQueue=m=g,h.pending=null}if(g=s.baseState,m===null)s.memoizedState=g;else{r=m.next;var _=S=null,O=null,G=r,X=!1;do{var ne=G.lane&-536870913;if(ne!==G.lane?(st&ne)===ne:(Tl&ne)===ne){var P=G.revertLane;if(P===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ne===no&&(X=!0);else if((Tl&P)===P){G=G.next,P===no&&(X=!0);continue}else ne={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},O===null?(_=O=ne,S=g):O=O.next=ne,Fe.lanes|=P,mr|=P;ne=G.action,ua&&c(g,ne),g=G.hasEagerState?G.eagerState:c(g,ne)}else P={lane:ne,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},O===null?(_=O=P,S=g):O=O.next=P,Fe.lanes|=ne,mr|=ne;G=G.next}while(G!==null&&G!==r);if(O===null?S=g:O.next=_,!Bi(g,s.memoizedState)&&(un=!0,X&&(c=io,c!==null)))throw c;s.memoizedState=g,s.baseState=S,s.baseQueue=O,h.lastRenderedState=g}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Qp(s){var r=sn(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var h=c.dispatch,m=c.pending,g=r.memoizedState;if(m!==null){c.pending=null;var S=m=m.next;do g=s(g,S.action),S=S.next;while(S!==m);Bi(g,r.memoizedState)||(un=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),c.lastRenderedState=g}return[g,h]}function zb(s,r,c){var h=Fe,m=sn(),g=rt;if(g){if(c===void 0)throw Error(i(407));c=c()}else c=r();var S=!Bi((Ct||m).memoizedState,c);if(S&&(m.memoizedState=c,un=!0),m=m.queue,em(Ub.bind(null,h,m,s),[s]),m.getSnapshot!==r||S||cn!==null&&cn.memoizedState.tag&1){if(h.flags|=2048,co(9,{destroy:void 0},Ib.bind(null,h,m,c,r),null),Rt===null)throw Error(i(349));g||(Tl&127)!==0||Hb(h,r,c)}return c}function Hb(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=Fe.updateQueue,r===null?(r=If(),Fe.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function Ib(s,r,c,h){r.value=c,r.getSnapshot=h,qb(r)&&Vb(s)}function Ub(s,r,c){return c(function(){qb(r)&&Vb(s)})}function qb(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!Bi(s,c)}catch{return!0}}function Vb(s){var r=ta(s,2);r!==null&&wi(r,s,2)}function Zp(s){var r=ui();if(typeof s=="function"){var c=s;if(s=c(),ua){Ei(!0);try{c()}finally{Ei(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:s},r}function Gb(s,r,c,h){return s.baseState=c,Xp(s,Ct,typeof h=="function"?h:Ml)}function sT(s,r,c,h,m){if(Pf(s))throw Error(i(485));if(s=r.action,s!==null){var g={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){g.listeners.push(S)}};q.T!==null?c(!0):g.isTransition=!1,h(g),c=r.pending,c===null?(g.next=r.pending=g,Pb(r,g)):(g.next=c.next,r.pending=c.next=g)}}function Pb(s,r){var c=r.action,h=r.payload,m=s.state;if(r.isTransition){var g=q.T,S={};q.T=S;try{var _=c(m,h),O=q.S;O!==null&&O(S,_),Yb(s,r,_)}catch(G){Jp(s,r,G)}finally{g!==null&&S.types!==null&&(g.types=S.types),q.T=g}}else try{g=c(m,h),Yb(s,r,g)}catch(G){Jp(s,r,G)}}function Yb(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){Fb(s,r,h)},function(h){return Jp(s,r,h)}):Fb(s,r,c)}function Fb(s,r,c){r.status="fulfilled",r.value=c,$b(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,Pb(s,c)))}function Jp(s,r,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do r.status="rejected",r.reason=c,$b(r),r=r.next;while(r!==h)}s.action=null}function $b(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function Wb(s,r){return r}function Kb(s,r){if(rt){var c=Rt.formState;if(c!==null){e:{var h=Fe;if(rt){if(Ut){t:{for(var m=Ut,g=is;m.nodeType!==8;){if(!g){m=null;break t}if(m=ls(m.nextSibling),m===null){m=null;break t}}g=m.data,m=g==="F!"||g==="F"?m:null}if(m){Ut=ls(m.nextSibling),h=m.data==="F!";break e}}rr(h)}h=!1}h&&(r=c[0])}}return c=ui(),c.memoizedState=c.baseState=r,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wb,lastRenderedState:r},c.queue=h,c=px.bind(null,Fe,h),h.dispatch=c,h=Zp(!1),g=lm.bind(null,Fe,!1,h.queue),h=ui(),m={state:r,dispatch:null,action:s,pending:null},h.queue=m,c=sT.bind(null,Fe,m,g,c),m.dispatch=c,h.memoizedState=s,[r,c,!1]}function Xb(s){var r=sn();return Qb(r,Ct,s)}function Qb(s,r,c){if(r=Xp(s,r,Wb)[0],s=qf(Ml)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var h=Hc(r)}catch(S){throw S===so?Df:S}else h=r;r=sn();var m=r.queue,g=m.dispatch;return c!==r.memoizedState&&(Fe.flags|=2048,co(9,{destroy:void 0},lT.bind(null,m,c),null)),[h,g,s]}function lT(s,r){s.action=r}function Zb(s){var r=sn(),c=Ct;if(c!==null)return Qb(r,c,s);sn(),r=r.memoizedState,c=sn();var h=c.queue.dispatch;return c.memoizedState=s,[r,h,!1]}function co(s,r,c,h){return s={tag:s,create:c,deps:h,inst:r,next:null},r=Fe.updateQueue,r===null&&(r=If(),Fe.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,r.lastEffect=s),s}function Jb(){return sn().memoizedState}function Vf(s,r,c,h){var m=ui();Fe.flags|=s,m.memoizedState=co(1|r,{destroy:void 0},c,h===void 0?null:h)}function Gf(s,r,c,h){var m=sn();h=h===void 0?null:h;var g=m.memoizedState.inst;Ct!==null&&h!==null&&Pp(h,Ct.memoizedState.deps)?m.memoizedState=co(r,g,c,h):(Fe.flags|=s,m.memoizedState=co(1|r,g,c,h))}function ex(s,r){Vf(8390656,8,s,r)}function em(s,r){Gf(2048,8,s,r)}function rT(s){Fe.flags|=4;var r=Fe.updateQueue;if(r===null)r=If(),Fe.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function tx(s){var r=sn().memoizedState;return rT({ref:r,nextImpl:s}),function(){if((yt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function nx(s,r){return Gf(4,2,s,r)}function ix(s,r){return Gf(4,4,s,r)}function sx(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function lx(s,r,c){c=c!=null?c.concat([s]):null,Gf(4,4,sx.bind(null,r,s),c)}function tm(){}function rx(s,r){var c=sn();r=r===void 0?null:r;var h=c.memoizedState;return r!==null&&Pp(r,h[1])?h[0]:(c.memoizedState=[s,r],s)}function ax(s,r){var c=sn();r=r===void 0?null:r;var h=c.memoizedState;if(r!==null&&Pp(r,h[1]))return h[0];if(h=s(),ua){Ei(!0);try{s()}finally{Ei(!1)}}return c.memoizedState=[h,r],h}function nm(s,r,c){return c===void 0||(Tl&1073741824)!==0&&(st&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=o1(),Fe.lanes|=s,mr|=s,c)}function ox(s,r,c,h){return Bi(c,r)?c:ro.current!==null?(s=nm(s,c,h),Bi(s,r)||(un=!0),s):(Tl&42)===0||(Tl&1073741824)!==0&&(st&261930)===0?(un=!0,s.memoizedState=c):(s=o1(),Fe.lanes|=s,mr|=s,r)}function cx(s,r,c,h,m){var g=J.p;J.p=g!==0&&8>g?g:8;var S=q.T,_={};q.T=_,lm(s,!1,r,c);try{var O=m(),G=q.S;if(G!==null&&G(_,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var X=tT(O,h);Ic(s,r,X,Vi(s))}else Ic(s,r,h,Vi(s))}catch(ne){Ic(s,r,{then:function(){},status:"rejected",reason:ne},Vi())}finally{J.p=g,S!==null&&_.types!==null&&(S.types=_.types),q.T=S}}function aT(){}function im(s,r,c,h){if(s.tag!==5)throw Error(i(476));var m=ux(s).queue;cx(s,m,r,W,c===null?aT:function(){return fx(s),c(h)})}function ux(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:W},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function fx(s){var r=ux(s);r.next===null&&(r=s.alternate.memoizedState),Ic(s,r.next.queue,{},Vi())}function sm(){return Hn(nu)}function hx(){return sn().memoizedState}function dx(){return sn().memoizedState}function oT(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=Vi();s=cr(c);var h=ur(r,s,c);h!==null&&(wi(h,r,c),jc(h,r,c)),r={cache:Rp()},s.payload=r;return}r=r.return}}function cT(s,r,c){var h=Vi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Pf(s)?mx(r,c):(c=wp(s,r,c,h),c!==null&&(wi(c,s,h),gx(c,r,h)))}function px(s,r,c){var h=Vi();Ic(s,r,c,h)}function Ic(s,r,c,h){var m={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Pf(s))mx(r,m);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var S=r.lastRenderedState,_=g(S,c);if(m.hasEagerState=!0,m.eagerState=_,Bi(_,S))return Af(s,r,m,0),Rt===null&&kf(),!1}catch{}finally{}if(c=wp(s,r,m,h),c!==null)return wi(c,s,h),gx(c,r,h),!0}return!1}function lm(s,r,c,h){if(h={lane:2,revertLane:zm(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Pf(s)){if(r)throw Error(i(479))}else r=wp(s,c,h,2),r!==null&&wi(r,s,2)}function Pf(s){var r=s.alternate;return s===Fe||r!==null&&r===Fe}function mx(s,r){ao=zf=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function gx(s,r,c){if((c&4194048)!==0){var h=r.lanes;h&=s.pendingLanes,c|=h,r.lanes=c,Ni(s,c)}}var Uc={readContext:Hn,use:Uf,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Uc.useEffectEvent=Zt;var yx={readContext:Hn,use:Uf,useCallback:function(s,r){return ui().memoizedState=[s,r===void 0?null:r],s},useContext:Hn,useEffect:ex,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,Vf(4194308,4,sx.bind(null,r,s),c)},useLayoutEffect:function(s,r){return Vf(4194308,4,s,r)},useInsertionEffect:function(s,r){Vf(4,2,s,r)},useMemo:function(s,r){var c=ui();r=r===void 0?null:r;var h=s();if(ua){Ei(!0);try{s()}finally{Ei(!1)}}return c.memoizedState=[h,r],h},useReducer:function(s,r,c){var h=ui();if(c!==void 0){var m=c(r);if(ua){Ei(!0);try{c(r)}finally{Ei(!1)}}}else m=r;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=cT.bind(null,Fe,s),[h.memoizedState,s]},useRef:function(s){var r=ui();return s={current:s},r.memoizedState=s},useState:function(s){s=Zp(s);var r=s.queue,c=px.bind(null,Fe,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:tm,useDeferredValue:function(s,r){var c=ui();return nm(c,s,r)},useTransition:function(){var s=Zp(!1);return s=cx.bind(null,Fe,s.queue,!0,!1),ui().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var h=Fe,m=ui();if(rt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),Rt===null)throw Error(i(349));(st&127)!==0||Hb(h,r,c)}m.memoizedState=c;var g={value:c,getSnapshot:r};return m.queue=g,ex(Ub.bind(null,h,g,s),[s]),h.flags|=2048,co(9,{destroy:void 0},Ib.bind(null,h,g,c,r),null),c},useId:function(){var s=ui(),r=Rt.identifierPrefix;if(rt){var c=Ks,h=Ws;c=(h&~(1<<32-yn(h)-1)).toString(32)+c,r="_"+r+"R_"+c,c=Hf++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=nT++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:sm,useFormState:Kb,useActionState:Kb,useOptimistic:function(s){var r=ui();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=lm.bind(null,Fe,!0,c),c.dispatch=r,[s,r]},useMemoCache:Kp,useCacheRefresh:function(){return ui().memoizedState=oT.bind(null,Fe)},useEffectEvent:function(s){var r=ui(),c={impl:s};return r.memoizedState=c,function(){if((yt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},rm={readContext:Hn,use:Uf,useCallback:rx,useContext:Hn,useEffect:em,useImperativeHandle:lx,useInsertionEffect:nx,useLayoutEffect:ix,useMemo:ax,useReducer:qf,useRef:Jb,useState:function(){return qf(Ml)},useDebugValue:tm,useDeferredValue:function(s,r){var c=sn();return ox(c,Ct.memoizedState,s,r)},useTransition:function(){var s=qf(Ml)[0],r=sn().memoizedState;return[typeof s=="boolean"?s:Hc(s),r]},useSyncExternalStore:zb,useId:hx,useHostTransitionStatus:sm,useFormState:Xb,useActionState:Xb,useOptimistic:function(s,r){var c=sn();return Gb(c,Ct,s,r)},useMemoCache:Kp,useCacheRefresh:dx};rm.useEffectEvent=tx;var bx={readContext:Hn,use:Uf,useCallback:rx,useContext:Hn,useEffect:em,useImperativeHandle:lx,useInsertionEffect:nx,useLayoutEffect:ix,useMemo:ax,useReducer:Qp,useRef:Jb,useState:function(){return Qp(Ml)},useDebugValue:tm,useDeferredValue:function(s,r){var c=sn();return Ct===null?nm(c,s,r):ox(c,Ct.memoizedState,s,r)},useTransition:function(){var s=Qp(Ml)[0],r=sn().memoizedState;return[typeof s=="boolean"?s:Hc(s),r]},useSyncExternalStore:zb,useId:hx,useHostTransitionStatus:sm,useFormState:Zb,useActionState:Zb,useOptimistic:function(s,r){var c=sn();return Ct!==null?Gb(c,Ct,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Kp,useCacheRefresh:dx};bx.useEffectEvent=tx;function am(s,r,c,h){r=s.memoizedState,c=c(h,r),c=c==null?r:b({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var om={enqueueSetState:function(s,r,c){s=s._reactInternals;var h=Vi(),m=cr(h);m.payload=r,c!=null&&(m.callback=c),r=ur(s,m,h),r!==null&&(wi(r,s,h),jc(r,s,h))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var h=Vi(),m=cr(h);m.tag=1,m.payload=r,c!=null&&(m.callback=c),r=ur(s,m,h),r!==null&&(wi(r,s,h),jc(r,s,h))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=Vi(),h=cr(c);h.tag=2,r!=null&&(h.callback=r),r=ur(s,h,c),r!==null&&(wi(r,s,c),jc(r,s,c))}};function xx(s,r,c,h,m,g,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,g,S):r.prototype&&r.prototype.isPureReactComponent?!Cc(c,h)||!Cc(m,g):!0}function vx(s,r,c,h){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,h),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,h),r.state!==s&&om.enqueueReplaceState(r,r.state,null)}function fa(s,r){var c=r;if("ref"in r){c={};for(var h in r)h!=="ref"&&(c[h]=r[h])}if(s=s.defaultProps){c===r&&(c=b({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function Sx(s){wf(s)}function wx(s){console.error(s)}function kx(s){wf(s)}function Yf(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(h){setTimeout(function(){throw h})}}function Ax(s,r,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function cm(s,r,c){return c=cr(c),c.tag=3,c.payload={element:null},c.callback=function(){Yf(s,r)},c}function _x(s){return s=cr(s),s.tag=3,s}function Cx(s,r,c,h){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var g=h.value;s.payload=function(){return m(g)},s.callback=function(){Ax(r,c,h)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){Ax(r,c,h),typeof m!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var _=h.stack;this.componentDidCatch(h.value,{componentStack:_!==null?_:""})})}function uT(s,r,c,h,m){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(r=c.alternate,r!==null&&to(r,c,m,!0),c=Hi.current,c!==null){switch(c.tag){case 31:case 13:return ss===null?ih():c.alternate===null&&Jt===0&&(Jt=3),c.flags&=-257,c.flags|=65536,c.lanes=m,h===Of?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([h]):r.add(h),jm(s,h,m)),!1;case 22:return c.flags|=65536,h===Of?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([h]):c.add(h)),jm(s,h,m)),!1}throw Error(i(435,c.tag))}return jm(s,h,m),ih(),!1}if(rt)return r=Hi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,h!==Mp&&(s=Error(i(422),{cause:h}),Ec(es(s,c)))):(h!==Mp&&(r=Error(i(423),{cause:h}),Ec(es(r,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=es(h,c),m=cm(s.stateNode,h,m),Ip(s,m),Jt!==4&&(Jt=2)),!1;var g=Error(i(520),{cause:h});if(g=es(g,c),Wc===null?Wc=[g]:Wc.push(g),Jt!==4&&(Jt=2),r===null)return!0;h=es(h,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=cm(c.stateNode,h,s),Ip(c,s),!1;case 1:if(r=c.type,g=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(gr===null||!gr.has(g))))return c.flags|=65536,m&=-m,c.lanes|=m,m=_x(m),Cx(m,s,c,h),Ip(c,m),!1}c=c.return}while(c!==null);return!1}var um=Error(i(461)),un=!1;function In(s,r,c,h){r.child=s===null?Nb(r,null,c,h):ca(r,s.child,c,h)}function Tx(s,r,c,h,m){c=c.render;var g=r.ref;if("ref"in h){var S={};for(var _ in h)_!=="ref"&&(S[_]=h[_])}else S=h;return la(r),h=Yp(s,r,c,S,g,m),_=Fp(),s!==null&&!un?($p(s,r,m),El(s,r,m)):(rt&&_&&Cp(r),r.flags|=1,In(s,r,h,m),r.child)}function Mx(s,r,c,h,m){if(s===null){var g=c.type;return typeof g=="function"&&!kp(g)&&g.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=g,Ex(s,r,g,h,m)):(s=Cf(c.type,null,h,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!bm(s,m)){var S=g.memoizedProps;if(c=c.compare,c=c!==null?c:Cc,c(S,h)&&s.ref===r.ref)return El(s,r,m)}return r.flags|=1,s=kl(g,h),s.ref=r.ref,s.return=r,r.child=s}function Ex(s,r,c,h,m){if(s!==null){var g=s.memoizedProps;if(Cc(g,h)&&s.ref===r.ref)if(un=!1,r.pendingProps=h=g,bm(s,m))(s.flags&131072)!==0&&(un=!0);else return r.lanes=s.lanes,El(s,r,m)}return fm(s,r,c,h,m)}function Nx(s,r,c,h){var m=h.children,g=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((r.flags&128)!==0){if(g=g!==null?g.baseLanes|c:c,s!==null){for(h=r.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~g}else h=0,r.child=null;return Dx(s,r,g,c,h)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Nf(r,g!==null?g.cachePool:null),g!==null?Rb(r,g):qp(),jb(r);else return h=r.lanes=536870912,Dx(s,r,g!==null?g.baseLanes|c:c,c,h)}else g!==null?(Nf(r,g.cachePool),Rb(r,g),hr(),r.memoizedState=null):(s!==null&&Nf(r,null),qp(),hr());return In(s,r,m,c),r.child}function qc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Dx(s,r,c,h,m){var g=Lp();return g=g===null?null:{parent:on._currentValue,pool:g},r.memoizedState={baseLanes:c,cachePool:g},s!==null&&Nf(r,null),qp(),jb(r),s!==null&&to(s,r,h,!0),r.childLanes=m,null}function Ff(s,r){return r=Wf({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function Ox(s,r,c){return ca(r,s.child,null,c),s=Ff(r,r.pendingProps),s.flags|=2,Ii(r),r.memoizedState=null,s}function fT(s,r,c){var h=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(rt){if(h.mode==="hidden")return s=Ff(r,h),r.lanes=536870912,qc(null,s);if(Gp(r),(s=Ut)?(s=P1(s,is),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:sr!==null?{id:Ws,overflow:Ks}:null,retryLane:536870912,hydrationErrors:null},c=mb(s),c.return=r,r.child=c,zn=r,Ut=null)):s=null,s===null)throw rr(r);return r.lanes=536870912,null}return Ff(r,h)}var g=s.memoizedState;if(g!==null){var S=g.dehydrated;if(Gp(r),m)if(r.flags&256)r.flags&=-257,r=Ox(s,r,c);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(un||to(s,r,c,!1),m=(c&s.childLanes)!==0,un||m){if(h=Rt,h!==null&&(S=Ki(h,c),S!==0&&S!==g.retryLane))throw g.retryLane=S,ta(s,S),wi(h,s,S),um;ih(),r=Ox(s,r,c)}else s=g.treeContext,Ut=ls(S.nextSibling),zn=r,rt=!0,lr=null,is=!1,s!==null&&bb(r,s),r=Ff(r,h),r.flags|=4096;return r}return s=kl(s.child,{mode:h.mode,children:h.children}),s.ref=r.ref,r.child=s,s.return=r,s}function $f(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function fm(s,r,c,h,m){return la(r),c=Yp(s,r,c,h,void 0,m),h=Fp(),s!==null&&!un?($p(s,r,m),El(s,r,m)):(rt&&h&&Cp(r),r.flags|=1,In(s,r,c,m),r.child)}function Rx(s,r,c,h,m,g){return la(r),r.updateQueue=null,c=Bb(r,h,c,m),Lb(s),h=Fp(),s!==null&&!un?($p(s,r,g),El(s,r,g)):(rt&&h&&Cp(r),r.flags|=1,In(s,r,c,g),r.child)}function jx(s,r,c,h,m){if(la(r),r.stateNode===null){var g=Qa,S=c.contextType;typeof S=="object"&&S!==null&&(g=Hn(S)),g=new c(h,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=om,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=h,g.state=r.memoizedState,g.refs={},zp(r),S=c.contextType,g.context=typeof S=="object"&&S!==null?Hn(S):Qa,g.state=r.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(am(r,c,S,h),g.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(S=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),S!==g.state&&om.enqueueReplaceState(g,g.state,null),Bc(r,h,g,m),Lc(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),h=!0}else if(s===null){g=r.stateNode;var _=r.memoizedProps,O=fa(c,_);g.props=O;var G=g.context,X=c.contextType;S=Qa,typeof X=="object"&&X!==null&&(S=Hn(X));var ne=c.getDerivedStateFromProps;X=typeof ne=="function"||typeof g.getSnapshotBeforeUpdate=="function",_=r.pendingProps!==_,X||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(_||G!==S)&&vx(r,g,h,S),or=!1;var P=r.memoizedState;g.state=P,Bc(r,h,g,m),Lc(),G=r.memoizedState,_||P!==G||or?(typeof ne=="function"&&(am(r,c,ne,h),G=r.memoizedState),(O=or||xx(r,c,O,h,P,G,S))?(X||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=h,r.memoizedState=G),g.props=h,g.state=G,g.context=S,h=O):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),h=!1)}else{g=r.stateNode,Hp(s,r),S=r.memoizedProps,X=fa(c,S),g.props=X,ne=r.pendingProps,P=g.context,G=c.contextType,O=Qa,typeof G=="object"&&G!==null&&(O=Hn(G)),_=c.getDerivedStateFromProps,(G=typeof _=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(S!==ne||P!==O)&&vx(r,g,h,O),or=!1,P=r.memoizedState,g.state=P,Bc(r,h,g,m),Lc();var $=r.memoizedState;S!==ne||P!==$||or||s!==null&&s.dependencies!==null&&Mf(s.dependencies)?(typeof _=="function"&&(am(r,c,_,h),$=r.memoizedState),(X=or||xx(r,c,X,h,P,$,O)||s!==null&&s.dependencies!==null&&Mf(s.dependencies))?(G||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(h,$,O),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(h,$,O)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||S===s.memoizedProps&&P===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&P===s.memoizedState||(r.flags|=1024),r.memoizedProps=h,r.memoizedState=$),g.props=h,g.state=$,g.context=O,h=X):(typeof g.componentDidUpdate!="function"||S===s.memoizedProps&&P===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&P===s.memoizedState||(r.flags|=1024),h=!1)}return g=h,$f(s,r),h=(r.flags&128)!==0,g||h?(g=r.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,s!==null&&h?(r.child=ca(r,s.child,null,m),r.child=ca(r,null,c,m)):In(s,r,c,m),r.memoizedState=g.state,s=r.child):s=El(s,r,m),s}function Lx(s,r,c,h){return ia(),r.flags|=256,In(s,r,c,h),r.child}var hm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dm(s){return{baseLanes:s,cachePool:Ab()}}function pm(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=qi),s}function Bx(s,r,c){var h=r.pendingProps,m=!1,g=(r.flags&128)!==0,S;if((S=g)||(S=s!==null&&s.memoizedState===null?!1:(nn.current&2)!==0),S&&(m=!0,r.flags&=-129),S=(r.flags&32)!==0,r.flags&=-33,s===null){if(rt){if(m?fr(r):hr(),(s=Ut)?(s=P1(s,is),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:sr!==null?{id:Ws,overflow:Ks}:null,retryLane:536870912,hydrationErrors:null},c=mb(s),c.return=r,r.child=c,zn=r,Ut=null)):s=null,s===null)throw rr(r);return Xm(s)?r.lanes=32:r.lanes=536870912,null}var _=h.children;return h=h.fallback,m?(hr(),m=r.mode,_=Wf({mode:"hidden",children:_},m),h=na(h,m,c,null),_.return=r,h.return=r,_.sibling=h,r.child=_,h=r.child,h.memoizedState=dm(c),h.childLanes=pm(s,S,c),r.memoizedState=hm,qc(null,h)):(fr(r),mm(r,_))}var O=s.memoizedState;if(O!==null&&(_=O.dehydrated,_!==null)){if(g)r.flags&256?(fr(r),r.flags&=-257,r=gm(s,r,c)):r.memoizedState!==null?(hr(),r.child=s.child,r.flags|=128,r=null):(hr(),_=h.fallback,m=r.mode,h=Wf({mode:"visible",children:h.children},m),_=na(_,m,c,null),_.flags|=2,h.return=r,_.return=r,h.sibling=_,r.child=h,ca(r,s.child,null,c),h=r.child,h.memoizedState=dm(c),h.childLanes=pm(s,S,c),r.memoizedState=hm,r=qc(null,h));else if(fr(r),Xm(_)){if(S=_.nextSibling&&_.nextSibling.dataset,S)var G=S.dgst;S=G,h=Error(i(419)),h.stack="",h.digest=S,Ec({value:h,source:null,stack:null}),r=gm(s,r,c)}else if(un||to(s,r,c,!1),S=(c&s.childLanes)!==0,un||S){if(S=Rt,S!==null&&(h=Ki(S,c),h!==0&&h!==O.retryLane))throw O.retryLane=h,ta(s,h),wi(S,s,h),um;Km(_)||ih(),r=gm(s,r,c)}else Km(_)?(r.flags|=192,r.child=s.child,r=null):(s=O.treeContext,Ut=ls(_.nextSibling),zn=r,rt=!0,lr=null,is=!1,s!==null&&bb(r,s),r=mm(r,h.children),r.flags|=4096);return r}return m?(hr(),_=h.fallback,m=r.mode,O=s.child,G=O.sibling,h=kl(O,{mode:"hidden",children:h.children}),h.subtreeFlags=O.subtreeFlags&65011712,G!==null?_=kl(G,_):(_=na(_,m,c,null),_.flags|=2),_.return=r,h.return=r,h.sibling=_,r.child=h,qc(null,h),h=r.child,_=s.child.memoizedState,_===null?_=dm(c):(m=_.cachePool,m!==null?(O=on._currentValue,m=m.parent!==O?{parent:O,pool:O}:m):m=Ab(),_={baseLanes:_.baseLanes|c,cachePool:m}),h.memoizedState=_,h.childLanes=pm(s,S,c),r.memoizedState=hm,qc(s.child,h)):(fr(r),c=s.child,s=c.sibling,c=kl(c,{mode:"visible",children:h.children}),c.return=r,c.sibling=null,s!==null&&(S=r.deletions,S===null?(r.deletions=[s],r.flags|=16):S.push(s)),r.child=c,r.memoizedState=null,c)}function mm(s,r){return r=Wf({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Wf(s,r){return s=zi(22,s,null,r),s.lanes=0,s}function gm(s,r,c){return ca(r,s.child,null,c),s=mm(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function zx(s,r,c){s.lanes|=r;var h=s.alternate;h!==null&&(h.lanes|=r),Dp(s.return,r,c)}function ym(s,r,c,h,m,g){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:m,treeForkCount:g}:(S.isBackwards=r,S.rendering=null,S.renderingStartTime=0,S.last=h,S.tail=c,S.tailMode=m,S.treeForkCount=g)}function Hx(s,r,c){var h=r.pendingProps,m=h.revealOrder,g=h.tail;h=h.children;var S=nn.current,_=(S&2)!==0;if(_?(S=S&1|2,r.flags|=128):S&=1,se(nn,S),In(s,r,h,c),h=rt?Mc:0,!_&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&zx(s,c,r);else if(s.tag===19)zx(s,c,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(c=r.child,m=null;c!==null;)s=c.alternate,s!==null&&Bf(s)===null&&(m=c),c=c.sibling;c=m,c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null),ym(r,!1,m,c,g,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&Bf(s)===null){r.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}ym(r,!0,c,null,g,h);break;case"together":ym(r,!1,null,null,void 0,h);break;default:r.memoizedState=null}return r.child}function El(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),mr|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(to(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,c=kl(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=kl(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function bm(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Mf(s)))}function hT(s,r,c){switch(r.tag){case 3:ft(r,r.stateNode.containerInfo),ar(r,on,s.memoizedState.cache),ia();break;case 27:case 5:xt(r);break;case 4:ft(r,r.stateNode.containerInfo);break;case 10:ar(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Gp(r),null;break;case 13:var h=r.memoizedState;if(h!==null)return h.dehydrated!==null?(fr(r),r.flags|=128,null):(c&r.child.childLanes)!==0?Bx(s,r,c):(fr(r),s=El(s,r,c),s!==null?s.sibling:null);fr(r);break;case 19:var m=(s.flags&128)!==0;if(h=(c&r.childLanes)!==0,h||(to(s,r,c,!1),h=(c&r.childLanes)!==0),m){if(h)return Hx(s,r,c);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),se(nn,nn.current),h)break;return null;case 22:return r.lanes=0,Nx(s,r,c,r.pendingProps);case 24:ar(r,on,s.memoizedState.cache)}return El(s,r,c)}function Ix(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)un=!0;else{if(!bm(s,c)&&(r.flags&128)===0)return un=!1,hT(s,r,c);un=(s.flags&131072)!==0}else un=!1,rt&&(r.flags&1048576)!==0&&yb(r,Mc,r.index);switch(r.lanes=0,r.tag){case 16:e:{var h=r.pendingProps;if(s=aa(r.elementType),r.type=s,typeof s=="function")kp(s)?(h=fa(s,h),r.tag=1,r=jx(null,r,s,h,c)):(r.tag=0,r=fm(null,r,s,h,c));else{if(s!=null){var m=s.$$typeof;if(m===H){r.tag=11,r=Tx(null,r,s,h,c);break e}else if(m===R){r.tag=14,r=Mx(null,r,s,h,c);break e}}throw r=Ae(s)||s,Error(i(306,r,""))}}return r;case 0:return fm(s,r,r.type,r.pendingProps,c);case 1:return h=r.type,m=fa(h,r.pendingProps),jx(s,r,h,m,c);case 3:e:{if(ft(r,r.stateNode.containerInfo),s===null)throw Error(i(387));h=r.pendingProps;var g=r.memoizedState;m=g.element,Hp(s,r),Bc(r,h,null,c);var S=r.memoizedState;if(h=S.cache,ar(r,on,h),h!==g.cache&&Op(r,[on],c,!0),Lc(),h=S.element,g.isDehydrated)if(g={element:h,isDehydrated:!1,cache:S.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=Lx(s,r,h,c);break e}else if(h!==m){m=es(Error(i(424)),r),Ec(m),r=Lx(s,r,h,c);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ut=ls(s.firstChild),zn=r,rt=!0,lr=null,is=!0,c=Nb(r,null,h,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ia(),h===m){r=El(s,r,c);break e}In(s,r,h,c)}r=r.child}return r;case 26:return $f(s,r),s===null?(c=X1(r.type,null,r.pendingProps,null))?r.memoizedState=c:rt||(c=r.type,s=r.pendingProps,h=uh(_e.current).createElement(c),h[Dt]=r,h[Qe]=s,Un(h,c,s),kt(h),r.stateNode=h):r.memoizedState=X1(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return xt(r),s===null&&rt&&(h=r.stateNode=$1(r.type,r.pendingProps,_e.current),zn=r,is=!0,m=Ut,vr(r.type)?(Qm=m,Ut=ls(h.firstChild)):Ut=m),In(s,r,r.pendingProps.children,c),$f(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&rt&&((m=h=Ut)&&(h=VT(h,r.type,r.pendingProps,is),h!==null?(r.stateNode=h,zn=r,Ut=ls(h.firstChild),is=!1,m=!0):m=!1),m||rr(r)),xt(r),m=r.type,g=r.pendingProps,S=s!==null?s.memoizedProps:null,h=g.children,Fm(m,g)?h=null:S!==null&&Fm(m,S)&&(r.flags|=32),r.memoizedState!==null&&(m=Yp(s,r,iT,null,null,c),nu._currentValue=m),$f(s,r),In(s,r,h,c),r.child;case 6:return s===null&&rt&&((s=c=Ut)&&(c=GT(c,r.pendingProps,is),c!==null?(r.stateNode=c,zn=r,Ut=null,s=!0):s=!1),s||rr(r)),null;case 13:return Bx(s,r,c);case 4:return ft(r,r.stateNode.containerInfo),h=r.pendingProps,s===null?r.child=ca(r,null,h,c):In(s,r,h,c),r.child;case 11:return Tx(s,r,r.type,r.pendingProps,c);case 7:return In(s,r,r.pendingProps,c),r.child;case 8:return In(s,r,r.pendingProps.children,c),r.child;case 12:return In(s,r,r.pendingProps.children,c),r.child;case 10:return h=r.pendingProps,ar(r,r.type,h.value),In(s,r,h.children,c),r.child;case 9:return m=r.type._context,h=r.pendingProps.children,la(r),m=Hn(m),h=h(m),r.flags|=1,In(s,r,h,c),r.child;case 14:return Mx(s,r,r.type,r.pendingProps,c);case 15:return Ex(s,r,r.type,r.pendingProps,c);case 19:return Hx(s,r,c);case 31:return fT(s,r,c);case 22:return Nx(s,r,c,r.pendingProps);case 24:return la(r),h=Hn(on),s===null?(m=Lp(),m===null&&(m=Rt,g=Rp(),m.pooledCache=g,g.refCount++,g!==null&&(m.pooledCacheLanes|=c),m=g),r.memoizedState={parent:h,cache:m},zp(r),ar(r,on,m)):((s.lanes&c)!==0&&(Hp(s,r),Bc(r,null,null,c),Lc()),m=s.memoizedState,g=r.memoizedState,m.parent!==h?(m={parent:h,cache:h},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),ar(r,on,h)):(h=g.cache,ar(r,on,h),h!==m.cache&&Op(r,[on],c,!0))),In(s,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Nl(s){s.flags|=4}function xm(s,r,c,h,m){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(h1())s.flags|=8192;else throw oa=Of,Bp}else s.flags&=-16777217}function Ux(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!tv(r))if(h1())s.flags|=8192;else throw oa=Of,Bp}function Kf(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Ln():536870912,s.lanes|=r,po|=r)}function Vc(s,r){if(!rt)switch(s.tailMode){case"hidden":r=s.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(r)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=c,r}function dT(s,r,c){var h=r.pendingProps;switch(Tp(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(r),null;case 1:return qt(r),null;case 3:return c=r.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),r.memoizedState.cache!==h&&(r.flags|=2048),Cl(on),ht(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(eo(r)?Nl(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Ep())),qt(r),null;case 26:var m=r.type,g=r.memoizedState;return s===null?(Nl(r),g!==null?(qt(r),Ux(r,g)):(qt(r),xm(r,m,null,h,c))):g?g!==s.memoizedState?(Nl(r),qt(r),Ux(r,g)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==h&&Nl(r),qt(r),xm(r,m,s,h,c)),null;case 27:if(Ye(r),c=_e.current,m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==h&&Nl(r);else{if(!h){if(r.stateNode===null)throw Error(i(166));return qt(r),null}s=ae.current,eo(r)?xb(r):(s=$1(m,h,c),r.stateNode=s,Nl(r))}return qt(r),null;case 5:if(Ye(r),m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==h&&Nl(r);else{if(!h){if(r.stateNode===null)throw Error(i(166));return qt(r),null}if(g=ae.current,eo(r))xb(r);else{var S=uh(_e.current);switch(g){case 1:g=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:g=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":g=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":g=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":g=S.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof h.is=="string"?S.createElement("select",{is:h.is}):S.createElement("select"),h.multiple?g.multiple=!0:h.size&&(g.size=h.size);break;default:g=typeof h.is=="string"?S.createElement(m,{is:h.is}):S.createElement(m)}}g[Dt]=r,g[Qe]=h;e:for(S=r.child;S!==null;){if(S.tag===5||S.tag===6)g.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===r)break e;for(;S.sibling===null;){if(S.return===null||S.return===r)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}r.stateNode=g;e:switch(Un(g,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Nl(r)}}return qt(r),xm(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==h&&Nl(r);else{if(typeof h!="string"&&r.stateNode===null)throw Error(i(166));if(s=_e.current,eo(r)){if(s=r.stateNode,c=r.memoizedProps,h=null,m=zn,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Dt]=r,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||B1(s.nodeValue,c)),s||rr(r,!0)}else s=uh(s).createTextNode(h),s[Dt]=r,r.stateNode=s}return qt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(h=eo(r),c!==null){if(s===null){if(!h)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Dt]=r}else ia(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else c=Ep(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return r.flags&256?(Ii(r),r):(Ii(r),null);if((r.flags&128)!==0)throw Error(i(558))}return qt(r),null;case 13:if(h=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=eo(r),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Dt]=r}else ia(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),m=!1}else m=Ep(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(Ii(r),r):(Ii(r),null)}return Ii(r),(r.flags&128)!==0?(r.lanes=c,r):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=r.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),g=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(g=h.memoizedState.cachePool.pool),g!==m&&(h.flags|=2048)),c!==s&&c&&(r.child.flags|=8192),Kf(r,r.updateQueue),qt(r),null);case 4:return ht(),s===null&&qm(r.stateNode.containerInfo),qt(r),null;case 10:return Cl(r.type),qt(r),null;case 19:if(F(nn),h=r.memoizedState,h===null)return qt(r),null;if(m=(r.flags&128)!==0,g=h.rendering,g===null)if(m)Vc(h,!1);else{if(Jt!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=Bf(s),g!==null){for(r.flags|=128,Vc(h,!1),s=g.updateQueue,r.updateQueue=s,Kf(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)pb(c,s),c=c.sibling;return se(nn,nn.current&1|2),rt&&Al(r,h.treeForkCount),r.child}s=s.sibling}h.tail!==null&&$e()>eh&&(r.flags|=128,m=!0,Vc(h,!1),r.lanes=4194304)}else{if(!m)if(s=Bf(g),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,Kf(r,s),Vc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!g.alternate&&!rt)return qt(r),null}else 2*$e()-h.renderingStartTime>eh&&c!==536870912&&(r.flags|=128,m=!0,Vc(h,!1),r.lanes=4194304);h.isBackwards?(g.sibling=r.child,r.child=g):(s=h.last,s!==null?s.sibling=g:r.child=g,h.last=g)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=$e(),s.sibling=null,c=nn.current,se(nn,m?c&1|2:c&1),rt&&Al(r,h.treeForkCount),s):(qt(r),null);case 22:case 23:return Ii(r),Vp(),h=r.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(r.flags|=8192):h&&(r.flags|=8192),h?(c&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),c=r.updateQueue,c!==null&&Kf(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(h=r.memoizedState.cachePool.pool),h!==c&&(r.flags|=2048),s!==null&&F(ra),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Cl(on),qt(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function pT(s,r){switch(Tp(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Cl(on),ht(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return Ye(r),null;case 31:if(r.memoizedState!==null){if(Ii(r),r.alternate===null)throw Error(i(340));ia()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(Ii(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));ia()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return F(nn),null;case 4:return ht(),null;case 10:return Cl(r.type),null;case 22:case 23:return Ii(r),Vp(),s!==null&&F(ra),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Cl(on),null;case 25:return null;default:return null}}function qx(s,r){switch(Tp(r),r.tag){case 3:Cl(on),ht();break;case 26:case 27:case 5:Ye(r);break;case 4:ht();break;case 31:r.memoizedState!==null&&Ii(r);break;case 13:Ii(r);break;case 19:F(nn);break;case 10:Cl(r.type);break;case 22:case 23:Ii(r),Vp(),s!==null&&F(ra);break;case 24:Cl(on)}}function Gc(s,r){try{var c=r.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var m=h.next;c=m;do{if((c.tag&s)===s){h=void 0;var g=c.create,S=c.inst;h=g(),S.destroy=h}c=c.next}while(c!==m)}}catch(_){_t(r,r.return,_)}}function dr(s,r,c){try{var h=r.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var g=m.next;h=g;do{if((h.tag&s)===s){var S=h.inst,_=S.destroy;if(_!==void 0){S.destroy=void 0,m=r;var O=c,G=_;try{G()}catch(X){_t(m,O,X)}}}h=h.next}while(h!==g)}}catch(X){_t(r,r.return,X)}}function Vx(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{Ob(r,c)}catch(h){_t(s,s.return,h)}}}function Gx(s,r,c){c.props=fa(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){_t(s,r,h)}}function Pc(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(m){_t(s,r,m)}}function Xs(s,r){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(m){_t(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){_t(s,r,m)}else c.current=null}function Px(s){var r=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(m){_t(s,s.return,m)}}function vm(s,r,c){try{var h=s.stateNode;BT(h,s.type,c,r),h[Qe]=r}catch(m){_t(s,s.return,m)}}function Yx(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&vr(s.type)||s.tag===4}function Sm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Yx(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.tag===27&&vr(s.type)||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 wm(s,r,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(s),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=Ht));else if(h!==4&&(h===27&&vr(s.type)&&(c=s.stateNode,r=null),s=s.child,s!==null))for(wm(s,r,c),s=s.sibling;s!==null;)wm(s,r,c),s=s.sibling}function Xf(s,r,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,r?c.insertBefore(s,r):c.appendChild(s);else if(h!==4&&(h===27&&vr(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Xf(s,r,c),s=s.sibling;s!==null;)Xf(s,r,c),s=s.sibling}function Fx(s){var r=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);Un(r,h,c),r[Dt]=s,r[Qe]=c}catch(g){_t(s,s.return,g)}}var Dl=!1,fn=!1,km=!1,$x=typeof WeakSet=="function"?WeakSet:Set,En=null;function mT(s,r){if(s=s.containerInfo,Pm=yh,s=lb(s),gp(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var m=h.anchorOffset,g=h.focusNode;h=h.focusOffset;try{c.nodeType,g.nodeType}catch{c=null;break e}var S=0,_=-1,O=-1,G=0,X=0,ne=s,P=null;t:for(;;){for(var $;ne!==c||m!==0&&ne.nodeType!==3||(_=S+m),ne!==g||h!==0&&ne.nodeType!==3||(O=S+h),ne.nodeType===3&&(S+=ne.nodeValue.length),($=ne.firstChild)!==null;)P=ne,ne=$;for(;;){if(ne===s)break t;if(P===c&&++G===m&&(_=S),P===g&&++X===h&&(O=S),($=ne.nextSibling)!==null)break;ne=P,P=ne.parentNode}ne=$}c=_===-1||O===-1?null:{start:_,end:O}}else c=null}c=c||{start:0,end:0}}else c=null;for(Ym={focusedElem:s,selectionRange:c},yh=!1,En=r;En!==null;)if(r=En,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,En=s;else for(;En!==null;){switch(r=En,g=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)m=s[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,c=r,m=g.memoizedProps,g=g.memoizedState,h=c.stateNode;try{var Ce=fa(c.type,m);s=h.getSnapshotBeforeUpdate(Ce,g),h.__reactInternalSnapshotBeforeUpdate=s}catch(Ie){_t(c,c.return,Ie)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,c=s.nodeType,c===9)Wm(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Wm(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=r.sibling,s!==null){s.return=r.return,En=s;break}En=r.return}}function Wx(s,r,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Rl(s,c),h&4&&Gc(5,c);break;case 1:if(Rl(s,c),h&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(S){_t(c,c.return,S)}else{var m=fa(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(S){_t(c,c.return,S)}}h&64&&Vx(c),h&512&&Pc(c,c.return);break;case 3:if(Rl(s,c),h&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{Ob(s,r)}catch(S){_t(c,c.return,S)}}break;case 27:r===null&&h&4&&Fx(c);case 26:case 5:Rl(s,c),r===null&&h&4&&Px(c),h&512&&Pc(c,c.return);break;case 12:Rl(s,c);break;case 31:Rl(s,c),h&4&&Qx(s,c);break;case 13:Rl(s,c),h&4&&Zx(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=AT.bind(null,c),PT(s,c))));break;case 22:if(h=c.memoizedState!==null||Dl,!h){r=r!==null&&r.memoizedState!==null||fn,m=Dl;var g=fn;Dl=h,(fn=r)&&!g?jl(s,c,(c.subtreeFlags&8772)!==0):Rl(s,c),Dl=m,fn=g}break;case 30:break;default:Rl(s,c)}}function Kx(s){var r=s.alternate;r!==null&&(s.alternate=null,Kx(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&xl(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Ft=null,bi=!1;function Ol(s,r,c){for(c=c.child;c!==null;)Xx(s,r,c),c=c.sibling}function Xx(s,r,c){if(kn&&typeof kn.onCommitFiberUnmount=="function")try{kn.onCommitFiberUnmount(ds,c)}catch{}switch(c.tag){case 26:fn||Xs(c,r),Ol(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:fn||Xs(c,r);var h=Ft,m=bi;vr(c.type)&&(Ft=c.stateNode,bi=!1),Ol(s,r,c),Jc(c.stateNode),Ft=h,bi=m;break;case 5:fn||Xs(c,r);case 6:if(h=Ft,m=bi,Ft=null,Ol(s,r,c),Ft=h,bi=m,Ft!==null)if(bi)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(c.stateNode)}catch(g){_t(c,r,g)}else try{Ft.removeChild(c.stateNode)}catch(g){_t(c,r,g)}break;case 18:Ft!==null&&(bi?(s=Ft,V1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),wo(s)):V1(Ft,c.stateNode));break;case 4:h=Ft,m=bi,Ft=c.stateNode.containerInfo,bi=!0,Ol(s,r,c),Ft=h,bi=m;break;case 0:case 11:case 14:case 15:dr(2,c,r),fn||dr(4,c,r),Ol(s,r,c);break;case 1:fn||(Xs(c,r),h=c.stateNode,typeof h.componentWillUnmount=="function"&&Gx(c,r,h)),Ol(s,r,c);break;case 21:Ol(s,r,c);break;case 22:fn=(h=fn)||c.memoizedState!==null,Ol(s,r,c),fn=h;break;default:Ol(s,r,c)}}function Qx(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{wo(s)}catch(c){_t(r,r.return,c)}}}function Zx(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{wo(s)}catch(c){_t(r,r.return,c)}}function gT(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new $x),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new $x),r;default:throw Error(i(435,s.tag))}}function Qf(s,r){var c=gT(s);r.forEach(function(h){if(!c.has(h)){c.add(h);var m=_T.bind(null,s,h);h.then(m,m)}})}function xi(s,r){var c=r.deletions;if(c!==null)for(var h=0;h<c.length;h++){var m=c[h],g=s,S=r,_=S;e:for(;_!==null;){switch(_.tag){case 27:if(vr(_.type)){Ft=_.stateNode,bi=!1;break e}break;case 5:Ft=_.stateNode,bi=!1;break e;case 3:case 4:Ft=_.stateNode.containerInfo,bi=!0;break e}_=_.return}if(Ft===null)throw Error(i(160));Xx(g,S,m),Ft=null,bi=!1,g=m.alternate,g!==null&&(g.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Jx(r,s),r=r.sibling}var Ts=null;function Jx(s,r){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:xi(r,s),vi(s),h&4&&(dr(3,s,s.return),Gc(3,s),dr(5,s,s.return));break;case 1:xi(r,s),vi(s),h&512&&(fn||c===null||Xs(c,c.return)),h&64&&Dl&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var m=Ts;if(xi(r,s),vi(s),h&512&&(fn||c===null||Xs(c,c.return)),h&4){var g=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":g=m.getElementsByTagName("title")[0],(!g||g[Ps]||g[Dt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=m.createElement(h),m.head.insertBefore(g,m.querySelector("head > title"))),Un(g,h,c),g[Dt]=s,kt(g),h=g;break e;case"link":var S=J1("link","href",m).get(h+(c.href||""));if(S){for(var _=0;_<S.length;_++)if(g=S[_],g.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&g.getAttribute("rel")===(c.rel==null?null:c.rel)&&g.getAttribute("title")===(c.title==null?null:c.title)&&g.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){S.splice(_,1);break t}}g=m.createElement(h),Un(g,h,c),m.head.appendChild(g);break;case"meta":if(S=J1("meta","content",m).get(h+(c.content||""))){for(_=0;_<S.length;_++)if(g=S[_],g.getAttribute("content")===(c.content==null?null:""+c.content)&&g.getAttribute("name")===(c.name==null?null:c.name)&&g.getAttribute("property")===(c.property==null?null:c.property)&&g.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&g.getAttribute("charset")===(c.charSet==null?null:c.charSet)){S.splice(_,1);break t}}g=m.createElement(h),Un(g,h,c),m.head.appendChild(g);break;default:throw Error(i(468,h))}g[Dt]=s,kt(g),h=g}s.stateNode=h}else ev(m,s.type,s.stateNode);else s.stateNode=Z1(m,h,s.memoizedProps);else g!==h?(g===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):g.count--,h===null?ev(m,s.type,s.stateNode):Z1(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&vm(s,s.memoizedProps,c.memoizedProps)}break;case 27:xi(r,s),vi(s),h&512&&(fn||c===null||Xs(c,c.return)),c!==null&&h&4&&vm(s,s.memoizedProps,c.memoizedProps);break;case 5:if(xi(r,s),vi(s),h&512&&(fn||c===null||Xs(c,c.return)),s.flags&32){m=s.stateNode;try{U(m,"")}catch(Ce){_t(s,s.return,Ce)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,vm(s,m,c!==null?c.memoizedProps:m)),h&1024&&(km=!0);break;case 6:if(xi(r,s),vi(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Ce){_t(s,s.return,Ce)}}break;case 3:if(dh=null,m=Ts,Ts=fh(r.containerInfo),xi(r,s),Ts=m,vi(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{wo(r.containerInfo)}catch(Ce){_t(s,s.return,Ce)}km&&(km=!1,e1(s));break;case 4:h=Ts,Ts=fh(s.stateNode.containerInfo),xi(r,s),vi(s),Ts=h;break;case 12:xi(r,s),vi(s);break;case 31:xi(r,s),vi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Qf(s,h)));break;case 13:xi(r,s),vi(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Jf=$e()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Qf(s,h)));break;case 22:m=s.memoizedState!==null;var O=c!==null&&c.memoizedState!==null,G=Dl,X=fn;if(Dl=G||m,fn=X||O,xi(r,s),fn=X,Dl=G,vi(s),h&8192)e:for(r=s.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(c===null||O||Dl||fn||ha(s)),c=null,r=s;;){if(r.tag===5||r.tag===26){if(c===null){O=c=r;try{if(g=O.stateNode,m)S=g.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{_=O.stateNode;var ne=O.memoizedProps.style,P=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;_.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(Ce){_t(O,O.return,Ce)}}}else if(r.tag===6){if(c===null){O=r;try{O.stateNode.nodeValue=m?"":O.memoizedProps}catch(Ce){_t(O,O.return,Ce)}}}else if(r.tag===18){if(c===null){O=r;try{var $=O.stateNode;m?G1($,!0):G1(O.stateNode,!1)}catch(Ce){_t(O,O.return,Ce)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Qf(s,c))));break;case 19:xi(r,s),vi(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Qf(s,h)));break;case 30:break;case 21:break;default:xi(r,s),vi(s)}}function vi(s){var r=s.flags;if(r&2){try{for(var c,h=s.return;h!==null;){if(Yx(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,g=Sm(s);Xf(s,g,m);break;case 5:var S=c.stateNode;c.flags&32&&(U(S,""),c.flags&=-33);var _=Sm(s);Xf(s,_,S);break;case 3:case 4:var O=c.stateNode.containerInfo,G=Sm(s);wm(s,G,O);break;default:throw Error(i(161))}}catch(X){_t(s,s.return,X)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function e1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;e1(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function Rl(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Wx(s,r.alternate,r),r=r.sibling}function ha(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:dr(4,r,r.return),ha(r);break;case 1:Xs(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&Gx(r,r.return,c),ha(r);break;case 27:Jc(r.stateNode);case 26:case 5:Xs(r,r.return),ha(r);break;case 22:r.memoizedState===null&&ha(r);break;case 30:ha(r);break;default:ha(r)}s=s.sibling}}function jl(s,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var h=r.alternate,m=s,g=r,S=g.flags;switch(g.tag){case 0:case 11:case 15:jl(m,g,c),Gc(4,g);break;case 1:if(jl(m,g,c),h=g,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(G){_t(h,h.return,G)}if(h=g,m=h.updateQueue,m!==null){var _=h.stateNode;try{var O=m.shared.hiddenCallbacks;if(O!==null)for(m.shared.hiddenCallbacks=null,m=0;m<O.length;m++)Db(O[m],_)}catch(G){_t(h,h.return,G)}}c&&S&64&&Vx(g),Pc(g,g.return);break;case 27:Fx(g);case 26:case 5:jl(m,g,c),c&&h===null&&S&4&&Px(g),Pc(g,g.return);break;case 12:jl(m,g,c);break;case 31:jl(m,g,c),c&&S&4&&Qx(m,g);break;case 13:jl(m,g,c),c&&S&4&&Zx(m,g);break;case 22:g.memoizedState===null&&jl(m,g,c),Pc(g,g.return);break;case 30:break;default:jl(m,g,c)}r=r.sibling}}function Am(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Nc(c))}function _m(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Nc(s))}function Ms(s,r,c,h){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)t1(s,r,c,h),r=r.sibling}function t1(s,r,c,h){var m=r.flags;switch(r.tag){case 0:case 11:case 15:Ms(s,r,c,h),m&2048&&Gc(9,r);break;case 1:Ms(s,r,c,h);break;case 3:Ms(s,r,c,h),m&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Nc(s)));break;case 12:if(m&2048){Ms(s,r,c,h),s=r.stateNode;try{var g=r.memoizedProps,S=g.id,_=g.onPostCommit;typeof _=="function"&&_(S,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(O){_t(r,r.return,O)}}else Ms(s,r,c,h);break;case 31:Ms(s,r,c,h);break;case 13:Ms(s,r,c,h);break;case 23:break;case 22:g=r.stateNode,S=r.alternate,r.memoizedState!==null?g._visibility&2?Ms(s,r,c,h):Yc(s,r):g._visibility&2?Ms(s,r,c,h):(g._visibility|=2,uo(s,r,c,h,(r.subtreeFlags&10256)!==0||!1)),m&2048&&Am(S,r);break;case 24:Ms(s,r,c,h),m&2048&&_m(r.alternate,r);break;default:Ms(s,r,c,h)}}function uo(s,r,c,h,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=s,S=r,_=c,O=h,G=S.flags;switch(S.tag){case 0:case 11:case 15:uo(g,S,_,O,m),Gc(8,S);break;case 23:break;case 22:var X=S.stateNode;S.memoizedState!==null?X._visibility&2?uo(g,S,_,O,m):Yc(g,S):(X._visibility|=2,uo(g,S,_,O,m)),m&&G&2048&&Am(S.alternate,S);break;case 24:uo(g,S,_,O,m),m&&G&2048&&_m(S.alternate,S);break;default:uo(g,S,_,O,m)}r=r.sibling}}function Yc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,h=r,m=h.flags;switch(h.tag){case 22:Yc(c,h),m&2048&&Am(h.alternate,h);break;case 24:Yc(c,h),m&2048&&_m(h.alternate,h);break;default:Yc(c,h)}r=r.sibling}}var Fc=8192;function fo(s,r,c){if(s.subtreeFlags&Fc)for(s=s.child;s!==null;)n1(s,r,c),s=s.sibling}function n1(s,r,c){switch(s.tag){case 26:fo(s,r,c),s.flags&Fc&&s.memoizedState!==null&&n2(c,Ts,s.memoizedState,s.memoizedProps);break;case 5:fo(s,r,c);break;case 3:case 4:var h=Ts;Ts=fh(s.stateNode.containerInfo),fo(s,r,c),Ts=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Fc,Fc=16777216,fo(s,r,c),Fc=h):fo(s,r,c));break;default:fo(s,r,c)}}function i1(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function $c(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var h=r[c];En=h,l1(h,s)}i1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)s1(s),s=s.sibling}function s1(s){switch(s.tag){case 0:case 11:case 15:$c(s),s.flags&2048&&dr(9,s,s.return);break;case 3:$c(s);break;case 12:$c(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Zf(s)):$c(s);break;default:$c(s)}}function Zf(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var h=r[c];En=h,l1(h,s)}i1(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:dr(8,r,r.return),Zf(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Zf(r));break;default:Zf(r)}s=s.sibling}}function l1(s,r){for(;En!==null;){var c=En;switch(c.tag){case 0:case 11:case 15:dr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Nc(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,En=h;else e:for(c=s;En!==null;){h=En;var m=h.sibling,g=h.return;if(Kx(h),h===c){En=null;break e}if(m!==null){m.return=g,En=m;break e}En=g}}}var yT={getCacheForType:function(s){var r=Hn(on),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return Hn(on).controller.signal}},bT=typeof WeakMap=="function"?WeakMap:Map,yt=0,Rt=null,et=null,st=0,At=0,Ui=null,pr=!1,ho=!1,Cm=!1,Ll=0,Jt=0,mr=0,da=0,Tm=0,qi=0,po=0,Wc=null,Si=null,Mm=!1,Jf=0,r1=0,eh=1/0,th=null,gr=null,xn=0,yr=null,mo=null,Bl=0,Em=0,Nm=null,a1=null,Kc=0,Dm=null;function Vi(){return(yt&2)!==0&&st!==0?st&-st:q.T!==null?zm():Vs()}function o1(){if(qi===0)if((st&536870912)===0||rt){var s=Us;Us<<=1,(Us&3932160)===0&&(Us=262144),qi=s}else qi=536870912;return s=Hi.current,s!==null&&(s.flags|=32),qi}function wi(s,r,c){(s===Rt&&(At===2||At===9)||s.cancelPendingCommit!==null)&&(go(s,0),br(s,st,qi,!1)),mi(s,c),((yt&2)===0||s!==Rt)&&(s===Rt&&((yt&2)===0&&(da|=c),Jt===4&&br(s,st,qi,!1)),Qs(s))}function c1(s,r,c){if((yt&6)!==0)throw Error(i(327));var h=!c&&(r&127)===0&&(r&s.expiredLanes)===0||li(s,r),m=h?ST(s,r):Rm(s,r,!0),g=h;do{if(m===0){ho&&!h&&br(s,r,0,!1);break}else{if(c=s.current.alternate,g&&!xT(c)){m=Rm(s,r,!1),g=!1;continue}if(m===2){if(g=r,s.errorRecoveryDisabledLanes&g)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){r=S;e:{var _=s;m=Wc;var O=_.current.memoizedState.isDehydrated;if(O&&(go(_,S).flags|=256),S=Rm(_,S,!1),S!==2){if(Cm&&!O){_.errorRecoveryDisabledLanes|=g,da|=g,m=4;break e}g=Si,Si=m,g!==null&&(Si===null?Si=g:Si.push.apply(Si,g))}m=S}if(g=!1,m!==2)continue}}if(m===1){go(s,0),br(s,r,0,!0);break}e:{switch(h=s,g=m,g){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:br(h,r,qi,!pr);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(m=Jf+300-$e(),10<m)){if(br(h,r,qi,!pr),yl(h,0,!0)!==0)break e;Bl=r,h.timeoutHandle=U1(u1.bind(null,h,c,Si,th,Mm,r,qi,da,po,pr,g,"Throttled",-0,0),m);break e}u1(h,c,Si,th,Mm,r,qi,da,po,pr,g,null,-0,0)}}break}while(!0);Qs(s)}function u1(s,r,c,h,m,g,S,_,O,G,X,ne,P,$){if(s.timeoutHandle=-1,ne=r.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ht},n1(r,g,ne);var Ce=(g&62914560)===g?Jf-$e():(g&4194048)===g?r1-$e():0;if(Ce=i2(ne,Ce),Ce!==null){Bl=g,s.cancelPendingCommit=Ce(b1.bind(null,s,r,g,c,h,m,S,_,O,X,ne,null,P,$)),br(s,g,S,!G);return}}b1(s,r,g,c,h,m,S,_,O)}function xT(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var m=c[h],g=m.getSnapshot;m=m.value;try{if(!Bi(g(),m))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function br(s,r,c,h){r&=~Tm,r&=~da,s.suspendedLanes|=r,s.pingedLanes&=~r,h&&(s.warmLanes|=r),h=s.expirationTimes;for(var m=r;0<m;){var g=31-yn(m),S=1<<g;h[g]=-1,m&=~S}c!==0&&qs(s,c,r)}function nh(){return(yt&6)===0?(Xc(0),!1):!0}function Om(){if(et!==null){if(At===0)var s=et.return;else s=et,_l=sa=null,Wp(s),lo=null,Oc=0,s=et;for(;s!==null;)qx(s.alternate,s),s=s.return;et=null}}function go(s,r){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,IT(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Bl=0,Om(),Rt=s,et=c=kl(s.current,null),st=r,At=0,Ui=null,pr=!1,ho=li(s,r),Cm=!1,po=qi=Tm=da=mr=Jt=0,Si=Wc=null,Mm=!1,(r&8)!==0&&(r|=r&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=r;0<h;){var m=31-yn(h),g=1<<m;r|=s[m],h&=~g}return Ll=r,kf(),c}function f1(s,r){Fe=null,q.H=Uc,r===so||r===Df?(r=Tb(),At=3):r===Bp?(r=Tb(),At=4):At=r===um?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ui=r,et===null&&(Jt=1,Yf(s,es(r,s.current)))}function h1(){var s=Hi.current;return s===null?!0:(st&4194048)===st?ss===null:(st&62914560)===st||(st&536870912)!==0?s===ss:!1}function d1(){var s=q.H;return q.H=Uc,s===null?Uc:s}function p1(){var s=q.A;return q.A=yT,s}function ih(){Jt=4,pr||(st&4194048)!==st&&Hi.current!==null||(ho=!0),(mr&134217727)===0&&(da&134217727)===0||Rt===null||br(Rt,st,qi,!1)}function Rm(s,r,c){var h=yt;yt|=2;var m=d1(),g=p1();(Rt!==s||st!==r)&&(th=null,go(s,r)),r=!1;var S=Jt;e:do try{if(At!==0&&et!==null){var _=et,O=Ui;switch(At){case 8:Om(),S=6;break e;case 3:case 2:case 9:case 6:Hi.current===null&&(r=!0);var G=At;if(At=0,Ui=null,yo(s,_,O,G),c&&ho){S=0;break e}break;default:G=At,At=0,Ui=null,yo(s,_,O,G)}}vT(),S=Jt;break}catch(X){f1(s,X)}while(!0);return r&&s.shellSuspendCounter++,_l=sa=null,yt=h,q.H=m,q.A=g,et===null&&(Rt=null,st=0,kf()),S}function vT(){for(;et!==null;)m1(et)}function ST(s,r){var c=yt;yt|=2;var h=d1(),m=p1();Rt!==s||st!==r?(th=null,eh=$e()+500,go(s,r)):ho=li(s,r);e:do try{if(At!==0&&et!==null){r=et;var g=Ui;t:switch(At){case 1:At=0,Ui=null,yo(s,r,g,1);break;case 2:case 9:if(_b(g)){At=0,Ui=null,g1(r);break}r=function(){At!==2&&At!==9||Rt!==s||(At=7),Qs(s)},g.then(r,r);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:_b(g)?(At=0,Ui=null,g1(r)):(At=0,Ui=null,yo(s,r,g,7));break;case 5:var S=null;switch(et.tag){case 26:S=et.memoizedState;case 5:case 27:var _=et;if(S?tv(S):_.stateNode.complete){At=0,Ui=null;var O=_.sibling;if(O!==null)et=O;else{var G=_.return;G!==null?(et=G,sh(G)):et=null}break t}}At=0,Ui=null,yo(s,r,g,5);break;case 6:At=0,Ui=null,yo(s,r,g,6);break;case 8:Om(),Jt=6;break e;default:throw Error(i(462))}}wT();break}catch(X){f1(s,X)}while(!0);return _l=sa=null,q.H=h,q.A=m,yt=c,et!==null?0:(Rt=null,st=0,kf(),Jt)}function wT(){for(;et!==null&&!Ve();)m1(et)}function m1(s){var r=Ix(s.alternate,s,Ll);s.memoizedProps=s.pendingProps,r===null?sh(s):et=r}function g1(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=Rx(c,r,r.pendingProps,r.type,void 0,st);break;case 11:r=Rx(c,r,r.pendingProps,r.type.render,r.ref,st);break;case 5:Wp(r);default:qx(c,r),r=et=pb(r,Ll),r=Ix(c,r,Ll)}s.memoizedProps=s.pendingProps,r===null?sh(s):et=r}function yo(s,r,c,h){_l=sa=null,Wp(r),lo=null,Oc=0;var m=r.return;try{if(uT(s,m,r,c,st)){Jt=1,Yf(s,es(c,s.current)),et=null;return}}catch(g){if(m!==null)throw et=m,g;Jt=1,Yf(s,es(c,s.current)),et=null;return}r.flags&32768?(rt||h===1?s=!0:ho||(st&536870912)!==0?s=!1:(pr=s=!0,(h===2||h===9||h===3||h===6)&&(h=Hi.current,h!==null&&h.tag===13&&(h.flags|=16384))),y1(r,s)):sh(r)}function sh(s){var r=s;do{if((r.flags&32768)!==0){y1(r,pr);return}s=r.return;var c=dT(r.alternate,r,Ll);if(c!==null){et=c;return}if(r=r.sibling,r!==null){et=r;return}et=r=s}while(r!==null);Jt===0&&(Jt=5)}function y1(s,r){do{var c=pT(s.alternate,s);if(c!==null){c.flags&=32767,et=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){et=s;return}et=s=c}while(s!==null);Jt=6,et=null}function b1(s,r,c,h,m,g,S,_,O){s.cancelPendingCommit=null;do lh();while(xn!==0);if((yt&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));if(g=r.lanes|r.childLanes,g|=Sp,Bn(s,c,g,S,_,O),s===Rt&&(et=Rt=null,st=0),mo=r,yr=s,Bl=c,Em=g,Nm=m,a1=h,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,CT(Le,function(){return k1(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||h){h=q.T,q.T=null,m=J.p,J.p=2,S=yt,yt|=4;try{mT(s,r,c)}finally{yt=S,J.p=m,q.T=h}}xn=1,x1(),v1(),S1()}}function x1(){if(xn===1){xn=0;var s=yr,r=mo,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=q.T,q.T=null;var h=J.p;J.p=2;var m=yt;yt|=4;try{Jx(r,s);var g=Ym,S=lb(s.containerInfo),_=g.focusedElem,O=g.selectionRange;if(S!==_&&_&&_.ownerDocument&&sb(_.ownerDocument.documentElement,_)){if(O!==null&&gp(_)){var G=O.start,X=O.end;if(X===void 0&&(X=G),"selectionStart"in _)_.selectionStart=G,_.selectionEnd=Math.min(X,_.value.length);else{var ne=_.ownerDocument||document,P=ne&&ne.defaultView||window;if(P.getSelection){var $=P.getSelection(),Ce=_.textContent.length,Ie=Math.min(O.start,Ce),Mt=O.end===void 0?Ie:Math.min(O.end,Ce);!$.extend&&Ie>Mt&&(S=Mt,Mt=Ie,Ie=S);var I=ib(_,Ie),j=ib(_,Mt);if(I&&j&&($.rangeCount!==1||$.anchorNode!==I.node||$.anchorOffset!==I.offset||$.focusNode!==j.node||$.focusOffset!==j.offset)){var V=ne.createRange();V.setStart(I.node,I.offset),$.removeAllRanges(),Ie>Mt?($.addRange(V),$.extend(j.node,j.offset)):(V.setEnd(j.node,j.offset),$.addRange(V))}}}}for(ne=[],$=_;$=$.parentNode;)$.nodeType===1&&ne.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ne.length;_++){var ee=ne[_];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}yh=!!Pm,Ym=Pm=null}finally{yt=m,J.p=h,q.T=c}}s.current=r,xn=2}}function v1(){if(xn===2){xn=0;var s=yr,r=mo,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=q.T,q.T=null;var h=J.p;J.p=2;var m=yt;yt|=4;try{Wx(s,r.alternate,r)}finally{yt=m,J.p=h,q.T=c}}xn=3}}function S1(){if(xn===4||xn===3){xn=0,vt();var s=yr,r=mo,c=Bl,h=a1;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?xn=5:(xn=0,mo=yr=null,w1(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(gr=null),Xi(c),r=r.stateNode,kn&&typeof kn.onCommitFiberRoot=="function")try{kn.onCommitFiberRoot(ds,r,void 0,(r.current.flags&128)===128)}catch{}if(h!==null){r=q.T,m=J.p,J.p=2,q.T=null;try{for(var g=s.onRecoverableError,S=0;S<h.length;S++){var _=h[S];g(_.value,{componentStack:_.stack})}}finally{q.T=r,J.p=m}}(Bl&3)!==0&&lh(),Qs(s),m=s.pendingLanes,(c&261930)!==0&&(m&42)!==0?s===Dm?Kc++:(Kc=0,Dm=s):Kc=0,Xc(0)}}function w1(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Nc(r)))}function lh(){return x1(),v1(),S1(),k1()}function k1(){if(xn!==5)return!1;var s=yr,r=Em;Em=0;var c=Xi(Bl),h=q.T,m=J.p;try{J.p=32>c?32:c,q.T=null,c=Nm,Nm=null;var g=yr,S=Bl;if(xn=0,mo=yr=null,Bl=0,(yt&6)!==0)throw Error(i(331));var _=yt;if(yt|=4,s1(g.current),t1(g,g.current,S,c),yt=_,Xc(0,!1),kn&&typeof kn.onPostCommitFiberRoot=="function")try{kn.onPostCommitFiberRoot(ds,g)}catch{}return!0}finally{J.p=m,q.T=h,w1(s,r)}}function A1(s,r,c){r=es(c,r),r=cm(s.stateNode,r,2),s=ur(s,r,2),s!==null&&(mi(s,2),Qs(s))}function _t(s,r,c){if(s.tag===3)A1(s,s,c);else for(;r!==null;){if(r.tag===3){A1(r,s,c);break}else if(r.tag===1){var h=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(gr===null||!gr.has(h))){s=es(c,s),c=_x(2),h=ur(r,c,2),h!==null&&(Cx(c,h,r,s),mi(h,2),Qs(h));break}}r=r.return}}function jm(s,r,c){var h=s.pingCache;if(h===null){h=s.pingCache=new bT;var m=new Set;h.set(r,m)}else m=h.get(r),m===void 0&&(m=new Set,h.set(r,m));m.has(c)||(Cm=!0,m.add(c),s=kT.bind(null,s,r,c),r.then(s,s))}function kT(s,r,c){var h=s.pingCache;h!==null&&h.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Rt===s&&(st&c)===c&&(Jt===4||Jt===3&&(st&62914560)===st&&300>$e()-Jf?(yt&2)===0&&go(s,0):Tm|=c,po===st&&(po=0)),Qs(s)}function _1(s,r){r===0&&(r=Ln()),s=ta(s,r),s!==null&&(mi(s,r),Qs(s))}function AT(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),_1(s,c)}function _T(s,r){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(r),_1(s,c)}function CT(s,r){return Kn(s,r)}var rh=null,bo=null,Lm=!1,ah=!1,Bm=!1,xr=0;function Qs(s){s!==bo&&s.next===null&&(bo===null?rh=bo=s:bo=bo.next=s),ah=!0,Lm||(Lm=!0,MT())}function Xc(s,r){if(!Bm&&ah){Bm=!0;do for(var c=!1,h=rh;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var g=0;else{var S=h.suspendedLanes,_=h.pingedLanes;g=(1<<31-yn(42|s)+1)-1,g&=m&~(S&~_),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(c=!0,E1(h,g))}else g=st,g=yl(h,h===Rt?g:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(g&3)===0||li(h,g)||(c=!0,E1(h,g));h=h.next}while(c);Bm=!1}}function TT(){C1()}function C1(){ah=Lm=!1;var s=0;xr!==0&&HT()&&(s=xr);for(var r=$e(),c=null,h=rh;h!==null;){var m=h.next,g=T1(h,r);g===0?(h.next=null,c===null?rh=m:c.next=m,m===null&&(bo=c)):(c=h,(s!==0||(g&3)!==0)&&(ah=!0)),h=m}xn!==0&&xn!==5||Xc(s),xr!==0&&(xr=0)}function T1(s,r){for(var c=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var S=31-yn(g),_=1<<S,O=m[S];O===-1?((_&c)===0||(_&h)!==0)&&(m[S]=Xl(_,r)):O<=r&&(s.expiredLanes|=_),g&=~_}if(r=Rt,c=st,c=yl(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===r&&(At===2||At===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&ce(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||li(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(h!==null&&ce(h),Xi(c)){case 2:case 8:c=ue;break;case 32:c=Le;break;case 268435456:c=Wt;break;default:c=Le}return h=M1.bind(null,s),c=Kn(c,h),s.callbackPriority=r,s.callbackNode=c,r}return h!==null&&h!==null&&ce(h),s.callbackPriority=2,s.callbackNode=null,2}function M1(s,r){if(xn!==0&&xn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(lh()&&s.callbackNode!==c)return null;var h=st;return h=yl(s,s===Rt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(c1(s,h,r),T1(s,$e()),s.callbackNode!=null&&s.callbackNode===c?M1.bind(null,s):null)}function E1(s,r){if(lh())return null;c1(s,r,!0)}function MT(){UT(function(){(yt&6)!==0?Kn(K,TT):C1()})}function zm(){if(xr===0){var s=no;s===0&&(s=Xt,Xt<<=1,(Xt&261888)===0&&(Xt=256)),xr=s}return xr}function N1(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:bn(""+s)}function D1(s,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,s.id&&c.setAttribute("form",s.id),r.parentNode.insertBefore(c,r),s=new FormData(s),c.parentNode.removeChild(c),s}function ET(s,r,c,h,m){if(r==="submit"&&c&&c.stateNode===m){var g=N1((m[Qe]||null).action),S=h.submitter;S&&(r=(r=S[Qe]||null)?N1(r.formAction):S.getAttribute("formAction"),r!==null&&(g=r,S=null));var _=new Ua("action","action",null,h,m);s.push({event:_,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(xr!==0){var O=S?D1(m,S):new FormData(m);im(c,{pending:!0,data:O,method:m.method,action:g},null,O)}}else typeof g=="function"&&(_.preventDefault(),O=S?D1(m,S):new FormData(m),im(c,{pending:!0,data:O,method:m.method,action:g},g,O))},currentTarget:m}]})}}for(var Hm=0;Hm<vp.length;Hm++){var Im=vp[Hm],NT=Im.toLowerCase(),DT=Im[0].toUpperCase()+Im.slice(1);Cs(NT,"on"+DT)}Cs(ob,"onAnimationEnd"),Cs(cb,"onAnimationIteration"),Cs(ub,"onAnimationStart"),Cs("dblclick","onDoubleClick"),Cs("focusin","onFocus"),Cs("focusout","onBlur"),Cs($C,"onTransitionRun"),Cs(WC,"onTransitionStart"),Cs(KC,"onTransitionCancel"),Cs(fb,"onTransitionEnd"),Oi("onMouseEnter",["mouseout","mouseover"]),Oi("onMouseLeave",["mouseout","mouseover"]),Oi("onPointerEnter",["pointerout","pointerover"]),Oi("onPointerLeave",["pointerout","pointerover"]),oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qc="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(" "),OT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qc));function O1(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],m=h.event;h=h.listeners;e:{var g=void 0;if(r)for(var S=h.length-1;0<=S;S--){var _=h[S],O=_.instance,G=_.currentTarget;if(_=_.listener,O!==g&&m.isPropagationStopped())break e;g=_,m.currentTarget=G;try{g(m)}catch(X){wf(X)}m.currentTarget=null,g=O}else for(S=0;S<h.length;S++){if(_=h[S],O=_.instance,G=_.currentTarget,_=_.listener,O!==g&&m.isPropagationStopped())break e;g=_,m.currentTarget=G;try{g(m)}catch(X){wf(X)}m.currentTarget=null,g=O}}}}function tt(s,r){var c=r[gs];c===void 0&&(c=r[gs]=new Set);var h=s+"__bubble";c.has(h)||(R1(r,s,2,!1),c.add(h))}function Um(s,r,c){var h=0;r&&(h|=4),R1(c,s,h,r)}var oh="_reactListening"+Math.random().toString(36).slice(2);function qm(s){if(!s[oh]){s[oh]=!0,Zn.forEach(function(c){c!=="selectionchange"&&(OT.has(c)||Um(c,!1,s),Um(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[oh]||(r[oh]=!0,Um("selectionchange",!1,r))}}function R1(s,r,c,h){switch(ov(r)){case 2:var m=r2;break;case 8:m=a2;break;default:m=ng}c=m.bind(null,r,c,s),m=void 0,!gc||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(r,c,{capture:!0,passive:m}):s.addEventListener(r,c,!0):m!==void 0?s.addEventListener(r,c,{passive:m}):s.addEventListener(r,c,!1)}function Vm(s,r,c,h,m){var g=h;if((r&1)===0&&(r&2)===0&&h!==null)e:for(;;){if(h===null)return;var S=h.tag;if(S===3||S===4){var _=h.stateNode.containerInfo;if(_===m)break;if(S===4)for(S=h.return;S!==null;){var O=S.tag;if((O===3||O===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;_!==null;){if(S=Di(_),S===null)return;if(O=S.tag,O===5||O===6||O===26||O===27){h=g=S;continue e}_=_.parentNode}}h=h.return}rf(function(){var G=g,X=pe(c),ne=[];e:{var P=hb.get(s);if(P!==void 0){var $=Ua,Ce=s;switch(s){case"keypress":if(Wr(c)===0)break e;case"keydown":case"keyup":$=dp;break;case"focusin":Ce="focus",$=bc;break;case"focusout":Ce="blur",$=bc;break;case"beforeblur":case"afterblur":$=bc;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":$=uf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=ff;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=pf;break;case ob:case cb:case ub:$=ap;break;case fb:$=Pa;break;case"scroll":case"scrollend":$=cf;break;case"wheel":$=$s;break;case"copy":case"cut":case"paste":$=vc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=df;break;case"toggle":case"beforetoggle":$=gf}var Ie=(r&4)!==0,Mt=!Ie&&(s==="scroll"||s==="scrollend"),I=Ie?P!==null?P+"Capture":null:P;Ie=[];for(var j=G,V;j!==null;){var ee=j;if(V=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||V===null||I===null||(ee=ws(j,I),ee!=null&&Ie.push(Zc(j,ee,V))),Mt)break;j=j.return}0<Ie.length&&(P=new $(P,Ce,null,c,X),ne.push({event:P,listeners:Ie}))}}if((r&7)===0){e:{if(P=s==="mouseover"||s==="pointerover",$=s==="mouseout"||s==="pointerout",P&&c!==re&&(Ce=c.relatedTarget||c.fromElement)&&(Di(Ce)||Ce[tn]))break e;if(($||P)&&(P=X.window===X?X:(P=X.ownerDocument)?P.defaultView||P.parentWindow:window,$?(Ce=c.relatedTarget||c.toElement,$=G,Ce=Ce?Di(Ce):null,Ce!==null&&(Mt=a(Ce),Ie=Ce.tag,Ce!==Mt||Ie!==5&&Ie!==27&&Ie!==6)&&(Ce=null)):($=null,Ce=G),$!==Ce)){if(Ie=uf,ee="onMouseLeave",I="onMouseEnter",j="mouse",(s==="pointerout"||s==="pointerover")&&(Ie=df,ee="onPointerLeave",I="onPointerEnter",j="pointer"),Mt=$==null?P:Qi($),V=Ce==null?P:Qi(Ce),P=new Ie(ee,j+"leave",$,c,X),P.target=Mt,P.relatedTarget=V,ee=null,Di(X)===G&&(Ie=new Ie(I,j+"enter",Ce,c,X),Ie.target=V,Ie.relatedTarget=Mt,ee=Ie),Mt=ee,$&&Ce)t:{for(Ie=RT,I=$,j=Ce,V=0,ee=I;ee;ee=Ie(ee))V++;ee=0;for(var je=j;je;je=Ie(je))ee++;for(;0<V-ee;)I=Ie(I),V--;for(;0<ee-V;)j=Ie(j),ee--;for(;V--;){if(I===j||j!==null&&I===j.alternate){Ie=I;break t}I=Ie(I),j=Ie(j)}Ie=null}else Ie=null;$!==null&&j1(ne,P,$,Ie,!1),Ce!==null&&Mt!==null&&j1(ne,Mt,Ce,Ie,!0)}}e:{if(P=G?Qi(G):window,$=P.nodeName&&P.nodeName.toLowerCase(),$==="select"||$==="input"&&P.type==="file")var mt=He;else if(_c(P))if(Ke)mt=PC;else{mt=VC;var De=qC}else $=P.nodeName,!$||$.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?G&&Be(G.elementType)&&(mt=He):mt=GC;if(mt&&(mt=mt(s,G))){k(ne,mt,c,X);break e}De&&De(s,P,G),s==="focusout"&&G&&P.type==="number"&&G.memoizedProps.value!=null&&Mn(P,"number",P.value)}switch(De=G?Qi(G):window,s){case"focusin":(_c(De)||De.contentEditable==="true")&&(Wa=De,yp=G,Tc=null);break;case"focusout":Tc=yp=Wa=null;break;case"mousedown":bp=!0;break;case"contextmenu":case"mouseup":case"dragend":bp=!1,rb(ne,c,X);break;case"selectionchange":if(FC)break;case"keydown":case"keyup":rb(ne,c,X)}var Xe;if(Fa)e:{switch(s){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else wl?bf(s,c)&&(lt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(lt="onCompositionStart");lt&&(kc&&c.locale!=="ko"&&(wl||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&wl&&(Xe=af()):(Fs=X,Ia="value"in Fs?Fs.value:Fs.textContent,wl=!0)),De=ch(G,lt),0<De.length&&(lt=new hf(lt,s,null,c,X),ne.push({event:lt,listeners:De}),Xe?lt.data=Xe:(Xe=ir(c),Xe!==null&&(lt.data=Xe)))),(Xe=Qr?xf(s,c):vf(s,c))&&(lt=ch(G,"onBeforeInput"),0<lt.length&&(De=new hf("onBeforeInput","beforeinput",null,c,X),ne.push({event:De,listeners:lt}),De.data=Xe)),ET(ne,s,G,c,X)}O1(ne,r)})}function Zc(s,r,c){return{instance:s,listener:r,currentTarget:c}}function ch(s,r){for(var c=r+"Capture",h=[];s!==null;){var m=s,g=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||g===null||(m=ws(s,c),m!=null&&h.unshift(Zc(s,m,g)),m=ws(s,r),m!=null&&h.push(Zc(s,m,g))),s.tag===3)return h;s=s.return}return[]}function RT(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function j1(s,r,c,h,m){for(var g=r._reactName,S=[];c!==null&&c!==h;){var _=c,O=_.alternate,G=_.stateNode;if(_=_.tag,O!==null&&O===h)break;_!==5&&_!==26&&_!==27||G===null||(O=G,m?(G=ws(c,g),G!=null&&S.unshift(Zc(c,G,O))):m||(G=ws(c,g),G!=null&&S.push(Zc(c,G,O)))),c=c.return}S.length!==0&&s.push({event:r,listeners:S})}var jT=/\r\n?/g,LT=/\u0000|\uFFFD/g;function L1(s){return(typeof s=="string"?s:""+s).replace(jT,`
|
|
50
|
-
`).replace(LT,"")}function B1(s,r){return r=L1(r),L1(s)===r}function Tt(s,r,c,h,m,g){switch(c){case"children":typeof h=="string"?r==="body"||r==="textarea"&&h===""||U(s,h):(typeof h=="number"||typeof h=="bigint")&&r!=="body"&&U(s,""+h);break;case"className":gi(s,"class",h);break;case"tabIndex":gi(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":gi(s,c,h);break;case"style":Oe(s,h,g);break;case"data":if(r!=="object"){gi(s,"data",h);break}case"src":case"href":if(h===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=bn(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(c==="formAction"?(r!=="input"&&Tt(s,r,"name",m.name,m,null),Tt(s,r,"formEncType",m.formEncType,m,null),Tt(s,r,"formMethod",m.formMethod,m,null),Tt(s,r,"formTarget",m.formTarget,m,null)):(Tt(s,r,"encType",m.encType,m,null),Tt(s,r,"method",m.method,m,null),Tt(s,r,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=bn(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=Ht);break;case"onScroll":h!=null&&tt("scroll",s);break;case"onScrollEnd":h!=null&&tt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=bn(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":tt("beforetoggle",s),tt("toggle",s),Ri(s,"popover",h);break;case"xlinkActuate":an(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":an(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":an(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":an(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":an(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":an(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":an(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":an(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":an(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Ri(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=St.get(c)||c,Ri(s,c,h))}}function Gm(s,r,c,h,m,g){switch(c){case"style":Oe(s,h,g);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof h=="string"?U(s,h):(typeof h=="number"||typeof h=="bigint")&&U(s,""+h);break;case"onScroll":h!=null&&tt("scroll",s);break;case"onScrollEnd":h!=null&&tt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Ht);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ha.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),r=c.slice(2,m?c.length-7:void 0),g=s[Qe]||null,g=g!=null?g[c]:null,typeof g=="function"&&s.removeEventListener(r,g,m),typeof h=="function")){typeof g!="function"&&g!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(r,h,m);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):Ri(s,c,h)}}}function Un(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",s),tt("load",s);var h=!1,m=!1,g;for(g in c)if(c.hasOwnProperty(g)){var S=c[g];if(S!=null)switch(g){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Tt(s,r,g,S,c,null)}}m&&Tt(s,r,"srcSet",c.srcSet,c,null),h&&Tt(s,r,"src",c.src,c,null);return;case"input":tt("invalid",s);var _=g=S=m=null,O=null,G=null;for(h in c)if(c.hasOwnProperty(h)){var X=c[h];if(X!=null)switch(h){case"name":m=X;break;case"type":S=X;break;case"checked":O=X;break;case"defaultChecked":G=X;break;case"value":g=X;break;case"defaultValue":_=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,r));break;default:Tt(s,r,h,X,c,null)}}Jl(s,g,_,O,G,S,m,!1);return;case"select":tt("invalid",s),h=S=g=null;for(m in c)if(c.hasOwnProperty(m)&&(_=c[m],_!=null))switch(m){case"value":g=_;break;case"defaultValue":S=_;break;case"multiple":h=_;default:Tt(s,r,m,_,c,null)}r=g,c=S,s.multiple=!!h,r!=null?Li(s,!!h,r,!1):c!=null&&Li(s,!!h,c,!0);return;case"textarea":tt("invalid",s),g=m=h=null;for(S in c)if(c.hasOwnProperty(S)&&(_=c[S],_!=null))switch(S){case"value":h=_;break;case"defaultValue":m=_;break;case"children":g=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:Tt(s,r,S,_,c,null)}T(s,h,m,g);return;case"option":for(O in c)if(c.hasOwnProperty(O)&&(h=c[O],h!=null))switch(O){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Tt(s,r,O,h,c,null)}return;case"dialog":tt("beforetoggle",s),tt("toggle",s),tt("cancel",s),tt("close",s);break;case"iframe":case"object":tt("load",s);break;case"video":case"audio":for(h=0;h<Qc.length;h++)tt(Qc[h],s);break;case"image":tt("error",s),tt("load",s);break;case"details":tt("toggle",s);break;case"embed":case"source":case"link":tt("error",s),tt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in c)if(c.hasOwnProperty(G)&&(h=c[G],h!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Tt(s,r,G,h,c,null)}return;default:if(Be(r)){for(X in c)c.hasOwnProperty(X)&&(h=c[X],h!==void 0&&Gm(s,r,X,h,c,void 0));return}}for(_ in c)c.hasOwnProperty(_)&&(h=c[_],h!=null&&Tt(s,r,_,h,c,null))}function BT(s,r,c,h){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,g=null,S=null,_=null,O=null,G=null,X=null;for($ in c){var ne=c[$];if(c.hasOwnProperty($)&&ne!=null)switch($){case"checked":break;case"value":break;case"defaultValue":O=ne;default:h.hasOwnProperty($)||Tt(s,r,$,null,h,ne)}}for(var P in h){var $=h[P];if(ne=c[P],h.hasOwnProperty(P)&&($!=null||ne!=null))switch(P){case"type":g=$;break;case"name":m=$;break;case"checked":G=$;break;case"defaultChecked":X=$;break;case"value":S=$;break;case"defaultValue":_=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(i(137,r));break;default:$!==ne&&Tt(s,r,P,$,h,ne)}}Tn(s,S,_,O,G,X,g,m);return;case"select":$=S=_=P=null;for(g in c)if(O=c[g],c.hasOwnProperty(g)&&O!=null)switch(g){case"value":break;case"multiple":$=O;default:h.hasOwnProperty(g)||Tt(s,r,g,null,h,O)}for(m in h)if(g=h[m],O=c[m],h.hasOwnProperty(m)&&(g!=null||O!=null))switch(m){case"value":P=g;break;case"defaultValue":_=g;break;case"multiple":S=g;default:g!==O&&Tt(s,r,m,g,h,O)}r=_,c=S,h=$,P!=null?Li(s,!!c,P,!1):!!h!=!!c&&(r!=null?Li(s,!!c,r,!0):Li(s,!!c,c?[]:"",!1));return;case"textarea":$=P=null;for(_ in c)if(m=c[_],c.hasOwnProperty(_)&&m!=null&&!h.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Tt(s,r,_,null,h,m)}for(S in h)if(m=h[S],g=c[S],h.hasOwnProperty(S)&&(m!=null||g!=null))switch(S){case"value":P=m;break;case"defaultValue":$=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==g&&Tt(s,r,S,m,h,g)}oe(s,P,$);return;case"option":for(var Ce in c)if(P=c[Ce],c.hasOwnProperty(Ce)&&P!=null&&!h.hasOwnProperty(Ce))switch(Ce){case"selected":s.selected=!1;break;default:Tt(s,r,Ce,null,h,P)}for(O in h)if(P=h[O],$=c[O],h.hasOwnProperty(O)&&P!==$&&(P!=null||$!=null))switch(O){case"selected":s.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Tt(s,r,O,P,h,$)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in c)P=c[Ie],c.hasOwnProperty(Ie)&&P!=null&&!h.hasOwnProperty(Ie)&&Tt(s,r,Ie,null,h,P);for(G in h)if(P=h[G],$=c[G],h.hasOwnProperty(G)&&P!==$&&(P!=null||$!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,r));break;default:Tt(s,r,G,P,h,$)}return;default:if(Be(r)){for(var Mt in c)P=c[Mt],c.hasOwnProperty(Mt)&&P!==void 0&&!h.hasOwnProperty(Mt)&&Gm(s,r,Mt,void 0,h,P);for(X in h)P=h[X],$=c[X],!h.hasOwnProperty(X)||P===$||P===void 0&&$===void 0||Gm(s,r,X,P,h,$);return}}for(var I in c)P=c[I],c.hasOwnProperty(I)&&P!=null&&!h.hasOwnProperty(I)&&Tt(s,r,I,null,h,P);for(ne in h)P=h[ne],$=c[ne],!h.hasOwnProperty(ne)||P===$||P==null&&$==null||Tt(s,r,ne,P,h,$)}function z1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var m=c[h],g=m.transferSize,S=m.initiatorType,_=m.duration;if(g&&_&&z1(S)){for(S=0,_=m.responseEnd,h+=1;h<c.length;h++){var O=c[h],G=O.startTime;if(G>_)break;var X=O.transferSize,ne=O.initiatorType;X&&z1(ne)&&(O=O.responseEnd,S+=X*(O<_?1:(_-G)/(O-G)))}if(--h,r+=8*(g+S)/(m.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Pm=null,Ym=null;function uh(s){return s.nodeType===9?s:s.ownerDocument}function H1(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function I1(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function Fm(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var $m=null;function HT(){var s=window.event;return s&&s.type==="popstate"?s===$m?!1:($m=s,!0):($m=null,!1)}var U1=typeof setTimeout=="function"?setTimeout:void 0,IT=typeof clearTimeout=="function"?clearTimeout:void 0,q1=typeof Promise=="function"?Promise:void 0,UT=typeof queueMicrotask=="function"?queueMicrotask:typeof q1<"u"?function(s){return q1.resolve(null).then(s).catch(qT)}:U1;function qT(s){setTimeout(function(){throw s})}function vr(s){return s==="head"}function V1(s,r){var c=r,h=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(m),wo(r);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Jc(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Jc(c);for(var g=c.firstChild;g;){var S=g.nextSibling,_=g.nodeName;g[Ps]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&g.rel.toLowerCase()==="stylesheet"||c.removeChild(g),g=S}}else c==="body"&&Jc(s.ownerDocument.body);c=m}while(c);wo(r)}function G1(s,r){var c=s;s=0;do{var h=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function Wm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Wm(c),xl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function VT(s,r,c,h){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[Ps])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var g=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=ls(s.nextSibling),s===null)break}return null}function GT(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=ls(s.nextSibling),s===null))return null;return s}function P1(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=ls(s.nextSibling),s===null))return null;return s}function Km(s){return s.data==="$?"||s.data==="$~"}function Xm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function PT(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var h=function(){r(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function ls(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Qm=null;function Y1(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return ls(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function F1(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function $1(s,r,c){switch(r=uh(c),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Jc(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);xl(s)}var rs=new Map,W1=new Set;function fh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var zl=J.d;J.d={f:YT,r:FT,D:$T,C:WT,L:KT,m:XT,X:ZT,S:QT,M:JT};function YT(){var s=zl.f(),r=nh();return s||r}function FT(s){var r=bs(s);r!==null&&r.tag===5&&r.type==="form"?fx(r):zl.r(s)}var xo=typeof document>"u"?null:document;function K1(s,r,c){var h=xo;if(h&&typeof r=="string"&&r){var m=Ot(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),W1.has(m)||(W1.add(m),s={rel:s,crossOrigin:c,href:r},h.querySelector(m)===null&&(r=h.createElement("link"),Un(r,"link",s),kt(r),h.head.appendChild(r)))}}function $T(s){zl.D(s),K1("dns-prefetch",s,null)}function WT(s,r){zl.C(s,r),K1("preconnect",s,r)}function KT(s,r,c){zl.L(s,r,c);var h=xo;if(h&&s&&r){var m='link[rel="preload"][as="'+Ot(r)+'"]';r==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+Ot(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+Ot(c.imageSizes)+'"]')):m+='[href="'+Ot(s)+'"]';var g=m;switch(r){case"style":g=vo(s);break;case"script":g=So(s)}rs.has(g)||(s=b({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),rs.set(g,s),h.querySelector(m)!==null||r==="style"&&h.querySelector(eu(g))||r==="script"&&h.querySelector(tu(g))||(r=h.createElement("link"),Un(r,"link",s),kt(r),h.head.appendChild(r)))}}function XT(s,r){zl.m(s,r);var c=xo;if(c&&s){var h=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Ot(h)+'"][href="'+Ot(s)+'"]',g=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=So(s)}if(!rs.has(g)&&(s=b({rel:"modulepreload",href:s},r),rs.set(g,s),c.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(tu(g)))return}h=c.createElement("link"),Un(h,"link",s),kt(h),c.head.appendChild(h)}}}function QT(s,r,c){zl.S(s,r,c);var h=xo;if(h&&s){var m=Cn(h).hoistableStyles,g=vo(s);r=r||"default";var S=m.get(g);if(!S){var _={loading:0,preload:null};if(S=h.querySelector(eu(g)))_.loading=5;else{s=b({rel:"stylesheet",href:s,"data-precedence":r},c),(c=rs.get(g))&&Zm(s,c);var O=S=h.createElement("link");kt(O),Un(O,"link",s),O._p=new Promise(function(G,X){O.onload=G,O.onerror=X}),O.addEventListener("load",function(){_.loading|=1}),O.addEventListener("error",function(){_.loading|=2}),_.loading|=4,hh(S,r,h)}S={type:"stylesheet",instance:S,count:1,state:_},m.set(g,S)}}}function ZT(s,r){zl.X(s,r);var c=xo;if(c&&s){var h=Cn(c).hoistableScripts,m=So(s),g=h.get(m);g||(g=c.querySelector(tu(m)),g||(s=b({src:s,async:!0},r),(r=rs.get(m))&&Jm(s,r),g=c.createElement("script"),kt(g),Un(g,"link",s),c.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},h.set(m,g))}}function JT(s,r){zl.M(s,r);var c=xo;if(c&&s){var h=Cn(c).hoistableScripts,m=So(s),g=h.get(m);g||(g=c.querySelector(tu(m)),g||(s=b({src:s,async:!0,type:"module"},r),(r=rs.get(m))&&Jm(s,r),g=c.createElement("script"),kt(g),Un(g,"link",s),c.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},h.set(m,g))}}function X1(s,r,c,h){var m=(m=_e.current)?fh(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=vo(c.href),c=Cn(m).hoistableStyles,h=c.get(r),h||(h={type:"style",instance:null,count:0,state:null},c.set(r,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=vo(c.href);var g=Cn(m).hoistableStyles,S=g.get(s);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,S),(g=m.querySelector(eu(s)))&&!g._p&&(S.instance=g,S.state.loading=5),rs.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},rs.set(s,c),g||e2(m,s,c,S.state))),r&&h===null)throw Error(i(528,""));return S}if(r&&h!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=So(c),c=Cn(m).hoistableScripts,h=c.get(r),h||(h={type:"script",instance:null,count:0,state:null},c.set(r,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function vo(s){return'href="'+Ot(s)+'"'}function eu(s){return'link[rel="stylesheet"]['+s+"]"}function Q1(s){return b({},s,{"data-precedence":s.precedence,precedence:null})}function e2(s,r,c,h){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?h.loading=1:(r=s.createElement("link"),h.preload=r,r.addEventListener("load",function(){return h.loading|=1}),r.addEventListener("error",function(){return h.loading|=2}),Un(r,"link",c),kt(r),s.head.appendChild(r))}function So(s){return'[src="'+Ot(s)+'"]'}function tu(s){return"script[async]"+s}function Z1(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var h=s.querySelector('style[data-href~="'+Ot(c.href)+'"]');if(h)return r.instance=h,kt(h),h;var m=b({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),kt(h),Un(h,"style",m),hh(h,c.precedence,s),r.instance=h;case"stylesheet":m=vo(c.href);var g=s.querySelector(eu(m));if(g)return r.state.loading|=4,r.instance=g,kt(g),g;h=Q1(c),(m=rs.get(m))&&Zm(h,m),g=(s.ownerDocument||s).createElement("link"),kt(g);var S=g;return S._p=new Promise(function(_,O){S.onload=_,S.onerror=O}),Un(g,"link",h),r.state.loading|=4,hh(g,c.precedence,s),r.instance=g;case"script":return g=So(c.src),(m=s.querySelector(tu(g)))?(r.instance=m,kt(m),m):(h=c,(m=rs.get(g))&&(h=b({},c),Jm(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),kt(m),Un(m,"link",h),s.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(h=r.instance,r.state.loading|=4,hh(h,c.precedence,s));return r.instance}function hh(s,r,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,g=m,S=0;S<h.length;S++){var _=h[S];if(_.dataset.precedence===r)g=_;else if(g!==m)break}g?g.parentNode.insertBefore(s,g.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(s,r.firstChild))}function Zm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Jm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var dh=null;function J1(s,r,c){if(dh===null){var h=new Map,m=dh=new Map;m.set(c,h)}else m=dh,h=m.get(c),h||(h=new Map,m.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var g=c[m];if(!(g[Ps]||g[Dt]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var S=g.getAttribute(r)||"";S=s+S;var _=h.get(S);_?_.push(g):h.set(S,[g])}}return h}function ev(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function t2(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function tv(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function n2(s,r,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=vo(h.href),g=r.querySelector(eu(m));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=ph.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=g,kt(g);return}g=r.ownerDocument||r,h=Q1(h),(m=rs.get(m))&&Zm(h,m),g=g.createElement("link"),kt(g);var S=g;S._p=new Promise(function(_,O){S.onload=_,S.onerror=O}),Un(g,"link",h),c.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=ph.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var eg=0;function i2(s,r){return s.stylesheets&&s.count===0&&gh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&gh(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&eg===0&&(eg=62500*zT());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&gh(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>eg?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function ph(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var mh=null;function gh(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,mh=new Map,r.forEach(s2,s),mh=null,ph.call(s))}function s2(s,r){if(!(r.state.loading&4)){var c=mh.get(s);if(c)var h=c.get(null);else{c=new Map,mh.set(s,c);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<m.length;g++){var S=m[g];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),h=S)}h&&c.set(null,h)}m=r.instance,S=m.getAttribute("data-precedence"),g=c.get(S)||h,g===h&&c.set(null,m),c.set(S,m),this.count++,h=ph.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),g?g.parentNode.insertBefore(m,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var nu={$$typeof:B,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function l2(s,r,c,h,m,g,S,_,O){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ri(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.hiddenUpdates=ri(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=g,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function nv(s,r,c,h,m,g,S,_,O,G,X,ne){return s=new l2(s,r,c,S,O,G,X,ne,_),r=1,g===!0&&(r|=24),g=zi(3,null,null,r),s.current=g,g.stateNode=s,r=Rp(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:h,isDehydrated:c,cache:r},zp(g),s}function iv(s){return s?(s=Qa,s):Qa}function sv(s,r,c,h,m,g){m=iv(m),h.context===null?h.context=m:h.pendingContext=m,h=cr(r),h.payload={element:c},g=g===void 0?null:g,g!==null&&(h.callback=g),c=ur(s,h,r),c!==null&&(wi(c,s,r),jc(c,s,r))}function lv(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function tg(s,r){lv(s,r),(s=s.alternate)&&lv(s,r)}function rv(s){if(s.tag===13||s.tag===31){var r=ta(s,67108864);r!==null&&wi(r,s,67108864),tg(s,67108864)}}function av(s){if(s.tag===13||s.tag===31){var r=Vi();r=ms(r);var c=ta(s,r);c!==null&&wi(c,s,r),tg(s,r)}}var yh=!0;function r2(s,r,c,h){var m=q.T;q.T=null;var g=J.p;try{J.p=2,ng(s,r,c,h)}finally{J.p=g,q.T=m}}function a2(s,r,c,h){var m=q.T;q.T=null;var g=J.p;try{J.p=8,ng(s,r,c,h)}finally{J.p=g,q.T=m}}function ng(s,r,c,h){if(yh){var m=ig(h);if(m===null)Vm(s,r,h,bh,c),cv(s,h);else if(c2(m,s,r,c,h))h.stopPropagation();else if(cv(s,h),r&4&&-1<o2.indexOf(s)){for(;m!==null;){var g=bs(m);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var S=Qn(g.pendingLanes);if(S!==0){var _=g;for(_.pendingLanes|=2,_.entangledLanes|=2;S;){var O=1<<31-yn(S);_.entanglements[1]|=O,S&=~O}Qs(g),(yt&6)===0&&(eh=$e()+500,Xc(0))}}break;case 31:case 13:_=ta(g,2),_!==null&&wi(_,g,2),nh(),tg(g,2)}if(g=ig(h),g===null&&Vm(s,r,h,bh,c),g===m)break;m=g}m!==null&&h.stopPropagation()}else Vm(s,r,h,null,c)}}function ig(s){return s=pe(s),sg(s)}var bh=null;function sg(s){if(bh=null,s=Di(s),s!==null){var r=a(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=o(r),s!==null)return s;s=null}else if(c===31){if(s=u(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return bh=s,null}function ov(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(gn()){case K:return 2;case ue:return 8;case Le:case dt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var lg=!1,Sr=null,wr=null,kr=null,iu=new Map,su=new Map,Ar=[],o2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function cv(s,r){switch(s){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":wr=null;break;case"mouseover":case"mouseout":kr=null;break;case"pointerover":case"pointerout":iu.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":su.delete(r.pointerId)}}function lu(s,r,c,h,m,g){return s===null||s.nativeEvent!==g?(s={blockedOn:r,domEventName:c,eventSystemFlags:h,nativeEvent:g,targetContainers:[m]},r!==null&&(r=bs(r),r!==null&&rv(r)),s):(s.eventSystemFlags|=h,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function c2(s,r,c,h,m){switch(r){case"focusin":return Sr=lu(Sr,s,r,c,h,m),!0;case"dragenter":return wr=lu(wr,s,r,c,h,m),!0;case"mouseover":return kr=lu(kr,s,r,c,h,m),!0;case"pointerover":var g=m.pointerId;return iu.set(g,lu(iu.get(g)||null,s,r,c,h,m)),!0;case"gotpointercapture":return g=m.pointerId,su.set(g,lu(su.get(g)||null,s,r,c,h,m)),!0}return!1}function uv(s){var r=Di(s.target);if(r!==null){var c=a(r);if(c!==null){if(r=c.tag,r===13){if(r=o(c),r!==null){s.blockedOn=r,_n(s.priority,function(){av(c)});return}}else if(r===31){if(r=u(c),r!==null){s.blockedOn=r,_n(s.priority,function(){av(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function xh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=ig(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);re=h,c.target.dispatchEvent(h),re=null}else return r=bs(c),r!==null&&rv(r),s.blockedOn=c,!1;r.shift()}return!0}function fv(s,r,c){xh(s)&&c.delete(r)}function u2(){lg=!1,Sr!==null&&xh(Sr)&&(Sr=null),wr!==null&&xh(wr)&&(wr=null),kr!==null&&xh(kr)&&(kr=null),iu.forEach(fv),su.forEach(fv)}function vh(s,r){s.blockedOn===r&&(s.blockedOn=null,lg||(lg=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,u2)))}var Sh=null;function hv(s){Sh!==s&&(Sh=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Sh===s&&(Sh=null);for(var r=0;r<s.length;r+=3){var c=s[r],h=s[r+1],m=s[r+2];if(typeof h!="function"){if(sg(h||c)===null)continue;break}var g=bs(c);g!==null&&(s.splice(r,3),r-=3,im(g,{pending:!0,data:m,method:c.method,action:h},h,m))}}))}function wo(s){function r(O){return vh(O,s)}Sr!==null&&vh(Sr,s),wr!==null&&vh(wr,s),kr!==null&&vh(kr,s),iu.forEach(r),su.forEach(r);for(var c=0;c<Ar.length;c++){var h=Ar[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<Ar.length&&(c=Ar[0],c.blockedOn===null);)uv(c),c.blockedOn===null&&Ar.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var m=c[h],g=c[h+1],S=m[Qe]||null;if(typeof g=="function")S||hv(c);else if(S){var _=null;if(g&&g.hasAttribute("formAction")){if(m=g,S=g[Qe]||null)_=S.formAction;else if(sg(m)!==null)continue}else _=S.action;typeof _=="function"?c[h+1]=_:(c.splice(h,3),h-=3),hv(c)}}}function dv(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),h||setTimeout(c,20)}function c(){if(!h&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function rg(s){this._internalRoot=s}wh.prototype.render=rg.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,h=Vi();sv(c,h,s,r,null,null)},wh.prototype.unmount=rg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;sv(s.current,2,null,s,null,null),nh(),r[tn]=null}};function wh(s){this._internalRoot=s}wh.prototype.unstable_scheduleHydration=function(s){if(s){var r=Vs();s={blockedOn:null,target:s,priority:r};for(var c=0;c<Ar.length&&r!==0&&r<Ar[c].priority;c++);Ar.splice(c,0,s),c===0&&uv(s)}};var pv=e.version;if(pv!=="19.2.8")throw Error(i(527,pv,"19.2.8"));J.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=d(r),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var f2={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kh.isDisabled&&kh.supportsFiber)try{ds=kh.inject(f2),kn=kh}catch{}}return au.createRoot=function(s,r){if(!l(s))throw Error(i(299));var c=!1,h="",m=Sx,g=wx,S=kx;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError)),r=nv(s,1,!1,null,null,c,h,null,m,g,S,dv),s[tn]=r.current,qm(s),new rg(r)},au.hydrateRoot=function(s,r,c){if(!l(s))throw Error(i(299));var h=!1,m="",g=Sx,S=wx,_=kx,O=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(g=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(_=c.onRecoverableError),c.formState!==void 0&&(O=c.formState)),r=nv(s,1,!0,r,c??null,h,m,O,g,S,_,dv),r.context=iv(null),c=r.current,h=Vi(),h=ms(h),m=cr(h),m.callback=null,ur(c,m,h),c=h,r.current.lanes=c,mi(r,c),Qs(r),s[tn]=r.current,qm(s),new wh(r)},au.version="19.2.8",au}var _v;function k2(){if(_v)return ug.exports;_v=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),ug.exports=w2(),ug.exports}var A2=k2();const rk=1;var Ul,Fo,$o,Wo,Ko,Fu,Xo,qd,ak;class _2{constructor(e){Kt(this,qd);Kt(this,Ul,null);Kt(this,Fo,new Set);Kt(this,$o,500);Kt(this,Wo,null);Kt(this,Ko,!1);Kt(this,Fu,null);Kt(this,Xo,null);this.url=e}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(e){bt(this,Xo,e)}connect(){if(Ue(this,Ko))return;const e=new WebSocket(this.url);bt(this,Ul,e),e.addEventListener("open",()=>{var t,i;bt(this,$o,500),this.send({type:"hello",protocol:rk,clientName:"ccv-web"}),(t=Ue(this,Fu))==null||t.call(this),(i=Ue(this,Xo))==null||i.call(this)}),e.addEventListener("message",t=>{let i;try{i=JSON.parse(String(t.data))}catch{return}for(const l of Ue(this,Fo))l(i)}),e.addEventListener("close",()=>{var t;bt(this,Ul,null),(t=Ue(this,Xo))==null||t.call(this),hn(this,qd,ak).call(this)}),e.addEventListener("error",()=>e.close())}onReconnect(e){bt(this,Fu,e)}on(e){return Ue(this,Fo).add(e),()=>Ue(this,Fo).delete(e)}send(e){var t;((t=Ue(this,Ul))==null?void 0:t.readyState)===WebSocket.OPEN&&Ue(this,Ul).send(JSON.stringify(e))}get connected(){var e;return((e=Ue(this,Ul))==null?void 0:e.readyState)===WebSocket.OPEN}close(){var e;bt(this,Ko,!0),(e=Ue(this,Ul))==null||e.close()}}Ul=new WeakMap,Fo=new WeakMap,$o=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Fu=new WeakMap,Xo=new WeakMap,qd=new WeakSet,ak=function(){if(Ue(this,Ko)||Ue(this,Wo)!==null)return;const e=Ue(this,$o);bt(this,$o,Math.min(e*2,1e4)),bt(this,Wo,window.setTimeout(()=>{bt(this,Wo,null),this.connect()},e))};const C2=1,ok="ccv:relay",Jh="ccv:relay.host";function T2(){try{const n=localStorage.getItem(ok);if(!n)return null;const e=JSON.parse(n);return typeof(e==null?void 0:e.token)!="string"||typeof e.expiresAt=="number"&&e.expiresAt<=Date.now()?null:e}catch{return null}}function ck(){localStorage.removeItem(ok)}var ll,Qo,rl,Zo,Jo,jr,Aa,_a,Lr,Ca,ec,Ta,Ma,Vt,Mr,n0,uk,ya,i0;class M2{constructor(e){Kt(this,Vt);Kt(this,ll,null);Kt(this,Qo,new Set);Kt(this,rl,null);Kt(this,Zo,null);Kt(this,Jo,500);Kt(this,jr,null);Kt(this,Aa,!1);Kt(this,_a,!1);Kt(this,Lr,!1);Kt(this,Ca,null);Kt(this,ec,"Подключаемся…");Kt(this,Ta,0);Kt(this,Ma,[]);this.session=e}get connected(){return Ue(this,_a)&&Ue(this,Lr)}get statusText(){return Ue(this,ec)}get hostId(){return Ue(this,Ca)}on(e){return Ue(this,Qo).add(e),()=>Ue(this,Qo).delete(e)}onReconnect(e){bt(this,Zo,e)}onStatus(e){bt(this,rl,e)}connect(){Ue(this,Aa)||hn(this,Vt,n0).call(this)}send(e){if(!Ue(this,_a)){Ue(this,Ma).length<64&&Ue(this,Ma).push(e);return}hn(this,Vt,ya).call(this,{t:"client.frame",body:e})}close(){var e;bt(this,Aa,!0),Ue(this,jr)!==null&&window.clearTimeout(Ue(this,jr)),(e=Ue(this,ll))==null||e.close()}}ll=new WeakMap,Qo=new WeakMap,rl=new WeakMap,Zo=new WeakMap,Jo=new WeakMap,jr=new WeakMap,Aa=new WeakMap,_a=new WeakMap,Lr=new WeakMap,Ca=new WeakMap,ec=new WeakMap,Ta=new WeakMap,Ma=new WeakMap,Vt=new WeakSet,Mr=function(e){var t;Ue(this,ec)!==e&&(bt(this,ec,e),(t=Ue(this,rl))==null||t.call(this))},n0=async function(){if(Ue(this,ll))return;if(!Ue(this,Ca))try{bt(this,Ca,await E2(this.session.token))}catch(i){hn(this,Vt,Mr).call(this,i instanceof Error?i.message:String(i)),hn(this,Vt,i0).call(this);return}const e=location.protocol==="https:"?"wss":"ws",t=new WebSocket(`${e}://${location.host}/relay/client`);bt(this,ll,t),t.addEventListener("open",()=>{hn(this,Vt,ya).call(this,{t:"client.hello",protocol:C2,token:this.session.token})}),t.addEventListener("message",i=>{let l;try{l=JSON.parse(String(i.data))}catch{return}hn(this,Vt,uk).call(this,l)}),t.addEventListener("close",()=>{var i;bt(this,ll,null),bt(this,_a,!1),bt(this,Lr,!1),hn(this,Vt,Mr).call(this,"Нет связи с сервером"),(i=Ue(this,rl))==null||i.call(this),hn(this,Vt,i0).call(this)}),t.addEventListener("error",()=>t.close())},uk=function(e){var t,i,l,a,o,u,f;switch(e.t){case"client.ok":bt(this,Jo,500),hn(this,Vt,ya).call(this,{t:"client.attach",hostId:Ue(this,Ca)??"",...Ue(this,Ta)>0?{sinceRseq:Ue(this,Ta)}:{}});return;case"client.attached":bt(this,_a,!0),bt(this,Lr,e.online),bt(this,Ta,e.rseq),hn(this,Vt,Mr).call(this,e.online?"Хост на связи":"Компьютер не на связи"),hn(this,Vt,ya).call(this,{t:"client.frame",body:{type:"hello",protocol:rk,clientName:"ccv-web-relay"}});const d=Ue(this,Ma);bt(this,Ma,[]);for(const p of d)hn(this,Vt,ya).call(this,{t:"client.frame",body:p});(t=Ue(this,Zo))==null||t.call(this),(i=Ue(this,rl))==null||i.call(this);return;case"host.frame":{e.rseq>0&&bt(this,Ta,e.rseq);const p=e.body;for(const b of Ue(this,Qo))b(p);return}case"host.online":bt(this,Lr,!0),hn(this,Vt,Mr).call(this,"Хост на связи"),(l=Ue(this,Zo))==null||l.call(this),(a=Ue(this,rl))==null||a.call(this);return;case"host.offline":bt(this,Lr,!1),hn(this,Vt,Mr).call(this,"Компьютер не на связи"),(o=Ue(this,rl))==null||o.call(this);return;case"ping":hn(this,Vt,ya).call(this,{t:"pong",nonce:e.nonce});return;case"error":if(e.code==="auth"){ck(),location.href="/login";return}if(e.code==="not_found"){localStorage.removeItem(Jh),hn(this,Vt,Mr).call(this,"Этот компьютер отвязан от аккаунта"),bt(this,Aa,!0),(u=Ue(this,ll))==null||u.close();return}e.code!=="offline"&&hn(this,Vt,Mr).call(this,e.message),(f=Ue(this,rl))==null||f.call(this);return}},ya=function(e){var t;((t=Ue(this,ll))==null?void 0:t.readyState)===WebSocket.OPEN&&Ue(this,ll).send(JSON.stringify(e))},i0=function(){if(Ue(this,Aa)||Ue(this,jr)!==null)return;const e=Ue(this,Jo);bt(this,Jo,Math.min(e*2,1e4)),bt(this,jr,window.setTimeout(()=>{bt(this,jr,null),hn(this,Vt,n0).call(this)},e))};async function E2(n){const e=new URLSearchParams(location.search).get("host");if(e)return localStorage.setItem(Jh,e),e;const t=localStorage.getItem(Jh);if(t)return t;const i=await fetch("/api/hosts",{headers:{authorization:`Bearer ${n}`}});if(i.status===401)throw ck(),location.href="/login",new Error("нужен вход");const a=(await i.json()).hosts??[];if(a.length===1&&a[0])return localStorage.setItem(Jh,a[0].id),a[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function fk(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const N2=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function D2(){if(fk()==="local")return new _2(N2);const n=T2();return n?new M2(n):(location.replace(`/login?next=${encodeURIComponent(location.pathname+location.search)}`),null)}const Gi={items:[],pending:[],lastSeq:0,contextTokens:null};function pg(n,e){let t=n;for(const i of e)i.seq<=t.lastSeq||(t={...O2(t,i.event,i.seq),lastSeq:i.seq});return t}function O2(n,e,t){var l,a;const i=n.items;switch(e.kind){case"user.message":return Zs(n,{id:`u${t}`,kind:"user",text:e.text});case"assistant.delta":{const o=i.findIndex(f=>f.id===e.blockId);if(o===-1)return Zs(n,{id:e.blockId,kind:"assistant",text:e.text,streaming:!0});const u=i[o];return ko(n,o,{...u,text:u.text+e.text})}case"assistant.text":{const o=i.findIndex(f=>f.id===e.blockId),u={id:e.blockId,kind:"assistant",text:e.text,streaming:!1};return o===-1?Zs(n,u):ko(n,o,u)}case"thinking.delta":{const o=i.findIndex(f=>f.id===e.blockId);if(o===-1)return Zs(n,{id:e.blockId,kind:"thinking",text:e.text});const u=i[o];return ko(n,o,{...u,text:u.text+e.text})}case"assistant.thinking":{const o=i.findIndex(f=>f.id===e.blockId),u={id:e.blockId,kind:"thinking",text:e.text};return o===-1?Zs(n,u):ko(n,o,u)}case"tool.use":return Zs(n,{id:`t${e.toolUseId}`,kind:"tool",toolUseId:e.toolUseId,name:e.name,input:e.input,result:null,isError:!1,awaitingPermission:!1});case"tool.result":{const o=i.findIndex(f=>f.kind==="tool"&&f.toolUseId===e.toolUseId);if(o===-1)return n;const u=i[o];return ko(n,o,{...u,result:e.content,isError:e.isError,awaitingPermission:!1})}case"permission.request":return{...n,pending:[...n.pending,{requestId:e.requestId,toolName:e.toolName,input:e.input,...e.reason?{reason:e.reason}:{},...e.questions?{questions:e.questions}:{},...e.toolUseId?{toolUseId:e.toolUseId}:{}}]};case"permission.resolved":{const o=n.pending.find(f=>f.requestId===e.requestId),u=n.pending.filter(f=>f.requestId!==e.requestId);if(e.answers&&(o!=null&&o.toolUseId)){const f=i.findIndex(d=>d.kind==="tool"&&d.toolUseId===o.toolUseId);if(f!==-1){const d=i[f];return ko({...n,pending:u},f,{...d,answers:e.answers})}}return e.decision==="allow"?{...n,pending:u}:Zs({...n,pending:u},{id:`p${t}`,kind:"notice",tone:"info",text:`Отклонено${e.reason?`: ${e.reason}`:""}`})}case"result":{const o=n.items.map(f=>f.kind==="assistant"&&f.streaming?{...f,streaming:!1}:f),u=e.usage?e.usage.inputTokens+e.usage.cacheReadTokens+e.usage.cacheCreationTokens:n.contextTokens;return Zs({...n,items:o,contextTokens:u},{id:`r${t}`,kind:"result",subtype:e.subtype,isError:e.isError,durationMs:e.durationMs,costUsd:e.costUsd,inputTokens:((l=e.usage)==null?void 0:l.inputTokens)??0,outputTokens:((a=e.usage)==null?void 0:a.outputTokens)??0})}case"system":return e.subtype!=="compact_boundary"?n:Zs(n,{id:`s${t}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return Zs(n,{id:`e${t}`,kind:"notice",tone:"error",text:e.message});case"state":return n;default:return n}}function Zs(n,e){return{...n,items:[...n.items,e]}}function ko(n,e,t){const i=n.items.slice();return i[e]=t,{...n,items:i}}const s0="ccv:theme",mg=["system","light","dark"];function R2(){const[n,e]=M.useState(j2);M.useEffect(()=>{const l=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{const o=n==="dark"||n==="system"&&l.matches;document.documentElement.dataset.theme=o?"dark":"light"};return a(),l.addEventListener("change",a),()=>l.removeEventListener("change",a)},[n]);const t=M.useCallback(l=>{try{localStorage.setItem(s0,l)}catch{}e(l)},[]),i=M.useCallback(()=>{e(l=>{const a=mg[(mg.indexOf(l)+1)%mg.length];try{localStorage.setItem(s0,a)}catch{}return a})},[]);return[n,t,i]}function j2(){try{const n=localStorage.getItem(s0);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}const Ea={sidebar:{side:"left",min:200,max:520,width:276,label:"сессий"},files:{side:"left",min:180,max:560,width:260,label:"файлов"},search:{side:"left",min:220,max:640,width:320,label:"поиска"},git:{side:"left",min:220,max:640,width:320,label:"истории"},ask:{side:"right",min:260,max:720,width:380,label:"вопроса"}},L2=320,hk="ccv:panes";function B2(n){return`--${n}-w`}function dk(n,e){const t=Ea[n];return Math.round(Math.min(t.max,Math.max(t.min,e)))}function z2(){const n={};for(const e of Object.keys(Ea))n[e]=Ea[e].width;try{const e=localStorage.getItem(hk);if(e){const t=JSON.parse(e);for(const i of Object.keys(Ea)){const l=t[i];typeof l=="number"&&Number.isFinite(l)&&(n[i]=dk(i,l))}}}catch{}return n}function H2(){const[n,e]=M.useState(z2),t=M.useCallback(o=>{try{localStorage.setItem(hk,JSON.stringify(o))}catch{}},[]),i=M.useCallback((o,u)=>{e(f=>{const d=dk(o,u);if(f[o]===d)return f;const p={...f,[o]:d};return t(p),p})},[t]),l=M.useCallback(o=>{e(u=>{const f={...u,[o]:Ea[o].width};return t(f),f})},[t]),a={};for(const o of Object.keys(Ea))a[B2(o)]=`${n[o]}px`;return{widths:n,style:a,setWidth:i,reset:l}}function pk(n){const[e,t]=M.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return M.useEffect(()=>{const i=window.matchMedia(n),l=()=>t(i.matches);return l(),i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[n]),e}function iy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var za=iy();function mk(n){za=n}var xa={exec:()=>null};function Ao(n){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),l=e[i];return l||(l=n(i),e[i]=l),l}}function ut(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(l,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(ni.caret,"$1"),t=t.replace(l,o),i},getRegex:()=>new RegExp(t,e)};return i}var I2=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),ni={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Ao(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ao(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ao(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ao(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Ao(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Ao(n=>new RegExp(`^ {0,${n}}>`))},U2=/^(?:[ \t]*(?:\n|$))+/,q2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,V2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,G2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,sy=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,gk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yk=ut(gk).replace(/bull/g,sy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),P2=ut(gk).replace(/bull/g,sy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ly=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Y2=/^[^\n]+/,ry=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,F2=ut(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ry).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$2=ut(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,sy).getRegex(),Vd="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ay=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,W2=ut("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ay).replace("tag",Vd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),bk=n=>ut(ly).replace("hr",$u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vd).getRegex(),K2=bk(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),X2=bk(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Q2=ut(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",X2).getRegex(),oy={blockquote:Q2,code:q2,def:F2,fences:V2,heading:G2,hr:$u,html:W2,lheading:yk,list:$2,newline:U2,paragraph:K2,table:xa,text:Y2},Cv=ut("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vd).getRegex(),Z2={...oy,lheading:P2,table:Cv,paragraph:ut(ly).replace("hr",$u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vd).getRegex()},J2={...oy,html:ut(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ay).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ut(ly).replace("hr",$u).replace("heading",` *#{1,6} *[^
|
|
51
|
-
]`).replace("lheading",yk).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},eM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xk=/^( {2,}|\\)\n(?!\s*$)/,nM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uc=/[\p{P}\p{S}]/u,Gd=/[\s\p{P}\p{S}]/u,cy=/[^\s\p{P}\p{S}]/u,iM=ut(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Gd).getRegex(),vk=/(?!~)[\p{P}\p{S}]/u,sM=/(?!~)[\s\p{P}\p{S}]/u,lM=/(?:[^\s\p{P}\p{S}]|~)/u,rM=ut(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",I2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Sk=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,aM=ut(Sk,"u").replace(/punct/g,uc).getRegex(),oM=ut(Sk,"u").replace(/punct/g,vk).getRegex(),wk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cM=ut(wk,"gu").replace(/notPunctSpace/g,cy).replace(/punctSpace/g,Gd).replace(/punct/g,uc).getRegex(),uM=ut(wk,"gu").replace(/notPunctSpace/g,lM).replace(/punctSpace/g,sM).replace(/punct/g,vk).getRegex(),fM=ut("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cy).replace(/punctSpace/g,Gd).replace(/punct/g,uc).getRegex(),hM=ut(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,uc).getRegex(),dM="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",pM=ut(dM,"gu").replace(/notPunctSpace/g,cy).replace(/punctSpace/g,Gd).replace(/punct/g,uc).getRegex(),mM=ut(/\\(punct)/,"gu").replace(/punct/g,uc).getRegex(),gM=ut(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),yM=ut(ay).replace("(?:-->|$)","-->").getRegex(),bM=ut("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",yM).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),od=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,xM=ut(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",od).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kk=ut(/^!?\[(label)\]\[(ref)\]/).replace("label",od).replace("ref",ry).getRegex(),Ak=ut(/^!?\[(ref)\](?:\[\])?/).replace("ref",ry).getRegex(),vM=ut("reflink|nolink(?!\\()","g").replace("reflink",kk).replace("nolink",Ak).getRegex(),Tv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,uy={_backpedal:xa,anyPunctuation:mM,autolink:gM,blockSkip:rM,br:xk,code:tM,del:xa,delLDelim:xa,delRDelim:xa,emStrongLDelim:aM,emStrongRDelimAst:cM,emStrongRDelimUnd:fM,escape:eM,link:xM,nolink:Ak,punctuation:iM,reflink:kk,reflinkSearch:vM,tag:bM,text:nM,url:xa},SM={...uy,link:ut(/^!?\[(label)\]\((.*?)\)/).replace("label",od).getRegex(),reflink:ut(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",od).getRegex()},l0={...uy,emStrongRDelimAst:uM,emStrongLDelim:oM,delLDelim:hM,delRDelim:pM,url:ut(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Tv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ut(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Tv).getRegex()},wM={...l0,br:ut(xk).replace("{2,}","*").getRegex(),text:ut(l0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ah={normal:oy,gfm:Z2,pedantic:J2},ou={normal:uy,gfm:l0,breaks:wM,pedantic:SM},kM={"&":"&","<":"<",">":">",'"':""","'":"'"},Mv=n=>kM[n];function nl(n,e){if(e){if(ni.escapeTest.test(n))return n.replace(ni.escapeReplace,Mv)}else if(ni.escapeTestNoEncode.test(n))return n.replace(ni.escapeReplaceNoEncode,Mv);return n}function Ev(n){try{n=encodeURI(n).replace(ni.percentDecode,"%")}catch{return null}return n}function Nv(n,e){var a;let t=n.replace(ni.findPipe,(o,u,f)=>{let d=!1,p=u;for(;--p>=0&&f[p]==="\\";)d=!d;return d?"|":" |"}),i=t.split(ni.splitPipe),l=0;if(i[0].trim()||i.shift(),i.length>0&&!((a=i.at(-1))!=null&&a.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;l<i.length;l++)i[l]=i[l].trim().replace(ni.slashPipe,"|");return i}function Cr(n,e,t){let i=n.length;if(i===0)return"";let l=0;for(;l<i&&n.charAt(i-l-1)===e;)l++;return n.slice(0,i-l)}function Dv(n){let e=n.split(`
|
|
52
|
-
`),t=e.length-1;for(;t>=0&&ni.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
53
|
-
`)}function AM(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<n.length;i++)if(n[i]==="\\")i++;else if(n[i]===e[0])t++;else if(n[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function _M(n,e=0){let t=e,i="";for(let l of n)if(l===" "){let a=4-t%4;i+=" ".repeat(a),t+=a}else i+=l,t++;return i}function Ov(n,e,t,i,l){let a=e.href,o=e.title||null,u=n[1].replace(l.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:o,text:u,tokens:i.inlineTokens(u)};return i.state.inLink=!1,f}function CM(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let l=i[1];return e.split(`
|
|
54
|
-
`).map(a=>{let o=a.match(t.other.beginningSpace);if(o===null)return a;let[u]=o;return u.length>=l.length?a.slice(l.length):a}).join(`
|
|
55
|
-
`)}var cd=class{constructor(n){Et(this,"options");Et(this,"rules");Et(this,"lexer");this.options=n||za}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:Dv(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],i=CM(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=Cr(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:Cr(e[0],`
|
|
56
|
-
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Cr(e[0],`
|
|
57
|
-
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Cr(e[0],`
|
|
58
|
-
`).split(`
|
|
59
|
-
`),i="",l="",a=[];for(;t.length>0;){let o=!1,u=[],f;for(f=0;f<t.length;f++)if(this.rules.other.blockquoteStart.test(t[f]))u.push(t[f]),o=!0;else if(!o)u.push(t[f]);else break;t=t.slice(f);let d=u.join(`
|
|
60
|
-
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
61
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
62
|
-
${d}`:d,l=l?`${l}
|
|
63
|
-
${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,a,!0),this.lexer.state.top=b,t.length===0)break;let x=a.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let v=x,w=v.raw+`
|
|
64
|
-
`+t.join(`
|
|
65
|
-
`),C=this.blockquote(w);a[a.length-1]=C,i=i.substring(0,i.length-v.raw.length)+C.raw,l=l.substring(0,l.length-v.text.length)+C.text;break}else if((x==null?void 0:x.type)==="list"){let v=x,w=v.raw+`
|
|
66
|
-
`+t.join(`
|
|
67
|
-
`),C=this.list(w);a[a.length-1]=C,i=i.substring(0,i.length-x.raw.length)+C.raw,l=l.substring(0,l.length-v.raw.length)+C.raw,t=w.substring(a.at(-1).raw.length).split(`
|
|
68
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:a,text:l}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),i=t.length>1,l={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let a=this.rules.other.listItemRegex(t),o=!1;for(;n;){let f=!1,d="",p="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let b=_M(e[2].split(`
|
|
69
|
-
`,1)[0],e[1].length),x=n.split(`
|
|
70
|
-
`,1)[0],v=!b.trim(),w=0;if(this.options.pedantic?(w=2,p=b.trimStart()):v?w=e[1].length+1:(w=b.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=b.slice(w),w+=e[1].length),v&&this.rules.other.blankLine.test(x)&&(d+=x+`
|
|
71
|
-
`,n=n.substring(x.length+1),f=!0),!f){let C=this.rules.other.nextBulletRegex(w),A=this.rules.other.hrRegex(w),E=this.rules.other.fencesBeginRegex(w),D=this.rules.other.headingBeginRegex(w),B=this.rules.other.htmlBeginRegex(w),H=this.rules.other.blockquoteBeginRegex(w);for(;n;){let z=n.split(`
|
|
72
|
-
`,1)[0],L;if(x=z,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),L=x):L=x.replace(this.rules.other.tabCharGlobal," "),E.test(x)||D.test(x)||B.test(x)||H.test(x)||C.test(x)||A.test(x))break;if(L.search(this.rules.other.nonSpaceChar)>=w||!x.trim())p+=`
|
|
73
|
-
`+L.slice(w);else{if(v||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(b)||D.test(b)||A.test(b))break;p+=`
|
|
74
|
-
`+x}v=!x.trim(),d+=z+`
|
|
75
|
-
`,n=n.substring(z.length+1),b=L.slice(w)}}l.loose||(o?l.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),l.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),l.raw+=d}let u=l.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let f of l.items){this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]);let d=f.tokens[0];if(f.task&&((d==null?void 0:d.type)==="text"||(d==null?void 0:d.type)==="paragraph")){f.text=f.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=b.checked,l.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=b.raw+f.tokens[0].raw,f.tokens[0].text=b.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(b)):f.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):f.tokens.unshift(b)}}else f.task&&(f.task=!1);if(!l.loose){let p=f.tokens.filter(x=>x.type==="space"),b=p.length>0&&p.some(x=>this.rules.other.anyLine.test(x.raw));l.loose=b}}if(l.loose)for(let f of l.items){f.loose=!0;for(let d of f.tokens)d.type==="text"&&(d.type="paragraph")}return l}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=Dv(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:Cr(e[0],`
|
|
76
|
-
`),href:i,title:l}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Nv(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
77
|
-
`):[],a={type:"table",raw:Cr(e[0],`
|
|
78
|
-
`),header:[],align:[],rows:[]};if(t.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?a.align.push("right"):this.rules.other.tableAlignCenter.test(u)?a.align.push("center"):this.rules.other.tableAlignLeft.test(u)?a.align.push("left"):a.align.push(null);for(let u=0;u<t.length;u++)a.header.push({text:t[u],tokens:this.lexer.inline(t[u]),header:!0,align:a.align[u]});for(let u of l)a.rows.push(Nv(u,a.header.length).map((f,d)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:a.align[d]})));return a}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:Cr(e[0],`
|
|
79
|
-
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
80
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let a=Cr(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=AM(e[2],"()");if(a===-2)return;if(a>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],l="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],l=a[3])}else l=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),Ov(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=e[i.toLowerCase()];if(!l){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Ov(t,l,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let l=[...i[0]].length-1,a,o,u=l,f=0,d=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+l);(i=d.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){u+=o;continue}else if((i[5]||i[6])&&l%3&&!((l+o)%3)){f+=o;continue}if(u-=o,u>0)continue;o=Math.min(o,o+u+f);let p=[...i[0]][0].length,b=n.slice(0,l+i.index+p+o);if(Math.min(l,o)%2){let v=b.slice(1,-1);return{type:"em",raw:b,text:v,tokens:this.lexer.inlineTokens(v)}}let x=b.slice(2,-2);return{type:"strong",raw:b,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),l=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&l&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let i=this.rules.inline.delLDelim.exec(n);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let l=[...i[0]].length-1,a,o,u=l,f=this.rules.inline.delRDelim;for(f.lastIndex=0,e=e.slice(-1*n.length+l);(i=f.exec(e))!==null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a||(o=[...a].length,o!==l))continue;if(i[3]||i[4]){u+=o;continue}if(u-=o,u>0)continue;o=Math.min(o,o+u);let d=[...i[0]][0].length,p=n.slice(0,l+i.index+d+o),b=p.slice(l,-l);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let i,l;if(e[2]==="@")i=e[0],l="mailto:"+i;else{let a;do a=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(a!==e[0]);i=e[0],e[1]==="www."?l="http://"+e[0]:l=e[0]}return{type:"link",raw:e[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Ns=class r0{constructor(e){Et(this,"tokens");Et(this,"options");Et(this,"state");Et(this,"inlineQueue");Et(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||za,this.options.tokenizer=this.options.tokenizer||new cd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ni,block:Ah.normal,inline:ou.normal};this.options.pedantic?(t.block=Ah.pedantic,t.inline=ou.pedantic):this.options.gfm&&(t.block=Ah.gfm,this.options.breaks?t.inline=ou.breaks:t.inline=ou.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ah,inline:ou}}static lex(e,t){return new r0(t).lex(e)}static lexInline(e,t){return new r0(t).inlineTokens(e)}lex(e){e=e.replace(ni.carriageReturn,`
|
|
81
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){var a,o,u;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ni.tabCharGlobal," ").replace(ni.spaceLine,""));let l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let f;if((o=(a=this.options.extensions)==null?void 0:a.block)!=null&&o.some(p=>(f=p.call({lexer:this},e,t))?(e=e.substring(f.raw.length),t.push(f),!0):!1))continue;if(f=this.tokenizer.space(e)){e=e.substring(f.raw.length);let p=t.at(-1);f.raw.length===1&&p!==void 0?p.raw+=`
|
|
82
|
-
`:t.push(f);continue}if(f=this.tokenizer.code(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
83
|
-
`)?"":`
|
|
84
|
-
`)+f.raw,p.text+=`
|
|
85
|
-
`+f.text,this.inlineQueue.at(-1).src=p.text):t.push(f);continue}if(f=this.tokenizer.fences(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.heading(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.hr(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.blockquote(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.list(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.html(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.def(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
86
|
-
`)?"":`
|
|
87
|
-
`)+f.raw,p.text+=`
|
|
88
|
-
`+f.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title},t.push(f));continue}if(f=this.tokenizer.table(e)){e=e.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.lheading(e)){e=e.substring(f.raw.length),t.push(f);continue}let d=e;if((u=this.options.extensions)!=null&&u.startBlock){let p=1/0,b=e.slice(1),x;this.options.extensions.startBlock.forEach(v=>{x=v.call({lexer:this},b),typeof x=="number"&&x>=0&&(p=Math.min(p,x))}),p<1/0&&p>=0&&(d=e.substring(0,p+1))}if(this.state.top&&(f=this.tokenizer.paragraph(d))){let p=t.at(-1);i&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=(p.raw.endsWith(`
|
|
89
|
-
`)?"":`
|
|
90
|
-
`)+f.raw,p.text+=`
|
|
91
|
-
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):t.push(f),i=d.length!==e.length,e=e.substring(f.raw.length);continue}if(f=this.tokenizer.text(e)){e=e.substring(f.raw.length);let p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
92
|
-
`)?"":`
|
|
93
|
-
`)+f.raw,p.text+=`
|
|
94
|
-
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):t.push(f);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var u,f,d,p,b;this.tokenizer.lexer=this;let i=e;if(this.tokens.links){let x=Object.keys(this.tokens.links);x.length>0&&(i=i.replace(this.tokenizer.rules.inline.reflinkSearch,v=>x.includes(v.slice(v.lastIndexOf("[")+1,-1))?"["+"a".repeat(v.length-2)+"]":v))}i=i.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),i=i.replace(this.tokenizer.rules.inline.blockSkip,(x,v,w)=>{let C=w?w.length:0;return x.slice(0,C)+"["+"a".repeat(x.length-C-2)+"]"}),i=((f=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:f.call({lexer:this},i))??i;let l=!1,a="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}l||(a=""),l=!1;let x;if((p=(d=this.options.extensions)==null?void 0:d.inline)!=null&&p.some(w=>(x=w.call({lexer:this},e,t))?(e=e.substring(x.raw.length),t.push(x),!0):!1))continue;if(x=this.tokenizer.escape(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.tag(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.link(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(x.raw.length);let w=t.at(-1);x.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):t.push(x);continue}if(x=this.tokenizer.emStrong(e,i,a)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.codespan(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.br(e)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.del(e,i,a)){e=e.substring(x.raw.length),t.push(x);continue}if(x=this.tokenizer.autolink(e)){e=e.substring(x.raw.length),t.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(e))){e=e.substring(x.raw.length),t.push(x);continue}let v=e;if((b=this.options.extensions)!=null&&b.startInline){let w=1/0,C=e.slice(1),A;this.options.extensions.startInline.forEach(E=>{A=E.call({lexer:this},C),typeof A=="number"&&A>=0&&(w=Math.min(w,A))}),w<1/0&&w>=0&&(v=e.substring(0,w+1))}if(x=this.tokenizer.inlineText(v)){e=e.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(a=x.raw.slice(-1)),l=!0;let w=t.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):t.push(x);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},ud=class{constructor(n){Et(this,"options");Et(this,"parser");this.options=n||za}space(n){return""}code({text:n,lang:e,escaped:t}){var a;let i=(a=(e||"").match(ni.notSpaceStart))==null?void 0:a[0],l=n.replace(ni.endingNewline,"")+`
|
|
95
|
-
`;return i?'<pre><code class="language-'+nl(i)+'">'+(t?l:nl(l,!0))+`</code></pre>
|
|
96
|
-
`:"<pre><code>"+(t?l:nl(l,!0))+`</code></pre>
|
|
97
|
-
`}blockquote({tokens:n}){return`<blockquote>
|
|
98
|
-
${this.parser.parse(n)}</blockquote>
|
|
99
|
-
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
100
|
-
`}hr(n){return`<hr>
|
|
101
|
-
`}list(n){let e=n.ordered,t=n.start,i="";for(let o=0;o<n.items.length;o++){let u=n.items[o];i+=this.listitem(u)}let l=e?"ol":"ul",a=e&&t!==1?' start="'+t+'"':"";return"<"+l+a+`>
|
|
102
|
-
`+i+"</"+l+`>
|
|
103
|
-
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
104
|
-
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
105
|
-
`}table(n){let e="",t="";for(let l=0;l<n.header.length;l++)t+=this.tablecell(n.header[l]);e+=this.tablerow({text:t});let i="";for(let l=0;l<n.rows.length;l++){let a=n.rows[l];t="";for(let o=0;o<a.length;o++)t+=this.tablecell(a[o]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
106
|
-
<thead>
|
|
107
|
-
`+e+`</thead>
|
|
108
|
-
`+i+`</table>
|
|
109
|
-
`}tablerow({text:n}){return`<tr>
|
|
110
|
-
${n}</tr>
|
|
111
|
-
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
112
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${nl(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t),l=Ev(n);if(l===null)return i;n=l;let a='<a href="'+n+'"';return e&&(a+=' title="'+nl(e)+'"'),a+=">"+i+"</a>",a}image({href:n,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let l=Ev(n);if(l===null)return nl(t);n=l;let a=`<img src="${n}" alt="${nl(t)}"`;return e&&(a+=` title="${nl(e)}"`),a+=">",a}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:nl(n.text)}},fy=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Ds=class a0{constructor(e){Et(this,"options");Et(this,"renderer");Et(this,"textRenderer");this.options=e||za,this.options.renderer=this.options.renderer||new ud,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new fy}static parse(e,t){return new a0(t).parse(e)}static parseInline(e,t){return new a0(t).parseInline(e)}parse(e){var i,l;this.renderer.parser=this;let t="";for(let a=0;a<e.length;a++){let o=e[a];if((l=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&l[o.type]){let f=o,d=this.options.extensions.renderers[f.type].call({parser:this},f);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(f.type)){t+=d||"";continue}}let u=o;switch(u.type){case"space":{t+=this.renderer.space(u);break}case"hr":{t+=this.renderer.hr(u);break}case"heading":{t+=this.renderer.heading(u);break}case"code":{t+=this.renderer.code(u);break}case"table":{t+=this.renderer.table(u);break}case"blockquote":{t+=this.renderer.blockquote(u);break}case"list":{t+=this.renderer.list(u);break}case"checkbox":{t+=this.renderer.checkbox(u);break}case"html":{t+=this.renderer.html(u);break}case"def":{t+=this.renderer.def(u);break}case"paragraph":{t+=this.renderer.paragraph(u);break}case"text":{t+=this.renderer.text(u);break}default:{let f='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return t}parseInline(e,t=this.renderer){var l,a;this.renderer.parser=this;let i="";for(let o=0;o<e.length;o++){let u=e[o];if((a=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&a[u.type]){let d=this.options.extensions.renderers[u.type].call({parser:this},u);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){i+=d||"";continue}}let f=u;switch(f.type){case"escape":{i+=t.text(f);break}case"html":{i+=t.html(f);break}case"link":{i+=t.link(f);break}case"image":{i+=t.image(f);break}case"checkbox":{i+=t.checkbox(f);break}case"strong":{i+=t.strong(f);break}case"em":{i+=t.em(f);break}case"codespan":{i+=t.codespan(f);break}case"br":{i+=t.br(f);break}case"del":{i+=t.del(f);break}case"text":{i+=t.text(f);break}default:{let d='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},Zh,bu=(Zh=class{constructor(n){Et(this,"options");Et(this,"block");this.options=n||za}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Ns.lex:Ns.lexInline}provideParser(n=this.block){return n?Ds.parse:Ds.parseInline}},Et(Zh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Et(Zh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Zh),TM=class{constructor(...n){Et(this,"defaults",iy());Et(this,"options",this.setOptions);Et(this,"parse",this.parseMarkdown(!0));Et(this,"parseInline",this.parseMarkdown(!1));Et(this,"Parser",Ds);Et(this,"Renderer",ud);Et(this,"TextRenderer",fy);Et(this,"Lexer",Ns);Et(this,"Tokenizer",cd);Et(this,"Hooks",bu);this.use(...n)}walkTokens(n,e){var i,l;let t=[];for(let a of n)switch(t=t.concat(e.call(this,a)),a.type){case"table":{let o=a;for(let u of o.header)t=t.concat(this.walkTokens(u.tokens,e));for(let u of o.rows)for(let f of u)t=t.concat(this.walkTokens(f.tokens,e));break}case"list":{let o=a;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=a;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[o.type]?this.defaults.extensions.childTokens[o.type].forEach(u=>{let f=o[u].flat(1/0);t=t.concat(this.walkTokens(f,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let a=e.renderers[l.name];a?e.renderers[l.name]=function(...o){let u=l.renderer.apply(this,o);return u===!1&&(u=a.apply(this,o)),u}:e.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[l.level];a?a.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),i.extensions=e),t.renderer){let l=this.defaults.renderer||new ud(this.defaults);for(let a in t.renderer){if(!(a in l))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,u=t.renderer[o],f=l[o];l[o]=(...d)=>{let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p||""}}i.renderer=l}if(t.tokenizer){let l=this.defaults.tokenizer||new cd(this.defaults);for(let a in t.tokenizer){if(!(a in l))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,u=t.tokenizer[o],f=l[o];l[o]=(...d)=>{let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p}}i.tokenizer=l}if(t.hooks){let l=this.defaults.hooks||new bu;for(let a in t.hooks){if(!(a in l))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,u=t.hooks[o],f=l[o];bu.passThroughHooks.has(a)?l[o]=d=>{if(this.defaults.async&&bu.passThroughHooksRespectAsync.has(a))return(async()=>{let b=await u.call(l,d);return f.call(l,b)})();let p=u.call(l,d);return f.call(l,p)}:l[o]=(...d)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(l,d);return b===!1&&(b=await f.apply(l,d)),b})();let p=u.apply(l,d);return p===!1&&(p=f.apply(l,d)),p}}i.hooks=l}if(t.walkTokens){let l=this.defaults.walkTokens,a=t.walkTokens;i.walkTokens=function(o){let u=[];return u.push(a.call(this,o)),l&&(u=u.concat(l.call(this,o))),u}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Ns.lex(n,e??this.defaults)}parser(n,e){return Ds.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},l={...this.defaults,...i},a=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=n),l.async)return(async()=>{let o=l.hooks?await l.hooks.preprocess(e):e,u=await(l.hooks?await l.hooks.provideLexer(n):n?Ns.lex:Ns.lexInline)(o,l),f=l.hooks?await l.hooks.processAllTokens(u):u;l.walkTokens&&await Promise.all(this.walkTokens(f,l.walkTokens));let d=await(l.hooks?await l.hooks.provideParser(n):n?Ds.parse:Ds.parseInline)(f,l);return l.hooks?await l.hooks.postprocess(d):d})().catch(a);try{l.hooks&&(e=l.hooks.preprocess(e));let o=(l.hooks?l.hooks.provideLexer(n):n?Ns.lex:Ns.lexInline)(e,l);l.hooks&&(o=l.hooks.processAllTokens(o)),l.walkTokens&&this.walkTokens(o,l.walkTokens);let u=(l.hooks?l.hooks.provideParser(n):n?Ds.parse:Ds.parseInline)(o,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(o){return a(o)}}}onError(n,e){return t=>{if(t.message+=`
|
|
113
|
-
Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error occurred:</p><pre>"+nl(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Oa=new TM;function wt(n,e){return Oa.parse(n,e)}wt.options=wt.setOptions=function(n){return Oa.setOptions(n),wt.defaults=Oa.defaults,mk(wt.defaults),wt};wt.getDefaults=iy;wt.defaults=za;wt.use=function(...n){return Oa.use(...n),wt.defaults=Oa.defaults,mk(wt.defaults),wt};wt.walkTokens=function(n,e){return Oa.walkTokens(n,e)};wt.parseInline=Oa.parseInline;wt.Parser=Ds;wt.parser=Ds.parse;wt.Renderer=ud;wt.TextRenderer=fy;wt.Lexer=Ns;wt.lexer=Ns.lex;wt.Tokenizer=cd;wt.Hooks=bu;wt.parse=wt;wt.options;wt.setOptions;wt.use;wt.walkTokens;wt.parseInline;Ds.parse;Ns.lex;/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */function Rv(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function MM(n){if(Array.isArray(n))return n}function EM(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,l,a,o,u=[],f=!0,d=!1;try{if(a=(t=t.call(n)).next,e!==0)for(;!(f=(i=a.call(t)).done)&&(u.push(i.value),u.length!==e);f=!0);}catch(p){d=!0,l=p}finally{try{if(!f&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw l}}return u}}function NM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
114
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DM(n,e){return MM(n)||EM(n,e)||OM(n,e)||NM()}function OM(n,e){if(n){if(typeof n=="string")return Rv(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Rv(n,e):void 0}}const _k=Object.entries,jv=Object.setPrototypeOf,RM=Object.isFrozen,jM=Object.getPrototypeOf,LM=Object.getOwnPropertyDescriptor;let Pn=Object.freeze,Fn=Object.seal,Mo=Object.create,Ck=typeof Reflect<"u"&&Reflect,o0=Ck.apply,c0=Ck.construct;Pn||(Pn=function(e){return e});Fn||(Fn=function(e){return e});o0||(o0=function(e,t){for(var i=arguments.length,l=new Array(i>2?i-2:0),a=2;a<i;a++)l[a-2]=arguments[a];return e.apply(t,l)});c0||(c0=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),l=1;l<t;l++)i[l-1]=arguments[l];return new e(...i)});const _o=mn(Array.prototype.forEach),BM=mn(Array.prototype.lastIndexOf),Lv=mn(Array.prototype.pop),Co=mn(Array.prototype.push),zM=mn(Array.prototype.splice),Dr=Array.isArray,xu=mn(String.prototype.toLowerCase),gg=mn(String.prototype.toString),Bv=mn(String.prototype.match),cu=mn(String.prototype.replace),zv=mn(String.prototype.indexOf),HM=mn(String.prototype.trim),IM=mn(Number.prototype.toString),UM=mn(Boolean.prototype.toString),Hv=typeof BigInt>"u"?null:mn(BigInt.prototype.toString),Iv=typeof Symbol>"u"?null:mn(Symbol.prototype.toString),Dn=mn(Object.prototype.hasOwnProperty),uu=mn(Object.prototype.toString),Nn=mn(RegExp.prototype.test),pa=qM(TypeError);function mn(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),l=1;l<t;l++)i[l-1]=arguments[l];return o0(n,e,i)}}function qM(n){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return c0(n,t)}}function ot(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xu;if(jv&&jv(n,null),!Dr(e))return n;let i=e.length;for(;i--;){let l=e[i];if(typeof l=="string"){const a=t(l);a!==l&&(RM(e)||(e[i]=a),l=a)}n[l]=!0}return n}function VM(n){for(let e=0;e<n.length;e++)Dn(n,e)||(n[e]=null);return n}function fi(n){const e=Mo(null);for(const i of _k(n)){var t=DM(i,2);const l=t[0],a=t[1];Dn(n,l)&&(Dr(a)?e[l]=VM(a):a&&typeof a=="object"&&a.constructor===Object?e[l]=fi(a):e[l]=a)}return e}function GM(n){switch(typeof n){case"string":return n;case"number":return IM(n);case"boolean":return UM(n);case"bigint":return Hv?Hv(n):"0";case"symbol":return Iv?Iv(n):"Symbol()";case"undefined":return uu(n);case"function":case"object":{if(n===null)return uu(n);const e=n,t=il(e,"toString");if(typeof t=="function"){const i=t(e);return typeof i=="string"?i:uu(i)}return uu(n)}default:return uu(n)}}function il(n,e){for(;n!==null;){const i=LM(n,e);if(i){if(i.get)return mn(i.get);if(typeof i.value=="function")return mn(i.value)}n=jM(n)}function t(){return null}return t}function PM(n){try{return Nn(n,""),!0}catch{return!1}}const Uv=Pn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yg=Pn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bg=Pn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),YM=Pn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),xg=Pn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),FM=Pn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qv=Pn(["#text"]),Vv=Pn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),vg=Pn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Gv=Pn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_h=Pn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$M=Fn(/{{[\w\W]*|^[\w\W]*}}/g),WM=Fn(/<%[\w\W]*|^[\w\W]*%>/g),KM=Fn(/\${[\w\W]*/g),XM=Fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),QM=Fn(/^aria-[\-\w]+$/),Pv=Fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ZM=Fn(/^(?:\w+script|data):/i),JM=Fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),eE=Fn(/^html$/i),tE=Fn(/^[a-z][.\w]*(-[.\w]+)+$/i),Yv=Fn(/<[/\w!]/g),Fv=Fn(/<[/\w]/g),nE=Fn(/<\/no(script|embed|frames)/i),iE=Fn(/\/>/i),Pi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sE=function(){return typeof window>"u"?null:window},lE=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const l="data-tt-policy-suffix";t&&t.hasAttribute(l)&&(i=t.getAttribute(l));const a="dompurify"+(i?"#"+i:"");try{return e.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},$v=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Tr=function(e,t,i,l){return Dn(e,t)&&Dr(e[t])?ot(l.base?fi(l.base):{},e[t],l.transform):i};function Tk(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sE();const e=oe=>Tk(oe);if(e.version="3.4.12",e.removed=[],!n||!n.document||n.document.nodeType!==Pi.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const i=t,l=i.currentScript;n.DocumentFragment;const a=n.HTMLTemplateElement,o=n.Node,u=n.Element,f=n.NodeFilter,d=n.NamedNodeMap;d===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const p=n.DOMParser,b=n.trustedTypes,x=u.prototype,v=il(x,"cloneNode"),w=il(x,"remove"),C=il(x,"nextSibling"),A=il(x,"childNodes"),E=il(x,"parentNode"),D=il(x,"shadowRoot"),B=il(x,"attributes"),H=o&&o.prototype?il(o.prototype,"nodeType"):null,z=o&&o.prototype?il(o.prototype,"nodeName"):null;if(typeof a=="function"){const oe=t.createElement("template");oe.content&&oe.content.ownerDocument&&(t=oe.content.ownerDocument)}let L,R="",te,fe=!1,Te=0;const he=function(){if(Te>0)throw pa('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(T){he(),Te++;try{return L.createHTML(T)}finally{Te--}},Me=function(T){he(),Te++;try{return L.createScriptURL(T)}finally{Te--}},Ae=function(){return fe||(te=lE(b,l),fe=!0),te},Se=t,q=Se.implementation,J=Se.createNodeIterator,W=Se.createDocumentFragment,Ee=Se.getElementsByTagName,Ne=i.importNode;let N=$v();e.isSupported=typeof _k=="function"&&typeof E=="function"&&q&&q.createHTMLDocument!==void 0;const F=$M,se=WM,ae=KM,de=XM,_e=QM,Re=ZM,ft=JM,ht=tE;let xt=Pv,Ye=null;const Sn=ot({},[...Uv,...yg,...bg,...xg,...qv]);let Je=null;const we=ot({},[...Vv,...vg,...Gv,..._h]);let xe=Object.seal(Mo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Gt=null,wn=null;const qe=Object.seal(Mo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jn=!0,Kn=!0,ce=!1,Ve=!0,vt=!1,$e=!0,gn=!1,K=!1,ue=null,Le=null,dt=!1,Wt=!1,Wi=!1,Kl=!1,ds=!0,kn=!1;const Ei="user-content-";let yn=!0,Is=!1,Xn={},An=null;const Xt=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Us=null;const ps=ot({},["audio","video","img","source","image","track"]);let Qn=null;const yl=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),li="http://www.w3.org/1998/Math/MathML",Xl="http://www.w3.org/2000/svg",Ln="http://www.w3.org/1999/xhtml";let ri=Ln,mi=!1,Bn=null;const qs=ot({},[li,Xl,Ln],gg),Ni=Pn(["mi","mo","mn","ms","mtext"]);let Ki=ot({},Ni);const ms=Pn(["annotation-xml"]);let Xi=ot({},ms);const Vs=ot({},["title","style","font","a","script"]);let _n=null;const ai=["application/xhtml+xml","text/html"],Dt="text/html";let Qe=null,tn=null;const gs=t.createElement("form"),bl=function(T){return T instanceof RegExp||T instanceof Function},ys=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(tn&&tn===T)return;(!T||typeof T!="object")&&(T={}),T=fi(T),_n=ai.indexOf(T.PARSER_MEDIA_TYPE)===-1?Dt:T.PARSER_MEDIA_TYPE,Qe=_n==="application/xhtml+xml"?gg:xu,Ye=Tr(T,"ALLOWED_TAGS",Sn,{transform:Qe}),Je=Tr(T,"ALLOWED_ATTR",we,{transform:Qe}),Bn=Tr(T,"ALLOWED_NAMESPACES",qs,{transform:gg}),Qn=Tr(T,"ADD_URI_SAFE_ATTR",yl,{transform:Qe,base:yl}),Us=Tr(T,"ADD_DATA_URI_TAGS",ps,{transform:Qe,base:ps}),An=Tr(T,"FORBID_CONTENTS",Xt,{transform:Qe}),Gt=Tr(T,"FORBID_TAGS",fi({}),{transform:Qe}),wn=Tr(T,"FORBID_ATTR",fi({}),{transform:Qe}),Xn=Dn(T,"USE_PROFILES")?T.USE_PROFILES&&typeof T.USE_PROFILES=="object"?fi(T.USE_PROFILES):T.USE_PROFILES:!1,jn=T.ALLOW_ARIA_ATTR!==!1,Kn=T.ALLOW_DATA_ATTR!==!1,ce=T.ALLOW_UNKNOWN_PROTOCOLS||!1,Ve=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,vt=T.SAFE_FOR_TEMPLATES||!1,$e=T.SAFE_FOR_XML!==!1,gn=T.WHOLE_DOCUMENT||!1,Wt=T.RETURN_DOM||!1,Wi=T.RETURN_DOM_FRAGMENT||!1,Kl=T.RETURN_TRUSTED_TYPE||!1,dt=T.FORCE_BODY||!1,ds=T.SANITIZE_DOM!==!1,kn=T.SANITIZE_NAMED_PROPS||!1,yn=T.KEEP_CONTENT!==!1,Is=T.IN_PLACE||!1,xt=PM(T.ALLOWED_URI_REGEXP)?T.ALLOWED_URI_REGEXP:Pv,ri=typeof T.NAMESPACE=="string"?T.NAMESPACE:Ln,Ki=Dn(T,"MATHML_TEXT_INTEGRATION_POINTS")&&T.MATHML_TEXT_INTEGRATION_POINTS&&typeof T.MATHML_TEXT_INTEGRATION_POINTS=="object"?fi(T.MATHML_TEXT_INTEGRATION_POINTS):ot({},Ni),Xi=Dn(T,"HTML_INTEGRATION_POINTS")&&T.HTML_INTEGRATION_POINTS&&typeof T.HTML_INTEGRATION_POINTS=="object"?fi(T.HTML_INTEGRATION_POINTS):ot({},ms);const U=Dn(T,"CUSTOM_ELEMENT_HANDLING")&&T.CUSTOM_ELEMENT_HANDLING&&typeof T.CUSTOM_ELEMENT_HANDLING=="object"?fi(T.CUSTOM_ELEMENT_HANDLING):Mo(null);if(xe=Mo(null),Dn(U,"tagNameCheck")&&bl(U.tagNameCheck)&&(xe.tagNameCheck=U.tagNameCheck),Dn(U,"attributeNameCheck")&&bl(U.attributeNameCheck)&&(xe.attributeNameCheck=U.attributeNameCheck),Dn(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(xe.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),Fn(xe),vt&&(Kn=!1),Wi&&(Wt=!0),Xn&&(Ye=ot({},qv),Je=Mo(null),Xn.html===!0&&(ot(Ye,Uv),ot(Je,Vv)),Xn.svg===!0&&(ot(Ye,yg),ot(Je,vg),ot(Je,_h)),Xn.svgFilters===!0&&(ot(Ye,bg),ot(Je,vg),ot(Je,_h)),Xn.mathMl===!0&&(ot(Ye,xg),ot(Je,Gv),ot(Je,_h))),qe.tagCheck=null,qe.attributeCheck=null,Dn(T,"ADD_TAGS")&&(typeof T.ADD_TAGS=="function"?qe.tagCheck=T.ADD_TAGS:Dr(T.ADD_TAGS)&&(Ye===Sn&&(Ye=fi(Ye)),ot(Ye,T.ADD_TAGS,Qe))),Dn(T,"ADD_ATTR")&&(typeof T.ADD_ATTR=="function"?qe.attributeCheck=T.ADD_ATTR:Dr(T.ADD_ATTR)&&(Je===we&&(Je=fi(Je)),ot(Je,T.ADD_ATTR,Qe))),Dn(T,"ADD_URI_SAFE_ATTR")&&Dr(T.ADD_URI_SAFE_ATTR)&&ot(Qn,T.ADD_URI_SAFE_ATTR,Qe),Dn(T,"FORBID_CONTENTS")&&Dr(T.FORBID_CONTENTS)&&(An===Xt&&(An=fi(An)),ot(An,T.FORBID_CONTENTS,Qe)),Dn(T,"ADD_FORBID_CONTENTS")&&Dr(T.ADD_FORBID_CONTENTS)&&(An===Xt&&(An=fi(An)),ot(An,T.ADD_FORBID_CONTENTS,Qe)),yn&&(Ye["#text"]=!0),gn&&ot(Ye,["html","head","body"]),Ye.table&&(ot(Ye,["tbody"]),delete Gt.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ie=L;L=T.TRUSTED_TYPES_POLICY;try{R=le("")}catch(ke){throw L=ie,ke}}else T.TRUSTED_TYPES_POLICY===null?(L=void 0,R=""):(L===void 0&&(L=Ae()),L&&typeof R=="string"&&(R=le("")));Pn&&Pn(T),tn=T},Gs=ot({},[...yg,...bg,...YM]),Ps=ot({},[...xg,...FM]),xl=function(T,U,ie){return U.namespaceURI===Ln?T==="svg":U.namespaceURI===li?T==="svg"&&(ie==="annotation-xml"||Ki[ie]):!!Gs[T]},Di=function(T,U,ie){return U.namespaceURI===Ln?T==="math":U.namespaceURI===Xl?T==="math"&&Xi[ie]:!!Ps[T]},bs=function(T,U,ie){return U.namespaceURI===Xl&&!Xi[ie]||U.namespaceURI===li&&!Ki[ie]?!1:!Ps[T]&&(Vs[T]||!Gs[T])},Qi=function(T){let U=E(T);(!U||!U.tagName)&&(U={namespaceURI:ri,tagName:"template"});const ie=xu(T.tagName),ke=xu(U.tagName);return Bn[T.namespaceURI]?T.namespaceURI===Xl?xl(ie,U,ke):T.namespaceURI===li?Di(ie,U,ke):T.namespaceURI===Ln?bs(ie,U,ke):!!(_n==="application/xhtml+xml"&&Bn[T.namespaceURI]):!1},Cn=function(T){Co(e.removed,{element:T});try{E(T).removeChild(T)}catch{if(w(T),!E(T))throw pa("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},kt=function(T){oi(T);const U=A(T);if(U){const ke=[];_o(U,Oe=>{Co(ke,Oe)}),_o(ke,Oe=>{try{w(Oe)}catch{}})}const ie=B(T);if(ie)for(let ke=ie.length-1;ke>=0;--ke){const Oe=ie[ke],Be=Oe&&Oe.name;if(typeof Be=="string")try{T.removeAttribute(Be)}catch{}}},Zn=function(T,U){try{Co(e.removed,{attribute:U.getAttributeNode(T),from:U})}catch{Co(e.removed,{attribute:null,from:U})}if(U.removeAttribute(T),T==="is")if(Wt||Wi)try{Cn(U)}catch{}else try{U.setAttribute(T,"")}catch{}},Ha=function(T){const U=B(T);if(U)for(let ie=U.length-1;ie>=0;--ie){const ke=U[ie],Oe=ke&&ke.name;if(!(typeof Oe!="string"||Je[Qe(Oe)]))try{T.removeAttribute(Oe)}catch{}}},oi=function(T){const U=[T];for(;U.length>0;){const ie=U.pop();(H?H(ie):ie.nodeType)===Pi.element&&Ha(ie);const Oe=A(ie);if(Oe)for(let Be=Oe.length-1;Be>=0;--Be)U.push(Oe[Be])}},Oi=function(T){if(!$e)return;const U=[T];for(;U.length>0;){const ie=U.pop(),ke=H?H(ie):ie.nodeType;if(ke===Pi.processingInstruction||ke===Pi.comment&&Nn(Fv,ie.data)){try{w(ie)}catch{}continue}if(ke===Pi.element){const Be=ie,St=Qe(z?z(ie):ie.nodeName);try{Be.hasAttribute&&Be.hasAttribute("patchsrc")&&Be.removeAttribute("patchsrc"),Be.hasAttribute&&Be.hasAttribute("for")&&St!=="label"&&St!=="output"&&Be.removeAttribute("for")}catch{}}const Oe=A(ie);if(Oe)for(let Be=Oe.length-1;Be>=0;--Be)U.push(Oe[Be])}},Ql=function(T){let U=null,ie=null;if(dt)T="<remove></remove>"+T;else{const Be=Bv(T,/^[\r\n\t ]+/);ie=Be&&Be[0]}_n==="application/xhtml+xml"&&ri===Ln&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");const ke=L?le(T):T;if(ri===Ln)try{U=new p().parseFromString(ke,_n)}catch{}if(!U||!U.documentElement){U=q.createDocument(ri,"template",null);try{U.documentElement.innerHTML=mi?R:ke}catch{}}const Oe=U.body||U.documentElement;return T&&ie&&Oe.insertBefore(t.createTextNode(ie),Oe.childNodes[0]||null),ri===Ln?Ee.call(U,gn?"html":"body")[0]:gn?U.documentElement:Oe},Zl=function(T){return J.call(T.ownerDocument||T,T,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Zi=function(T){return T=cu(T,F," "),T=cu(T,se," "),T=cu(T,ae," "),T},xs=function(T){var U;T.normalize();const ie=J.call(T.ownerDocument||T,T,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let ke=ie.nextNode();for(;ke;)ke.data=Zi(ke.data),ke=ie.nextNode();const Oe=(U=T.querySelectorAll)===null||U===void 0?void 0:U.call(T,"template");Oe&&_o(Oe,Be=>{gi(Be.content)&&xs(Be.content)})},Ri=function(T){const U=z?z(T):null;return typeof U!="string"||Qe(U)!=="form"?!1:typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||T.attributes!==B(T)||typeof T.removeAttribute!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function"||T.nodeType!==H(T)||T.childNodes!==A(T)},gi=function(T){if(!H||typeof T!="object"||T===null)return!1;try{return H(T)===Pi.documentFragment}catch{return!1}},an=function(T){if(!H||typeof T!="object"||T===null)return!1;try{return typeof H(T)=="number"}catch{return!1}};function zt(oe,T,U){oe.length!==0&&_o(oe,ie=>{ie.call(e,T,U,tn)})}const vl=function(T,U){return!!($e&&T.hasChildNodes()&&!an(T.firstElementChild)&&Nn(Yv,T.textContent)&&Nn(Yv,T.innerHTML)||$e&&T.namespaceURI===Ln&&U==="style"&&an(T.firstElementChild)||T.nodeType===Pi.processingInstruction||$e&&T.nodeType===Pi.comment&&Nn(Fv,T.data))},ji=function(T,U){if(!Gt[U]&&Ys(U)&&(xe.tagNameCheck instanceof RegExp&&Nn(xe.tagNameCheck,U)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(U)))return!1;if(yn&&!An[U]){const ie=E(T),ke=A(T);if(ke&&ie){const Oe=ke.length;for(let Be=Oe-1;Be>=0;--Be){const St=Is?ke[Be]:v(ke[Be],!0);ie.insertBefore(St,C(T))}}}return Cn(T),!0},vs=function(T,U){if(zt(N.beforeSanitizeElements,T,null),T!==U&&E(T)===null)return!0;if(Ri(T))return Cn(T),!0;const ie=Qe(z?z(T):T.nodeName);if(zt(N.uponSanitizeElement,T,{tagName:ie,allowedTags:Ye}),T!==U&&E(T)===null)return!0;if(vl(T,ie))return Cn(T),!0;if(Gt[ie]||!(qe.tagCheck instanceof Function&&qe.tagCheck(ie))&&!Ye[ie]){const Oe=ji(T,ie);return Oe===!1&&zt(N.afterSanitizeElements,T,null),Oe}if((H?H(T):T.nodeType)===Pi.element&&!Qi(T)||(ie==="noscript"||ie==="noembed"||ie==="noframes")&&Nn(nE,T.innerHTML))return Cn(T),!0;if(vt&&T.nodeType===Pi.text){const Oe=Zi(T.textContent);T.textContent!==Oe&&(Co(e.removed,{element:T.cloneNode()}),T.textContent=Oe)}return zt(N.afterSanitizeElements,T,null),!1},Ss=function(T,U,ie){if(wn[U]||$e&&U==="patchsrc"||$e&&U==="for"&&T!=="label"&&T!=="output"||ds&&(U==="id"||U==="name")&&(ie in t||ie in gs))return!1;const ke=Je[U]||qe.attributeCheck instanceof Function&&qe.attributeCheck(U,T);if(!(Kn&&Nn(de,U))){if(!(jn&&Nn(_e,U))){if(ke){if(!Qn[U]){if(!Nn(xt,cu(ie,ft,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&T!=="script"&&zv(ie,"data:")===0&&Us[T])){if(!(ce&&!Nn(Re,cu(ie,ft,"")))){if(ie)return!1}}}}}else if(!(Ys(T)&&(xe.tagNameCheck instanceof RegExp&&Nn(xe.tagNameCheck,T)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(T))&&(xe.attributeNameCheck instanceof RegExp&&Nn(xe.attributeNameCheck,U)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(U,T))||U==="is"&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&Nn(xe.tagNameCheck,ie)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ie))))return!1}}return!0},yi=ot({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ys=function(T){return!yi[xu(T)]&&Nn(ht,T)},Ot=function(T,U,ie,ke){if(L&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!ie)switch(b.getAttributeType(T,U)){case"TrustedHTML":return le(ke);case"TrustedScriptURL":return Me(ke)}return ke},Tn=function(T,U,ie,ke){try{ie?T.setAttributeNS(ie,U,ke):T.setAttribute(U,ke),Ri(T)?Cn(T):Lv(e.removed)}catch{Zn(U,T)}},Jl=function(T){zt(N.beforeSanitizeAttributes,T,null);const U=T.attributes;if(!U||Ri(T))return;const ie={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Je,forceKeepAttr:void 0};let ke=U.length;const Oe=Qe(T.nodeName);for(;ke--;){const Be=U[ke],St=Be.name,Pt=Be.namespaceURI,bn=Be.value,Ht=Qe(St),re=bn;let pe=St==="value"?re:HM(re);if(ie.attrName=Ht,ie.attrValue=pe,ie.keepAttr=!0,ie.forceKeepAttr=void 0,zt(N.uponSanitizeAttribute,T,ie),pe=ie.attrValue,kn&&(Ht==="id"||Ht==="name")&&zv(pe,Ei)!==0&&(Zn(St,T),pe=Ei+pe),$e&&Nn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pe)){Zn(St,T);continue}if(Ht==="attributename"&&Bv(pe,"href")){Zn(St,T);continue}if(!ie.forceKeepAttr){if(!ie.keepAttr){Zn(St,T);continue}if(!Ve&&Nn(iE,pe)){Zn(St,T);continue}if(vt&&(pe=Zi(pe)),!Ss(Oe,Ht,pe)){Zn(St,T);continue}pe=Ot(Oe,Ht,Pt,pe),pe!==re&&Tn(T,St,Pt,pe)}}zt(N.afterSanitizeAttributes,T,null)},Mn=function(T){let U=null;const ie=Zl(T);for(zt(N.beforeSanitizeShadowDOM,T,null);U=ie.nextNode();)if(zt(N.uponSanitizeShadowNode,U,null),vs(U,T),Jl(U),gi(U.content)&&Mn(U.content),(H?H(U):U.nodeType)===Pi.element){const Oe=D(U);gi(Oe)&&(Li(Oe),Mn(Oe))}zt(N.afterSanitizeShadowDOM,T,null)},Li=function(T){const U=[{node:T,shadow:null}];for(;U.length>0;){const ie=U.pop();if(ie.shadow){Mn(ie.shadow);continue}const ke=ie.node,Be=(H?H(ke):ke.nodeType)===Pi.element,St=A(ke);if(St)for(let Pt=St.length-1;Pt>=0;--Pt)U.push({node:St[Pt],shadow:null});if(Be){const Pt=z?z(ke):null;if(typeof Pt=="string"&&Qe(Pt)==="template"){const bn=ke.content;gi(bn)&&U.push({node:bn,shadow:null})}}if(Be){const Pt=D(ke);gi(Pt)&&U.push({node:null,shadow:Pt},{node:Pt,shadow:null})}}};return e.sanitize=function(oe){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,ie=null,ke=null,Oe=null;if(mi=!oe,mi&&(oe="<!-->"),typeof oe!="string"&&!an(oe)&&(oe=GM(oe),typeof oe!="string"))throw pa("dirty is not a string, aborting");if(!e.isSupported)return oe;K?(Ye=ue,Je=Le):ys(T),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(Ye=fi(Ye)),N.uponSanitizeAttribute.length>0&&(Je=fi(Je)),e.removed=[];const Be=Is&&typeof oe!="string"&&an(oe);if(Be){Oi(oe);const Ht=z?z(oe):oe.nodeName;if(typeof Ht=="string"){const re=Qe(Ht);if(!Ye[re]||Gt[re])throw kt(oe),pa("root node is forbidden and cannot be sanitized in-place")}if(Ri(oe))throw kt(oe),pa("root node is clobbered and cannot be sanitized in-place");try{Li(oe)}catch(re){throw kt(oe),re}}else if(an(oe))U=Ql("<!---->"),ie=U.ownerDocument.importNode(oe,!0),ie.nodeType===Pi.element&&ie.nodeName==="BODY"||ie.nodeName==="HTML"?U=ie:U.appendChild(ie),Li(ie);else{if(!Wt&&!vt&&!gn&&oe.indexOf("<")===-1)return L&&Kl?le(oe):oe;if(U=Ql(oe),!U)return Wt?null:Kl?R:""}U&&dt&&Cn(U.firstChild);const St=Be?oe:U,Pt=Zl(St);try{for(;ke=Pt.nextNode();)vs(ke,St),Jl(ke),gi(ke.content)&&Mn(ke.content)}catch(Ht){throw Be&&(kt(oe),_o(e.removed,re=>{re.element&&oi(re.element)})),Ht}if(Be)return _o(e.removed,Ht=>{Ht.element&&oi(Ht.element)}),vt&&xs(oe),oe;if(Wt){if(vt&&xs(U),Wi)for(Oe=W.call(U.ownerDocument);U.firstChild;)Oe.appendChild(U.firstChild);else Oe=U;return(Je.shadowroot||Je.shadowrootmode)&&(Oe=Ne.call(i,Oe,!0)),Oe}let bn=gn?U.outerHTML:U.innerHTML;return gn&&Ye["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&Nn(eE,U.ownerDocument.doctype.name)&&(bn="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
|
|
115
|
-
`+bn),vt&&(bn=Zi(bn)),L&&Kl?le(bn):bn},e.setConfig=function(){let oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ys(oe),K=!0,ue=Ye,Le=Je},e.clearConfig=function(){tn=null,K=!1,ue=null,Le=null,L=te,R=""},e.isValidAttribute=function(oe,T,U){tn||ys({});const ie=Qe(oe),ke=Qe(T);return Ss(ie,ke,U)},e.addHook=function(oe,T){typeof T=="function"&&Dn(N,oe)&&Co(N[oe],T)},e.removeHook=function(oe,T){if(Dn(N,oe)){if(T!==void 0){const U=BM(N[oe],T);return U===-1?void 0:zM(N[oe],U,1)[0]}return Lv(N[oe])}},e.removeHooks=function(oe){Dn(N,oe)&&(N[oe]=[])},e.removeAllHooks=function(){N=$v()},e}var rE=Tk();const aE=1024;let oE=0,os=class{constructor(e,t){this.from=e,this.to=t}};class it{constructor(e={}){this.id=oE++,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=Mi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}it.closedBy=new it({deserialize:n=>n.split(" ")});it.openedBy=new it({deserialize:n=>n.split(" ")});it.group=new it({deserialize:n=>n.split(" ")});it.isolate=new it({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});it.contextHash=new it({perNode:!0});it.lookAhead=new it({perNode:!0});it.mounted=new it({perNode:!0});class Ho{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[it.mounted.id]}}const cE=Object.create(null);class Mi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):cE,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Mi(e.name||"",t,e.id,i);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(l)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[a[0].id]=a[1]}}return l}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(it.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(it.group),a=-1;a<(l?l.length:0);a++){let o=t[a<0?i.name:l[a]];if(o)return o}}}}Mi.none=new Mi("",Object.create(null),0,8);class Mk{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 i of this.types){let l=null;for(let a of e){let o=a(i);if(o){l||(l=Object.assign({},i.props));let u=o[1],f=o[0];f.combine&&f.id in l&&(u=f.combine(l[f.id],u)),l[f.id]=u}}t.push(l?new Mi(i.name,l,i.id,i.flags):i)}return new Mk(t)}}const Ch=new WeakMap,Wv=new WeakMap;var Lt;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Lt||(Lt={}));class dn{constructor(e,t,i,l,a){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,u]of a)this.props[typeof o=="number"?o:o.id]=u}}toString(){let e=Ho.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.toString();l&&(t&&(t+=","),t+=l)}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 fd(this.topNode,e)}cursorAt(e,t=0,i=0){let l=Ch.get(this)||this.topNode,a=new fd(l);return a.moveTo(e,t),Ch.set(this,a._tree),a}get topNode(){return new ii(this,0,0,null)}resolve(e,t=0){let i=Eu(Ch.get(this)||this.topNode,e,t,!1);return Ch.set(this,i),i}resolveInner(e,t=0){let i=Eu(Wv.get(this)||this.topNode,e,t,!0);return Wv.set(this,i),i}resolveStack(e,t=0){return hE(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:a=this.length}=e,o=e.mode||0,u=(o&Lt.IncludeAnonymous)>0;for(let f=this.cursor(o|Lt.IncludeAnonymous);;){let d=!1;if(f.from<=a&&f.to>=l&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.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:py(Mi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new dn(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new dn(Mi.none,t,i,l)))}static build(e){return dE(e)}}dn.empty=new dn(Mi.none,[],[],0);class hy{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 hy(this.buffer,this.index)}}class Hr{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Mi.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],i=this.buffer[e+3],l=this.set.types[t],a=l.name;if(/\W/.test(a)&&!l.isError&&(a=JSON.stringify(a)),e+=4,i==e)return a;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return a+"("+o.join(",")+")"}findChild(e,t,i,l,a){let{buffer:o}=this,u=-1;for(let f=e;f!=t&&!(Ek(a,l,o[f+1],o[f+2])&&(u=f,i>0));f=o[f+3]);return u}slice(e,t,i){let l=this.buffer,a=new Uint16Array(t-e),o=0;for(let u=e,f=0;u<t;){a[f++]=l[u++],a[f++]=l[u++]-i;let d=a[f++]=l[u++]-i;a[f++]=l[u++]-e,o=Math.max(o,d)}return new Hr(a,o,this.set)}}function Ek(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Eu(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof ii&&n.index<0?null:n.parent;if(!o)return n;n=o}let a=i?0:Lt.IgnoreOverlays;if(i)for(let o=n,u=o.parent;u;o=u,u=o.parent)o instanceof ii&&o.index<0&&((l=u.enter(e,t,a))===null||l===void 0?void 0:l.from)!=o.from&&(n=u);for(;;){let o=n.enter(e,t,a);if(!o)return n;n=o}}class Nk{cursor(e=0){return new fd(this,e)}getChild(e,t=null,i=null){let l=Kv(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Kv(this,e,t,i)}resolve(e,t=0){return Eu(this,e,t,!1)}resolveInner(e,t=0){return Eu(this,e,t,!0)}matchContext(e){return u0(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class ii extends Nk{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,l,a=0){for(let o=this;;){for(let{children:u,positions:f}=o._tree,d=t>0?u.length:-1;e!=d;e+=t){let p=u[e],b=f[e]+o.from,x;if(!(!(a&Lt.EnterBracketed&&p instanceof dn&&(x=Ho.get(p))&&!x.overlay&&x.bracketed&&i>=b&&i<=b+p.length)&&!Ek(l,i,b,b+p.length))){if(p instanceof Hr){if(a&Lt.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,t,i-b,l);if(v>-1)return new ul(new uE(o,p,e,b),null,v)}else if(a&Lt.IncludeAnonymous||!p.type.isAnonymous||dy(p)){let v;if(!(a&Lt.IgnoreMounts)&&(v=Ho.get(p))&&!v.overlay)return new ii(v.tree,b,e,o);let w=new ii(p,b,e,o);return a&Lt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?p.children.length-1:0,t,i,l,a)}}}if(a&Lt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&Lt.IgnoreOverlays)&&(l=Ho.get(this._tree))&&l.overlay){let a=e-this.from,o=i&Lt.EnterBracketed&&l.bracketed;for(let{from:u,to:f}of l.overlay)if((t>0||o?u<=a:u<a)&&(t<0||o?f>=a:f>a))return new ii(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Kv(n,e,t,i){let l=n.cursor(),a=[];if(!l.firstChild())return a;if(t!=null){for(let o=!1;!o;)if(o=l.type.is(t),!l.nextSibling())return a}for(;;){if(i!=null&&l.type.is(i))return a;if(l.type.is(e)&&a.push(l.node),!l.nextSibling())return i==null?a:[]}}function u0(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class uE{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class ul extends Nk{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,a=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return a<0?null:new ul(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&Lt.ExcludeBuffers)return null;let{buffer:l}=this.context,a=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return a<0?null:new ul(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ul(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 ul(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,a=i.buffer[this.index+3];if(a>l){let o=i.buffer[this.index+1];e.push(i.slice(l,a,o)),t.push(0)}return new dn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Dk(n){if(!n.length)return null;let e=0,t=n[0];for(let a=1;a<n.length;a++){let o=n[a];(o.from>t.from||o.to<t.to)&&(t=o,e=a)}let i=t instanceof ii&&t.index<0?null:t.parent,l=n.slice();return i?l[e]=i:l.splice(e,1),new fE(l,t)}class fE{constructor(e,t){this.heads=e,this.node=t}get next(){return Dk(this.heads)}}function hE(n,e,t){let i=n.resolveInner(e,t),l=null;for(let a=i instanceof ii?i:i.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(l||(l=[i])).push(o.resolve(e,t)),a=o}else{let o=Ho.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let u=new ii(o.tree,o.overlay[0].from+a.from,-1,a);(l||(l=[i])).push(Eu(u,e,t,!1))}}return l?Dk(l):i}class fd{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&~Lt.EnterBracketed,e instanceof ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof ii?(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,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,a=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}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,i=this.mode){return this.buffer?i&Lt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Lt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Lt.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,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(l.buffer.buffer[a+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let a=t+e,o=e<0?-1:i._tree.children.length;a!=o;a+=e){let u=i._tree.children[a];if(this.mode&Lt.IncludeAnonymous||u instanceof Hr||!u.type.isAnonymous||dy(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,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,a=this.stack.length;a>=0;){for(let o=e;o;o=o._parent)if(o.index==l){if(l==this.index)return o;t=o,i=a+1;break e}l=this.stack[--a]}for(let l=i;l<this.stack.length;l++)t=new ul(this.buffer,t,this.stack[l]);return this.bufferNode=new ul(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;;){if(l&&t&&t(this),l=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return u0(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,a=this.stack.length-1;l>=0;a--){if(a<0)return u0(this._tree,e,l);let o=i[t.buffer[this.stack[a]]];if(!o.isAnonymous){if(e[l]&&e[l]!=o.name)return!1;l--}}return!0}}function dy(n){return n.children.some(e=>e instanceof Hr||!e.type.isAnonymous||dy(e))}function dE(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=aE,reused:a=[],minRepeatType:o=i.types.length}=n,u=Array.isArray(t)?new hy(t,t.length):t,f=i.types,d=0,p=0;function b(z,L,R,te,fe,Te){let{id:he,start:le,end:Me,size:Ae}=u,Se=p,q=d;if(Ae<0)if(u.next(),Ae==-1){let N=a[he];R.push(N),te.push(le-z);return}else if(Ae==-3){d=he;return}else if(Ae==-4){p=he;return}else throw new RangeError(`Unrecognized record size: ${Ae}`);let J=f[he],W,Ee,Ne=le-z;if(Me-le<=l&&(Ee=A(u.pos-L,fe))){let N=new Uint16Array(Ee.size-Ee.skip),F=u.pos-Ee.size,se=N.length;for(;u.pos>F;)se=E(Ee.start,N,se);W=new Hr(N,Me-Ee.start,i),Ne=Ee.start-z}else{let N=u.pos-Ae;u.next();let F=[],se=[],ae=he>=o?he:-1,de=0,_e=Me;for(;u.pos>N;)ae>=0&&u.id==ae&&u.size>=0?(u.end<=_e-l&&(w(F,se,le,de,u.end,_e,ae,Se,q),de=F.length,_e=u.end),u.next()):Te>2500?x(le,N,F,se):b(le,N,F,se,ae,Te+1);if(ae>=0&&de>0&&de<F.length&&w(F,se,le,de,le,_e,ae,Se,q),F.reverse(),se.reverse(),ae>-1&&de>0){let Re=v(J,q);W=py(J,F,se,0,F.length,0,Me-le,Re,Re)}else W=C(J,F,se,Me-le,Se-Me,q)}R.push(W),te.push(Ne)}function x(z,L,R,te){let fe=[],Te=0,he=-1;for(;u.pos>L;){let{id:le,start:Me,end:Ae,size:Se}=u;if(Se>4)u.next();else{if(he>-1&&Me<he)break;he<0&&(he=Ae-l),fe.push(le,Me,Ae),Te++,u.next()}}if(Te){let le=new Uint16Array(Te*4),Me=fe[fe.length-2];for(let Ae=fe.length-3,Se=0;Ae>=0;Ae-=3)le[Se++]=fe[Ae],le[Se++]=fe[Ae+1]-Me,le[Se++]=fe[Ae+2]-Me,le[Se++]=Se;R.push(new Hr(le,fe[2]-Me,i)),te.push(Me-z)}}function v(z,L){return(R,te,fe)=>{let Te=0,he=R.length-1,le,Me;if(he>=0&&(le=R[he])instanceof dn){if(!he&&le.type==z&&le.length==fe)return le;(Me=le.prop(it.lookAhead))&&(Te=te[he]+le.length+Me)}return C(z,R,te,fe,Te,L)}}function w(z,L,R,te,fe,Te,he,le,Me){let Ae=[],Se=[];for(;z.length>te;)Ae.push(z.pop()),Se.push(L.pop()+R-fe);z.push(C(i.types[he],Ae,Se,Te-fe,le-Te,Me)),L.push(fe-R)}function C(z,L,R,te,fe,Te,he){if(Te){let le=[it.contextHash,Te];he=he?[le].concat(he):[le]}if(fe>25){let le=[it.lookAhead,fe];he=he?[le].concat(he):[le]}return new dn(z,L,R,te,he)}function A(z,L){let R=u.fork(),te=0,fe=0,Te=0,he=R.end-l,le={size:0,start:0,skip:0};e:for(let Me=R.pos-z;R.pos>Me;){let Ae=R.size;if(R.id==L&&Ae>=0){le.size=te,le.start=fe,le.skip=Te,Te+=4,te+=4,R.next();continue}let Se=R.pos-Ae;if(Ae<0||Se<Me||R.start<he)break;let q=R.id>=o?4:0,J=R.start;for(R.next();R.pos>Se;){if(R.size<0)if(R.size==-3||R.size==-4)q+=4;else break e;else R.id>=o&&(q+=4);R.next()}fe=J,te+=Ae,Te+=q}return(L<0||te==z)&&(le.size=te,le.start=fe,le.skip=Te),le.size>4?le:void 0}function E(z,L,R){let{id:te,start:fe,end:Te,size:he}=u;if(u.next(),he>=0&&te<o){let le=R;if(he>4){let Me=u.pos-(he-4);for(;u.pos>Me;)R=E(z,L,R)}L[--R]=le,L[--R]=Te-z,L[--R]=fe-z,L[--R]=te}else he==-3?d=te:he==-4&&(p=te);return R}let D=[],B=[];for(;u.pos>0;)b(n.start||0,n.bufferStart||0,D,B,-1,0);let H=(e=n.length)!==null&&e!==void 0?e:D.length?B[0]+D[0].length:0;return new dn(f[n.topID],D.reverse(),B.reverse(),H)}const Xv=new WeakMap;function ed(n,e){if(!n.isAnonymous||e instanceof Hr||e.type!=n)return 1;let t=Xv.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof dn)){t=1;break}t+=ed(n,i)}Xv.set(e,t)}return t}function py(n,e,t,i,l,a,o,u,f){let d=0;for(let w=i;w<l;w++)d+=ed(n,e[w]);let p=Math.ceil(d*1.5/8),b=[],x=[];function v(w,C,A,E,D){for(let B=A;B<E;){let H=B,z=C[B],L=ed(n,w[B]);for(B++;B<E;B++){let R=ed(n,w[B]);if(L+R>=p)break;L+=R}if(B==H+1){if(L>p){let R=w[H];v(R.children,R.positions,0,R.children.length,C[H]+D);continue}b.push(w[H])}else{let R=C[B-1]+w[B-1].length-z;b.push(py(n,w,C,H,B,z,R,null,f))}x.push(z+D-a)}}return v(e,t,i,l,0),(u||f)(b,x,o)}class Tz{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let l=this.map.get(e);l||this.map.set(e,l=new Map),l.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof ul?this.setBuffer(e.context.buffer,e.index,t):e instanceof ii&&this.map.set(e.tree,t)}get(e){return e instanceof ul?this.getBuffer(e.context.buffer,e.index):e instanceof ii?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Vl{constructor(e,t,i,l,a=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new Vl(0,e.length,e,0,!1,i)];for(let a of t)a.to>e.length&&l.push(a);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],a=1,o=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let p=u<t.length?t[u]:null,b=p?p.fromA:1e9;if(b-f>=i)for(;o&&o.from<b;){let x=o;if(f>=x.from||b<=x.to||d){let v=Math.max(x.from,f)-d,w=Math.min(x.to,b)-d;x=v>=w?null:new Vl(v,w,x.tree,x.offset+d,u>0,!!p)}if(x&&l.push(x),o.to>b)break;o=a<e.length?e[a++]:null}if(!p)break;f=p.toA,d=p.toA-p.toB}return l}}class pE{startParse(e,t,i){return typeof e=="string"&&(e=new mE(e)),i=i?i.length?i.map(l=>new os(l.from,l.to)):[new os(0,0)]:[new os(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let a=l.advance();if(a)return a}}}class mE{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Mz(n){return(e,t,i,l)=>new yE(e,n,t,i,l)}class Qv{constructor(e,t,i,l,a,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=l,this.target=a,this.from=o}}function Zv(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class gE{constructor(e,t,i,l,a,o,u,f){this.parser=e,this.predicate=t,this.mounts=i,this.index=l,this.start=a,this.bracketed=o,this.target=u,this.prev=f,this.depth=0,this.ranges=[]}}const f0=new it({perNode:!0});class yE{constructor(e,t,i,l,a){this.nest=t,this.input=i,this.fragments=l,this.ranges=a,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let l of this.inner)l.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new dn(i.type,i.children,i.positions,i.length,i.propValues.concat([[f0,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[it.mounted.id]=new Ho(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new vE(this.fragments),t=null,i=null,l=new fd(new ii(this.baseTree,this.ranges[0].from,0,null),Lt.IncludeAnonymous|Lt.IgnoreMounts);e:for(let a,o;;){let u=!0,f;if(this.stoppedAt!=null&&l.from>=this.stoppedAt)u=!1;else if(e.hasNode(l)){if(t){let d=t.mounts.find(p=>p.frag.from<=l.from&&p.frag.to>=l.to&&p.mount.overlay);if(d)for(let p of d.mount.overlay){let b=p.from+d.pos,x=p.to+d.pos;b>=l.from&&x<=l.to&&!t.ranges.some(v=>v.from<x&&v.to>b)&&t.ranges.push({from:b,to:x})}}u=!1}else if(i&&(o=bE(i.ranges,l.from,l.to)))u=o!=2;else if(!l.type.isAnonymous&&(a=this.nest(l,this.input))&&(l.from<l.to||!a.overlay)){l.tree||(xE(l),t&&t.depth++,i&&i.depth++);let d=e.findMounts(l.from,a.parser);if(typeof a.overlay=="function")t=new gE(a.parser,a.overlay,d,this.inner.length,l.from,!!a.bracketed,l.tree,t);else{let p=tS(this.ranges,a.overlay||(l.from<l.to?[new os(l.from,l.to)]:[]));p.length&&Zv(p),(p.length||!a.overlay)&&this.inner.push(new Qv(a.parser,p.length?a.parser.startParse(this.input,nS(d,p),p):a.parser.startParse(""),a.overlay?a.overlay.map(b=>new os(b.from-l.from,b.to-l.from)):null,!!a.bracketed,l.tree,p.length?p[0].from:l.from)),a.overlay?p.length&&(i={ranges:p,depth:0,prev:i}):u=!1}}else if(t&&(f=t.predicate(l))&&(f===!0&&(f=new os(l.from,l.to)),f.from<f.to)){let d=t.ranges.length-1;d>=0&&t.ranges[d].to==f.from?t.ranges[d]={from:t.ranges[d].from,to:f.to}:t.ranges.push(f)}if(u&&l.firstChild())t&&t.depth++,i&&i.depth++;else for(;!l.nextSibling();){if(!l.parent())break e;if(t&&!--t.depth){let d=tS(this.ranges,t.ranges);d.length&&(Zv(d),this.inner.splice(t.index,0,new Qv(t.parser,t.parser.startParse(this.input,nS(t.mounts,d),d),t.ranges.map(p=>new os(p.from-t.start,p.to-t.start)),t.bracketed,t.target,d[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function bE(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Jv(n,e,t,i,l,a){if(e<t){let o=n.buffer[e+1];i.push(n.slice(e,t,o)),l.push(o-a)}}function xE(n){let{node:e}=n,t=[],i=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let l=n.tree,a=l.children.indexOf(i),o=l.children[a],u=o.buffer,f=[a];function d(p,b,x,v,w,C){let A=t[C],E=[],D=[];Jv(o,p,A,E,D,v);let B=u[A+1],H=u[A+2];f.push(E.length);let z=C?d(A+4,u[A+3],o.set.types[u[A]],B,H-B,C-1):e.toTree();return E.push(z),D.push(B-v),Jv(o,u[A+3],b,E,D,v),new dn(x,E,D,w)}l.children[a]=d(0,u.length,Mi.none,0,o.length,t.length-1);for(let p of f){let b=n.tree.children[p],x=n.tree.positions[p];n.yield(new ii(b,x+n.from,p,n._tree))}}class eS{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Lt.IncludeAnonymous|Lt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)if(!(t.to>=e&&t.enter(i,1,Lt.IgnoreOverlays|Lt.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof dn)t=t.children[0];else break}return!1}}class vE{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(f0))!==null&&t!==void 0?t:i.to,this.inner=new eS(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(f0))!==null&&e!==void 0?e:t.to,this.inner=new eS(t.tree,-t.offset)}}findMounts(e,t){var i;let l=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let a=this.inner.cursor.node;a;a=a.parent){let o=(i=a.tree)===null||i===void 0?void 0:i.prop(it.mounted);if(o&&o.parser==t)for(let u=this.fragI;u<this.fragments.length;u++){let f=this.fragments[u];if(f.from>=a.to)break;f.tree==this.curFrag.tree&&l.push({frag:f,pos:a.from-f.offset,mount:o})}}}return l}}function tS(n,e){let t=null,i=e;for(let l=1,a=0;l<n.length;l++){let o=n[l-1].to,u=n[l].from;for(;a<i.length;a++){let f=i[a];if(f.from>=u)break;f.to<=o||(t||(i=t=e.slice()),f.from<o?(t[a]=new os(f.from,o),f.to>u&&t.splice(a+1,0,new os(u,f.to))):f.to>u?t[a--]=new os(u,f.to):t.splice(a--,1))}}return i}function SE(n,e,t,i){let l=0,a=0,o=!1,u=!1,f=-1e9,d=[];for(;;){let p=l==n.length?1e9:o?n[l].to:n[l].from,b=a==e.length?1e9:u?e[a].to:e[a].from;if(o!=u){let x=Math.max(f,t),v=Math.min(p,b,i);x<v&&d.push(new os(x,v))}if(f=Math.min(p,b),f==1e9)break;p==f&&(o?(o=!1,l++):o=!0),b==f&&(u?(u=!1,a++):u=!0)}return d}function nS(n,e){let t=[];for(let{pos:i,mount:l,frag:a}of n){let o=i+(l.overlay?l.overlay[0].from:0),u=o+l.tree.length,f=Math.max(a.from,o),d=Math.min(a.to,u);if(l.overlay){let p=l.overlay.map(x=>new os(x.from+i,x.to+i)),b=SE(e,p,f,d);for(let x=0,v=f;;x++){let w=x==b.length,C=w?d:b[x].from;if(C>v&&t.push(new Vl(v,C,l.tree,-o,a.from>=v||a.openStart,a.to<=C||a.openEnd)),w)break;v=b[x].to}}else t.push(new Vl(f,d,l.tree,-o,a.from>=o||a.openStart,a.to<=u||a.openEnd))}return t}let wE=0;class as{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=wE++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof as&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new as(i,[],null,[]);if(l.set.push(l),t)for(let a of t.set)l.set.push(a);return l}static defineModifier(e){let t=new hd(e);return i=>i.modified.indexOf(t)>-1?i:hd.get(i.base||i,i.modified.concat(t).sort((l,a)=>l.id-a.id))}}let kE=0;class hd{constructor(e){this.name=e,this.instances=[],this.id=kE++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&AE(t,u.modified));if(i)return i;let l=[],a=new as(e.name,l,e,t);for(let u of t)u.instances.push(a);let o=_E(t);for(let u of e.set)if(!u.modified.length)for(let f of o)l.push(hd.get(u,f));return a}}function AE(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function _E(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function CE(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let a=[],o=2,u=l;for(let b=0;;){if(u=="..."&&b>0&&b+3==l.length){o=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!x)throw new RangeError("Invalid path: "+l);if(a.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),b+=x[0].length,b==l.length)break;let v=l[b++];if(b==l.length&&v=="!"){o=0;break}if(v!="/")throw new RangeError("Invalid path: "+l);u=l.slice(b)}let f=a.length-1,d=a[f];if(!d)throw new RangeError("Invalid path: "+l);let p=new Nu(i,o,f>0?a.slice(0,f):null);e[d]=p.sort(e[d])}}return Ok.add(e)}const Ok=new it({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth>=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let a=new Nu(l.tags,l.mode,l.context);t?t.next=a:i=a,t=a}return i}});class Nu{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}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}}Nu.empty=new Nu([],2,null);function my(n,e){let t=Object.create(null);for(let a of n)if(!Array.isArray(a.tag))t[a.tag.id]=a.class;else for(let o of a.tag)t[o.id]=a.class;let{scope:i,all:l=null}=e||{};return{style:a=>{let o=l;for(let u of a)for(let f of u.set){let d=t[f.id];if(d){o=o?o+" "+d:d;break}}return o},scope:i}}function TE(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function Rk(n,e,t,i=0,l=n.length){let a=new EE(i,Array.isArray(e)?e:[e],t);a.highlightRange(n.cursor(),i,l,"",a.highlighters),a.flush(l)}function ME(n,e,t,i,l,a=0,o=n.length){let u=a;function f(d,p){if(!(d<=u)){for(let b=n.slice(u,d),x=0;;){let v=b.indexOf(`
|
|
116
|
-
`,x),w=v<0?b.length:v;if(w>x&&i(b.slice(x,w),p),v<0)break;l(),x=v+1}u=d}}Rk(e,t,(d,p,b)=>{f(d,""),f(p,b)},a,o),f(o,"")}class EE{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,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,i,l,a){let{type:o,from:u,to:f}=e;if(u>=i||f<=t)return;o.isTop&&(a=this.highlighters.filter(v=>!v.scope||v.scope(o)));let d=l,p=NE(e)||Nu.empty,b=TE(a,p.tags);if(b&&(d&&(d+=" "),d+=b,p.mode==1&&(l+=(l?" ":"")+b)),this.startSpan(Math.max(t,u),d),p.opaque)return;let x=e.tree&&e.tree.prop(it.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+u,1),w=this.highlighters.filter(A=>!A.scope||A.scope(x.tree.type)),C=e.firstChild();for(let A=0,E=u;;A++){let D=A<x.overlay.length?x.overlay[A]:null,B=D?D.from+u:f,H=Math.max(t,E),z=Math.min(i,B);if(H<z&&C)for(;e.from<z&&(this.highlightRange(e,H,z,l,a),this.startSpan(Math.min(z,e.to),d),!(e.to>=B||!e.nextSibling())););if(!D||B>i)break;E=D.to+u,E>t&&(this.highlightRange(v.cursor(),Math.max(t,D.from+u),Math.min(i,E),"",w),this.startSpan(Math.min(i,E),d))}C&&e.parent()}else if(e.firstChild()){x&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,a),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function NE(n){let e=n.type.prop(Ok);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const me=as.define,Th=me(),Er=me(),iS=me(Er),sS=me(Er),Nr=me(),Mh=me(Nr),Sg=me(Nr),sl=me(),ma=me(sl),Js=me(),el=me(),h0=me(),fu=me(h0),Eh=me(),Y={comment:Th,lineComment:me(Th),blockComment:me(Th),docComment:me(Th),name:Er,variableName:me(Er),typeName:iS,tagName:me(iS),propertyName:sS,attributeName:me(sS),className:me(Er),labelName:me(Er),namespace:me(Er),macroName:me(Er),literal:Nr,string:Mh,docString:me(Mh),character:me(Mh),attributeValue:me(Mh),number:Sg,integer:me(Sg),float:me(Sg),bool:me(Nr),regexp:me(Nr),escape:me(Nr),color:me(Nr),url:me(Nr),keyword:Js,self:me(Js),null:me(Js),atom:me(Js),unit:me(Js),modifier:me(Js),operatorKeyword:me(Js),controlKeyword:me(Js),definitionKeyword:me(Js),moduleKeyword:me(Js),operator:el,derefOperator:me(el),arithmeticOperator:me(el),logicOperator:me(el),bitwiseOperator:me(el),compareOperator:me(el),updateOperator:me(el),definitionOperator:me(el),typeOperator:me(el),controlOperator:me(el),punctuation:h0,separator:me(h0),bracket:fu,angleBracket:me(fu),squareBracket:me(fu),paren:me(fu),brace:me(fu),content:sl,heading:ma,heading1:me(ma),heading2:me(ma),heading3:me(ma),heading4:me(ma),heading5:me(ma),heading6:me(ma),contentSeparator:me(sl),list:me(sl),quote:me(sl),emphasis:me(sl),strong:me(sl),link:me(sl),monospace:me(sl),strikethrough:me(sl),inserted:me(),deleted:me(),changed:me(),invalid:me(),meta:Eh,documentMeta:me(Eh),annotation:me(Eh),processingInstruction:me(Eh),definition:as.defineModifier("definition"),constant:as.defineModifier("constant"),function:as.defineModifier("function"),standard:as.defineModifier("standard"),local:as.defineModifier("local"),special:as.defineModifier("special")};for(let n in Y){let e=Y[n];e instanceof as&&(e.name=n)}my([{tag:Y.link,class:"tok-link"},{tag:Y.heading,class:"tok-heading"},{tag:Y.emphasis,class:"tok-emphasis"},{tag:Y.strong,class:"tok-strong"},{tag:Y.keyword,class:"tok-keyword"},{tag:Y.atom,class:"tok-atom"},{tag:Y.bool,class:"tok-bool"},{tag:Y.url,class:"tok-url"},{tag:Y.labelName,class:"tok-labelName"},{tag:Y.inserted,class:"tok-inserted"},{tag:Y.deleted,class:"tok-deleted"},{tag:Y.literal,class:"tok-literal"},{tag:Y.string,class:"tok-string"},{tag:Y.number,class:"tok-number"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],class:"tok-string2"},{tag:Y.variableName,class:"tok-variableName"},{tag:Y.local(Y.variableName),class:"tok-variableName tok-local"},{tag:Y.definition(Y.variableName),class:"tok-variableName tok-definition"},{tag:Y.special(Y.variableName),class:"tok-variableName2"},{tag:Y.definition(Y.propertyName),class:"tok-propertyName tok-definition"},{tag:Y.typeName,class:"tok-typeName"},{tag:Y.namespace,class:"tok-namespace"},{tag:Y.className,class:"tok-className"},{tag:Y.macroName,class:"tok-macroName"},{tag:Y.propertyName,class:"tok-propertyName"},{tag:Y.operator,class:"tok-operator"},{tag:Y.comment,class:"tok-comment"},{tag:Y.meta,class:"tok-meta"},{tag:Y.invalid,class:"tok-invalid"},{tag:Y.punctuation,class:"tok-punctuation"}]);const DE="modulepreload",OE=function(n,e){return new URL(n,e).href},lS={},at=function(e,t,i){let l=Promise.resolve();if(t&&t.length>0){let o=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const u=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=o(t.map(p=>{if(p=OE(p,i),p in lS)return;lS[p]=!0;const b=p.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let C=u.length-1;C>=0;C--){const A=u[C];if(A.href===p&&(!b||A.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":DE,b||(w.as="script"),w.crossOrigin="",w.href=p,d&&w.setAttribute("nonce",d),document.head.appendChild(w),b)return new Promise((C,A)=>{w.addEventListener("load",C),w.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return l.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};let d0=[],jk=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?jk:d0).push(t=t+n[e])})();function RE(n){if(n<768)return!1;for(let e=0,t=d0.length;;){let i=e+t>>1;if(n<d0[i])t=i;else if(n>=jk[i])e=i+1;else return!0;if(e==t)return!1}}function rS(n){return n>=127462&&n<=127487}const aS=8205;function jE(n,e,t=!0,i=!0){return(t?Lk:LE)(n,e,i)}function Lk(n,e,t){if(e==n.length)return e;e&&Bk(n.charCodeAt(e))&&zk(n.charCodeAt(e-1))&&e--;let i=wg(n,e);for(e+=oS(i);e<n.length;){let l=wg(n,e);if(i==aS||l==aS||t&&RE(l))e+=oS(l),i=l;else if(rS(l)){let a=0,o=e-2;for(;o>=0&&rS(wg(n,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function LE(n,e,t){for(;e>1;){let i=Lk(n,e-2,t);if(i<e)return i;e--}return 0}function wg(n,e){let t=n.charCodeAt(e);if(!zk(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Bk(i)?(t-55296<<10)+(i-56320)+65536:t}function Bk(n){return n>=56320&&n<57344}function zk(n){return n>=55296&&n<56320}function oS(n){return n<65536?1:2}class ct{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,i){[e,t]=tc(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),al.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=tc(this,e,t);let i=[];return this.decompose(e,t,i,0),al.from(i,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),i=this.length-this.scanIdentical(e,-1),l=new ku(this),a=new ku(e);for(let o=t,u=t;;){if(l.next(o),a.next(o),o=0,l.lineBreak!=a.lineBreak||l.done!=a.done||l.value!=a.value)return!1;if(u+=l.value.length,l.done||u>=i)return!0}}iter(e=1){return new ku(this,e)}iterRange(e,t=this.length){return new Hk(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ik(i)}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]?ct.empty:e.length<=32?new ln(e):al.from(ln.split(e,[]))}}class ln extends ct{constructor(e,t=BE(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let a=0;;a++){let o=this.text[a],u=l+o.length;if((t?i:u)>=e)return new zE(l,u,i,o);l=u+1,i++}}decompose(e,t,i,l){let a=e<=0&&t>=this.length?this:new ln(cS(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let o=i.pop(),u=td(a.text,o.text.slice(),0,a.length);if(u.length<=32)i.push(new ln(u,o.length+a.length));else{let f=u.length>>1;i.push(new ln(u.slice(0,f)),new ln(u.slice(f)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof ln))return super.replace(e,t,i);[e,t]=tc(this,e,t);let l=td(this.text,td(i.text,cS(this.text,0,e)),t),a=this.length+i.length-(t-e);return l.length<=32?new ln(l,a):al.from(ln.split(l,[]),a)}sliceString(e,t=this.length,i=`
|
|
117
|
-
`){[e,t]=tc(this,e,t);let l="";for(let a=0,o=0;a<=t&&o<this.text.length;o++){let u=this.text[o],f=a+u.length;a>e&&o&&(l+=i),e<f&&t>a&&(l+=u.slice(Math.max(0,e-a),t-a)),a=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let a of e)i.push(a),l+=a.length+1,i.length==32&&(t.push(new ln(i,l)),i=[],l=-1);return l>-1&&t.push(new ln(i,l)),t}}class al extends ct{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let a=0;;a++){let o=this.children[a],u=l+o.length,f=i+o.lines-1;if((t?f:u)>=e)return o.lineInner(e,t,i,l);l=u+1,i=f+1}}decompose(e,t,i,l){for(let a=0,o=0;o<=t&&a<this.children.length;a++){let u=this.children[a],f=o+u.length;if(e<=f&&t>=o){let d=l&((o<=e?1:0)|(f>=t?2:0));o>=e&&f<=t&&!d?i.push(u):u.decompose(e-o,t-o,i,d)}o=f+1}}replace(e,t,i){if([e,t]=tc(this,e,t),i.lines<this.lines)for(let l=0,a=0;l<this.children.length;l++){let o=this.children[l],u=a+o.length;if(e>=a&&t<=u){let f=o.replace(e-a,t-a,i),d=this.lines-o.lines+f.lines;if(f.lines<d>>4&&f.lines>d>>6){let p=this.children.slice();return p[l]=f,new al(p,this.length-(t-e)+i.length)}return super.replace(a,u,f)}a=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
118
|
-
`){[e,t]=tc(this,e,t);let l="";for(let a=0,o=0;a<this.children.length&&o<=t;a++){let u=this.children[a],f=o+u.length;o>e&&a&&(l+=i),e<f&&t>o&&(l+=u.sliceString(e-o,t-o,i)),o=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof al))return 0;let i=0,[l,a,o,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,a+=t){if(l==o||a==u)return i;let f=this.children[l],d=e.children[a];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let w of e)w.flatten(v);return new ln(v,t)}let l=Math.max(32,i>>5),a=l<<1,o=l>>1,u=[],f=0,d=-1,p=[];function b(v){let w;if(v.lines>a&&v instanceof al)for(let C of v.children)b(C);else v.lines>o&&(f>o||!f)?(x(),u.push(v)):v instanceof ln&&f&&(w=p[p.length-1])instanceof ln&&v.lines+w.lines<=32?(f+=v.lines,d+=v.length+1,p[p.length-1]=new ln(w.text.concat(v.text),w.length+1+v.length)):(f+v.lines>l&&x(),f+=v.lines,d+=v.length+1,p.push(v))}function x(){f!=0&&(u.push(p.length==1?p[0]:al.from(p,d)),d=-1,f=p.length=0)}for(let v of e)b(v);return x(),u.length==1?u[0]:new al(u,t)}}ct.empty=new ln([""],0);function BE(n){let e=-1;for(let t of n)e+=t.length+1;return e}function td(n,e,t=0,i=1e9){for(let l=0,a=0,o=!0;a<n.length&&l<=i;a++){let u=n[a],f=l+u.length;f>=t&&(f>i&&(u=u.slice(0,i-l)),l<t&&(u=u.slice(t-l)),o?(e[e.length-1]+=u,o=!1):e.push(u)),l=f+1}return e}function cS(n,e,t){return td(n,[""],e,t)}class ku{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 ln?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],a=this.offsets[i],o=a>>1,u=l instanceof ln?l.text.length:l.children.length;if(o==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
119
|
-
`,this;e--}else if(l instanceof ln){let f=l.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[o+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof ln?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Hk{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ku(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),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 Ik{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ct.prototype[Symbol.iterator]=function(){return this.iter()},ku.prototype[Symbol.iterator]=Hk.prototype[Symbol.iterator]=Ik.prototype[Symbol.iterator]=function(){return this});class zE{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function tc(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Rn(n,e,t=!0,i=!0){return jE(n,e,t,i)}function HE(n){return n>=56320&&n<57344}function IE(n){return n>=55296&&n<56320}function ki(n,e){let t=n.charCodeAt(e);if(!IE(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return HE(i)?(t-55296<<10)+(i-56320)+65536:t}function gy(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ol(n){return n<65536?1:2}const p0=/\r\n?|\n/;var Gn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Gn||(Gn={}));class pl{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let a=this.sections[t++],o=this.sections[t++];o<0?(e(i,l,a),l+=a):l+=o,i+=a}}iterChangedRanges(e,t=!1){m0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new pl(e)}composeDesc(e){return this.empty?e:e.empty?this:Uk(this,e)}mapDesc(e,t=!1){return e.empty?this:g0(this,e,t)}mapPos(e,t=-1,i=Gn.Simple){let l=0,a=0;for(let o=0;o<this.sections.length;){let u=this.sections[o++],f=this.sections[o++],d=l+u;if(f<0){if(d>e)return a+(e-l);a+=u}else{if(i!=Gn.Simple&&d>=e&&(i==Gn.TrackDel&&l<e&&d>e||i==Gn.TrackBefore&&l<e||i==Gn.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!u)return e==l||t<0?a:a+f;a+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return a}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let a=this.sections[i++],o=this.sections[i++],u=l+a;if(o>=0&&l<=t&&u>=e)return l<e&&u>t?"cover":!0;l=u}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}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 pl(e)}static create(e){return new pl(e)}}class vn extends pl{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 m0(this,(t,i,l,a,o)=>e=e.replace(l,l+(i-t),o),!1),e}mapDesc(e,t=!1){return g0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,a=0;l<t.length;l+=2){let o=t[l],u=t[l+1];if(u>=0){t[l]=u,t[l+1]=o;let f=l>>1;for(;i.length<f;)i.push(ct.empty);i.push(o?e.slice(a,a+o):ct.empty)}a+=o}return new vn(t,i)}compose(e){return this.empty?e:e.empty?this:Uk(this,e,!0)}map(e,t=!1){return e.empty?this:g0(this,e,t,!0)}iterChanges(e,t=!1){m0(this,e,t)}get desc(){return pl.create(this.sections)}filter(e){let t=[],i=[],l=[],a=new Du(this);e:for(let o=0,u=0;;){let f=o==e.length?1e9:e[o++];for(;u<f||u==f&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,f-u);ti(l,p,-1);let b=a.ins==-1?-1:a.off==0?a.ins:0;ti(t,p,b),b>0&&Br(i,t,a.text),a.forward(p),u+=p}let d=e[o++];for(;u<d;){if(a.done)break e;let p=Math.min(a.len,d-u);ti(t,p,-1),ti(l,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),u+=p}}return{changes:new vn(t,i),filtered:pl.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],a=[],o=0,u=null;function f(p=!1){if(!p&&!l.length)return;o<t&&ti(l,t-o,-1);let b=new vn(l,a);u=u?u.compose(b.map(u)):b,l=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let b of p)d(b);else if(p instanceof vn){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);f(),u=u?u.compose(p.map(u)):p}else{let{from:b,to:x=b,insert:v}=p;if(b>x||b<0||x>t)throw new RangeError(`Invalid change range ${b} to ${x} (in doc of length ${t})`);let w=v?typeof v=="string"?ct.of(v.split(i||p0)):v:ct.empty,C=w.length;if(b==x&&C==0)return;b<o&&f(),b>o&&ti(l,b-o,-1),ti(l,x-b,C),Br(a,l,w),o=x}}return d(e),f(!u),u}static empty(e){return new vn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let a=e[l];if(typeof a=="number")t.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,u)=>u&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)t.push(a[0],0);else{for(;i.length<l;)i.push(ct.empty);i[l]=ct.of(a.slice(1)),t.push(a[0],i[l].length)}}}return new vn(t,i)}static createSet(e,t){return new vn(e,t)}}function ti(n,e,t,i=!1){if(e==0&&t<=0)return;let l=n.length-2;l>=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function Br(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(ct.empty);n.push(t)}}function m0(n,e,t){let i=n.inserted;for(let l=0,a=0,o=0;o<n.sections.length;){let u=n.sections[o++],f=n.sections[o++];if(f<0)l+=u,a+=u;else{let d=l,p=a,b=ct.empty;for(;d+=u,p+=f,f&&i&&(b=b.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)u=n.sections[o++],f=n.sections[o++];e(l,d,a,p,b),l=d,a=p}}}function g0(n,e,t,i=!1){let l=[],a=i?[]:null,o=new Du(n),u=new Du(e);for(let f=-1;;){if(o.done&&u.len||u.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&u.ins==-1){let d=Math.min(o.len,u.len);ti(l,d,-1),o.forward(d),u.forward(d)}else if(u.ins>=0&&(o.ins<0||f==o.i||o.off==0&&(u.len<o.len||u.len==o.len&&!t))){let d=u.len;for(ti(l,u.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&f<o.i&&o.len<=p&&(ti(l,0,o.ins),a&&Br(a,l,o.text),f=o.i),o.forward(p),d-=p}u.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(u.ins==-1){let b=Math.min(p,u.len);d+=b,p-=b,u.forward(b)}else if(u.ins==0&&u.len<p)p-=u.len,u.next();else break;ti(l,d,f<o.i?o.ins:0),a&&f<o.i&&Br(a,l,o.text),f=o.i,o.forward(o.len-p)}else{if(o.done&&u.done)return a?vn.createSet(l,a):pl.create(l);throw new Error("Mismatched change set lengths")}}}function Uk(n,e,t=!1){let i=[],l=t?[]:null,a=new Du(n),o=new Du(e);for(let u=!1;;){if(a.done&&o.done)return l?vn.createSet(i,l):pl.create(i);if(a.ins==0)ti(i,a.len,0,u),a.next();else if(o.len==0&&!o.done)ti(i,0,o.ins,u),l&&Br(l,i,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let f=Math.min(a.len2,o.len),d=i.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;ti(i,f,p,u),l&&p&&Br(l,i,o.text)}else o.ins==-1?(ti(i,a.off?0:a.len,f,u),l&&Br(l,i,a.textBit(f))):(ti(i,a.off?0:a.len,o.off?0:o.ins,u),l&&!o.off&&Br(l,i,o.text));u=(a.ins>f||o.ins>=0&&o.len>f)&&(u||i.length>d),a.forward2(f),o.forward(f)}}}}class Du{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?ct.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ct.empty:t[i].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 Or{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}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 i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Or(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return Q.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Q.range(this.anchor,l,void 0,void 0,i)}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 Q.range(e.anchor,e.head)}static create(e,t,i,l){return new Or(e,t,i,l)}}class Q{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Q.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Q([this.main],0)}addRange(e,t=!0){return Q.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,Q.create(i,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 Q(e.ranges.map(t=>Or.fromJSON(t)),e.main)}static single(e,t=e){return new Q([Q.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 i=0,l=0;l<e.length;l++){let a=e[l];if(a.empty?a.from<=i:a.from<i)return Q.normalized(e.slice(),t);i=a.to}return new Q(e,t)}static cursor(e,t=0,i,l){return Or.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),l)}static range(e,t,i,l,a){let o=l==null?7:Math.min(6,l);return!a&&e!=t&&(a=t<e?1:-1),a&&(o|=a<0?8:16),t<e?Or.create(t,e,o|32,i):Or.create(e,t,o,i)}static undirectionalRange(e,t){return Or.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((l,a)=>l.from-a.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let a=e[l],o=e[l-1];if(a.empty?a.from<=o.to:a.from<o.to){let u=o.from,f=Math.max(a.to,o.to);l<=t&&t--,e.splice(--l,2,a.anchor>a.head?Q.range(f,u):Q.range(u,f))}}return new Q(e,t)}}function qk(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let yy=0;class be{constructor(e,t,i,l,a){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=yy++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new be(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:by),!!e.static,e.enables)}of(e){return new nd([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new nd(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new nd(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function by(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class nd{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=yy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,a=this.id,o=e[a]>>1,u=this.type==2,f=!1,d=!1,p=[];for(let b of this.dependencies)b=="doc"?f=!0:b=="selection"?d=!0:(((t=e[b.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[b.id]);return{create(b){return b.values[o]=i(b),1},update(b,x){if(f&&x.docChanged||d&&(x.docChanged||x.selection)||y0(b,p)){let v=i(b);if(u?!uS(v,b.values[o],l):!l(v,b.values[o]))return b.values[o]=v,1}return 0},reconfigure:(b,x)=>{let v,w=x.config.address[a];if(w!=null){let C=pd(x,w);if(this.dependencies.every(A=>A instanceof be?x.facet(A)===b.facet(A):A instanceof Wn?x.field(A,!1)==b.field(A,!1):!0)||(u?uS(v=i(b),C,l):l(v=i(b),C)))return b.values[o]=C,0}else v=i(b);return b.values[o]=v,1}}}get extension(){return this}}function uS(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function y0(n,e){let t=!1;for(let i of e)Au(n,i)&1&&(t=!0);return t}function UE(n,e,t){let i=t.map(f=>n[f.id]),l=t.map(f=>f.type),a=i.filter(f=>!(f&1)),o=n[e.id]>>1;function u(f){let d=[];for(let p=0;p<i.length;p++){let b=pd(f,i[p]);if(l[p]==2)for(let x of b)d.push(x);else d.push(b)}return e.combine(d)}return{create(f){for(let d of i)Au(f,d);return f.values[o]=u(f),1},update(f,d){if(!y0(f,a))return 0;let p=u(f);return e.compare(p,f.values[o])?0:(f.values[o]=p,1)},reconfigure(f,d){let p=y0(f,i),b=d.config.facets[e.id],x=d.facet(e);if(b&&!p&&by(t,b))return f.values[o]=x,0;let v=u(f);return e.compare(v,x)?(f.values[o]=x,0):(f.values[o]=v,1)}}}const Nh=be.define({static:!0});class Wn{constructor(e,t,i,l,a){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=a,this.provides=void 0}static define(e){let t=new Wn(yy++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Nh).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let a=i.values[t],o=this.updateF(a,l);return this.compareF(a,o)?0:(i.values[t]=o,1)},reconfigure:(i,l)=>{let a=i.facet(Nh),o=l.facet(Nh),u;return(u=a.find(f=>f.field==this))&&u!=o.find(f=>f.field==this)?(i.values[t]=u.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Nh.of({field:this,create:e})]}get extension(){return this}}const va={lowest:4,low:3,default:2,high:1,highest:0};function hu(n){return e=>new Vk(e,n)}const $l={highest:hu(va.highest),high:hu(va.high),default:hu(va.default),low:hu(va.low),lowest:hu(va.lowest)};class Vk{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Wu{of(e){return new b0(this,e)}reconfigure(e){return Wu.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class b0{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class dd{constructor(e,t,i,l,a,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.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,i){let l=[],a=Object.create(null),o=new Map;for(let x of qE(e,t,o))x instanceof Wn?l.push(x):(a[x.facet.id]||(a[x.facet.id]=[])).push(x);let u=Object.create(null),f=[],d=[];for(let x of l)u[x.id]=d.length<<1,d.push(v=>x.slot(v));let p=i==null?void 0:i.config.facets;for(let x in a){let v=a[x],w=v[0].facet,C=p&&p[x]||[];if(v.every(A=>A.type==0))if(u[w.id]=f.length<<1|1,by(C,v))f.push(i.facet(w));else{let A=w.combine(v.map(E=>E.value));f.push(i&&w.compare(A,i.facet(w))?i.facet(w):A)}else{for(let A of v)A.type==0?(u[A.id]=f.length<<1|1,f.push(A.value)):(u[A.id]=d.length<<1,d.push(E=>A.dynamicSlot(E)));u[w.id]=d.length<<1,d.push(A=>UE(A,w,v))}}let b=d.map(x=>x(u));return new dd(e,o,b,u,f,a)}}function qE(n,e,t){let i=[[],[],[],[],[]],l=new Map;function a(o,u){let f=l.get(o);if(f!=null){if(f<=u)return;let d=i[f].indexOf(o);d>-1&&i[f].splice(d,1),o instanceof b0&&t.delete(o.compartment)}if(l.set(o,u),Array.isArray(o))for(let d of o)a(d,u);else if(o instanceof b0){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;t.set(o.compartment,d),a(d,u)}else if(o instanceof Vk)a(o.inner,o.prec);else if(o instanceof Wn)i[u].push(o),o.provides&&a(o.provides,u);else if(o instanceof nd)i[u].push(o),o.facet.extensions&&a(o.facet.extensions,va.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(d==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,u)}}return a(n,va.default),i.reduce((o,u)=>o.concat(u))}function Au(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function pd(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Gk=be.define(),x0=be.define({combine:n=>n.some(e=>e),static:!0}),Pk=be.define({combine:n=>n.length?n[0]:void 0,static:!0}),Yk=be.define(),Fk=be.define(),$k=be.define(),Wk=be.define({combine:n=>n.length?n[0]:!1});class Wl{constructor(e,t){this.type=e,this.value=t}static define(){return new VE}}class VE{of(e){return new Wl(this,e)}}class GE{constructor(e){this.map=e}of(e){return new Ge(this,e)}}class Ge{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 Ge(this.type,t)}is(e){return this.type==e}static define(e={}){return new GE(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let a=l.map(t);a&&i.push(a)}return i}}Ge.reconfigure=Ge.define();Ge.appendConfig=Ge.define();class pn{constructor(e,t,i,l,a,o){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,i&&qk(i,t.newLength),a.some(u=>u.type==pn.time)||(this.annotations=a.concat(pn.time.of(Date.now())))}static create(e,t,i,l,a,o){return new pn(e,t,i,l,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(pn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}pn.time=Wl.define();pn.userEvent=Wl.define();pn.addToHistory=Wl.define();pn.remote=Wl.define();function PE(n,e){let t=[];for(let i=0,l=0;;){let a,o;if(i<n.length&&(l==e.length||e[l]>=n[i]))a=n[i++],o=n[i++];else if(l<e.length)a=e[l++],o=e[l++];else return t;!t.length||t[t.length-1]<a?t.push(a,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Kk(n,e,t){var i;let l,a,o;return t?(l=e.changes,a=vn.empty(e.changes.length),o=n.changes.compose(e.changes)):(l=e.changes.map(n.changes),a=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(l)),{changes:o,selection:e.selection?e.selection.map(a):(i=n.selection)===null||i===void 0?void 0:i.map(l),effects:Ge.mapEffects(n.effects,l).concat(Ge.mapEffects(e.effects,a)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function v0(n,e,t){let i=e.selection,l=Io(e.annotations);return e.userEvent&&(l=l.concat(pn.userEvent.of(e.userEvent))),{changes:e.changes instanceof vn?e.changes:vn.of(e.changes||[],t,n.facet(Pk)),selection:i&&(i instanceof Q?i:Q.single(i.anchor,i.head)),effects:Io(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Xk(n,e,t){let i=v0(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(t=!1);let o=!!e[a].sequential;i=Kk(i,v0(n,e[a],o?i.changes.newLength:n.doc.length),o)}let l=pn.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return FE(t?YE(l):l)}function YE(n){let e=n.startState,t=!0;for(let l of e.facet(Yk)){let a=l(n);if(a===!1){t=!1;break}Array.isArray(a)&&(t=t===!0?a:PE(t,a))}if(t!==!0){let l,a;if(t===!1)a=n.changes.invertedDesc,l=vn.empty(e.doc.length);else{let o=n.changes.filter(t);l=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}n=pn.create(e,l,n.selection&&n.selection.map(a),Ge.mapEffects(n.effects,a),n.annotations,n.scrollIntoView)}let i=e.facet(Fk);for(let l=i.length-1;l>=0;l--){let a=i[l](n);a instanceof pn?n=a:Array.isArray(a)&&a.length==1&&a[0]instanceof pn?n=a[0]:n=Xk(e,Io(a),!1)}return n}function FE(n){let e=n.startState,t=e.facet($k),i=n;for(let l=t.length-1;l>=0;l--){let a=t[l](n);a&&Object.keys(a).length&&(i=Kk(i,v0(e,a,n.changes.newLength),!0))}return i==n?n:pn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const $E=[];function Io(n){return n==null?$E:Array.isArray(n)?n:[n]}var $t=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})($t||($t={}));const WE=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let S0;try{S0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function KE(n){if(S0)return S0.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||WE.test(t)))return!0}return!1}function XE(n){return e=>{if(!/\S/.test(e))return $t.Space;if(KE(e))return $t.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return $t.Word;return $t.Other}}class pt{constructor(e,t,i,l,a,o){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)Au(this,u<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Au(this,i),pd(this,i)}update(...e){return Xk(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let u of e.effects)u.is(Wu.reconfigure)?(t&&(l=new Map,t.compartments.forEach((f,d)=>l.set(d,f)),t=null),l.set(u.value.compartment,u.value.extension)):u.is(Ge.reconfigure)?(t=null,i=u.value):u.is(Ge.appendConfig)&&(t=null,i=Io(i).concat(u.value));let a;t?a=e.startState.values.slice():(t=dd.resolve(i,l,this),a=new pt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let o=e.startState.facet(x0)?e.newSelection:e.newSelection.asSingle();new pt(t,e.newDoc,o,a,(u,f)=>f.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:Q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),a=[i.range],o=Io(i.effects);for(let u=1;u<t.ranges.length;u++){let f=e(t.ranges[u]),d=this.changes(f.changes),p=d.map(l);for(let x=0;x<u;x++)a[x]=a[x].map(p);let b=l.mapDesc(d,!0);a.push(f.range.map(b)),l=l.compose(p),o=Ge.mapEffects(o,p).concat(Ge.mapEffects(Io(f.effects),b))}return{changes:l,selection:Q.create(a,t.mainIndex),effects:o}}changes(e=[]){return e instanceof vn?e:vn.of(e,this.doc.length,this.facet(pt.lineSeparator))}toText(e){return ct.of(e.split(this.facet(pt.lineSeparator)||p0))}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:(Au(this,t),pd(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof Wn&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(e,a)){let o=i[a],u=e[a];l.push(o.init(f=>o.spec.fromJSON(u,f)))}}return pt.create({doc:e.doc,selection:Q.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=dd.resolve(e.extensions||[],new Map),i=e.doc instanceof ct?e.doc:ct.of((e.doc||"").split(t.staticFacet(pt.lineSeparator)||p0)),l=e.selection?e.selection instanceof Q?e.selection:Q.single(e.selection.anchor,e.selection.head):Q.single(0);return qk(l,i.length),t.staticFacet(x0)||(l=l.asSingle()),new pt(t,i,l,t.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(pt.tabSize)}get lineBreak(){return this.facet(pt.lineSeparator)||`
|
|
120
|
-
`}get readOnly(){return this.facet(Wk)}phrase(e,...t){for(let i of this.facet(pt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let a=+(l||1);return!a||a>t.length?i:t[a-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let a of this.facet(Gk))for(let o of a(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&l.push(o[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return XE(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-i,u=e-i;for(;o>0;){let f=Rn(t,o,!1);if(a(t.slice(f,o))!=$t.Word)break;o=f}for(;u<l;){let f=Rn(t,u);if(a(t.slice(u,f))!=$t.Word)break;u=f}return o==u?null:Q.range(o+i,u+i)}}pt.allowMultipleSelections=x0;pt.tabSize=be.define({combine:n=>n.length?n[0]:4});pt.lineSeparator=Pk;pt.readOnly=Wk;pt.phrases=be.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});pt.languageData=Gk;pt.changeFilter=Yk;pt.transactionFilter=Fk;pt.transactionExtender=$k;Wu.reconfigure=Ge.define();function ml(n,e,t={}){let i={};for(let l of n)for(let a of Object.keys(l)){let o=l[a],u=i[a];if(u===void 0)i[a]=o;else if(!(u===o||o===void 0))if(Object.hasOwnProperty.call(t,a))i[a]=t[a](u,o);else throw new Error("Config merge conflict for field "+a)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class Ir{eq(e){return this==e}range(e,t=e){return Ou.create(e,t,this)}}Ir.prototype.startSide=Ir.prototype.endSide=0;Ir.prototype.point=!1;Ir.prototype.mapMode=Gn.TrackDel;function xy(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class Ou{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ou(e,t,i)}}function w0(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class vy{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let a=i?this.to:this.from;for(let o=l,u=a.length;;){if(o==u)return o;let f=o+u>>1,d=a[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==o)return d>=0?o:u;d>=0?u=f:o=f+1}}between(e,t,i,l){for(let a=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,a);a<o;a++)if(l(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,t){let i=[],l=[],a=[],o=-1,u=-1;for(let f=0;f<this.value.length;f++){let d=this.value[f],p=this.from[f]+e,b=this.to[f]+e,x,v;if(p==b){let w=t.mapPos(p,d.startSide,d.mapMode);if(w==null||(x=v=w,d.startSide!=d.endSide&&(v=t.mapPos(p,d.endSide),v<x)))continue}else if(x=t.mapPos(p,d.startSide),v=t.mapPos(b,d.endSide),x>v||x==v&&d.startSide>0&&d.endSide<=0)continue;(v-x||d.endSide-d.startSide)<0||(o<0&&(o=x),d.point&&(u=Math.max(u,v-x)),i.push(d),l.push(x-o),a.push(v-o))}return{mapped:i.length?new vy(l,a,i,u):null,pos:o}}}class nt{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new nt(e,t,i,l)}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:i=!1,filterFrom:l=0,filterTo:a=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(w0)),this.isEmpty)return t.length?nt.of(t):this;let u=new Qk(this,null,-1).goto(0),f=0,d=[],p=new Pl;for(;u.value||f<t.length;)if(f<t.length&&(u.from-t[f].from||u.startSide-t[f].value.startSide)>=0){let b=t[f++];p.addInner(b.from,b.to,b.value)||d.push(b)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==t.length||this.chunkEnd(u.chunkIndex)<t[f].from)&&(!o||l>this.chunkEnd(u.chunkIndex)||a<this.chunkPos[u.chunkIndex])&&p.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!o||l>u.to||a<u.from||o(u.from,u.to,u.value))&&(p.addInner(u.from,u.to,u.value)||d.push(Ou.create(u.from,u.to,u.value))),u.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?nt.empty:this.nextLayer.update({add:d,filter:o,filterFrom:l,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let o=0;o<this.chunk.length;o++){let u=this.chunkPos[o],f=this.chunk[o],d=e.touchesRange(u,u+f.length);if(d===!1)l=Math.max(l,f.maxPoint),t.push(f),i.push(e.mapPos(u));else if(d===!0){let{mapped:p,pos:b}=f.map(u,e);p&&(l=Math.max(l,p.maxPoint),t.push(p),i.push(b))}}let a=this.nextLayer.map(e);return t.length==0?a:new nt(i,t,a||nt.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],o=this.chunk[l];if(t>=a&&e<=a+o.length&&o.between(a,e-a,t-a,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Ru.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ru.from(e).goto(t)}static compare(e,t,i,l,a=-1){let o=e.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),u=t.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),f=fS(o,u,i),d=new du(o,f,a),p=new du(u,f,a);i.iterGaps((b,x,v)=>hS(d,b,p,x,v,l)),i.empty&&i.length==0&&hS(d,0,p,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let a=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),o=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let u=fS(a,o),f=new du(a,u,0).goto(i),d=new du(o,u,0).goto(i);for(;;){if(f.to!=d.to||!k0(f.active,d.active)||f.point&&(!d.point||!xy(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,a=-1){let o=new du(e,null,a).goto(t),u=t,f=o.openStart;for(;;){let d=Math.min(o.to,i);if(o.point){let p=o.activeForPoint(o.to),b=o.pointFrom<t?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,f);l.point(u,d,o.point,p,b,o.pointRank),f=Math.min(o.openEnd(d),p.length)}else d>u&&(l.span(u,d,o.active,f),f=o.openEnd(d));if(o.to>i)return f+(o.point&&o.to>i?1:0);u=o.to,o.next()}}static of(e,t=!1){let i=new Pl;for(let l of e instanceof Ou?[e]:t?QE(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return nt.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=nt.empty;l=l.nextLayer)t=new nt(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}nt.empty=new nt([],[],null,-1);function QE(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(w0(e,i)>0)return n.slice().sort(w0);e=i}return n}nt.empty.nextLayer=nt.empty;class Pl{finishChunk(e){this.chunks.push(new vy(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,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Pl)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<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=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(nt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=nt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function fS(n,e,t){let i=new Map;for(let a of n)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&i.set(a.chunk[o],a.chunkPos[o]);let l=new Set;for(let a of e)for(let o=0;o<a.chunk.length;o++){let u=i.get(a.chunk[o]);u!=null&&(t?t.mapPos(u):u)==a.chunkPos[o]&&!(t!=null&&t.touchesRange(u,u+a.chunk[o].length))&&l.add(a.chunk[o])}return l}class Qk{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=l}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,i){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}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],i=e+t.from[this.rangeIndex];if(this.from=i,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 Ru{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let a=0;a<e.length;a++)for(let o=e[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&l.push(new Qk(o,t,i,a));return l.length==1?l[0]:new Ru(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)kg(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)kg(this.heap,i);(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(),kg(this.heap,0)}}}function kg(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1<n.length&&l.compare(n[i+1])>=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class du{constructor(e,t,i){this.minPoint=i,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=Ru.from(e,t,i)}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){Dh(this.active,e),Dh(this.activeTo,e),Dh(this.activeRank,e),this.minActive=dS(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:a}=this.cursor;for(;t<this.activeRank.length&&(a-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Oh(this.active,t,i),Oh(this.activeTo,t,l),Oh(this.activeRank,t,a),e&&Oh(e,t,this.cursor.from),this.minActive=dS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&Dh(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function hS(n,e,t,i,l,a){n.goto(e),t.goto(i);let o=i+l,u=i,f=i-e,d=!!a.boundChange;for(let p=!1;;){let b=n.to+f-t.to,x=b||n.endSide-t.endSide,v=x<0?n.to+f:t.to,w=Math.min(v,o);if(n.point||t.point?(n.point&&t.point&&xy(n.point,t.point)&&k0(n.activeForPoint(n.to),t.activeForPoint(t.to))||a.comparePoint(u,w,n.point,t.point),p=!1):(p&&a.boundChange(u),w>u&&!k0(n.active,t.active)&&a.compareRange(u,w,n.active,t.active),d&&w<o&&(b||n.openEnd(v)!=t.openEnd(v))&&(p=!0)),v>o)break;u=v,x<=0&&n.next(),x>=0&&t.next()}}function k0(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!xy(n[t],e[t]))return!1;return!0}function Dh(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function Oh(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function dS(n,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||n[l].endSide-n[t].endSide)<0&&(t=l,i=e[l]);return t}function fc(n,e,t=n.length){let i=0;for(let l=0;l<t&&l<n.length;)n.charCodeAt(l)==9?(i+=e-i%e,l++):(i++,l=Rn(n,l));return i}function A0(n,e,t,i){for(let l=0,a=0;;){if(a>=e)return l;if(l==n.length)break;a+=n.charCodeAt(l)==9?t-a%t:1,l=Rn(n,l)}return i===!0?-1:n.length}const _0="ͼ",pS=typeof Symbol>"u"?"__"+_0:Symbol.for(_0),C0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),mS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ur{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,u,f,d){let p=[],b=/^@(\w+)\b/.exec(o[0]),x=b&&b[1]=="keyframes";if(b&&u==null)return f.push(o[0]+";");for(let v in u){let w=u[v];if(/&/.test(v))a(v.split(/,\s*/).map(C=>o.map(A=>C.replace(/&/,A))).reduce((C,A)=>C.concat(A)),w,f);else if(w&&typeof w=="object"){if(!b)throw new RangeError("The value of a property ("+v+") should be a primitive value.");a(l(v),w,p,x)}else w!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,C=>"-"+C.toLowerCase())+": "+w+";")}(p.length||x)&&f.push((i&&!b&&!d?o.map(i):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in e)a(l(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
121
|
-
`)}static newName(){let e=mS[pS]||1;return mS[pS]=e+1,_0+e.toString(36)}static mount(e,t,i){let l=e[C0],a=i&&i.nonce;l?a&&l.setNonce(a):l=new ZE(e,a),l.mount(Array.isArray(t)?t:[t],e)}}let gS=new Map;class ZE{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let a=gS.get(i);if(a)return e[C0]=a;this.sheet=new l.CSSStyleSheet,gS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[C0]=this}mount(e,t){let i=this.sheet,l=0,a=0;for(let o=0;o<e.length;o++){let u=e[o],f=this.modules.indexOf(u);if(f<a&&f>-1&&(this.modules.splice(f,1),a--,f=-1),f==-1){if(this.modules.splice(a++,0,u),i)for(let d=0;d<u.rules.length;d++)i.insertRule(u.rules[d],l++)}else{for(;a<f;)l+=this.modules[a++].rules.length;l+=u.rules.length,a++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let f=0;f<this.modules.length;f++)o+=this.modules[f].getRules()+`
|
|
122
|
-
`;this.styleTag.textContent=o;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 qr={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:"'"},ju={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},JE=typeof navigator<"u"&&/Mac/.test(navigator.platform),eN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Vn=0;Vn<10;Vn++)qr[48+Vn]=qr[96+Vn]=String(Vn);for(var Vn=1;Vn<=24;Vn++)qr[Vn+111]="F"+Vn;for(var Vn=65;Vn<=90;Vn++)qr[Vn]=String.fromCharCode(Vn+32),ju[Vn]=String.fromCharCode(Vn);for(var Ag in qr)ju.hasOwnProperty(Ag)||(ju[Ag]=qr[Ag]);function tN(n){var e=JE&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||eN&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ju:qr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Nt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e<arguments.length;e++)Zk(n,arguments[e]);return n}function Zk(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Zk(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let hi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},T0=typeof document<"u"?document:{documentElement:{style:{}}};const M0=/Edge\/(\d+)/.exec(hi.userAgent),Jk=/MSIE \d/.test(hi.userAgent),E0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hi.userAgent),Pd=!!(Jk||E0||M0),yS=!Pd&&/gecko\/(\d+)/i.test(hi.userAgent),_g=!Pd&&/Chrome\/(\d+)/.exec(hi.userAgent),bS="webkitFontSmoothing"in T0.documentElement.style,N0=!Pd&&/Apple Computer/.test(hi.vendor),xS=N0&&(/Mobile\/\w+/.test(hi.userAgent)||hi.maxTouchPoints>2);var ge={mac:xS||/Mac/.test(hi.platform),windows:/Win/.test(hi.platform),linux:/Linux|X11/.test(hi.platform),ie:Pd,ie_version:Jk?T0.documentMode||6:E0?+E0[1]:M0?+M0[1]:0,gecko:yS,gecko_version:yS?+(/Firefox\/(\d+)/.exec(hi.userAgent)||[0,0])[1]:0,chrome:!!_g,chrome_version:_g?+_g[1]:0,ios:xS,android:/Android\b/.test(hi.userAgent),webkit:bS,webkit_version:bS?+(/\bAppleWebKit\/(\d+)/.exec(hi.userAgent)||[0,0])[1]:0,safari:N0,safari_version:N0?+(/\bVersion\/(\d+(\.\d+)?)/.exec(hi.userAgent)||[0,0])[1]:0,tabSize:T0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Sy(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const md=Object.create(null);function wy(n,e,t){if(n==e)return!0;n||(n=md),e||(e=md);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let a of i)if(a!=t&&(l.indexOf(a)==-1||n[a]!==e[a]))return!1;return!0}function nN(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function vS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function iN(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class gl{eq(e){return!1}updateDOM(e,t,i){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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Yn=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Yn||(Yn={}));class ze extends Ir{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new Ku(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ra(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:a,end:o}=eA(e,t);i=(a?t?-3e8:-1:5e8)-1,l=(o?t?2e8:1:-6e8)+1}return new Ra(e,i,l,t,e.widget||null,!0)}static line(e){return new Xu(e)}static set(e,t=!1){return nt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ze.none=nt.empty;class Ku extends ze{constructor(e){let{start:t,end:i}=eA(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Sy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||md}eq(e){return this==e||e instanceof Ku&&this.tagName==e.tagName&&wy(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)}}Ku.prototype.point=!1;class Xu extends ze{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Xu&&this.spec.class==e.spec.class&&wy(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)}}Xu.prototype.mapMode=Gn.TrackBefore;Xu.prototype.point=!0;class Ra extends ze{constructor(e,t,i,l,a,o){super(t,i,a,e),this.block=l,this.isReplace=o,this.mapMode=l?t<=0?Gn.TrackBefore:Gn.TrackAfter:Gn.TrackDel}get type(){return this.startSide!=this.endSide?Yn.WidgetRange:this.startSide<=0?Yn.WidgetBefore:Yn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ra&&sN(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ra.prototype.point=!0;function eA(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function sN(n,e){return n==e||!!(n&&e&&n.compare(e))}function Uo(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class Lu extends Ir{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof Lu&&this.tagName==e.tagName&&wy(this.attributes,e.attributes)}static create(e){return new Lu(e.tagName,e.attributes||md,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return nt.of(e,t)}}Lu.prototype.startSide=Lu.prototype.endSide=-1;function Bu(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function D0(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _u(n,e){if(!e.anchorNode)return!1;try{return D0(n,e.anchorNode)}catch{return!1}}function id(n){return n.nodeType==3?zu(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Cu(n,e,t,i){return t?SS(n,e,t,i,-1)||SS(n,e,t,i,1):!1}function Vr(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function gd(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function SS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:Yl(n))){if(n.nodeName=="DIV")return!1;let a=n.parentNode;if(!a||a.nodeType!=1)return!1;e=Vr(n)+(l<0?0:1),n=a}else if(n.nodeType==1){if(n=n.childNodes[e+(l<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=l<0?Yl(n):0}else return!1}}function Yl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function yd(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function lN(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function tA(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function rN(n,e,t,i,l,a,o,u){let f=n.ownerDocument,d=f.defaultView||window;for(let p=n,b=!1;p&&!b;)if(p.nodeType==1){let x,v=p==f.body,w=1,C=1;if(v)x=lN(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(b=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let D=p.getBoundingClientRect();({scaleX:w,scaleY:C}=tA(p,D)),x={left:D.left,right:D.left+p.clientWidth*w,top:D.top,bottom:D.top+p.clientHeight*C}}let A=0,E=0;if(l=="nearest")e.top<x.top+o?(E=e.top-(x.top+o),t>0&&e.bottom>x.bottom+E&&(E=e.bottom-x.bottom+o)):e.bottom>x.bottom-o&&(E=e.bottom-x.bottom+o,t<0&&e.top-E<x.top&&(E=e.top-(x.top+o)));else{let D=e.bottom-e.top,B=x.bottom-x.top;E=(l=="center"&&D<=B?e.top+D/2-B/2:l=="start"||l=="center"&&t<0?e.top-o:e.bottom-B+o)-x.top}if(i=="nearest"?e.left<x.left+a?(A=e.left-(x.left+a),t>0&&e.right>x.right+A&&(A=e.right-x.right+a)):e.right>x.right-a&&(A=e.right-x.right+a,t<0&&e.left<x.left+A&&(A=e.left-(x.left+a))):A=(i=="center"?e.left+(e.right-e.left)/2-(x.right-x.left)/2:i=="start"==u?e.left-a:e.right-(x.right-x.left)+a)-x.left,A||E)if(v)d.scrollBy(A,E);else{let D=0,B=0;if(E){let H=p.scrollTop;p.scrollTop+=E/C,B=(p.scrollTop-H)*C}if(A){let H=p.scrollLeft;p.scrollLeft+=A/w,D=(p.scrollLeft-H)*w}e={left:e.left-D,top:e.top-B,right:e.right-D,bottom:e.bottom-B},D&&Math.abs(D-A)<1&&(i="nearest"),B&&Math.abs(B-E)<1&&(l="nearest")}if(v)break;(e.top<x.top||e.bottom>x.bottom||e.left<x.left||e.right>x.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function nA(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let a=n.parentNode;a&&!(a==t.body||(!e||i)&&l);)if(a.nodeType==1)!l&&a.scrollHeight>a.clientHeight&&(l=a),e&&!i&&a.scrollWidth>a.clientWidth&&(i=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:i,y:l}}class aN{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Yl(t):0),i,Math.min(e.focusOffset,i?Yl(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let ba=null;ge.safari&&ge.safari_version>=26&&(ba=!1);function iA(n){if(n.setActive)return n.setActive();if(ba)return n.focus(ba);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(ba==null?{get preventScroll(){return ba={preventScroll:!0},!0}}:void 0),!ba){ba=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],a=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=a&&(i.scrollLeft=a)}}}let wS;function zu(n,e,t=e){let i=wS||(wS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function qo(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let a=new KeyboardEvent("keydown",l);a.synthetic=!0,n.dispatchEvent(a);let o=new KeyboardEvent("keyup",l);return o.synthetic=!0,n.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function oN(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function cN(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Yl(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Yl(t))}else{if(t==n)return!0;i=Vr(t),t=t.parentNode}}function sA(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function lA(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Yl(t)}else if(t.parentNode&&!gd(t))i=Vr(t),t=t.parentNode;else return null}}function rA(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!gd(t))i=Vr(t)+1,t=t.parentNode;else return null}}class Rs{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new Rs(e.parentNode,Vr(e),t)}static after(e,t){return new Rs(e.parentNode,Vr(e)+1,t)}}var Bt=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Bt||(Bt={}));const ja=Bt.LTR,ky=Bt.RTL;function aA(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const uN=aA("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),fN=aA("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),O0=Object.create(null),tl=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);O0[e]=t,O0[t]=-e}function oA(n){return n<=247?uN[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?fN[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const hN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fl{get dir(){return this.level%2?ky:ja}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let a=-1;for(let o=0;o<e.length;o++){let u=e[o];if(u.from<=t&&u.to>=t){if(u.level==i)return o;(a<0||(l!=0?l<0?u.from<t:u.to>t:e[a].level>u.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function cA(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!cA(i.inner,l.inner))return!1}return!0}const jt=[];function dN(n,e,t,i,l){for(let a=0;a<=i.length;a++){let o=a?i[a-1].to:e,u=a<i.length?i[a].from:t,f=a?256:l;for(let d=o,p=f,b=f;d<u;d++){let x=oA(n.charCodeAt(d));x==512?x=p:x==8&&b==4&&(x=16),jt[d]=x==4?2:x,x&7&&(b=x),p=x}for(let d=o,p=f,b=f;d<u;d++){let x=jt[d];if(x==128)d<u-1&&p==jt[d+1]&&p&24?x=jt[d]=p:jt[d]=256;else if(x==64){let v=d+1;for(;v<u&&jt[v]==64;)v++;let w=d&&p==8||v<t&&jt[v]==8?b==1?1:8:256;for(let C=d;C<v;C++)jt[C]=w;d=v-1}else x==8&&b==1&&(jt[d]=1);p=x,x&7&&(b=x)}}}function pN(n,e,t,i,l){let a=l==1?2:1;for(let o=0,u=0,f=0;o<=i.length;o++){let d=o?i[o-1].to:e,p=o<i.length?i[o].from:t;for(let b=d,x,v,w;b<p;b++)if(v=O0[x=n.charCodeAt(b)])if(v<0){for(let C=u-3;C>=0;C-=3)if(tl[C+1]==-v){let A=tl[C+2],E=A&2?l:A&4?A&1?a:l:0;E&&(jt[b]=jt[tl[C]]=E),u=C;break}}else{if(tl.length==189)break;tl[u++]=b,tl[u++]=x,tl[u++]=f}else if((w=jt[b])==2||w==1){let C=w==l;f=C?0:1;for(let A=u-3;A>=0;A-=3){let E=tl[A+2];if(E&2)break;if(C)tl[A+2]|=2;else{if(E&4)break;tl[A+2]|=4}}}}}function mN(n,e,t,i){for(let l=0,a=i;l<=t.length;l++){let o=l?t[l-1].to:n,u=l<t.length?t[l].from:e;for(let f=o;f<u;){let d=jt[f];if(d==256){let p=f+1;for(;;)if(p==u){if(l==t.length)break;p=t[l++].to,u=l<t.length?t[l].from:e}else if(jt[p]==256)p++;else break;let b=a==1,x=(p<e?jt[p]:i)==1,v=b==x?b?1:2:i;for(let w=p,C=l,A=C?t[C-1].to:n;w>f;)w==A&&(w=t[--C].from,A=C?t[C-1].to:n),jt[--w]=v;f=p}else a=d,f++}}}function R0(n,e,t,i,l,a,o){let u=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;f<t;){let p=!0,b=!1;if(d==a.length||f<a[d].from){let C=jt[f];C!=u&&(p=!1,b=C==16)}let x=!p&&u==1?[]:null,v=p?i:i+1,w=f;e:for(;;)if(d<a.length&&w==a[d].from){if(b)break e;let C=a[d];if(!p)for(let A=C.to,E=d+1;;){if(A==t)break e;if(E<a.length&&a[E].from==A)A=a[E++].to;else{if(jt[A]==u)break e;break}}if(d++,x)x.push(C);else{C.from>f&&o.push(new fl(f,C.from,v));let A=C.direction==ja!=!(v%2);j0(n,A?i+1:i,l,C.inner,C.from,C.to,o),f=C.to}w=C.to}else{if(w==t||(p?jt[w]!=u:jt[w]==u))break;w++}x?R0(n,f,w,i+1,l,x,o):f<w&&o.push(new fl(f,w,v)),f=w}else for(let f=t,d=a.length;f>e;){let p=!0,b=!1;if(!d||f>a[d-1].to){let C=jt[f-1];C!=u&&(p=!1,b=C==16)}let x=!p&&u==1?[]:null,v=p?i:i+1,w=f;e:for(;;)if(d&&w==a[d-1].to){if(b)break e;let C=a[--d];if(!p)for(let A=C.from,E=d;;){if(A==e)break e;if(E&&a[E-1].to==A)A=a[--E].from;else{if(jt[A-1]==u)break e;break}}if(x)x.push(C);else{C.to<f&&o.push(new fl(C.to,f,v));let A=C.direction==ja!=!(v%2);j0(n,A?i+1:i,l,C.inner,C.from,C.to,o),f=C.from}w=C.from}else{if(w==e||(p?jt[w-1]!=u:jt[w-1]==u))break;w--}x?R0(n,w,f,i+1,l,x,o):w<f&&o.push(new fl(w,f,v)),f=w}}function j0(n,e,t,i,l,a,o){let u=e%2?2:1;dN(n,l,a,i,u),pN(n,l,a,i,u),mN(l,a,i,u),R0(n,l,a,e,t,i,o)}function gN(n,e,t){if(!n)return[new fl(0,0,e==ky?1:0)];if(e==ja&&!t.length&&!hN.test(n))return uA(n.length);if(t.length)for(;n.length>jt.length;)jt[jt.length]=256;let i=[],l=e==ja?0:1;return j0(n,l,l,t,0,n.length,i),i}function uA(n){return[new fl(0,n,0)]}let fA="";function yN(n,e,t,i,l){var a;let o=i.head-n.from,u=fl.find(e,o,(a=i.bidiLevel)!==null&&a!==void 0?a:-1,i.assoc),f=e[u],d=f.side(l,t);if(o==d){let x=u+=l?1:-1;if(x<0||x>=e.length)return null;f=e[u=x],o=f.side(!l,t),d=f.side(l,t)}let p=Rn(n.text,o,f.forward(l,t));(p<f.from||p>f.to)&&(p=d),fA=n.text.slice(Math.min(o,p),Math.max(o,p));let b=u==(l?e.length-1:0)?null:e[u+(l?1:-1)];return b&&p==d&&b.level+(l?0:1)<f.level?Q.cursor(b.side(!l,t)+n.from,b.forward(l,t)?1:-1,b.level):Q.cursor(p+n.from,f.forward(l,t)?-1:1,f.level)}function bN(n,e,t){for(let i=e;i<t;i++){let l=oA(n.charCodeAt(i));if(l==1)return ja;if(l==2||l==4)return ky}return ja}const hA=be.define(),dA=be.define(),pA=be.define(),mA=be.define(),L0=be.define(),gA=be.define(),yA=be.define(),Ay=be.define(),_y=be.define(),bA=be.define({combine:n=>n.some(e=>e)}),xA=be.define({combine:n=>n.some(e=>e)}),vA=be.define();class Vo{constructor(e,t,i,l,a,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=a,this.isSnapshot=o}map(e){return e.empty?this:new Vo(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 Vo(Q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Rh=Ge.define({map:(n,e)=>n.map(e)}),SA=Ge.define();function Ci(n,e,t){let i=n.facet(mA);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const ql=be.define({combine:n=>n.length?n[0]:!0});let xN=0;const Oo=be.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class rn{constructor(e,t,i,l,a){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(Oo.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Oo.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:a,decorations:o}=t||{};return new rn(xN++,e,i,l,u=>{let f=[];return o&&f.push(Yd.of(d=>{let p=d.plugin(u);return p?o(p):ze.none})),a&&f.push(a(u)),f})}static fromClass(e,t){return rn.define((i,l)=>new e(i,l),t)}}class Cg{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(i){if(Ci(t.state,i,"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){Ci(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(i){Ci(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const wA=be.define(),Cy=be.define(),Yd=be.define(),kA=be.define(),Ty=be.define(),Qu=be.define(),AA=be.define();function kS(n,e){let t=n.state.facet(AA);if(!t.length)return t;let i=t.map(a=>a instanceof Function?a(n):a),l=[];return nt.spans(i,e.from,e.to,{point(){},span(a,o,u,f){let d=a-e.from,p=o-e.from,b=l;for(let x=u.length-1;x>=0;x--,f--){let v=u[x].spec.bidiIsolate,w;if(v==null&&(v=bN(e.text,d,p)),f>0&&b.length&&(w=b[b.length-1]).to==d&&w.direction==v)w.to=p,b=w.inner;else{let C={from:d,to:p,direction:v,inner:[]};b.push(C),b=C.inner}}}}),l}const _A=be.define();function My(n){let e=0,t=0,i=0,l=0;for(let a of n.state.facet(_A)){let o=a(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(l=Math.max(l,o.bottom)))}return{left:e,right:t,top:i,bottom:l}}const vu=be.define();class cs{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new cs(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,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,a=0,o=0;;){let u=l<e.length?e[l].fromB:1e9,f=a<t.length?t[a]:1e9,d=Math.min(u,f);if(d==1e9)break;let p=d+o,b=d,x=p;for(;;)if(a<t.length&&t[a]<=b){let v=t[a+1];a+=2,b=Math.max(b,v);for(let w=l;w<e.length&&e[w].fromB<=b;w++)o=e[w].toA-e[w].toB;x=Math.max(x,v+o)}else if(l<e.length&&e[l].fromB<=b){let v=e[l++];b=Math.max(b,v.toB),x=Math.max(x,v.toA),o=v.toA-v.toB}else break;i.push(new cs(p,x,d,b))}return i}}class bd{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=vn.empty(this.startState.doc.length);for(let a of i)this.changes=this.changes.compose(a.changes);let l=[];this.changes.iterChangedRanges((a,o,u,f)=>l.push(new cs(a,o,u,f))),this.changedRanges=l}static create(e,t,i){return new bd(e,t,i)}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 vN=[];class en{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return vN}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&&nN(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 i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=Vr(this.dom),l=this.length?e>0:t>0;return new Rs(this.parent.dom,i+(l?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 $d)return e;return null}static get(e){return e.cmTile}}class Fd extends en{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,i=null,l,a=(e==null?void 0:e.node)==t?e:null,o=0;for(let u of this.children){if(u.sync(e),o+=u.length+u.breakAfter,l=i?i.nextSibling:t.firstChild,a&&l!=u.dom&&(a.written=!0),u.dom.parentNode==t)for(;l&&l!=u.dom;)l=AS(l);else t.insertBefore(u.dom,l);i=u.dom}for(l=i?i.nextSibling:t.firstChild,a&&l&&(a.written=!0);l;)l=AS(l);this.length=o}}function AS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class $d extends Fd{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=en.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,a=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&a++,l=t.pop()}else{let o=i.children[l++];if(o instanceof Gl)t.push(l),i=o,l=0;else{let u=a+o.length,f=e(o,a);if(f!==void 0)return f;a=u+o.breakAfter}}}resolveBlock(e,t){let i,l=-1,a,o=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(f<e||e==d&&(t<-1?u.length:u.covers(1)))&&(!i||!u.isWidget()&&i.isWidget())&&(i=u,l=e-f),(d>e||e==f&&(t>1?u.length:u.covers(-1)))&&(!a||!u.isWidget()&&a.isWidget())&&(a=u,o=e-f)}}),!i&&!a)throw new Error("No tile at position "+e);return i&&t<0||!a?{tile:i,offset:l}:{tile:a,offset:o}}}class Gl extends Fd{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 i=new Gl(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class nc extends Fd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new nc(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i){let l=null,a=-1,o=null,u=-1;function f(p,b){for(let x=0,v=0;x<p.children.length&&v<=b;x++){let w=p.children[x],C=v+w.length;C>=b&&(w.isComposite()?f(w,b-v):(!o||o.isHidden&&(t>0&&!(o.flags&32)||i&&wN(o,w)))&&(C>b||w.flags&32)?(o=w,u=b-v):(v<b||w.flags&16&&!w.isHidden)&&(l=w,a=b-v)),v=C}}f(this,e);let d=(t<0?l:o)||l||o;return d?{tile:d,offset:d==l?a:u}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):SN(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:a}=i;if(this.dom.contains(l.dom))return l.isText()?new Rs(l.dom,Math.min(l.dom.nodeValue.length,a)):l.domPosFor(a,l.flags&16?1:l.flags&32?-1:t);let o=i.tile.parent,u=!1;for(let f of o.children){if(u)return new Rs(f.dom,0);f==i.tile&&(u=!0)}}return new Rs(this.dom,0)}}function SN(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=id(e);return t[t.length-1]||null}function wN(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class _i extends Fd{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new _i(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class wa extends en{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,i){let l=this.dom.nodeValue.length;e>l&&(e=l);let a=e,o=e,u=0;e==0&&t<0||e==l&&t>=0?ge.chrome||ge.gecko||(e?(a--,u=1):o<l&&(o++,u=-1)):t<0?a--:o<l&&o++;let f=zu(this.dom,a,o).getClientRects();if(!f.length)return null;let d=f[(u?u<0:t>=0)?0:f.length-1];return ge.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,p=>p.width)||d),i==null?d:yd(d,(u?u>0:t<0)==i)}static of(e,t){let i=new wa(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class La extends en{constructor(e,t,i,l){super(e,t,l),this.widget=i}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,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return yd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?a.length-1:0;o=a[f],!(e>0?f==0:f==a.length-1||o.top<o.bottom);f+=u?-1:1);return yd(o,!u)}}get overrideDOMText(){if(!this.length)return ct.empty;let{root:e}=this;if(!e)return ct.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,i,l,a){return a||(a=e.toDOM(t),e.editable||(a.contentEditable="false")),new La(a,i,e,l)}}class xd extends en{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 ct.empty}coordsIn(e,t,i){let l=this.dom.getBoundingClientRect();return i==null?l:yd(l,t>0==i)}}class kN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:a,beforeBreak:o,parents:u}=this;for(;e||t>0;)if(l.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(a==l.children.length){if(!e&&!u.length)break;i&&i.leave(l),o=!!l.breakAfter,{tile:l,index:a}=u.pop(),a++}else{let f=l.children[a],d=f.breakAfter;(t>0?f.length<=e:f.length<e)&&(!i||i.skip(f,0,f.length)!==!1||!f.isComposite)?(o=!!d,a++,e-=f.length):(u.push({tile:l,index:a}),l=f,a=0,i&&f.isComposite()&&i.enter(f))}else if(a==l.length)o=!!l.breakAfter,{tile:l,index:a}=u.pop(),a++;else if(e){let f=Math.min(e,l.length-a);i&&i.skip(l,a,a+f),e-=f,a+=f}else break;return this.tile=l,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class AN{constructor(e,t,i,l){this.from=e,this.to=t,this.wrapper=i,this.rank=l}}class _N{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,l){var a;this.flushBuffer();let o=this.ensureMarks(t,i),u=o.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=o.children[o.children.length-1]=new wa(u.dom,u.text+e);f.parent=o}else o.append(l||wa.of(e,(a=this.cache.find(wa))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?Tg(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let l=i;for(let u=t.marks.length-1;u>=0;u--){let f=t.marks[u],d=l.lastChild;if(d instanceof _i&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(Tg(f.dom)),l=d;else{if(this.cache.reused.get(f)){let b=en.get(f.dom);b&&b.setDOM(Tg(f.dom))}let p=_i.of(f.mark,f.dom);l.append(p),l=p}this.cache.reused.set(f,2)}let a=en.get(e.text);a&&this.cache.reused.set(a,2);let o=new wa(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,l.append(o)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let a=this.ensureMarks(t,i);!l&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).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 i;e||(e=CA);let l=nc.start(e,t||((i=this.cache.find(nc))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}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 i;let l=this.curLine;for(let a=e.length-1;a>=0;a--){let o=e[a],u;if(t>0&&(u=l.lastChild)&&u instanceof _i&&u.mark.eq(o))l=u,t--;else{let f=_i.of(o,(i=this.cache.find(_i,d=>d.mark.eq(o)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!_S(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ge.ios&&_S(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Mg,0,32)||new La(Mg.toDOM(),0,Mg,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,i=new AN(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.from<this.pos&&l instanceof Gl&&l.wrapper.eq(i.wrapper))t=l;else{let a=Gl.of(i.wrapper,(e=this.cache.find(Gl,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(a),t=a}}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),i=this.cache.find(xd,void 0,1);return i&&(i.flags=t),i||new xd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class CN{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:l,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=l;let u=this.textOff=Math.min(e,l.length);return a?null:l.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const vd=[La,nc,wa,_i,xd,Gl,$d];for(let n=0;n<vd.length;n++)vd[n].bucket=n;class TN{constructor(e){this.view=e,this.buckets=vd.map(()=>[]),this.index=vd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,a=this.buckets[l],o=this.index[l];for(let u=0;u<a.length;u++){let f=(u+o)%a.length,d=a[f];if((!t||t(d))&&!this.reused.has(d))return a.splice(f,1),f<o&&this.index[l]--,this.reused.set(d,i),d}return null}findWidget(e,t,i){let l=this.buckets[0];if(l.length)for(let a=0,o=0;;a++){if(a==l.length){if(o)return null;o=1,a=0}let u=l[a];if(!this.reused.has(u)&&(o==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return l.splice(a,1),a<this.index[0]&&this.index[0]--,u.widget==e&&u.length==t&&(u.flags&497)==i?(this.reused.set(u,1),u):(this.reused.set(u,2),new La(u.dom,t,e,u.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class MN{constructor(e,t,i,l,a){this.view=e,this.decorations=l,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new TN(e),this.text=new CN(e.state.doc),this.builder=new _N(this.cache,new $d(e,e.contentDOM),nt.iter(i)),this.cache.reused.set(t,2),this.old=new kN(t),this.reuseWalker={skip:(o,u,f)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,a=0,o=0;;){let u=o<e.length?e[o++]:null,f=u?u.fromA:this.old.root.length;if(f>l){let d=f-l;this.preserve(d,!o,!u),l=f,a+=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(a,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),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(a,u.toB)),a=u.toB,l=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let l=DN(this.old),a=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,u,f)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u<o.length?La.of(o.widget,this.view,f-u,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,l,a),a=l.length)}else if(o.isText())this.builder.ensureLine(null),!u&&f==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,l,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(u,f),l,a)),a=l.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof xd)this.cache.add(o);else if(o instanceof _i)this.builder.ensureLine(null),this.builder.addMark(o,l,a),this.cache.reused.set(o,1),a=l.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof _i&&l.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?l.length&&(l.length=a=0):o instanceof _i&&(l.shift(),a=Math.min(a,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,a=-1,o=nt.spans(this.decorations,e,t,{point:(u,f,d,p,b,x)=>{if(d instanceof Ra){if(this.disallowBlockEffectsFor[x]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,b>p.length)l.continueWidget(f-u);else{let v=d.widget||(d.block?ic.block:ic.inline),w=EN(d),C=this.cache.findWidget(v,f-u,w)||La.of(v,this.view,f-u,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(C)):(l.ensureLine(i),l.addInlineWidget(C,p,b))}i=null}else i=NN(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,p)=>{for(let b=u;b<f;){let x=this.text.next(Math.min(512,f-b));x==null?(l.addLineStartIfNotCovered(i),l.addBreak(),b++):(l.ensureLine(i),l.addText(x,d,b==u?p:d.length),b+=x.length),i=null}a=d.length}});a>-1&&(this.openWidget=o>a),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let a=en.get(l);if(l==this.view.contentDOM)break;a instanceof _i?t.push(a):a!=null&&a.isLine()?i=a:a instanceof Gl||(l.nodeName=="DIV"&&!i&&l!=this.view.contentDOM?i=new nc(l,CA):i||t.push(_i.of(new Ku({tagName:l.nodeName.toLowerCase(),attributes:iN(l)}),l)))}return{line:i,marks:t}}}function _S(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function EN(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const CA={class:"cm-line"};function NN(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Sy(t,n),i&&(n.class+=" "+i)),n}function DN(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof _i&&e.push(i.mark)}return e}function Tg(n){let e=en.get(n);return e&&e.setDOM(n.cloneNode()),n}class ic extends gl{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}}ic.inline=new ic("span");ic.block=new ic("div");const Mg=new class extends gl{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class CS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ze.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 $d(e,e.contentDOM),this.updateInner([new cs(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:b})=>b<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 l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!UN(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let a=l>-1?RN(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:b}=this.hasComposition;i=new cs(p,b,e.changes.mapPos(p,-1),e.changes.mapPos(b,1)).addToSet(i.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(ge.ie||ge.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,u=this.blockWrappers;this.updateDeco();let f=BN(o,this.decorations,e.changes);f.length&&(i=cs.extendWithRanges(i,f));let d=HN(u,this.blockWrappers,e.changes);return d.length&&(i=cs.extendWithRanges(i,d)),a&&!i.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(i=a.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,u=new MN(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&en.get(t.text)&&u.cache.reused.set(en.get(t.text),2),this.tile=u.run(e,t),B0(o,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 a=ge.chrome||ge.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||i.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof Eg&&l.push(a.dom);i.updateGaps(l)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(SA)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,l=this.view.root.activeElement,a=l==i,o=!a&&!(this.view.state.facet(ql)||i.tabIndex>-1)&&_u(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(a||t||o))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,p;if(f.empty?p=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(p=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),ge.gecko&&f.empty&&!this.hasComposition&&ON(d)){let x=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(x,d.node.childNodes[d.offset]||null)),d=p=new Rs(x,0),u=!0}let b=this.view.observer.selectionRange;(u||!b.focusNode||(!Cu(d.node,d.offset,b.anchorNode,b.anchorOffset)||!Cu(p.node,p.offset,b.focusNode,b.focusOffset))&&!this.suppressWidgetCursorChange(b,f))&&(this.view.observer.ignore(()=>{ge.android&&ge.chrome&&i.contains(b.focusNode)&&IN(b.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let x=Bu(this.view.root);if(x)if(f.empty){if(ge.gecko){let v=jN(d.node,d.offset);if(v&&v!=3){let w=(v==1?lA:rA)(d.node,d.offset);w&&(d=new Rs(w.node,w.offset))}}x.collapse(d.node,d.offset),f.bidiLevel!=null&&x.caretBidiLevel!==void 0&&(x.caretBidiLevel=f.bidiLevel)}else if(x.extend){x.collapse(d.node,d.offset);try{x.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),x.removeAllRanges(),x.addRange(v)}o&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Rs(b.anchorNode,b.anchorOffset),this.impreciseHead=p.precise?null:new Rs(b.focusNode,b.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Cu(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,i=Bu(e.root),{anchorNode:l,anchorOffset:a}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let u=o.posAtStart;if(t.head==u||t.head==u+o.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(p.node,p.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let b=e.observer.selectionRange;e.docView.posFromDOM(b.anchorNode,b.anchorOffset)!=t.from&&i.collapse(l,a)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let a;if(e==i.dom)a=i.dom.childNodes[t];else{let o=Yl(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;o==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?o=-1:o=1),e=u}o<0?a=e:a=e.nextSibling}if(a==i.dom.firstChild)return l;for(;a&&!en.get(a);)a=a.nextSibling;if(!a)return l+i.length;for(let o=0,u=l;;o++){let f=i.children[o];if(f.dom==a)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,a=!1,o,u=-1,f=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(a=!0)}else{let b=p+d.length;if(p<=e&&(i=d,l=e-p,a=b<e),b>=e&&!o&&(o=d,u=e-p,f=p>e),p>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(a&&o?i=null:f&&i&&(o=null),i&&t<0||!o?i.domIn(l,t):o.domIn(u,t))}coordsAt(e,t,i){let{tile:l,offset:a}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof Eg?null:l.coordsInWidget(a,t,!0):l.coordsIn(a,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(a,o){if(a.isComposite())for(let u of a.children){if(u.length>=o){let f=l(u,o);if(f)return f}if(o-=u.length,o<0)break}else if(a.isText()&&o<a.length){let u=Rn(a.text,o);if(u==o)return null;let f=zu(a.dom,o,u).getClientRects();for(let d=0;d<f.length;d++){let p=f[d];if(d==f.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return l(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Bt.LTR,d=0,p=(b,x,v)=>{for(let w=0;w<b.children.length&&!(x>l);w++){let C=b.children[w],A=x+C.length,E=C.dom.getBoundingClientRect(),{height:D}=E;if(v&&!w&&(d+=E.top-v.top),C instanceof Gl)A>i&&p(C,x,E);else if(x>=i&&(d>0&&t.push(-d),t.push(D+d),d=0,o)){let B=C.dom.lastChild,H=B?id(B):[];if(H.length){let z=H[H.length-1],L=f?z.right-E.left:E.right-z.left;L>u&&(u=L,this.minWidth=a,this.minWidthFrom=x,this.minWidthTo=A)}}v&&w==b.children.length-1&&(d+=v.bottom-E.bottom),x=A+C.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Bt.RTL:Bt.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let u=0,f;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=id(d.dom);if(p.length!=1)return;u+=p[0].width,f=p[0].height}if(u)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:u/o.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,a;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=id(t.firstChild)[0];i=t.getBoundingClientRect().height,l=o&&o.width?o.width/27:7,a=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:a}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let a=l==t.viewports.length?null:t.viewports[l],o=a?a.from-1:this.view.state.doc.length;if(o>i){let u=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(ze.replace({widget:new Eg(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!a)break;i=a.to+1}return ze.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Yd).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),i=!1,l=this.view.state.facet(Ty).map((a,o)=>{let u=typeof a=="function";return u&&(i=!0),u?a(this.view):a});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(nt.join(l))),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(kA).map(a=>typeof a=="function"?a(this.view):a)}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(vA))try{if(d(this.view,e.range,e))return!0}catch(p){Ci(this.view.state,p,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let a=My(this.view),o={left:i.left-a.left,top:i.top-a.top,right:i.right+a.right,bottom:i.bottom+a.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(rN(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,f),-f),this.view.textDirection==Bt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(t.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){B0(this.tile)}}function B0(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)B0(i,e)}}function ON(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function TA(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=lA(t.focusNode,t.focusOffset),l=rA(t.focusNode,t.focusOffset),a=i||l;if(l&&i&&l.node!=i.node){let u=en.get(l.node);if(!u||u.isText()&&u.text!=l.node.nodeValue)a=l;else if(n.docView.lastCompositionAfterCursor){let f=en.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(a=l)}}if(n.docView.lastCompositionAfterCursor=a!=i,!a)return null;let o=e-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function RN(n,e,t){let i=TA(n,t);if(!i)return null;let{node:l,from:a,to:o}=i,u=l.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new cs(f.mapPos(a),f.mapPos(o),a,o),text:l}}function jN(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let LN=class{constructor(){this.changes=[]}compareRange(e,t){Uo(e,t,this.changes)}comparePoint(e,t){Uo(e,t,this.changes)}boundChange(e){Uo(e,e,this.changes)}};function BN(n,e,t){let i=new LN;return nt.compare(n,e,t,i),i.changes}class zN{constructor(){this.changes=[]}compareRange(e,t){Uo(e,t,this.changes)}comparePoint(){}boundChange(e){Uo(e,e,this.changes)}}function HN(n,e,t){let i=new zN;return nt.compare(n,e,t,i),i.changes}function IN(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function UN(n,e){let t=!1;return e&&n.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}class Eg extends gl{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 qN(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),a=e-l.from;if(l.length==0)return Q.cursor(e);a==0?t=1:a==l.length&&(t=-1);let o=a,u=a;t<0?o=Rn(l.text,a,!1):u=Rn(l.text,a);let f=i(l.text.slice(o,u));for(;o>0;){let d=Rn(l.text,o,!1);if(i(l.text.slice(d,o))!=f)break;o=d}for(;u<l.length;){let d=Rn(l.text,u);if(i(l.text.slice(u,d))!=f)break;u=d}return Q.undirectionalRange(o+l.from,u+l.from)}function VN(n,e,t,i,l){let a=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-u)*.5)/u);a+=f*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+A0(o,a,n.state.tabSize)}function z0(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let a of i.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!l||a.type==Yn.Text&&(l.type!=a.type||(t<0?a.from<e:a.to>e)))&&(l=a)}}return l||i}return i}function GN(n,e,t,i){let l=z0(n,e.head,e.assoc||-1),a=!i||l.type!=Yn.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(a){let o=n.dom.getBoundingClientRect(),u=n.textDirectionAt(l.from),f=n.posAtCoords({x:t==(u==Bt.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(f!=null)return Q.cursor(f,t?-1:1)}return Q.cursor(t?l.to:l.from,t?-1:1)}function TS(n,e,t,i){let l=n.state.doc.lineAt(e.head),a=n.bidiSpans(l),o=n.textDirectionAt(l.from);for(let u=e,f=null;;){let d=yN(l,a,o,u,t),p=fA;if(!d){if(l.number==(t?n.state.doc.lines:1))return u;p=`
|
|
123
|
-
`,l=n.state.doc.line(l.number+(t?1:-1)),a=n.bidiSpans(l),d=n.visualLineSide(l,!t)}if(f){if(!f(p))return u}else{if(!i)return d;f=i(p)}u=d}}function PN(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return a=>{let o=i(a);return l==$t.Space&&(l=o),l==o}}function YN(n,e,t,i){let l=e.head,a=t?1:-1;if(l==(t?n.state.doc.length:0))return Q.cursor(l,e.assoc);let o=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=n.documentTop;if(d)o==null&&(o=d.left-f.left),u=a<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);o==null&&(o=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),u=(a<0?w.top:w.bottom)+p}let b=f.left+o,x=n.viewState.heightOracle.textHeight>>1,v=i??x;for(let w=0;;w+=x){let C=u+(v+w)*a,A=H0(n,{x:b,y:C},!1,a);if(t?C>f.bottom:C<f.top)return Q.cursor(A.pos,A.assoc);let E=n.coordsAtPos(A.pos,A.assoc),D=E?(E.top+E.bottom)/2:0;if(!E||(t?D>u:D<u))return Q.cursor(A.pos,A.assoc,void 0,o)}}function Tu(n,e,t){for(;;){let i=0;for(let l of n)l.between(e-1,e+1,(a,o,u)=>{if(e>a&&e<o){let f=i||t||(e-a<o-e?-1:1);e=f<0?a:o,i=f}});if(!i)return e}}function MA(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],a=null;if(l.empty){let o=Tu(n,l.from,0);o!=l.from&&(a=Q.cursor(o,-1))}else{let o=Tu(n,l.from,-1),u=Tu(n,l.to,1);(o!=l.from||u!=l.to)&&(l.undirectional?a=Q.undirectionalRange(l.from,l.to):a=Q.range(l.from==l.anchor?o:u,l.from==l.head?o:u))}a&&(t||(t=e.ranges.slice()),t[i]=a)}return t?Q.create(t,e.mainIndex):e}function Ng(n,e,t){let i=Tu(n.state.facet(Qu).map(l=>l(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:Q.cursor(i,i<t.from?1:-1)}class cl{constructor(e,t){this.pos=e,this.assoc=t}}function H0(n,e,t,i){let l=n.contentDOM.getBoundingClientRect(),a=l.top+n.viewState.paddingTop,{x:o,y:u}=e,f=u-a,d;for(;;){if(f<0)return new cl(0,1);if(f>n.viewState.docHeight)return new cl(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Yn.Text){if(i<0?d.to<n.viewport.from:d.from>n.viewport.to)break;let x=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(x&&(i<0?x.top<=f+a:x.bottom>=f+a))break}let b=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+b:d.top-b}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Yn.Text){let b=VN(n,l,d,o,u);return new cl(b,b==d.from?1:-1)}}if(d.type!=Yn.Text)return f<(d.top+d.bottom)/2?new cl(d.from,1):new cl(d.to,-1);let p=n.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=n.docView.lineAt(d.from,-2)),new FN(n,o,u,n.textDirectionAt(d.from)).scanTile(p,d.from)}class FN{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,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:i,spans:l}=this.bidiSpansAt(e);return l[fl.find(l,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:l}=this.bidiSpansAt(e);return l[fl.find(l,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:l}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from<t)}scan(e,t,i=!1){let l=0,a=e.length-1,o=new Set,u=this.bidiIn(e[0],e[a]),f,d,p=-1,b=1e9,x;e:for(;l<a;){let w=a-l,C=l+a>>1;t:if(o.has(C)){let E=l+Math.floor(Math.random()*w);for(let D=0;D<w;D++){if(!o.has(E)){C=E;break t}E++,E==a&&(E=l)}break e}o.add(C);let A=t(C);if(A)for(let E=0;E<A.length;E++){let D=A[E],B=0;if(!(D.width==0&&A.length>1)){if(D.bottom<this.y)(!f||f.bottom<D.bottom)&&(f=D),B=1;else if(D.top>this.y)(!d||d.top>D.top)&&(d=D),B=-1;else{let H=D.left>this.x?this.x-D.left:D.right<this.x?this.x-D.right:0,z=Math.abs(H);z<b&&(p=C,b=z,x=D),H&&(B=H<0==(this.baseDir==Bt.LTR)?-1:1)}B==-1&&(!u||this.baseDirAt(e[C],1))?a=C:B==1&&(!u||this.baseDirAt(e[C+1],-1))&&(l=C+1)}}}if(!x){if(!d&&!f)return{i:e[0],after:!1};let w=f&&(!d||this.y-f.bottom<d.top-this.y)?f:d;return this.y=(w.top+w.bottom)/2,this.scan(e,t,!0)}if(b&&!i){let{top:w,bottom:C}=x;if(f&&f.bottom>(w+w+C)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+C+C)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[p],1):this.baseDir)==Bt.LTR;return{i:p,after:this.x>(x.left+x.right)/2==v}}scanText(e,t){let i=[];for(let a=0;a<e.length;a=Rn(e.text,a))i.push(t+a);i.push(t+e.length);let l=this.scan(i,a=>{let o=i[a]-t,u=i[a+1]-t;return zu(e.dom,o,u).getClientRects()});return l.after?new cl(i[l.i+1],-1):new cl(i[l.i],1)}scanTile(e,t){if(!e.length)return new cl(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 i=[t];for(let u=0,f=t;u<e.children.length;u++)i.push(f+=e.children[u].length);let l=this.scan(i,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:zu(f.dom,0,f.length)).getClientRects()}),a=e.children[l.i],o=i[l.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):l.after?new cl(i[l.i+1],-1):new cl(o,1)}}const Eo="";class $N{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(pt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Eo}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let a=this.text.length;this.readNode(l);let o=en.get(l),u=l.nextSibling;if(u==t){o!=null&&o.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=en.get(u);(o&&f?o.breakAfter:(o?o.breakAfter:gd(l))||gd(u)&&(l.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!KN(u,t)&&this.lineBreak(),l=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,u;if(this.lineSeparator?(a=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(u=l.exec(t))&&(a=u.index,o=u[0].length),this.append(t.slice(i,a<0?t.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=o-1);i=a+o}}readNode(e){let t=en.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(WN(e,i.node,i.offset)?t:0))}}function WN(n,e,t){for(;;){if(!e||t<Yl(e))return!1;if(e==n)return!0;t=Vr(e)+1,e=e.parentNode}}function KN(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=en.get(n);if(!(i!=null&&i.isWidget()))return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let l=i.overrideDOMText;if(l!=null&&l.length)return!1}return!0}class MS{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class XN{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=EA(e.docView.tile,t,i,0))){let f=a||o?[]:ZN(e),d=new $N(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JN(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=a&&a.node==f.focusNode&&a.offset==f.focusOffset||!D0(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),p=o&&o.node==f.anchorNode&&o.offset==f.anchorOffset||!D0(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),b=e.viewport;if((ge.ios||ge.chrome)&&d!=p&&Math.min(d,p)<=u.main.from&&Math.max(d,p)>=u.main.to&&(b.from>0||b.to<e.state.doc.length)){let x=Math.min(d,p),v=Math.max(d,p),w=b.from-x,C=b.to-v;(w==0||w==1||x==0)&&(C==0||C==-1||v==e.state.doc.length)&&(d=0,p=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(Q.range(p,d));else if(e.lineWrapping&&p==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let x=e.coordsAtPos(d,-1),v=0;x&&(v=e.inputState.lastTouchY<=x.bottom?-1:1),this.newSel=Q.create([Q.cursor(d,v)])}else this.newSel=Q.single(p,d)}}}function EA(n,e,t,i){if(n.isComposite()){let l=-1,a=-1,o=-1,u=-1;for(let f=0,d=i,p=i;f<n.children.length;f++){let b=n.children[f],x=d+b.length;if(d<e&&x>t)return EA(b,e,t,d);if(x>=e&&l==-1&&(l=f,a=d),d>t&&b.dom.parentNode==n.dom){o=f,u=p;break}p=x,d=x+b.breakAfter}return{from:a,to:u<0?i+n.length:u,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function NA(n,e){let t,{newSel:i}=e,{state:l}=n,a=l.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=a.from,p=null;(o===8||ge.android&&e.text.length<f-u)&&(d=a.to,p="end");let b=l.doc.sliceString(u,f,Eo),x,v;!a.empty&&a.from>=u&&a.to<=f&&(e.typeOver||b!=e.text)&&b.slice(0,a.from-u)==e.text.slice(0,a.from-u)&&b.slice(a.to-u)==e.text.slice(x=e.text.length-(b.length-(a.to-u)))?t={from:a.from,to:a.to,insert:ct.of(e.text.slice(a.from-u,x).split(Eo))}:(v=DA(b,e.text,d-u,p))&&(ge.chrome&&o==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==Eo+Eo&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:ct.of(e.text.slice(v.from,v.toB).split(Eo))})}else i&&(!n.hasFocus&&l.facet(ql)||Sd(i,a))&&(i=null);if(!t&&!i)return!1;if((ge.mac||ge.android)&&t&&t.from==t.to&&t.from==a.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=Q.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:ct.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(a.from).to<a.to&&n.docView.lineHasWidget(a.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:a.from,to:a.to,insert:l.toText(n.inputState.insertingText)}:ge.chrome&&t&&t.from==t.to&&t.from==a.head&&t.insert.toString()==`
|
|
124
|
-
`&&n.lineWrapping&&(i&&(i=Q.single(i.main.anchor-1,i.main.head-1)),t={from:a.from,to:a.to,insert:ct.of([" "])}),t)return Ey(n,t,i,o);if(i&&!Sd(i,a)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=MA(l.facet(Qu).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function Ey(n,e,t,i=-1){if(ge.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(ge.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&qo(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&qo(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&qo(n.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,u=()=>o||(o=QN(n,e,t));return n.state.facet(gA).some(f=>f(n,e.from,e.to,a,u))||n.dispatch(u()),!0}function QN(n,e,t){let i,l=n.state,a=l.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let f=e.from<a.from?-1:1,d=f<0?a.from:a.to,p=Tu(l.facet(Qu).map(b=>b(n)),d,f);e.from==p&&(o=p)}if(o>-1)i={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=a.from<e.from?l.sliceDoc(a.from,e.from):"",d=a.to>e.to?l.sliceDoc(e.to,a.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let p=n.state.sliceDoc(e.from,e.to),b,x=t&&TA(n,t.main.head);if(x){let w=e.insert.length-(e.to-e.from);b={from:x.from,to:x.to-w}}else b=n.state.doc.lineAt(a.head);let v=a.to-e.to;i=l.changeByRange(w=>{if(w.from==a.from&&w.to==a.to)return{changes:f,range:d||w.map(f)};let C=w.to-v,A=C-p.length;if(n.state.sliceDoc(A,C)!=p||C>=b.from&&A<=b.to)return{range:w};let E=l.changes({from:A,to:C,insert:e.insert}),D=w.to-a.to;return{changes:E,range:d?Q.range(Math.max(0,d.anchor+D),Math.max(0,d.head+D)):w.map(E)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:u,scrollIntoView:!0})}function DA(n,e,t,i){let l=Math.min(n.length,e.length),a=0;for(;a<l&&n.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==l&&n.length==e.length)return null;let o=n.length,u=e.length;for(;o>0&&u>0&&n.charCodeAt(o-1)==e.charCodeAt(u-1);)o--,u--;if(i=="end"){let f=Math.max(0,a-Math.min(o,u));t-=o+f-a}if(o<a&&n.length<e.length){let f=t<=a&&t>=o?a-t:0;a-=f,u=a+(u-o),o=a}else if(u<a){let f=t<=a&&t>=u?a-t:0;a-=f,o=a+(o-u),u=a}return{from:a,toA:o,toB:u}}function ZN(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:a}=n.observer.selectionRange;return t&&(e.push(new MS(t,i)),(l!=t||a!=i)&&e.push(new MS(l,a))),e}function JN(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?Q.single(t+e,i+e):null}function Sd(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class eD{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,ge.safari&&e.contentDOM.addEventListener("input",()=>null),ge.gecko&&gD(e.contentDOM.ownerDocument)}handleEvent(e){!cD(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 i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=nD(e),i=this.handlers,l=this.view.contentDOM;for(let a in t)if(a!="scroll"){let o=!t[a].handlers.length,u=i[a];u&&o!=!u.handlers.length&&(l.removeEventListener(a,this.handleEvent),u=null),u||l.addEventListener(a,this.handleEvent,{passive:o})}for(let a in i)a!="scroll"&&!t[a]&&l.removeEventListener(a,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&&RA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ge.android&&ge.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ge.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(OA.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||iD.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&ge.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&tD(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,qo(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ge.safari&&!ge.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 tD(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function ES(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){Ci(t.state,l)}}}function nD(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,a=l&&l.plugin.domEventHandlers,o=l&&l.plugin.domEventObservers;if(a)for(let u in a){let f=a[u];f&&t(u).handlers.push(ES(i.value,f))}if(o)for(let u in o){let f=o[u];f&&t(u).observers.push(ES(i.value,f))}}for(let i in Bs)t(i).handlers.push(Bs[i]);for(let i in pi)t(i).observers.push(pi[i]);return e}const OA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],iD="dthko",RA=[16,17,18,20,91,92,224,225],jh=6;function Lh(n){return Math.max(0,n)*.7+8}function sD(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class lD{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=nA(e.contentDOM),this.atoms=e.state.facet(Qu).map(o=>o(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(pt.allowMultipleSelections)&&rD(e,t),this.dragging=oD(e,t)&&BA(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&&sD(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,a=0,o=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=My(this.view);e.clientX-f.left<=l+jh?t=-Lh(l-e.clientX):e.clientX+f.right>=o-jh&&(t=Lh(e.clientX-o)),e.clientY-f.top<=a+jh?i=-Lh(a-e.clientY):e.clientY+f.bottom>=u-jh&&(i=Lh(e.clientY-u)),this.setScrollSpeed(t,i)}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,i=MA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,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 rD(n,e){let t=n.state.facet(hA);return t.length?t[0](e):ge.mac?e.metaKey:e.ctrlKey}function aD(n,e){let t=n.state.facet(dA);return t.length?t[0](e):ge.mac?!e.altKey:!e.ctrlKey}function oD(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Bu(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let a=0;a<l.length;a++){let o=l[a];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function cD(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=en.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const Bs=Object.create(null),pi=Object.create(null),jA=ge.ie&&ge.ie_version<15||ge.ios&&ge.webkit_version<604;function uD(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),LA(n,t.value)},50)}function Wd(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function LA(n,e){e=Wd(n.state,Ay,e);let{state:t}=n,i,l=1,a=t.toText(e),o=a.lines==t.selection.ranges.length;if(I0!=null&&t.selection.ranges.every(f=>f.empty)&&I0==a.toString()){let f=-1;i=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==f)return{range:d};f=p.from;let b=t.toText((o?a.line(l++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:b},range:Q.cursor(d.from+b.length)}})}else o?i=t.changeByRange(f=>{let d=a.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:Q.cursor(f.from+d.length)}}):i=t.replaceSelection(a);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}pi.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,ge.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};pi.wheel=pi.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Bs.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);pi.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};pi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};pi.touchend=(n,e)=>{n.inputState.touchActive=!1};Bs.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(pA))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=hD(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new lD(n,e,t,i)),i&&n.observer.ignore(()=>{iA(n.contentDOM);let a=n.root.activeElement;a&&!a.contains(n.contentDOM)&&a.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function NS(n,e,t,i){if(i==1)return Q.cursor(e,t);if(i==2)return qN(n.state,e,t);{let l=n.docView.lineAt(e,t),a=n.state.doc.lineAt(l?l.posAtEnd:e),o=l?l.posAtStart:a.from,u=l?l.posAtEnd:a.to;return u<n.state.doc.length&&u==a.to&&u++,Q.undirectionalRange(o,u)}}const fD=ge.ie&&ge.ie_version<=11;let DS=null,OS=0,RS=0;function BA(n){if(!fD)return n.detail;let e=DS,t=RS;return DS=n,RS=Date.now(),OS=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(OS+1)%3:1}function hD(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=BA(e),l=n.state.selection;return{update(a){a.docChanged&&(t.pos=a.changes.mapPos(t.pos),l=l.map(a.changes))},get(a,o,u){let f=n.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=NS(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!o){let b=NS(n,t.pos,t.assoc,i),x=Math.min(b.from,p.from),v=Math.max(b.to,p.to);p=x<p.from?Q.range(x,v,p.assoc):Q.range(v,x,p.assoc)}return o?l.replaceRange(l.main.extend(p.from,p.to,p.assoc)):u&&i==1&&l.ranges.length>1&&(d=dD(l,f.pos))?d:u?l.addRange(p):Q.create([p])}}}function dD(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:l}=n.ranges[t];if(i<=e&&l>=e)return Q.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Bs.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let a=l.posAtStart,o=a+l.length;(a>=t.to||o<=t.from)&&(t=Q.undirectionalRange(a,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wd(n.state,_y,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Bs.dragend=n=>(n.inputState.draggedContent=null,!1);function jS(n,e,t,i){if(t=Wd(n.state,Ay,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=n.inputState,o=i&&a&&aD(n,e)?{from:a.from,to:a.to}:null,u={from:l,insert:t},f=n.state.changes(o?[o,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Bs.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,a=()=>{++l==t.length&&jS(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let u=new FileReader;u.onerror=a,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[o]=u.result),a()},u.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return jS(n,e,i,!0),!0}return!1};Bs.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=jA?null:e.clipboardData;return t?(LA(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(uD(n),!1)};function pD(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function mD(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:a}of n.selection.ranges){let o=n.doc.lineAt(a);o.number>l&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),l=o.number}i=!0}return{text:Wd(n,_y,e.join(n.lineBreak)),ranges:t,linewise:i}}let I0=null;Bs.copy=Bs.cut=(n,e)=>{if(!_u(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=mD(n.state);if(!t&&!l)return!1;I0=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let a=jA?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",t),!0):(pD(n,t),!1)};const zA=Wl.define();function HA(n,e){let t=[];for(let i of n.facet(yA)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:zA.of(!0)}):null}function IA(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=HA(n.state,e);t?n.dispatch(t):n.update([])}},10)}pi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),IA(n)};pi.blur=n=>{n.observer.clearSelectionRange(),IA(n)};pi.compositionstart=pi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};pi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ge.chrome&&ge.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};pi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Bs.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let a=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(a&&o.length){let u=o[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return Ey(n,{from:f,to:d,insert:n.state.toText(a)},null),!0}}let l;if(ge.chrome&&ge.android&&(l=OA.find(a=>a.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let a=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ge.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ge.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>pi.compositionend(n,e),20),!1};const LS=new Set;function gD(n){LS.has(n)||(LS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const BS=["pre-wrap","normal","pre-line","break-spaces"];let sc=!1;function zS(){sc=!1}class yD{constructor(e){this.lineWrapping=e,this.doc=ct.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 BS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,a,o){let u=BS.indexOf(e)>-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=a,f){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return f}}class bD{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Os{constructor(e,t,i,l,a){this.from=e,this.length=t,this.top=i,this.height=l,this._content=a}get type(){return typeof this._content=="number"?Yn.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 Ra?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 Os(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var It=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(It||(It={}));const sd=.001;class di{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>sd&&(sc=!0),this.height=e)}replace(e,t,i){return di.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let a=this,o=i.doc;for(let u=l.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:p,toB:b}=l[u],x=a.lineAt(f,It.ByPosNoHeight,i.setDoc(t),0,0),v=x.to>=d?x:a.lineAt(d,It.ByPosNoHeight,i,0,0);for(b+=v.to-d,d=v.to;u>0&&x.from<=l[u-1].toA;)f=l[u-1].fromA,p=l[u-1].fromB,u--,f<x.from&&(x=a.lineAt(f,It.ByPosNoHeight,i,0,0));p+=x.from-f,f=x.from;let w=Ny.build(i.setDoc(o),e,p,b);a=wd(a,a.replace(f,d,w))}return a.updateHeight(i,0)}static empty(){return new Fi(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,a=0;for(;;)if(t==i)if(l>a*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),i+=1+u.break,l-=u.size}else if(a>l*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,a-=u.size}else break;else if(l<a){let u=e[t++];u&&(l+=u.size)}else{let u=e[--i];u&&(a+=u.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new vD(di.of(e.slice(0,t)),o,di.of(e.slice(i)))}}function wd(n,e){return n==e?n:(n.constructor!=e.constructor&&(sc=!0),e)}di.prototype.size=1;const xD=ze.replace({});class UA extends di{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Os(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,l){return this.spaceAbove&&e<i+this.spaceAbove?new Os(l,0,i,this.spaceAbove,xD):this.mainBlock(i,l)}lineAt(e,t,i,l,a){let o=this.mainBlock(l,a);return this.spaceAbove?this.blockAt(0,i,l,a).join(o):o}forEachLine(e,t,i,l,a,o){e<=a+this.length&&t>=a&&o(this.lineAt(0,It.ByPos,i,l,a))}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,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Fi extends UA{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Os(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Fi||l instanceof qn&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof qn?l=new Fi(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):di.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||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 qn extends di{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,a=l-i+1,o,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*a);o=f/a,this.length>a+1&&(u=(this.height-f)/(this.length-a-1))}else o=this.height/a;return{firstLine:i,lastLine:l,perLine:o,perChar:u}}blockAt(e,t,i,l){let{firstLine:a,lastLine:o,perLine:u,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),p=t.doc.lineAt(d),b=u+p.length*f,x=Math.max(i,e-b/2);return new Os(p.from,p.length,x,b,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((e-i)/u))),{from:p,length:b}=t.doc.line(a+d);return new Os(p,b,i+u*d,u,0)}}lineAt(e,t,i,l,a){if(t==It.ByHeight)return this.blockAt(e,i,l,a);if(t==It.ByPosNoHeight){let{from:v,to:w}=i.doc.lineAt(e);return new Os(v,w-v,0,0,0)}let{firstLine:o,perLine:u,perChar:f}=this.heightMetrics(i,a),d=i.doc.lineAt(e),p=u+d.length*f,b=d.number-o,x=l+u*b+f*(d.from-a-b);return new Os(d.from,d.length,Math.max(l,Math.min(x,l+this.height-p)),p,0)}forEachLine(e,t,i,l,a,o){e=Math.max(e,a),t=Math.min(t,a+this.length);let{firstLine:u,perLine:f,perChar:d}=this.heightMetrics(i,a);for(let p=e,b=l;p<=t;){let x=i.doc.lineAt(p);if(p==e){let w=x.number-u;b+=f*w+d*(e-a-w)}let v=f+d*x.length;o(new Os(x.from,x.length,b,v,0)),b+=v,p=x.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let a=i[i.length-1];a instanceof qn?i[i.length-1]=new qn(a.length+l):i.push(null,new qn(l-1))}if(e>0){let a=i[0];a instanceof qn?i[0]=new qn(e+a.length):i.unshift(new qn(e-1),null)}return di.of(i)}decomposeLeft(e,t){t.push(new qn(e-1),null)}decomposeRight(e,t){t.push(null,new qn(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let a=t+this.length;if(l&&l.from<=t+this.length&&l.more){let o=[],u=Math.max(t,l.from),f=-1;for(l.from>t&&o.push(new qn(l.from-t-1).updateHeight(e,t));u<=a&&l.more;){let p=e.doc.lineAt(u).length;o.length&&o.push(null);let b=l.heights[l.index++],x=0;b<0&&(x=-b,b=l.heights[l.index++]),f==-1?f=b:Math.abs(b-f)>=sd&&(f=-2);let v=new Fi(p,b,x);v.outdated=!1,o.push(v),u+=p+1}u<=a&&o.push(null,new qn(a-u).updateHeight(e,u));let d=di.of(o);return(f<0||Math.abs(d.height-this.height)>=sd||Math.abs(f-this.heightMetrics(e,t).perLine)>=sd)&&(sc=!0),wd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class vD extends di{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let a=i+this.left.height;return e<a?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,a,l+this.left.length+this.break)}lineAt(e,t,i,l,a){let o=l+this.left.height,u=a+this.left.length+this.break,f=t==It.ByHeight?e<o:e<u,d=f?this.left.lineAt(e,t,i,l,a):this.right.lineAt(e,t,i,o,u);if(this.break||(f?d.to<u:d.from>u))return d;let p=t==It.ByPosNoHeight?It.ByPosNoHeight:It.ByPos;return f?d.join(this.right.lineAt(u,p,i,o,u)):this.left.lineAt(u,p,i,l,a).join(d)}forEachLine(e,t,i,l,a,o){let u=l+this.left.height,f=a+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,t,i,l,a,o),t>=f&&this.right.forEachLine(e,t,i,u,f,o);else{let d=this.lineAt(f,It.ByPos,i,l,a);e<d.from&&this.left.forEachLine(e,d.from-1,i,l,a,o),d.to>=e&&d.from<=t&&o(d),t>d.to&&this.right.forEachLine(d.to+1,t,i,u,f,o)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let a=[];e>0&&this.decomposeLeft(e,a);let o=a.length;for(let u of i)a.push(u);if(e>0&&HS(a,o-1),t<this.length){let u=a.length;this.decomposeRight(t,a),HS(a,u)}return di.of(a)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?di.of(this.break?[e,null,t]:[e,t]):(this.left=wd(this.left,e),this.right=wd(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,i=!1,l){let{left:a,right:o}=this,u=t+a.length+this.break,f=null;return l&&l.from<=t+a.length&&l.more?f=a=a.updateHeight(e,t,i,l):a.updateHeight(e,t,i),l&&l.from<=u+o.length&&l.more?f=o=o.updateHeight(e,u,i,l):o.updateHeight(e,u,i),f?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function HS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof qn&&(i=n[e+1])instanceof qn&&n.splice(e-1,3,new qn(t.length+1+i.length))}const SD=5;class Ny{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Fi?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Fi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,a=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new UA(o,l,i)):(o||a||l>=SD)&&this.addLineDeco(l,a,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Fi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new qn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Fi)return e;let t=new Fi(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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Fi)&&!this.isCovered?this.nodes.push(new Fi(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Fi&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let a=new Ny(i,e);return nt.spans(t,i,l,a,0),a.finish(i)}}function wD(n,e,t){let i=new kD;return nt.compare(n,e,t,i,0),i.changes}class kD{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&Uo(e,t,this.changes,5)}}function AD(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,l=i.defaultView||window,a=Math.max(0,t.left),o=Math.min(l.innerWidth,t.right),u=Math.max(0,t.top),f=Math.min(l.innerHeight,t.bottom);for(let d=n.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,b=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&b.overflow!="visible"){let x=p.getBoundingClientRect();a=Math.max(a,x.left),o=Math.min(o,x.right),u=Math.max(u,x.top),f=Math.min(d==n.parentNode?l.innerHeight:f,x.bottom)}d=b.position=="absolute"||b.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-t.left,right:Math.max(a,o)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function _D(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function CD(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Dg{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],a=t[i];if(l.from!=a.from||l.to!=a.to||l.size!=a.size)return!1}return!0}draw(e,t){return ze.replace({widget:new TD(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class TD extends gl{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 IS{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=US,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Bt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(Cy).some(l=>typeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new yD(i),this.stateDeco=qS(t),this.heightMap=di.empty().applyChanges(this.stateDeco,ct.empty,this.heightOracle.setDoc(t.doc),[new cs(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ze.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:a,to:o})=>l>=a&&l<=o)){let{from:a,to:o}=this.lineBlockAt(l);e.push(new Bh(a,o))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?US:new Dy(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(Su(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=qS(this.state);let l=e.changedRanges,a=cs.extendWithRanges(l,wD(i,this.stateDeco,e?e.changes:vn.empty(this.state.doc.length))),o=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);zS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||sc)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let f=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<f.from||t.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,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(xA)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,a=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Bt.RTL:Bt.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=o||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:z,scaleY:L}=tA(t,u);(z>.005&&Math.abs(this.scaleX-z)>.005||L>.005&&Math.abs(this.scaleY-L)>.005)&&(this.scaleX=z,this.scaleY=L,d|=16,o=f=!0)}let b=(parseInt(i.paddingTop)||0)*this.scaleY,x=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=b||this.paddingBottom!=x)&&(this.paddingTop=b,this.paddingBottom=x,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=nA(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=sA(this.scrollParent||e.win);let C=(this.printing?CD:AD)(t,this.paddingTop),A=C.top-this.pixelViewport.top,E=C.bottom-this.pixelViewport.bottom;this.pixelViewport=C;let D=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(D!=this.inView&&(this.inView=D,D&&(f=!0)),!this.inView&&!this.scrollTarget&&!_D(e.dom))return 0;let B=u.width;if((this.contentDOMWidth!=B||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let z=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(z)&&(o=!0),o||l.lineWrapping&&Math.abs(B-this.contentDOMWidth)>l.charWidth){let{lineHeight:L,charWidth:R,textHeight:te}=e.docView.measureTextSize();o=L>0&&l.refresh(a,L,R,te,Math.max(5,B/R),z),o&&(e.docView.minWidth=0,d|=16)}A>0&&E>0?p=Math.max(A,E):A<0&&E<0&&(p=Math.min(A,E)),zS();for(let L of this.viewports){let R=L.from==this.viewport.from?z:e.docView.measureVisibleLineHeights(L);this.heightMap=(o?di.empty().applyChanges(this.stateDeco,ct.empty,this.heightOracle,[new cs(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,o,new bD(L.from,R))}sc&&(d|=2)}let H=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return H&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||H)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]: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 i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:u}=this,f=new Bh(l.lineAt(o-i*1e3,It.ByHeight,a,0,0).from,l.lineAt(u+(1-i)*1e3,It.ByHeight,a,0,0).to);if(t){let{head:d}=t.range;if(d<f.from||d>f.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),b=l.lineAt(d,It.ByPos,a,0,0),x;t.y=="center"?x=(b.top+b.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<f.from?x=b.top:x=b.bottom-p,f=new Bh(l.lineAt(x-1e3/2,It.ByHeight,a,0,0).from,l.lineAt(x+p+1e3/2,It.ByHeight,a,0,0).to)}}return f}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Bh(this.heightMap.lineAt(i,It.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,It.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,It.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(t,It.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:u}=this;return(e==0||l<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||a>=u+Math.max(10,Math.min(i,250)))&&l>o-2*1e3&&a<u+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new Dg(t.mapPos(l.from),t.mapPos(l.to),l.size,l.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,a=l>>1,o=l<<1;if(this.defaultTextDirection!=Bt.LTR&&!i)return[];let u=[],f=(p,b,x,v)=>{if(b-p<a)return;let w=this.state.selection.main,C=[w.from];w.empty||C.push(w.to);for(let E of C)if(E>p&&E<b){f(p,E-10,x,v),f(E+10,b,x,v);return}let A=ED(e,E=>E.from>=x.from&&E.to<=x.to&&Math.abs(E.from-p)<a&&Math.abs(E.to-b)<a&&!C.some(D=>E.from<D&&E.to>D));if(!A){if(b<x.to&&t&&i&&t.visibleRanges.some(B=>B.from<=b&&B.to>=b)){let B=t.moveToLineBoundary(Q.cursor(b),!1,!0).head;B>p&&(b=B)}let E=this.gapSize(x,p,b,v),D=i||E<2e6?E:2e6;A=new Dg(p,b,E,D)}u.push(A)},d=p=>{if(p.length<o||p.type!=Yn.Text)return;let b=MD(p.from,p.to,this.stateDeco);if(b.total<o)return;let x=this.scrollTarget?this.scrollTarget.range.head:null,v,w;if(i){let C=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,A,E;if(x!=null){let D=Hh(b,x),B=((this.visibleBottom-this.visibleTop)/2+C)/p.height;A=D-B,E=D+B}else A=(this.visibleTop-p.top-C)/p.height,E=(this.visibleBottom-p.top+C)/p.height;v=zh(b,A),w=zh(b,E)}else{let C=b.total*this.heightOracle.charWidth,A=l*this.heightOracle.charWidth,E=0;if(C>2e6)for(let L of e)L.from>=p.from&&L.from<p.to&&L.size!=L.displaySize&&L.from*this.heightOracle.charWidth+E<this.pixelViewport.left&&(E=L.size-L.displaySize);let D=this.pixelViewport.left+E,B=this.pixelViewport.right+E,H,z;if(x!=null){let L=Hh(b,x),R=((B-D)/2+A)/C;H=L-R,z=L+R}else H=(D-A)/C,z=(B+A)/C;v=zh(b,H),w=zh(b,z)}v>p.from&&f(p.from,v,p,b),w<p.to&&f(w,p.to,p,b)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return u}gapSize(e,t,i,l){let a=Hh(l,i)-Hh(l,t);return this.heightOracle.lineWrapping?e.height*a:l.total*this.heightOracle.charWidth*a}updateLineGaps(e){Dg.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ze.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 i=[];nt.spans(t,this.viewport.from,this.viewport.to,{span(a,o){i.push({from:a,to:o})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let a=0;a<i.length&&!(l&8);a++){let o=this.visibleRanges[a],u=i[a];(o.from!=u.from||o.to!=u.to)&&(l|=4,e&&e.mapPos(o.from,-1)==u.from&&e.mapPos(o.to,1)==u.to||(l|=8))}return this.visibleRanges=i,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Su(this.heightMap.lineAt(e,It.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)||Su(this.heightMap.lineAt(this.scaler.fromDOM(e),It.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Su(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 Bh{constructor(e,t){this.from=e,this.to=t}}function MD(n,e,t){let i=[],l=n,a=0;return nt.spans(t,n,e,{span(){},point(o,u){o>l&&(i.push({from:l,to:o}),a+=o-l),l=u}},20),l<e&&(i.push({from:l,to:e}),a+=e-l),{total:a,ranges:i}}function zh({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:a,to:o}=e[l],u=o-a;if(i<=u)return a+i;i-=u}}function Hh(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function ED(n,e){for(let t of n)if(e(t))return t}const US={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function qS(n){let e=n.facet(Yd).filter(i=>typeof i!="function"),t=n.facet(Ty).filter(i=>typeof i!="function");return t.length&&e.push(nt.join(t)),e}class Dy{constructor(e,t,i){let l=0,a=0,o=0;this.viewports=i.map(({from:u,to:f})=>{let d=t.lineAt(u,It.ByPos,e,0,0).top,p=t.lineAt(f,It.ByPos,e,0,0).bottom;return l+=p-d,{from:u,to:f,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let u of this.viewports)u.domTop=o+(u.top-a)*this.scale,o=u.domBottom=u.domTop+(u.bottom-u.top),a=u.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.top)return l+(e-i)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);i=a.bottom,l=a.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.domTop)return i+(e-l)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);i=a.bottom,l=a.domBottom}}eq(e){return e instanceof Dy?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Su(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Os(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>Su(l,e)):n._content)}const Ih=be.define({combine:n=>n.join(" ")}),U0=be.define({combine:n=>n.indexOf(!0)>-1}),q0=Ur.newName(),qA=Ur.newName(),VA=Ur.newName(),GA={"&light":"."+qA,"&dark":"."+VA};function V0(n,e,t){return new Ur(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const ND=V0("."+q0,{"&":{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"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},GA),DD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Og=ge.ie&&ge.ie_version<=11;class OD{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new aN,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(ge.ie&&ge.ie_version<=11||ge.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ge.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ge.chrome&&ge.chrome_version<126)&&(this.editContext=new jD(e),e.state.facet(ql)&&(e.contentDOM.editContext=this.editContext.editContext)),Og&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(ql)?i.root.activeElement!=this.dom:!_u(this.dom,l))return;let a=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ge.ie&&ge.ie_version<=11||ge.android&&ge.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Cu(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Bu(e.root);if(!t)return!1;let i=ge.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&RD(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=_u(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&cN(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(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 i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,DD),Og&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Og&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&qo(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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,i=-1,l=!1;for(let a of e){let o=this.readMutation(a);o&&(o.typeOver&&(l=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&_u(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new XN(this.view,e,t,i);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,l=NA(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!Sd(this.view.state.selection,t.newSel.main))&&this.view.update([]),l}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 i=VS(t,e.previousSibling||e.target.previousSibling,-1),l=VS(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):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(ql)!=e.state.facet(ql)&&(e.view.contentDOM.editContext=e.state.facet(ql)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.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 VS(n,e,t){for(;e;){let i=en.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function GS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,a=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Cu(o.node,o.offset,l,a)&&([t,i,l,a]=[l,a,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:a}}function RD(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return GS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?GS(n,t):null}class jD{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=i=>{let l=e.state.selection.main,{anchor:a,head:o}=l,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&a<this.from?u=a:f==this.to&&a>this.to&&(f=a);let p=DA(e.state.sliceDoc(u,f),i.text,(d?l.from:l.to)-u,d?"end":null);if(!p){let x=Q.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Sd(x,l)||e.dispatch({selection:x,userEvent:"select"});return}let b={from:p.from+u,to:p.toA+u,insert:ct.of(i.text.slice(p.from,p.toB).split(`
|
|
125
|
-
`))};if((ge.mac||ge.android)&&b.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(b={from:u,to:f,insert:ct.of([i.text.replace("."," ")])}),this.pendingContextChange=b,!e.state.readOnly){let x=this.to-this.from+(b.to-b.from+b.insert.length);Ey(e,b,Q.single(this.toEditorPos(i.selectionStart,x),this.toEditorPos(i.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),b.from<b.to&&!b.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],a=null;for(let o=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);o<u;o++){let f=e.coordsForChar(o);a=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||a||new DOMRect,l.push(a)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let a of i.getTextFormats()){let o=a.underlineStyle,u=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(u)){let f=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(f<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;l.push(ze.mark({attributes:{style:p}}).range(f,d))}}}e.dispatch({effects:SA.of(ze.set(l))})},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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=Bu(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((a,o,u,f,d)=>{if(i)return;let p=d.length-(o-a);if(l&&o>=l.to)if(l.from==a&&l.to==o&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=p,this.to+=p;return}else l=null,this.revertPending(e.state);if(a+=t,o+=t,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}t+=p}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}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 i=this.composing;return i&&i.drifted?i.editorBase+(e-i.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 ye{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(a=>i(a,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||oN(e.parent)||document,this.viewState=new IS(this,e.state||pt.create(e)),e.scrollTo&&e.scrollTo.is(Rh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Oo).map(l=>new Cg(l));for(let l of this.plugins)l.update(this);this.observer=new OD(this),this.inputState=new eD(this),this.inputState.ensureHandlers(this.plugins),this.docView=new CS(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 pn?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,i=!1,l,a=this.state;for(let x of e){if(x.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=x.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,u=0,f=null;e.some(x=>x.annotation(zA))?(this.inputState.notifiedFocused=o,u=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,f=HA(a,o),f||(u=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(pt.phrases)!=this.state.facet(pt.phrases))return this.setState(a);l=bd.create(this,a,e),l.flags|=u;let b=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(b&&(b=b.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection,{x:w,y:C}=this.state.facet(ye.cursorScrollMargin);b=new Vo(v.empty?v:Q.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",C,w)}for(let v of x.effects)v.is(Rh)&&(b=v.value.clip(this.state))}this.viewState.update(l,b),this.bidiCache=kd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(vu)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Ih)!=l.state.facet(Ih)&&(this.viewState.mustMeasureContent=!0),(t||i||b||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let x of this.state.facet(L0))try{x(l)}catch(v){Ci(this.state,v,"update listener")}(f||p)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),p&&!NA(this,p)&&d.force&&qo(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 i of this.plugins)i.destroy(this);this.viewState=new IS(this,e),this.plugins=e.facet(Oo).map(i=>new Cg(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new CS(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(Oo),i=e.state.facet(Oo);if(t!=i){let l=[];for(let a of i){let o=t.indexOf(a);if(o<0)l.push(new Cg(a));else{let u=this.plugins[o];u.mustUpdate=e,l.push(u)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=i&&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(i){Ci(this.state,i,"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,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let u=0;;u++){if(o<0)if(sA(i||this.win))a=-1,o=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(l);a=v.from,o=v.top}this.updateState=1;let f=this.viewState.measure();if(!f&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(u>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];f&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(w){return Ci(this.state,w),PS}}),b=bd.create(this,this.state,[]),x=!1;b.flags|=f,t?t.flags|=f:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),x=this.docView.update(b),x&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=PS)try{let w=d[v];w.write&&w.write(p[v],this)}catch(w){Ci(this.state,w)}if(x&&this.docView.updateSelection(!0),!b.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let w=((a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o)/this.scaleY;if((w>1||w<-1)&&!(ge.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+w,i?i.scrollTop+=w:this.win.scrollBy(0,w),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let u of this.state.facet(L0))u(t)}get themeClasses(){return q0+" "+(this.state.facet(U0)?VA:qA)+" "+this.state.facet(Ih)}updateAttrs(){let e=YS(this,wA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ql)?"true":"false",class:"cm-content",style:`${ge.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),YS(this,Cy,t);let i=this.observer.ignore(()=>{let l=vS(this.contentDOM,this.contentAttrs,t),a=vS(this.dom,this.editorAttrs,e);return l||a});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(ye.announce)){t&&(this.announceDOM.textContent=""),t=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(vu);let e=this.state.facet(ye.cspNonce);Ur.mount(this.root,this.styleModules.concat(ND).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(i=>i.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,i){return Ng(this,e,TS(this,e,t,i))}moveByGroup(e,t){return Ng(this,e,TS(this,e,t,i=>PN(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),a=i[t?i.length-1:0];return Q.cursor(a.side(t,l)+e.from,a.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return GN(this,e,t,i)}moveVertically(e,t,i){return Ng(this,e,YN(this,e,t,i))}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 i=H0(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),H0(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),a=l[fl.find(l,e-i.from,-1,t)];return this.docView.coordsAt(e,t,a.dir==Bt.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(bA)||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>LD)return uA(e.length);let t=this.textDirectionAt(e.from),i;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==t&&(a.fresh||cA(a.isolates,i=kS(this,e))))return a.order;i||(i=kS(this,e));let l=gN(e.text,t,i);return this.bidiCache.push(new kd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ge.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{iA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,a,o;return Rh.of(new Vo(typeof e=="number"?Q.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(a=t.yMargin)!==null&&a!==void 0?a:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Rh.of(new Vo(Q.cursor(i.from),"start","start",i.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 rn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return rn.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Ur.newName(),l=[Ih.of(i),vu.of(V0(`.${i}`,e))];return t&&t.dark&&l.push(U0.of(!0)),l}static baseTheme(e){return $l.lowest(vu.of(V0("."+q0,e,GA)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&en.get(i)||en.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}ye.styleModule=vu;ye.inputHandler=gA;ye.clipboardInputFilter=Ay;ye.clipboardOutputFilter=_y;ye.scrollHandler=vA;ye.focusChangeEffect=yA;ye.perLineTextDirection=bA;ye.exceptionSink=mA;ye.updateListener=L0;ye.editable=ql;ye.mouseSelectionStyle=pA;ye.dragMovesSelection=dA;ye.clickAddsSelectionRange=hA;ye.decorations=Yd;ye.blockWrappers=kA;ye.outerDecorations=Ty;ye.atomicRanges=Qu;ye.bidiIsolatedRanges=AA;ye.cursorScrollMargin=be.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});ye.scrollMargins=_A;ye.darkTheme=U0;ye.cspNonce=be.define({combine:n=>n.length?n[0]:""});ye.contentAttributes=Cy;ye.editorAttributes=wA;ye.lineWrapping=ye.contentAttributes.of({class:"cm-lineWrapping"});ye.announce=Ge.define();const LD=4096,PS={};class kd{constructor(e,t,i,l,a,o){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=a,this.order=o}static update(e,t){if(t.empty&&!e.some(a=>a.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Bt.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let o=e[a];o.dir==l&&!t.touchesRange(o.from,o.to)&&i.push(new kd(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function YS(n,e,t){for(let i=n.state.facet(e),l=i.length-1;l>=0;l--){let a=i[l],o=typeof a=="function"?a(n):a;o&&Sy(o,t)}return t}const BD=ge.mac?"mac":ge.windows?"win":ge.linux?"linux":"key";function zD(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,a,o,u;for(let f=0;f<t.length-1;++f){const d=t[f];if(/^(cmd|meta|m)$/i.test(d))u=!0;else if(/^a(lt)?$/i.test(d))l=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?u=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return l&&(i="Alt-"+i),a&&(i="Ctrl-"+i),u&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function Uh(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const HD=$l.default(ye.domEventHandlers({keydown(n,e){return YA(PA(e.state),n,e,"editor")}})),lc=be.define({enables:HD}),FS=new WeakMap;function PA(n){let e=n.facet(lc),t=FS.get(e);return t||FS.set(e,t=qD(e.reduce((i,l)=>i.concat(l),[]))),t}function ID(n,e,t){return YA(PA(n.state),e,n,t)}let Rr=null;const UD=4e3;function qD(n,e=BD){let t=Object.create(null),i=Object.create(null),l=(o,u)=>{let f=i[o];if(f==null)i[o]=u;else if(f!=u)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,u,f,d,p)=>{var b,x;let v=t[o]||(t[o]=Object.create(null)),w=u.split(/ (?!$)/).map(E=>zD(E,e));for(let E=1;E<w.length;E++){let D=w.slice(0,E).join(" ");l(D,!0),v[D]||(v[D]={preventDefault:!0,stopPropagation:!1,run:[B=>{let H=Rr={view:B,prefix:D,scope:o};return setTimeout(()=>{Rr==H&&(Rr=null)},UD),!0}]})}let C=w.join(" ");l(C,!1);let A=v[C]||(v[C]={preventDefault:!1,stopPropagation:!1,run:((x=(b=v._any)===null||b===void 0?void 0:b.run)===null||x===void 0?void 0:x.slice())||[]});f&&A.run.push(f),d&&(A.preventDefault=!0),p&&(A.stopPropagation=!0)};for(let o of n){let u=o.scope?o.scope.split(" "):["editor"];if(o.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:b}=o;for(let x in p)p[x].run.push(v=>b(v,G0))}let f=o[e]||o.key;if(f)for(let d of u)a(d,f,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+f,o.shift,o.preventDefault,o.stopPropagation)}return t}let G0=null;function YA(n,e,t,i){G0=e;let l=tN(e),a=ki(l,0),o=ol(a)==l.length&&l!=" ",u="",f=!1,d=!1,p=!1;Rr&&Rr.view==t&&Rr.scope==i&&(u=Rr.prefix+" ",RA.indexOf(e.keyCode)<0&&(d=!0,Rr=null));let b=new Set,x=A=>{if(A){for(let E of A.run)if(!b.has(E)&&(b.add(E),E(t)))return A.stopPropagation&&(p=!0),!0;A.preventDefault&&(A.stopPropagation&&(p=!0),d=!0)}return!1},v=n[i],w,C;return v&&(x(v[u+Uh(l,e,!o)])?f=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ge.windows&&e.ctrlKey&&e.altKey)&&!(ge.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=qr[e.keyCode])&&w!=l?(x(v[u+Uh(w,e,!0)])||e.shiftKey&&(C=ju[e.keyCode])!=l&&C!=w&&x(v[u+Uh(C,e,!1)]))&&(f=!0):o&&e.shiftKey&&x(v[u+Uh(l,e,!0)])&&(f=!0),!f&&x(v._any)&&(f=!0)),d&&(f=!0),f&&p&&e.stopPropagation(),G0=null,f}class Na{constructor(e,t,i,l,a){this.className=e,this.left=t,this.top=i,this.width=l,this.height=a}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,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let a=FA(e);return[new Na(t,l.left-a.left,l.top-a.top,null,l.bottom-l.top)]}else return VD(e,t,i)}}function FA(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Bt.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function $S(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let a=n.dom.getBoundingClientRect(),o=(l.top+l.bottom)/2,u=n.posAtCoords({x:a.left+1,y:o}),f=n.posAtCoords({x:a.right-1,y:o});return u==null||f==null?i:{from:Math.max(i.from,Math.min(u,f)),to:Math.min(i.to,Math.max(u,f))}}function VD(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),a=n.textDirection==Bt.LTR,o=n.contentDOM,u=o.getBoundingClientRect(),f=FA(n),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),b=u.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),x=u.right-(p?parseInt(p.paddingRight):0),v=z0(n,i,1),w=z0(n,l,-1),C=v.type==Yn.Text?v:null,A=w.type==Yn.Text?w:null;if(C&&(n.lineWrapping||v.widgetLineBreaks)&&(C=$S(n,i,1,C)),A&&(n.lineWrapping||w.widgetLineBreaks)&&(A=$S(n,l,-1,A)),C&&A&&C.from==A.from&&C.to==A.to)return D(B(t.from,t.to,C));{let z=C?B(t.from,null,C):H(v,!1),L=A?B(null,t.to,A):H(w,!0),R=[];return(C||v).to<(A||w).from-(C&&A?1:0)||v.widgetLineBreaks>1&&z.bottom+n.defaultLineHeight/2<L.top?R.push(E(b,z.bottom,x,L.top)):z.bottom<L.top&&n.elementAtHeight((z.bottom+L.top)/2).type==Yn.Text&&(z.bottom=L.top=(z.bottom+L.top)/2),D(z).concat(R).concat(D(L))}function E(z,L,R,te){return new Na(e,z-f.left,L-f.top,Math.max(0,R-z),te-L)}function D({top:z,bottom:L,horizontal:R}){let te=[];for(let fe=0;fe<R.length;fe+=2)te.push(E(R[fe],z,R[fe+1],L));return te}function B(z,L,R){let te=1e9,fe=-1e9,Te=[];function he(Ae,Se,q,J,W){let Ee=n.coordsAtPos(Ae,Ae==R.to?-2:2),Ne=n.coordsAtPos(q,q==R.from?2:-2);!Ee||!Ne||(te=Math.min(Ee.top,Ne.top,te),fe=Math.max(Ee.bottom,Ne.bottom,fe),W==Bt.LTR?Te.push(a&&Se?b:Ee.left,a&&J?x:Ne.right):Te.push(!a&&J?b:Ne.left,!a&&Se?x:Ee.right))}let le=z??R.from,Me=L??R.to;for(let Ae of n.visibleRanges)if(Ae.to>le&&Ae.from<Me)for(let Se=Math.max(Ae.from,le),q=Math.min(Ae.to,Me);;){let J=n.state.doc.lineAt(Se);for(let W of n.bidiSpans(J)){let Ee=W.from+J.from,Ne=W.to+J.from;if(Ee>=q)break;Ne>Se&&he(Math.max(Ee,Se),z==null&&Ee<=le,Math.min(Ne,q),L==null&&Ne>=Me,W.dir)}if(Se=J.to+1,Se>=q)break}return Te.length==0&&he(le,z==null,Me,L==null,n.textDirection),{top:te,bottom:fe,horizontal:Te}}function H(z,L){let R=u.top+(L?z.top:z.bottom);return{top:R,bottom:R,horizontal:[]}}}function GD(n,e){return n.constructor==e.constructor&&n.eq(e)}class PD{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(ld)!=e.state.facet(ld)&&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,i=e.facet(ld);for(;t<i.length&&i[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,i)=>!GD(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,ge.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const ld=be.define();function $A(n){return[rn.define(e=>new PD(e,n)),ld.of(n)]}const rc=be.define({combine(n){return ml(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function YD(n={}){return[rc.of(n),FD,$D,WD,xA.of(!0)]}function WA(n){return n.startState.facet(rc)!=n.state.facet(rc)}const FD=$A({above:!0,markers(n){let{state:e}=n,t=e.facet(rc),i=[];for(let l of e.selection.ranges){let a=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(a&&ge.ios&&t.iosSelectionHandles)){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=l.empty?l:Q.cursor(l.head,l.assoc);for(let f of Na.forRange(n,o,u))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=WA(n);return t&&WS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){WS(e.state,n)},class:"cm-cursorLayer"});function WS(n,e){e.style.animationDuration=n.facet(rc).cursorBlinkRate+"ms"}const $D=$A({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty)for(let a of Na.forRange(n,"cm-selectionBackground",l))e.push(a);if(ge.ios&&!t.empty&&n.state.facet(rc).iosSelectionHandles){for(let l of Na.forRange(n,"cm-selectionHandle cm-selectionHandle-start",Q.cursor(t.from,1)))e.push(l);for(let l of Na.forRange(n,"cm-selectionHandle cm-selectionHandle-end",Q.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||WA(n)},class:"cm-selectionLayer"}),WD=$l.highest(ye.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),KA=Ge.define({map(n,e){return n==null?null:e.mapPos(n)}}),wu=Wn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(KA)?i.value:t,n)}}),KD=rn.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(wu);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(wu)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(wu),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(wu)!=n&&this.view.dispatch({effects:KA.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XD(){return[wu,KD]}function KS(n,e,t,i,l){e.lastIndex=0;for(let a=n.iterRange(t,i),o=t,u;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;u=e.exec(a.value);)l(o+u.index,u)}function QD(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:l,to:a}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),a=Math.min(n.state.doc.lineAt(a).to,a+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=a:i.push({from:l,to:a});return i}class ZD{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:a,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(u,f,d,p)=>l(p,d,d+u[0].length,u,f);else if(typeof i=="function")this.addMatch=(u,f,d,p)=>{let b=i(u,f,d);b&&p(d,d+u[0].length,b)};else if(i)this.addMatch=(u,f,d,p)=>p(d,d+u[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(e){let t=new Pl,i=t.add.bind(t);for(let{from:l,to:a}of QD(e,this.maxLength))KS(e.state.doc,this.regexp,l,a,(o,u)=>this.addMatch(u,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((a,o,u,f)=>{f>=e.view.viewport.from&&u<=e.view.viewport.to&&(i=Math.min(u,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let a of e.visibleRanges){let o=Math.max(a.from,i),u=Math.min(a.to,l);if(u>=o){let f=e.state.doc.lineAt(o),d=f.to<u?e.state.doc.lineAt(u):f,p=Math.max(a.from,f.from),b=Math.min(a.to,d.to);if(this.boundary){for(;o>f.from;o--)if(this.boundary.test(f.text[o-1-f.from])){p=o;break}for(;u<d.to;u++)if(this.boundary.test(d.text[u-d.from])){b=u;break}}let x=[],v,w=(C,A,E)=>x.push(E.range(C,A));if(f==d)for(this.regexp.lastIndex=p-f.from;(v=this.regexp.exec(f.text))&&v.index<b-f.from;)this.addMatch(v,e,v.index+f.from,w);else KS(e.state.doc,this.regexp,p,b,(C,A)=>this.addMatch(A,e,C,w));t=t.update({filterFrom:p,filterTo:b,filter:(C,A)=>C<p||A>b,add:x})}}return t}}const P0=/x/.unicode!=null?"gu":"g",JD=new RegExp(`[\0-\b
|
|
126
|
-
--\u2028\u2029\uFEFF-]`,P0),eO={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 Rg=null;function tO(){var n;if(Rg==null&&typeof document<"u"&&document.body){let e=document.body.style;Rg=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Rg||!1}const rd=be.define({combine(n){let e=ml(n,{render:null,specialChars:JD,addSpecialChars:null});return(e.replaceTabs=!tO())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,P0)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,P0)),e}});function nO(n={}){return[rd.of(n),iO()]}let XS=null;function iO(){return XS||(XS=rn.fromClass(class{constructor(n){this.view=n,this.decorations=ze.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(rd)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new ZD({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,a=ki(e[0],0);if(a==9){let o=l.lineAt(i),u=t.state.tabSize,f=fc(o.text,u,i-o.from);return ze.replace({widget:new aO((u-f%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ze.replace({widget:new rO(n,a)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(rd);n.startState.facet(rd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sO="•";function lO(n){return n>=32?sO:n==10?"":String.fromCharCode(9216+n)}class rO extends gl{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=lO(this.code),i=e.state.phrase("Control character")+" "+(eO[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let a=document.createElement("span");return a.textContent=t,a.title=i,a.setAttribute("aria-label",i),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class aO extends gl{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 oO(){return uO}const cO=ze.line({class:"cm-activeLine"}),uO=rn.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(cO.range(l.from)),e=l.from)}return ze.set(t)}},{decorations:n=>n.decorations}),Y0=2e3;function fO(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),a=[];if(e.off>Y0||t.off>Y0||e.col<0||t.col<0){let o=Math.min(e.off,t.off),u=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=u&&a.push(Q.range(d.from+o,d.to+u))}}else{let o=Math.min(e.col,t.col),u=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),p=A0(d.text,o,n.tabSize,!0);if(p<0)a.push(Q.cursor(d.to));else{let b=A0(d.text,u,n.tabSize);a.push(Q.range(d.from+p,d.from+b))}}}return a}function hO(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function QS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,a=l>Y0?-1:l==i.length?hO(n,e.clientX):fc(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:a,off:l}}function dO(n,e){let t=QS(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let a=l.changes.mapPos(l.startState.doc.line(t.line).from),o=l.state.doc.lineAt(a);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(l.changes)}},get(l,a,o){let u=QS(n,l);if(!u)return i;let f=fO(n.state,t,u);return f.length?o?Q.create(f.concat(i.ranges)):Q.create(f):i}}:null}function pO(n){let e=(t=>t.altKey&&t.button==0);return ye.mouseSelectionStyle.of((t,i)=>e(i)?dO(t,i):null)}const mO={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},gO={style:"cursor: crosshair"};function yO(n={}){let[e,t]=mO[n.key||"Alt"],i=rn.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,ye.contentAttributes.of(l=>{var a;return!((a=l.plugin(i))===null||a===void 0)&&a.isDown?gO:null})]}const qh="-10000px";class XA{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=i(o,a))}update(e,t){var i;let l=e.state.facet(this.facet),a=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let o=[],u=t?[]:null;for(let f=0;f<a.length;f++){let d=a[f],p=-1;if(d){for(let b=0;b<this.tooltips.length;b++){let x=this.tooltips[b];x&&x.create==d.create&&(p=b)}if(p<0)o[f]=this.createTooltipView(d,f?o[f-1]:null),u&&(u[f]=!!d.above);else{let b=o[f]=this.tooltipViews[p];u&&(u[f]=t[p]),b.update&&b.update(e)}}}for(let f of this.tooltipViews)o.indexOf(f)<0&&(this.removeTooltipView(f),(i=f.destroy)===null||i===void 0||i.call(f));return t&&(u.forEach((f,d)=>t[d]=f),t.length=u.length),this.input=l,this.tooltips=a,this.tooltipViews=o,!0}}function bO(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const jg=be.define({combine:n=>{var e,t,i;return{position:ge.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||bO}}}),ZS=new WeakMap,Oy=rn.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(jg);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new XA(n,Ry,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(jg);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=qh,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(ge.safari){let o=a.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.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&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),l=My(this.view);return{visible:{left:i.left+l.left,top:i.top+l.top,right:i.right-l.right,bottom:i.bottom-l.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let u=this.manager.tooltipViews[o];return u.getCoords?u.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(jg).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:a}=n,o=[];for(let u=0;u<this.manager.tooltips.length;u++){let f=this.manager.tooltips[u],d=this.manager.tooltipViews[u],{dom:p}=d,b=n.pos[u],x=n.size[u];if(!b||f.clip!==!1&&(b.bottom<=Math.max(t.top,i.top)||b.top>=Math.min(t.bottom,i.bottom)||b.right<Math.max(t.left,i.left)-.1||b.left>Math.min(t.right,i.right)+.1)){p.style.top=qh;continue}let v=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,C=x.right-x.left,A=(e=ZS.get(d))!==null&&e!==void 0?e:x.bottom-x.top,E=d.offset||vO,D=this.view.textDirection==Bt.LTR,B=x.width>i.right-i.left?D?i.left:i.right-x.width:D?Math.max(i.left,Math.min(b.left-(v?14:0)+E.x,i.right-C)):Math.min(Math.max(i.left,b.left-C+(v?14:0)-E.x),i.right-C),H=this.above[u];!f.strictSide&&(H?b.top-A-w-E.y<i.top:b.bottom+A+w+E.y>i.bottom)&&H==i.bottom-b.bottom>b.top-i.top&&(H=this.above[u]=!H);let z=(H?b.top-i.top:i.bottom-b.bottom)-w;if(z<A&&d.resize!==!1){if(z<this.view.defaultLineHeight){p.style.top=qh;continue}ZS.set(d,A),p.style.height=(A=z)/a+"px"}else p.style.height&&(p.style.height="");let L=H?b.top-A-w-E.y:b.bottom+w+E.y,R=B+C;if(d.overlap!==!0)for(let te of o)te.left<R&&te.right>B&&te.top<L+A&&te.bottom>L&&(L=H?te.top-A-2-w:te.bottom+w+2);if(this.position=="absolute"?(p.style.top=(L-n.parent.top)/a+"px",JS(p,(B-n.parent.left)/l)):(p.style.top=L/a+"px",JS(p,B/l)),v){let te=b.left+(D?E.x:-E.x)-(B+14-7);v.style.left=te/l+"px"}d.overlap!==!0&&o.push({left:B,top:L,right:R,bottom:L+A}),p.classList.toggle("cm-tooltip-above",H),p.classList.toggle("cm-tooltip-below",!H),d.positioned&&d.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=qh}},{eventObservers:{scroll(){this.maybeMeasure()}}});function JS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const xO=ye.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"}}}),vO={x:0,y:0},Ry=be.define({enables:[Oy,xO]}),Ad=be.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Kd{static create(e){return new Kd(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new XA(e,Ad,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SO=Ry.compute([Ad],n=>{let e=n.facet(Ad);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Kd.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),QA=be.define();class wO{constructor(e,t,i,l,a,o){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=a,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.tile.nearest(t.target);if(!i)return;let l,a=1;if(i.isWidget())l=i.posAtStart;else{if(l=e.posAtCoords(t),l==null)return;let o=e.coordsAtPos(l);if(!o||t.y<o.top||t.y>o.bottom||t.x<o.left-e.defaultCharacterWidth||t.x>o.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=u&&u.dir==Bt.RTL?-1:1;a=t.x<o.left?-f:f}this.activateHover(e,l,a)}activateHover(e,t,i,l){let a=this.source(e,t,i),o=u=>{if(u&&!(Array.isArray(u)&&!u.length)){let f=Array.isArray(u)?u:[u];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(a&&"then"in a){let u=this.pending={pos:t};a.then(f=>{this.pending==u&&(this.pending=null,o(f))},f=>Ci(e.state,f,"hover tooltip"))}else o(a)}get tooltip(){let e=this.view.plugin(Oy),t=e?e.manager.tooltips.findIndex(i=>i.create==Kd.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:l,tooltip:a}=this;if(l.length&&!this.locked.has(l)&&a&&!kO(a.dom,e)||this.pending){let{pos:o}=l[0]||this.pending,u=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==u?this.view.posAtCoords(this.lastMove)!=o:!AO(this.view,o,u,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Vh=4;function kO(n,e){let{left:t,right:i,top:l,bottom:a}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let u=o.getBoundingClientRect();l=Math.min(u.top,l),a=Math.max(u.bottom,a)}return e.clientX>=t-Vh&&e.clientX<=i+Vh&&e.clientY>=l-Vh&&e.clientY<=a+Vh}function AO(n,e,t,i,l,a){let o=n.scrollDOM.getBoundingClientRect(),u=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.right<i||o.top>l||Math.min(o.bottom,u)<l)return!1;let f=n.posAtCoords({x:i,y:l},!1);return f>=e&&f<=t}function _O(n,e={}){let t=Ge.define(),i=new WeakMap,l=Wn.define({create(){return[]},update(o,u){let f=i.get(o);if(o.length&&(e.hideOnChange&&(u.docChanged||u.selection)?o=[]:f&&f(u)?o=[]:e.hideOn&&(o=o.filter(d=>!e.hideOn(u,d)))),u.docChanged&&o.length){let d=[];for(let p of o){let b=u.changes.mapPos(p.pos,-1,Gn.TrackDel);if(b!=null){let x=Object.assign(Object.create(null),p);x.pos=b,x.end!=null&&(x.end=u.changes.mapPos(x.end)),d.push(x)}}o=d}for(let d of u.effects)d.is(t)&&(o=d.value,f=void 0),(d.is(TO)&&!d.value||d.value==l)&&(o=[]);return o.length&&f&&i.set(o,f),o},provide:o=>Ad.from(o)});const a=rn.define(o=>new wO(o,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,a,QA.of(a),SO]}}function CO(n,e,t,i={}){var l;let a=n.state.facet(QA).map(o=>n.plugin(o)).filter(o=>!!o);if(i.tooltip&&i.tooltip.active){let o=a.find(u=>u.field==i.tooltip.active);o&&(a=[o])}for(let o of a)o.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function ZA(n,e){let t=n.plugin(Oy);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const TO=Ge.define(),ew=be.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function jy(n,e){let t=n.plugin(JA),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const JA=rn.fromClass(class{constructor(n){this.input=n.state.facet(Hu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(ew);this.top=new Gh(n,!0,e.topContainer),this.bottom=new Gh(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(ew);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Gh(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Gh(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Hu);if(t!=this.input){let i=t.filter(f=>f),l=[],a=[],o=[],u=[];for(let f of i){let d=this.specs.indexOf(f),p;d<0?(p=f(n.view),u.push(p)):(p=this.panels[d],p.update&&p.update(n)),l.push(p),(p.top?a:o).push(p)}this.specs=i,this.panels=l,this.top.sync(a),this.bottom.sync(o);for(let f of u)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>ye.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Gh{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=tw(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=tw(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function tw(n){let e=n.nextSibling;return n.remove(),e}const Hu=be.define({enables:JA});function MO(n,e){let t,i=new Promise(o=>t=o),l=o=>EO(o,e,t);n.state.field(Lg,!1)?n.dispatch({effects:e_.of(l)}):n.dispatch({effects:Ge.appendConfig.of(Lg.init(()=>[l]))});let a=t_.of(l);return{close:a,result:i.then(o=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(Lg).indexOf(l)>-1&&n.dispatch({effects:a})}),o))}}const Lg=Wn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(e_)?n=[t.value].concat(n):t.is(t_)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Hu.computeN([n],e=>e.field(n))}),e_=Ge.define(),t_=Ge.define();function EO(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=Nt("form"),e.input){let u=Nt("input",e.input);/^(text|password|number|email|tel|url)$/.test(u.type)&&u.classList.add("cm-textfield"),u.name||(u.name="input"),i.appendChild(Nt("label",(e.label||"")+": ",u))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Nt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let u=0;u<l.length;u++){let f=l[u];f.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(f))}),f.addEventListener("submit",d=>{d.preventDefault(),o(f)})}let a=Nt("div",i,Nt("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(a.className=e.class),a.classList.add("cm-dialog");function o(u){a.contains(a.ownerDocument.activeElement)&&n.focus(),t(u)}return{dom:a,top:e.top,mount:()=>{if(e.focus){let u;typeof e.focus=="string"?u=i.querySelector(e.focus):u=i.querySelector("input")||i.querySelector("button"),u&&"select"in u?u.select():u&&"focus"in u&&u.focus()}}}}class Fl extends Ir{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Fl.prototype.elementClass="";Fl.prototype.toDOM=void 0;Fl.prototype.mapMode=Gn.TrackBefore;Fl.prototype.startSide=Fl.prototype.endSide=-1;Fl.prototype.point=!0;const ad=be.define(),NO=be.define(),DO={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>nt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Mu=be.define();function OO(n){return[n_(),Mu.of({...DO,...n})]}const nw=be.define({combine:n=>n.some(e=>e)});function n_(n){return[RO]}const RO=rn.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Mu).map(e=>new sw(n,e)),this.fixed=!n.state.facet(nw);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(nw)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=nt.iter(this.view.state.facet(ad),this.view.viewport.from),i=[],l=this.gutters.map(a=>new jO(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(a.type)){let o=!0;for(let u of a.type)if(u.type==Yn.Text&&o){F0(t,i,u.from);for(let f of l)f.line(this.view,u,i);o=!1}else if(u.widget)for(let f of l)f.widget(this.view,u)}else if(a.type==Yn.Text){F0(t,i,a.from);for(let o of l)o.line(this.view,a,i)}else if(a.widget)for(let o of l)o.widget(this.view,a);for(let a of l)a.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Mu),t=n.state.facet(Mu),i=n.docChanged||n.heightChanged||n.viewportChanged||!nt.eq(n.startState.facet(ad),n.state.facet(ad),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let a of t){let o=e.indexOf(a);o<0?l.push(new sw(this.view,a)):(this.gutters[o].update(n),l.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),l.indexOf(a)<0&&a.destroy();for(let a of l)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>ye.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Bt.LTR?{left:i,right:l}:{right:i,left:l}})});function iw(n){return Array.isArray(n)?n:[n]}function F0(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class jO{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=nt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,a=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==l.elements.length){let u=new i_(e,o,a,i);l.elements.push(u),l.dom.appendChild(u.dom)}else l.elements[this.i].update(e,o,a,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];F0(this.cursor,l,t.from),i.length&&(l=l.concat(i));let a=this.gutter.config.lineMarker(e,t,l);a&&l.unshift(a);let o=this.gutter;l.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let a of e.state.facet(NO)){let o=a(e,t.widget,t);o&&(l||(l=[])).push(o)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class sw{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 i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let a=l.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let f=a.getBoundingClientRect();o=(f.top+f.bottom)/2}else o=l.clientY;let u=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,u,l)&&l.preventDefault()});this.markers=iw(t.markers(e)),t.initialSpacer&&(this.spacer=new i_(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=iw(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!nt.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class i_{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),LO(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let a=0,o=0;;){let u=o,f=a<t.length?t[a++]:null,d=!1;if(f){let p=f.elementClass;p&&(i+=" "+p);for(let b=o;b<this.markers.length;b++)if(this.markers[b].compare(f)){u=b,d=!0;break}}else u=this.markers.length;for(;o<u;){let p=this.markers[o++];if(p.toDOM){p.destroy(l);let b=l.nextSibling;l.remove(),l=b}}if(!f)break;f.toDOM&&(d?l=l.nextSibling:this.dom.insertBefore(f.toDOM(e),l)),d&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function LO(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const BO=be.define(),zO=be.define(),Ro=be.define({combine(n){return ml(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let l in t){let a=i[l],o=t[l];i[l]=a?(u,f,d)=>a(u,f,d)||o(u,f,d):o}return i}})}});class Bg extends Fl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function zg(n,e){return n.state.facet(Ro).formatNumber(e,n.state)}const HO=Mu.compute([Ro],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(BO)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new Bg(zg(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(zO)){let a=l(e,t,i);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(Ro)!=e.state.facet(Ro),initialSpacer(e){return new Bg(zg(e,lw(e.state.doc.lines)))},updateSpacer(e,t){let i=zg(t.view,lw(t.view.state.doc.lines));return i==e.number?e:new Bg(i)},domEventHandlers:n.facet(Ro).domEventHandlers,side:"before"}));function IO(n={}){return[Ro.of(n),n_(),HO]}function lw(n){let e=9;for(;e<n;)e=e*10+9;return e}const UO=new class extends Fl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},qO=ad.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(UO.range(l)))}return nt.of(e)});function VO(){return qO}var Hg;const jo=new it;function GO(n){return be.define({combine:n?e=>e.concat(n):void 0})}const PO=new it;class js{constructor(e,t,i=[],l=""){this.data=e,this.name=l,pt.prototype.hasOwnProperty("tree")||Object.defineProperty(pt.prototype,"tree",{get(){return $n(this)}}),this.parser=t,this.extension=[Gr.of(this),pt.languageData.of((a,o,u)=>{let f=rw(a,o,u),d=f.type.prop(jo);if(!d)return[];let p=a.facet(d),b=f.type.prop(PO);if(b){let x=f.resolve(o-f.from,u);for(let v of b)if(v.test(x,a)){let w=a.facet(v.facet);return v.type=="replace"?w:w.concat(p)}}return p})].concat(i)}isActiveAt(e,t,i=-1){return rw(e,t,i).type.prop(jo)==this.data}findRegions(e){let t=e.facet(Gr);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(a,o)=>{if(a.prop(jo)==this.data){i.push({from:o,to:o+a.length});return}let u=a.prop(it.mounted);if(u){if(u.tree.prop(jo)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+o,to:f.to+o});else i.push({from:o,to:o+a.length});return}else if(u.overlay){let f=i.length;if(l(u.tree,u.overlay[0].from+o),i.length>f)return}}for(let f=0;f<a.children.length;f++){let d=a.children[f];d instanceof dn&&l(d,a.positions[f]+o)}};return l($n(e),0),i}get allowsNesting(){return!0}}js.setState=Ge.define();function rw(n,e,t){let i=n.facet(Gr),l=$n(n).topNode;if(!i||i.allowsNesting)for(let a=l;a;a=a.enter(e,t,Lt.ExcludeBuffers|Lt.EnterBracketed))a.type.isTop&&(l=a);return l}class $0 extends js{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=GO(e.languageData);return new $0(t,e.parser.configure({props:[jo.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new $0(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function $n(n){let e=n.field(js.state,!1);return e?e.tree:dn.empty}class YO{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 i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let pu=null;class _d{constructor(e,t,i=[],l,a,o,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=a,this.viewport=o,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new _d(e,t,[],dn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new YO(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=dn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}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 l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(Vl.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,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(Vl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=pu;pu=this;try{return e()}finally{pu=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=aw(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:a,viewport:o,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,p,b,x)=>f.push({fromA:d,toA:p,fromB:b,toB:x})),i=Vl.applyChanges(i,f),l=dn.empty,a=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),b=e.mapPos(d.to,-1);p<b&&u.push({from:p,to:b})}}}return new _d(this.parser,t,i,l,a,o,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 i=0;i<this.skipped.length;i++){let{from:l,to:a}=this.skipped[i];l<e.to&&a>e.from&&(this.fragments=aw(this.fragments,l,a),this.skipped.splice(i--,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 pE{createParse(t,i,l){let a=l[0].from,o=l[l.length-1].to;return{parsedPos:a,advance(){let f=pu;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=o,new dn(Mi.none,[],[],o-a)},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 pu}}function aw(n,e,t){return Vl.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class ac{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new ac(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=_d.create(e.facet(Gr).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new ac(i)}}js.state=Wn.define({create:ac.init,update(n,e){for(let t of e.effects)if(t.is(js.setState))return t.value;return e.startState.facet(Gr)!=e.state.facet(Gr)?ac.init(e.state):n.apply(e)}});let s_=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(s_=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ig=typeof navigator<"u"&&(!((Hg=navigator.scheduling)===null||Hg===void 0)&&Hg.isInputPending)?()=>navigator.scheduling.isInputPending():null,FO=rn.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(js.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(js.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=s_(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:i,viewport:{to:l}}=this.view,a=i.field(js.state);if(a.tree==a.context.tree&&a.context.isDone(l+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ig?Math.max(25,e.timeRemaining()-5):1e9),u=a.context.treeLen<l&&i.doc.length>l+1e3,f=a.context.work(()=>Ig&&Ig()||Date.now()>o,l+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:js.setState.of(new ac(a.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ci(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()}}}),Gr=be.define({combine(n){return n.length?n[0]:null},enables:n=>[js.state,FO,ye.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Dz{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class l_{constructor(e,t,i,l,a,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=l,this.loadFunc=a,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new l_(e.name,(e.alias||[]).concat(e.name).map(l=>l.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let l of e)if(l.filename&&l.filename.test(t))return l;let i=/\.([^.]+)$/.exec(t);if(i){for(let l of e)if(l.extensions.indexOf(i[1])>-1)return l}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let l of e)if(l.alias.some(a=>a==t))return l;if(i)for(let l of e)for(let a of l.alias){let o=t.indexOf(a);if(o>-1&&(a.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+a.length])))return l}return null}}const $O=be.define(),Xd=be.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Cd(n){let e=n.facet(Xd);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Iu(n,e){let t="",i=n.tabSize,l=n.facet(Xd)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let a=0;a<e;a++)t+=l;return t}function Ly(n,e){n instanceof pt&&(n=new Qd(n));for(let i of n.state.facet($O)){let l=i(n,e);if(l!==void 0)return l}let t=$n(n.state);return t.length>=e?KO(n,t,e):null}class Qd{constructor(e,t={}){this.state=e,this.options=t,this.unit=Cd(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:a}=this.options;return l!=null&&l>=i.from&&l<=i.to?a&&l==e?{text:"",from:e}:(t<0?l<e:l<=e)?{text:i.text.slice(l-i.from),from:l}:{text:i.text.slice(0,l-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:l}=this.lineAt(e,t);return i.slice(e-l,Math.min(i.length,e+100-l))}column(e,t=1){let{text:i,from:l}=this.lineAt(e,t),a=this.countColumn(i,e-l),o=this.options.overrideIndentation?this.options.overrideIndentation(l):-1;return o>-1&&(a+=o-this.countColumn(i,i.search(/\S|$/))),a}countColumn(e,t=e.length){return fc(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),a=this.options.overrideIndentation;if(a){let o=a(l);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const WO=new it;function KO(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let a=[];for(let o=l;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)i={node:a[o],next:i}}return r_(i,n,t)}function r_(n,e,t){for(let i=n;i;i=i.next){let l=QO(i.node);if(l)return l(By.create(e,t,i))}return 0}function XO(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function QO(n){let e=n.type.prop(WO);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(it.closedBy))){let l=n.lastChild,a=l&&i.indexOf(l.name)>-1;return o=>a_(o,!0,1,void 0,a&&!XO(o)?l.from:void 0)}return n.parent==null?ZO:null}function ZO(){return 0}class By extends Qd{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new By(e,t,i)}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 i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(JO(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return r_(this.context.next,this.base,this.pos)}}function JO(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function eR(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,a=n.state.doc.lineAt(t.from),o=l==null||l<=a.from?a.to:Math.min(a.to,l);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=o)return null;let d=/^ */.exec(a.text.slice(t.to-a.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function Oz({closing:n,align:e=!0,units:t=1}){return i=>a_(i,e,t,n)}function a_(n,e,t,i,l){let a=n.textAfter,o=a.match(/^\s*/)[0].length,u=i&&a.slice(o,o+i.length)==i||l==n.pos+o,f=e?eR(n):null;return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}const Rz=n=>n.baseIndent;function jz({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const tR=200;function nR(){return pt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+tR)return n;let a=t.sliceString(l.from,i);if(!e.some(d=>d.test(a)))return n;let{state:o}=n,u=-1,f=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==u)continue;u=p.from;let b=Ly(o,p.from);if(b==null)continue;let x=/^\s*/.exec(p.text)[0],v=Iu(o,b);x!=v&&f.push({from:p.from,to:p.from+x.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const iR=be.define(),sR=new it;function Lz(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function lR(n,e,t){let i=$n(n);if(i.length<t)return null;let l=i.resolveStack(t,1),a=null;for(let o=l;o;o=o.next){let u=o.node;if(u.to<=t||u.from>t)continue;if(a&&u.from<e)break;let f=u.type.prop(sR);if(f&&(u.to<i.length-50||i.length==n.doc.length||!rR(u))){let d=f(u,n);d&&d.from<=t&&d.from>=e&&d.to>t&&(a=d)}}return a}function rR(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Td(n,e,t){for(let i of n.facet(iR)){let l=i(n,e,t);if(l)return l}return lR(n,e,t)}function o_(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Zd=Ge.define({map:o_}),Zu=Ge.define({map:o_});function c_(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Ba=Wn.define({create(){return ze.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=ow(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is(Zd)&&!aR(n,i.value.from,i.value.to)?t.push(i.value):i.is(Zu)&&(n=n.update({filter:(l,a)=>i.value.from!=l||i.value.to!=a,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(h_),l=t.map(a=>(i?ze.replace({widget:new pR(i(e.state,a))}):cw).range(a.from,a.to));n=n.update({add:l})}return e.selection&&(n=ow(n,e.selection.main.head)),n},provide:n=>ye.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let i=n[t++],l=n[t++];if(typeof i!="number"||typeof l!="number")throw new RangeError("Invalid JSON for fold state");e.push(cw.range(i,l))}return ze.set(e,!0)}});function ow(n,e,t=e){let i=!1;return n.between(e,t,(l,a)=>{l<t&&a>e&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,a)=>l>=t||a<=e}):n}function Md(n,e,t){var i;let l=null;return(i=n.field(Ba,!1))===null||i===void 0||i.between(e,t,(a,o)=>{(!l||l.from>a)&&(l={from:a,to:o})}),l}function aR(n,e,t){let i=!1;return n.between(e,e,(l,a)=>{l==e&&a==t&&(i=!0)}),i}function u_(n,e){return n.field(Ba,!1)?e:e.concat(Ge.appendConfig.of(d_()))}const oR=n=>{for(let e of c_(n)){let t=Td(n.state,e.from,e.to);if(t)return n.dispatch({effects:u_(n.state,[Zd.of(t),f_(n,t)])}),!0}return!1},cR=n=>{if(!n.state.field(Ba,!1))return!1;let e=[];for(let t of c_(n)){let i=Md(n.state,t.from,t.to);i&&e.push(Zu.of(i),f_(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function f_(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return ye.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const uR=n=>{let{state:e}=n,t=[];for(let i=0;i<e.doc.length;){let l=n.lineBlockAt(i),a=Td(e,l.from,l.to);a&&t.push(Zd.of(a)),i=(a?n.lineBlockAt(a.to):l).to+1}return t.length&&n.dispatch({effects:u_(n.state,t)}),!!t.length},fR=n=>{let e=n.state.field(Ba,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Zu.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},hR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:oR},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:cR},{key:"Ctrl-Alt-[",run:uR},{key:"Ctrl-Alt-]",run:fR}],dR={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},h_=be.define({combine(n){return ml(n,dR)}});function d_(n){return[Ba,yR]}function p_(n,e){let{state:t}=n,i=t.facet(h_),l=o=>{let u=n.lineBlockAt(n.posAtDOM(o.target)),f=Md(n.state,u.from,u.to);f&&n.dispatch({effects:Zu.of(f)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let a=document.createElement("span");return a.textContent=i.placeholderText,a.setAttribute("aria-label",t.phrase("folded code")),a.title=t.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=l,a}const cw=ze.replace({widget:new class extends gl{toDOM(n){return p_(n,null)}}});class pR extends gl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return p_(e,this.value)}}const mR={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Ug extends Fl{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function gR(n={}){let e={...mR,...n},t=new Ug(e,!0),i=new Ug(e,!1),l=rn.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Gr)!=o.state.facet(Gr)||o.startState.field(Ba,!1)!=o.state.field(Ba,!1)||$n(o.startState)!=$n(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let u=new Pl;for(let f of o.viewportLineBlocks){let d=Md(o.state,f.from,f.to)?i:Td(o.state,f.from,f.to)?t:null;d&&u.add(f.from,f.from,d)}return u.finish()}}),{domEventHandlers:a}=e;return[l,OO({class:"cm-foldGutter",markers(o){var u;return((u=o.plugin(l))===null||u===void 0?void 0:u.markers)||nt.empty},initialSpacer(){return new Ug(e,!1)},domEventHandlers:{...a,click:(o,u,f)=>{if(a.click&&a.click(o,u,f))return!0;let d=Md(o.state,u.from,u.to);if(d)return o.dispatch({effects:Zu.of(d)}),!0;let p=Td(o.state,u.from,u.to);return p?(o.dispatch({effects:Zd.of(p)}),!0):!1}}}),d_()]}const yR=ye.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ju{constructor(e,t){this.specs=e;let i;function l(u){let f=Ur.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const a=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,o=t.scope;this.scope=o instanceof js?u=>u.prop(jo)==o.data:o?u=>u==o:void 0,this.style=my(e.map(u=>({tag:u.tag,class:u.class||l(Object.assign({},u,{tag:null}))})),{all:a}).style,this.module=i?new Ur(i):null,this.themeType=t.themeType}static define(e,t){return new Ju(e,t||{})}}const W0=be.define(),m_=be.define({combine(n){return n.length?[n[0]]:null}});function qg(n){let e=n.facet(W0);return e.length?e:n.facet(m_)}function g_(n,e){let t=[xR],i;return n instanceof Ju&&(n.module&&t.push(ye.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(m_.of(n)):i?t.push(W0.computeN([ye.darkTheme],l=>l.facet(ye.darkTheme)==(i=="dark")?[n]:[])):t.push(W0.of(n)),t}class bR{constructor(e){this.markCache=Object.create(null),this.tree=$n(e.state),this.decorations=this.buildDeco(e,qg(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=$n(e.state),i=qg(e.state),l=i!=qg(e.startState),{viewport:a}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<a.to&&!l&&t.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=a.to)}buildDeco(e,t){if(!t||!this.tree.length)return ze.none;let i=new Pl;for(let{from:l,to:a}of e.visibleRanges)Rk(this.tree,t,(o,u,f)=>{i.add(o,u,this.markCache[f]||(this.markCache[f]=ze.mark({class:f})))},l,a);return i.finish()}}const xR=$l.high(rn.fromClass(bR,{decorations:n=>n.decorations})),vR=Ju.define([{tag:Y.meta,color:"#404740"},{tag:Y.link,textDecoration:"underline"},{tag:Y.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strong,fontWeight:"bold"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.keyword,color:"#708"},{tag:[Y.atom,Y.bool,Y.url,Y.contentSeparator,Y.labelName],color:"#219"},{tag:[Y.literal,Y.inserted],color:"#164"},{tag:[Y.string,Y.deleted],color:"#a11"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],color:"#e40"},{tag:Y.definition(Y.variableName),color:"#00f"},{tag:Y.local(Y.variableName),color:"#30a"},{tag:[Y.typeName,Y.namespace],color:"#085"},{tag:Y.className,color:"#167"},{tag:[Y.special(Y.variableName),Y.macroName],color:"#256"},{tag:Y.definition(Y.propertyName),color:"#00c"},{tag:Y.comment,color:"#940"},{tag:Y.invalid,color:"#f00"}]),SR=ye.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),y_=1e4,b_="()[]{}",x_=be.define({combine(n){return ml(n,{afterCursor:!0,brackets:b_,maxScanDistance:y_,renderMatch:AR})}}),wR=ze.mark({class:"cm-matchingBracket"}),kR=ze.mark({class:"cm-nonmatchingBracket"});function AR(n){let e=[],t=n.matched?wR:kR;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function uw(n){let e=[],t=n.facet(x_);for(let i of n.selection.ranges){if(!i.empty)continue;let l=hl(n,i.head,-1,t)||i.head>0&&hl(n,i.head-1,1,t)||t.afterCursor&&(hl(n,i.head,1,t)||i.head<n.doc.length&&hl(n,i.head+1,-1,t));l&&(e=e.concat(t.renderMatch(l,n)))}return ze.set(e,!0)}const _R=rn.fromClass(class{constructor(n){this.paused=!1,this.decorations=uw(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=uw(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),CR=[_R,SR];function TR(n={}){return[x_.of(n),CR]}const MR=new it;function K0(n,e,t){let i=n.prop(e<0?it.openedBy:it.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function X0(n){let e=n.type.prop(MR);return e?e(n.node):n}function hl(n,e,t,i={}){let l=i.maxScanDistance||y_,a=i.brackets||b_,o=$n(n),u=o.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=K0(f.type,t,a);if(d&&f.from<f.to){let p=X0(f);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return ER(n,e,t,f,p,d,a)}}return NR(n,e,t,o,u.type,l,a)}function ER(n,e,t,i,l,a,o){let u=i.parent,f={from:l.from,to:l.to},d=0,p=u==null?void 0:u.cursor();if(p&&(t<0?p.childBefore(i.from):p.childAfter(i.to)))do if(t<0?p.to<=i.from:p.from>=i.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let b=X0(p);return{start:f,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if(K0(p.type,t,o))d++;else if(K0(p.type,-t,o)){if(d==0){let b=X0(p);return{start:f,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:f,matched:!1}}function NR(n,e,t,i,l,a,o){if(t<0?!e:e==n.doc.length)return null;let u=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),f=o.indexOf(u);if(f<0||f%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=n.doc.iterRange(e,t>0?n.doc.length:0),b=0;for(let x=0;!p.next().done&&x<=a;){let v=p.value;t<0&&(x+=v.length);let w=e+x*t;for(let C=t>0?0:v.length-1,A=t>0?v.length:-1;C!=A;C+=t){let E=o.indexOf(v[C]);if(!(E<0||i.resolveInner(w+C,1).type!=l))if(E%2==0==t>0)b++;else{if(b==1)return{start:d,end:{from:w+C,to:w+C+1},matched:E>>1==f>>1};b--}}t>0&&(x+=v.length)}return p.done?{start:d,matched:!1}:null}const DR=Object.create(null),fw=[Mi.none],hw=[],dw=Object.create(null),OR=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])OR[n]=RR(DR,e);function Vg(n,e){hw.indexOf(n)>-1||(hw.push(n),console.warn(e))}function RR(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let p=n[d]||Y[d];p?typeof p=="function"?f.length?f=f.map(p):Vg(d,`Modifier ${d} used at start of tag`):f.length?Vg(d,`Tag ${d} used as modifier`):f=Array.isArray(p)?p:[p]:Vg(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(u=>u.id),a=dw[l];if(a)return a.id;let o=dw[l]=Mi.define({id:fw.length,name:i,props:[CE({[i]:t})]});return fw.push(o),o.id}Bt.RTL,Bt.LTR;const jR=ye.theme({"&":{height:"100%",color:"var(--text)",backgroundColor:"var(--bg)",fontSize:"13px"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.6"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--cm-selection)"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--muted)",borderRight:"1px solid var(--border-soft)"},".cm-activeLineGutter":{backgroundColor:"var(--surface-2)",color:"var(--text-2)"},".cm-activeLine":{backgroundColor:"var(--cm-active)"},".cm-selectionMatch":{backgroundColor:"var(--cm-match)"},"&.cm-focused .cm-matchingBracket":{backgroundColor:"var(--cm-match)",outline:"1px solid var(--accent-line)"},".cm-foldPlaceholder":{backgroundColor:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--muted)"},".cm-panels":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panels input, .cm-panels button, .cm-panels select":{fontFamily:"var(--sans)",fontSize:"12px",background:"var(--surface-2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"6px",padding:"3px 6px"},".cm-searchMatch":{backgroundColor:"var(--cm-match)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)"},".cm-tooltip":{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"var(--shadow-md)",color:"var(--text)"},".cm-tooltip-autocomplete ul li[aria-selected]":{background:"var(--surface-2)",color:"var(--text)"}}),LR=g_(Ju.define([{tag:[Y.keyword,Y.modifier,Y.controlKeyword,Y.moduleKeyword],color:"var(--cm-key)"},{tag:[Y.name,Y.deleted,Y.character,Y.macroName],color:"var(--text)"},{tag:[Y.propertyName],color:"var(--cm-prop)"},{tag:[Y.function(Y.variableName),Y.labelName],color:"var(--cm-fn)"},{tag:[Y.color,Y.constant(Y.name),Y.standard(Y.name),Y.bool],color:"var(--cm-const)"},{tag:[Y.definition(Y.name),Y.separator],color:"var(--text)"},{tag:[Y.typeName,Y.className,Y.changed,Y.annotation,Y.self,Y.namespace],color:"var(--cm-type)"},{tag:[Y.number,Y.integer,Y.float],color:"var(--cm-num)"},{tag:[Y.string,Y.special(Y.string),Y.regexp],color:"var(--cm-str)"},{tag:[Y.operator,Y.operatorKeyword,Y.escape],color:"var(--cm-op)"},{tag:[Y.meta,Y.comment],color:"var(--cm-comment)",fontStyle:"italic"},{tag:Y.strong,fontWeight:"650"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.link,color:"var(--cm-str)",textDecoration:"underline"},{tag:Y.heading,fontWeight:"650",color:"var(--cm-key)"},{tag:Y.invalid,color:"var(--danger)"}])),v_={js:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript(),mjs:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript(),jsx:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await at(async()=>{const{javascript:n}=await import("./index-BMMMWgeR.js");return{javascript:n}},__vite__mapDeps([0,1]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await at(async()=>{const{json:n}=await import("./index-DcGWR_5B.js");return{json:n}},__vite__mapDeps([2,1]),import.meta.url)).json(),jsonc:async()=>(await at(async()=>{const{json:n}=await import("./index-DcGWR_5B.js");return{json:n}},__vite__mapDeps([2,1]),import.meta.url)).json(),css:async()=>(await at(async()=>{const{css:n}=await import("./index-CpwLxLdo.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),scss:async()=>(await at(async()=>{const{css:n}=await import("./index-CpwLxLdo.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),less:async()=>(await at(async()=>{const{css:n}=await import("./index-CpwLxLdo.js");return{css:n}},__vite__mapDeps([3,1]),import.meta.url)).css(),html:async()=>(await at(async()=>{const{html:n}=await import("./index-7poo-d50.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),htm:async()=>(await at(async()=>{const{html:n}=await import("./index-7poo-d50.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),vue:async()=>(await at(async()=>{const{html:n}=await import("./index-7poo-d50.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),svelte:async()=>(await at(async()=>{const{html:n}=await import("./index-7poo-d50.js");return{html:n}},__vite__mapDeps([4,1,3,0]),import.meta.url)).html(),md:async()=>(await at(async()=>{const{markdown:n}=await import("./index-C9vrRfhW.js");return{markdown:n}},__vite__mapDeps([5,4,1,3,0]),import.meta.url)).markdown(),markdown:async()=>(await at(async()=>{const{markdown:n}=await import("./index-C9vrRfhW.js");return{markdown:n}},__vite__mapDeps([5,4,1,3,0]),import.meta.url)).markdown(),py:async()=>(await at(async()=>{const{python:n}=await import("./index-C7CZdm1C.js");return{python:n}},__vite__mapDeps([6,1]),import.meta.url)).python(),pyi:async()=>(await at(async()=>{const{python:n}=await import("./index-C7CZdm1C.js");return{python:n}},__vite__mapDeps([6,1]),import.meta.url)).python(),yaml:async()=>(await at(async()=>{const{yaml:n}=await import("./index-PCsjZn72.js");return{yaml:n}},__vite__mapDeps([7,1]),import.meta.url)).yaml(),yml:async()=>(await at(async()=>{const{yaml:n}=await import("./index-PCsjZn72.js");return{yaml:n}},__vite__mapDeps([7,1]),import.meta.url)).yaml(),rs:async()=>(await at(async()=>{const{rust:n}=await import("./index-DDnDtQl5.js");return{rust:n}},__vite__mapDeps([8,1]),import.meta.url)).rust(),c:async()=>(await at(async()=>{const{cpp:n}=await import("./index-BW8WtNtA.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),h:async()=>(await at(async()=>{const{cpp:n}=await import("./index-BW8WtNtA.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),cc:async()=>(await at(async()=>{const{cpp:n}=await import("./index-BW8WtNtA.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),cpp:async()=>(await at(async()=>{const{cpp:n}=await import("./index-BW8WtNtA.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),hpp:async()=>(await at(async()=>{const{cpp:n}=await import("./index-BW8WtNtA.js");return{cpp:n}},__vite__mapDeps([9,1]),import.meta.url)).cpp(),java:async()=>(await at(async()=>{const{java:n}=await import("./index-DKwcT9vY.js");return{java:n}},__vite__mapDeps([10,1]),import.meta.url)).java(),go:async()=>(await at(async()=>{const{go:n}=await import("./index-XBmPtinY.js");return{go:n}},__vite__mapDeps([11,1]),import.meta.url)).go(),php:async()=>(await at(async()=>{const{php:n}=await import("./index-gDk09Gbz.js");return{php:n}},__vite__mapDeps([12,1,4,3,0]),import.meta.url)).php(),sql:async()=>(await at(async()=>{const{sql:n}=await import("./index-D-buiUaW.js");return{sql:n}},__vite__mapDeps([13,1]),import.meta.url)).sql(),xml:async()=>(await at(async()=>{const{xml:n}=await import("./index-CVP8I8tU.js");return{xml:n}},__vite__mapDeps([14,1]),import.meta.url)).xml(),svg:async()=>(await at(async()=>{const{xml:n}=await import("./index-CVP8I8tU.js");return{xml:n}},__vite__mapDeps([14,1]),import.meta.url)).xml()},BR={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},zR={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function HR(n){const e=zR[n.toLowerCase()]??n.toLowerCase(),t=v_[e];return t?t().catch(()=>null):null}async function IR(n){const e=(n.split("/").pop()??"").toLowerCase(),t=BR[e]??e.split(".").pop()??"",i=v_[t];return i?i().catch(()=>null):null}const UR=my([{tag:[Y.keyword,Y.modifier,Y.controlKeyword,Y.moduleKeyword],class:"cmh-key"},{tag:[Y.propertyName],class:"cmh-prop"},{tag:[Y.function(Y.variableName),Y.labelName],class:"cmh-fn"},{tag:[Y.color,Y.constant(Y.name),Y.standard(Y.name),Y.bool],class:"cmh-const"},{tag:[Y.typeName,Y.className,Y.changed,Y.annotation,Y.self,Y.namespace],class:"cmh-type"},{tag:[Y.number,Y.integer,Y.float],class:"cmh-num"},{tag:[Y.string,Y.special(Y.string),Y.regexp],class:"cmh-str"},{tag:[Y.operator,Y.operatorKeyword,Y.escape],class:"cmh-op"},{tag:[Y.meta,Y.comment],class:"cmh-comment"},{tag:Y.invalid,class:"cmh-invalid"}]);function Ph(n){return n.replace(/[&<>]/g,e=>e==="&"?"&":e==="<"?"<":">")}async function qR(n,e){const t=e?await HR(e):null;if(!t)return Ph(n);try{const i=t.language.parser.parse(n);let l="";return ME(n,i,UR,(a,o)=>{l+=o?`<span class="${o}">${Ph(a)}</span>`:Ph(a)},()=>{l+=`
|
|
127
|
-
`}),l}catch{return Ph(n)}}wt.setOptions({gfm:!0,breaks:!1});function S_(n){var t;const e=(t=n.split(".").pop())==null?void 0:t.toLowerCase();return e==="md"||e==="markdown"}async function w_(n){const e=await wt.parse(n,{async:!0,walkTokens:async t=>{if(t.type!=="code")return;const i=t;i.text=await qR(i.text,i.lang??""),i.escaped=!0}});return rE.sanitize(e)}function pw(n,e){return{path:n.path,text:n.content,saved:n.content,eol:n.eol,mtime:n.mtime,size:n.size,binary:n.binary,tooLarge:n.tooLarge,stale:!1,revision:e,previewMode:S_(n.path)}}function Hl(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function VR(n){return n.split("/").pop()??n}function Go(n){const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function Gg(n){return n<1024?`${n} Б`:n<1024*1024?`${(n/1024).toFixed(1)} КБ`:`${(n/1024/1024).toFixed(1)} МБ`}const GR=3500,PR=9e3,YR=220;function ef({result:n}){const[e,t]=M.useState(n),[i,l]=M.useState(!1);return M.useEffect(()=>{if(!n){t(null),l(!1);return}t(n),l(!1);const a=n.ok?GR:PR,o=setTimeout(()=>l(!0),a),u=setTimeout(()=>t(null),a+YR);return()=>{clearTimeout(o),clearTimeout(u)}},[n]),e?y.jsx("div",{className:"oplog "+(e.ok?"oplog--ok":"oplog--bad")+(i?" oplog--leaving":""),role:"status","aria-live":e.ok?"polite":"assertive",children:e.message}):null}function Ed({value:n,className:e,placeholder:t="Название сессии",onCommit:i,onCancel:l}){const[a,o]=M.useState(n),u=M.useRef(null);M.useEffect(()=>{var d;(d=u.current)==null||d.select()},[]);function f(){const d=a.trim();if(!d||d===n)return l();i(d)}return y.jsx("input",{ref:u,className:e?`rename ${e}`:"rename",value:a,autoFocus:!0,spellCheck:!1,placeholder:t,onChange:d=>o(d.target.value),onBlur:f,onKeyDown:d=>{d.stopPropagation(),d.key==="Enter"?(d.preventDefault(),f()):d.key==="Escape"&&(d.preventDefault(),l())}})}const ga="application/x-ccv-fs-path",FR=200;function $R({open:n,tree:e,expanded:t,activePath:i,dirty:l,gitChanges:a,result:o,searchResult:u,onSearch:f,onReveal:d,onToggle:p,onOpen:b,onCreate:x,onRename:v,onMove:w,onDelete:C,onRefresh:A,onClose:E}){const[D,B]=M.useState(""),[H,z]=M.useState(null),[L,R]=M.useState(null),[te,fe]=M.useState(null),[Te,he]=M.useState(null),le=M.useMemo(()=>QR(a),[a]);function Me(we){return!(!te||we===te.path||te.kind==="dir"&&we.startsWith(`${te.path}/`)||we===Go(te.path))}function Ae(we){return xe=>{xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(ga,we.path),fe({path:we.path,kind:we.kind})}}function Se(){fe(null),he(null)}function q(we){return xe=>{xe.dataTransfer.types.includes(ga)&&(xe.stopPropagation(),!(we.kind!=="dir"||!Me(we.path))&&(xe.preventDefault(),he(we.path)))}}function J(we){return xe=>{if(!xe.dataTransfer.types.includes(ga)||(xe.stopPropagation(),we.kind!=="dir"||!Me(we.path)))return;xe.preventDefault();const Gt=xe.dataTransfer.getData(ga);he(null),Gt&&w(Gt,we.path)}}function W(we){!we.dataTransfer.types.includes(ga)||!Me("")||(we.preventDefault(),he(""))}function Ee(we){if(!we.dataTransfer.types.includes(ga)||!Me(""))return;we.preventDefault();const xe=we.dataTransfer.getData(ga);he(null),xe&&w(xe,"")}const[Ne,N]=M.useState(""),F=Ne.trim(),se=F.length>0,ae=M.useRef(null),de=M.useRef(f);de.current=f;function _e(we){N(we),ae.current&&clearTimeout(ae.current);const xe=we.trim();if(!xe){de.current("");return}ae.current=setTimeout(()=>de.current(xe),FR)}function Re(we){ae.current&&clearTimeout(ae.current),N(""),de.current(""),B(we.path),d(we)}const ft=se&&(u==null?void 0:u.query)===F?u:null;function ht(){if(D==="")return"";const we=XR(e,D);if((we==null?void 0:we.kind)==="dir")return D;const xe=D.lastIndexOf("/");return xe===-1?"":D.slice(0,xe)}function xt(we){const xe=ht();xe&&!t.has(xe)&&p(xe),R({parent:xe,kind:we})}const Ye=se?[]:Sn("",0);function Sn(we,xe){const Gt=e[we],wn=[];if(L&&L.parent===we&&wn.push(y.jsxs("div",{className:"fsrow fsrow--draft",style:Il(xe),children:[y.jsx("span",{className:"fsrow__icon",children:L.kind==="dir"?y.jsx(Dd,{}):y.jsx(Od,{})}),y.jsx(Ed,{className:"rename--file",value:"",placeholder:L.kind==="dir"?"имя каталога":"имя файла",onCommit:qe=>{R(null),x(we,L.kind,qe)},onCancel:()=>R(null)})]},`draft:${we}`)),!Gt)return wn.push(y.jsx("p",{className:"fsrow__pending",style:Il(xe),children:"читаем…"},`wait:${we}`)),wn;Gt.length===0&&!L&&wn.push(y.jsx("p",{className:"fsrow__pending",style:Il(xe),children:"пусто"},`empty:${we}`));for(const qe of Gt){const jn=qe.kind==="dir"&&t.has(qe.path);wn.push(H===qe.path?y.jsxs("div",{className:"fsrow fsrow--draft",style:Il(xe),children:[y.jsx("span",{className:"fsrow__icon",children:qe.kind==="dir"?y.jsx(Dd,{open:jn}):y.jsx(Od,{})}),y.jsx(Ed,{className:"rename--file",value:qe.name,placeholder:"новое имя",onCommit:Kn=>{z(null),v(qe.path,Kn)},onCancel:()=>z(null)})]},qe.path):y.jsx(WR,{entry:qe,depth:xe,open:jn,active:qe.path===i,selected:qe.path===D,dirty:l.has(qe.path),gitStatus:le.get(qe.path),dragging:(te==null?void 0:te.path)===qe.path,dropTarget:Te===qe.path,onClick:()=>{B(qe.path),qe.kind==="dir"?p(qe.path):b(qe.path)},onRename:()=>z(qe.path),onDelete:()=>C(qe),onDragStart:Ae(qe),onDragEnd:Se,onDragOver:q(qe),onDrop:J(qe)},qe.path)),jn&&wn.push(...Sn(qe.path,xe+1))}return wn}function Je(){if(!ft)return[y.jsx("p",{className:"fsrow__pending",style:Il(0),children:"ищем…"},"search:wait")];if(ft.entries.length===0)return[y.jsx("p",{className:"fsrow__pending",style:Il(0),children:"ничего не найдено"},"search:empty")];const we=ft.entries.map(xe=>y.jsx(KR,{entry:xe,gitStatus:le.get(xe.path),onClick:()=>Re(xe)},xe.path));return ft.truncated&&we.push(y.jsxs("p",{className:"fsrow__pending",style:Il(0),children:["показаны первые ",ft.entries.length," — уточните запрос"]},"search:truncated")),we}return y.jsxs("aside",{className:n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files","aria-label":"Файлы проекта",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(tj,{}),y.jsx("span",{className:"sidepane__title",children:"Файлы"}),y.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>xt("file"),children:y.jsx(JR,{})}),y.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>xt("dir"),children:y.jsx(ej,{})}),y.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:A,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:E,children:"✕"})]}),y.jsxs("div",{className:"fssearch",children:[y.jsx(nj,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:Ne,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:we=>_e(we.target.value),onKeyDown:we=>{we.stopPropagation(),we.key==="Escape"&&(we.preventDefault(),Ne?_e(""):we.currentTarget.blur())}}),Ne&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>_e(""),children:"✕"})]}),y.jsx("div",{className:"sidepane__scroll fstree"+(Te===""?" fstree--drop-target":""),onDragOver:W,onDrop:Ee,children:se?Je():Ye}),y.jsx(ef,{result:o})]})}function WR({entry:n,depth:e,open:t,active:i,selected:l,dirty:a,gitStatus:o,dragging:u,dropTarget:f,onClick:d,onRename:p,onDelete:b,onDragStart:x,onDragEnd:v,onDragOver:w,onDrop:C}){const A="fsrow"+(i?" is-open":"")+(l&&!i?" is-selected":"")+(n.ignored?" fsrow--ignored":"")+(u?" fsrow--dragging":"")+(f?" fsrow--drop-target":"");return y.jsxs("div",{className:A,style:Il(e),draggable:!0,onDragStart:x,onDragEnd:v,onDragOver:w,onDrop:C,children:[y.jsxs("button",{className:"fsrow__main",onClick:d,title:k_(n),children:[y.jsx("span",{className:"fsrow__icon"+Nd("fsrow__icon",o),children:n.kind==="dir"?y.jsx(Dd,{open:t}):y.jsx(Od,{})}),y.jsx("span",{className:"fsrow__name"+Nd("fsrow__name",o),children:n.name}),n.ignored&&y.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),a&&y.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),y.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${n.name}`,onClick:p,children:"✎"}),y.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${n.name}`,onClick:b,children:"✕"})]})}function KR({entry:n,gitStatus:e,onClick:t}){const i=n.path.slice(0,n.path.length-n.name.length-1);return y.jsxs("button",{className:"fsrow fsrow--search"+(n.ignored?" fsrow--ignored":""),style:Il(0),onClick:t,title:k_(n),children:[y.jsx("span",{className:"fsrow__icon"+Nd("fsrow__icon",e),children:n.kind==="dir"?y.jsx(Dd,{}):y.jsx(Od,{})}),y.jsx("span",{className:"fsrow__name"+Nd("fsrow__name",e),children:n.name}),n.ignored&&y.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),i&&y.jsx("span",{className:"fsrow__path",children:i})]})}function k_(n){return n.ignored?`${n.path} — игнорируется git (.gitignore)`:n.path}function Il(n){return{"--depth":n}}function XR(n,e){var l;const t=e.lastIndexOf("/"),i=t===-1?"":e.slice(0,t);return((l=n[i])==null?void 0:l.find(a=>a.path===e))??null}function QR(n){const e=new Map,t={added:1,modified:2},i=(l,a)=>{const o=e.get(l);(!o||t[a]>t[o])&&e.set(l,a)};for(const l of n){const a=ZR(l.status);if(!a)continue;i(l.path,a);let o=Go(l.path);for(;i(o,a),!!o;)o=Go(o)}return e}function ZR(n){if(n==="??")return"added";const[e="",t=""]=n;return e==="A"||e==="R"||e==="C"?"added":e==="M"||t==="M"?"modified":null}function Nd(n,e){return e?` ${n}--git-${e}`:""}function Dd({open:n=!1}){return y.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:n?y.jsx("path",{d:"M2 12.5V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h4.4a.7.7 0 0 1 .7.7v1.2M2 12.5l1.7-4.6a.7.7 0 0 1 .66-.46h9.2a.5.5 0 0 1 .47.66L12.4 12.5Z"}):y.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})})}function Od(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),y.jsx("path",{d:"M9 2v3.2h3.3"})]})}function JR(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[y.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[y.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),y.jsx("path",{d:"M9 2v3.2h3.3"})]}),y.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function ej(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[y.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:y.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})}),y.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function tj(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),y.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function nj(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const ij=200;function sj({open:n,result:e,onSearch:t,onOpenMatch:i,onClose:l}){const[a,o]=M.useState(""),u=a.trim(),f=u.length>0,d=M.useRef(null),p=M.useRef(t);p.current=t;function b(w){o(w),d.current&&clearTimeout(d.current);const C=w.trim();if(!C){p.current("");return}d.current=setTimeout(()=>p.current(C),ij)}const x=f&&(e==null?void 0:e.query)===u?e:null;function v(){if(!x)return[y.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(x.matches.length===0)return[y.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const w=[];let C="";for(const A of x.matches)A.path!==C&&(C=A.path,w.push(y.jsx("p",{className:"searchgroup__path",title:A.path,children:A.path},`path:${A.path}`))),w.push(y.jsx(lj,{match:A,onClick:()=>i(A)},`${A.path}:${A.line}:${A.column}`));return x.truncated&&w.push(y.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",x.matches.length," — уточните запрос"]},"grep:truncated")),w}return y.jsxs("aside",{className:n?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search","aria-label":"Поиск по тексту в проекте",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(rj,{}),y.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:l,children:"✕"})]}),y.jsxs("div",{className:"fssearch",children:[y.jsx(aj,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:a,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:w=>b(w.target.value),onKeyDown:w=>{w.stopPropagation(),w.key==="Escape"&&(w.preventDefault(),a?b(""):w.currentTarget.blur())}}),a&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>b(""),children:"✕"})]}),y.jsx("div",{className:"sidepane__scroll fstree",children:f?v():y.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function lj({match:n,onClick:e}){const t=n.lineText.slice(0,n.column-1),i=n.lineText.slice(n.column-1,n.column-1+n.matchLength),l=n.lineText.slice(n.column-1+n.matchLength);return y.jsxs("button",{className:"searchmatch",onClick:e,title:`${n.path}:${n.line}`,children:[y.jsx("span",{className:"searchmatch__line",children:n.line}),y.jsxs("span",{className:"searchmatch__text",children:[t,y.jsx("mark",{children:i}),l]})]})}function rj(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function aj(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const oj=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Hy(n.state,t.from);return i.line?cj(n):i.block?fj(n):!1};function zy(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const cj=zy(pj,0),uj=zy(A_,0),fj=zy((n,e)=>A_(n,e,dj(e)),0);function Hy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const mu=50;function hj(n,{open:e,close:t},i,l){let a=n.sliceDoc(i-mu,i),o=n.sliceDoc(l,l+mu),u=/\s*$/.exec(a)[0].length,f=/^\s*/.exec(o)[0].length,d=a.length-u;if(a.slice(d-e.length,d)==e&&o.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:l+f,margin:f&&1}};let p,b;l-i<=2*mu?p=b=n.sliceDoc(i,l):(p=n.sliceDoc(i,i+mu),b=n.sliceDoc(l-mu,l));let x=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(b)[0].length,w=b.length-v-t.length;return p.slice(x,x+e.length)==e&&b.slice(w,w+t.length)==t?{open:{pos:i+x+e.length,margin:/\s/.test(p.charAt(x+e.length))?1:0},close:{pos:l-v-t.length,margin:/\s/.test(b.charAt(w-1))?1:0}}:null}function dj(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let a=e.length-1;a>=0&&e[a].to>i.from?e[a].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function A_(n,e,t=e.selection.ranges){let i=t.map(a=>Hy(e,a.from).block);if(!i.every(a=>a))return null;let l=t.map((a,o)=>hj(e,i[o],a.from,a.to));if(n!=2&&!l.every(a=>a))return{changes:e.changes(t.map((a,o)=>l[o]?[]:[{from:a.from,insert:i[o].open+" "},{from:a.to,insert:" "+i[o].close}]))};if(n!=1&&l.some(a=>a)){let a=[];for(let o=0,u;o<l.length;o++)if(u=l[o]){let f=i[o],{open:d,close:p}=u;a.push({from:d.pos-f.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+f.close.length})}return{changes:a}}return null}function pj(n,e,t=e.selection.ranges){let i=[],l=-1;e:for(let{from:a,to:o}of t){let u=i.length,f=1e9,d;for(let p=a;p<=o;){let b=e.doc.lineAt(p);if(d==null&&(d=Hy(e,b.from).line,!d))continue e;if(b.from>l&&(a==o||o>b.from)){l=b.from;let x=/^\s*/.exec(b.text)[0].length,v=x==b.length,w=b.text.slice(x,x+d.length)==d?x:-1;x<b.text.length&&x<f&&(f=x),i.push({line:b,comment:w,token:d,indent:x,empty:v,single:!1})}p=b.to+1}if(f<1e9)for(let p=u;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=f);i.length==u+1&&(i[u].single=!0)}if(n!=2&&i.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:u,token:f,indent:d,empty:p,single:b}of i)(b||!p)&&a.push({from:u.from+d,insert:f+" "});let o=e.changes(a);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:u,token:f}of i)if(u>=0){let d=o.from+u,p=d+f.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const Q0=Wl.define(),mj=Wl.define(),gj=be.define(),__=be.define({combine(n){return ml(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),C_=Wn.define({create(){return dl.empty},update(n,e){let t=e.state.facet(__),i=e.annotation(Q0);if(i){let f=Ti.fromTransaction(e,i.selection),d=i.side,p=d==0?n.undone:n.done;return f?p=Rd(p,p.length,t.minDepth,f):p=E_(p,e.startState.selection),new dl(d==0?i.rest:p,d==0?p:i.rest)}let l=e.annotation(mj);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(pn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let a=Ti.fromTransaction(e),o=e.annotation(pn.time),u=e.annotation(pn.userEvent);return a?n=n.addChanges(a,o,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,u,t.newGroupDelay)),(l=="full"||l=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new dl(n.done.map(Ti.fromJSON),n.undone.map(Ti.fromJSON))}});function yj(n={}){return[C_,__.of(n),ye.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?T_:e.inputType=="historyRedo"?Z0:null;return i?(e.preventDefault(),i(t)):!1}})]}function Jd(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(C_,!1);if(!l)return!1;let a=l.pop(n,t,e);return a?(i(a),!0):!1}}const T_=Jd(0,!1),Z0=Jd(1,!1),bj=Jd(0,!0),xj=Jd(1,!0);class Ti{constructor(e,t,i,l,a){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=a}setSelAfter(e){return new Ti(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;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:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new Ti(e.changes&&vn.fromJSON(e.changes),[],e.mapped&&pl.fromJSON(e.mapped),e.startSelection&&Q.fromJSON(e.startSelection),e.selectionsAfter.map(Q.fromJSON))}static fromTransaction(e,t){let i=us;for(let l of e.startState.facet(gj)){let a=l(e);a.length&&(i=i.concat(a))}return!i.length&&e.changes.empty?null:new Ti(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,us)}static selection(e){return new Ti(void 0,us,void 0,void 0,e)}}function Rd(n,e,t,i){let l=e+1>t+20?e-t-1:0,a=n.slice(l,e);return a.push(i),a}function vj(n,e){let t=[],i=!1;return n.iterChangedRanges((l,a)=>t.push(l,a)),e.iterChangedRanges((l,a,o,u)=>{for(let f=0;f<t.length;){let d=t[f++],p=t[f++];u>=d&&o<=p&&(i=!0)}}),i}function Sj(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function M_(n,e){return n.length?e.length?n.concat(e):n:e}const us=[],wj=200;function E_(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-wj));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Rd(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Ti.selection([e])]}function kj(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Pg(n,e){if(!n.length)return n;let t=n.length,i=us;for(;t;){let l=Aj(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let a=n.slice(0,t);return a[t-1]=l,a}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[Ti.selection(i)]:us}function Aj(n,e,t){let i=M_(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):us,t);if(!n.changes)return Ti.selection(i);let l=n.changes.map(e),a=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(a):a;return new Ti(l,Ge.mapEffects(n.effects,e),o,n.startSelection.map(a),i)}const _j=/^(input\.type|delete)($|\.)/;class dl{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new dl(this.done,this.undone):this}addChanges(e,t,i,l,a){let o=this.done,u=o[o.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||_j.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime<l.newGroupDelay&&l.joinToEvent(a,vj(u.changes,e.changes))||i=="input.type.compose")?o=Rd(o,o.length-1,l.minDepth,new Ti(e.changes.compose(u.changes),M_(Ge.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,us)):o=Rd(o,o.length,l.minDepth,e),new dl(o,us,t,i)}addSelection(e,t,i,l){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:us;return a.length>0&&t-this.prevTime<l&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&Sj(a[a.length-1],e)?this:new dl(E_(this.done,e),this.undone,t,i)}addMapping(e){return new dl(Pg(this.done,e),Pg(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let l=e==0?this.done:this.undone;if(l.length==0)return null;let a=l[l.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):t.selection);if(i&&a.selectionsAfter.length)return t.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:Q0.of({side:e,rest:kj(l),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let u=l.length==1?us:l.slice(0,l.length-1);return a.mapped&&(u=Pg(u,a.mapped)),t.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:Q0.of({side:e,rest:u,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}dl.empty=new dl(us,us);const Cj=[{key:"Mod-z",run:T_,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Z0,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Z0,preventDefault:!0},{key:"Mod-u",run:bj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xj,preventDefault:!0}];function hc(n,e){return Q.create(n.ranges.map(e),n.mainIndex)}function zs(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Hs({state:n,dispatch:e},t){let i=hc(n.selection,t);return i.eq(n.selection,!0)?!1:(e(zs(n,i)),!0)}function ep(n,e){return Q.cursor(e?n.to:n.from)}function N_(n,e){return Hs(n,t=>t.empty?n.moveByChar(t,e):ep(t,e))}function si(n){return n.textDirectionAt(n.state.selection.main.head)==Bt.LTR}const D_=n=>N_(n,!si(n)),O_=n=>N_(n,si(n));function R_(n,e){return Hs(n,t=>t.empty?n.moveByGroup(t,e):ep(t,e))}const Tj=n=>R_(n,!si(n)),Mj=n=>R_(n,si(n));function Ej(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function tp(n,e,t){let i=$n(n).resolveInner(e.head),l=t?it.closedBy:it.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;Ej(n,d,l)?i=d:f=t?d.to:d.from}let a=i.type.prop(l),o,u;return a&&(o=t?hl(n,i.from,1):hl(n,i.to,-1))&&o.matched?u=t?o.end.to:o.end.from:u=t?i.to:i.from,Q.cursor(u,t?-1:1)}const Nj=n=>Hs(n,e=>tp(n.state,e,!si(n))),Dj=n=>Hs(n,e=>tp(n.state,e,si(n)));function j_(n,e){return Hs(n,t=>{if(!t.empty)return ep(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const L_=n=>j_(n,!1),B_=n=>j_(n,!0);function z_(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,l;if(e){for(let a of n.state.facet(ye.scrollMargins)){let o=a(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}l=n.scrollDOM.clientHeight-t-i}else l=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,l-5)}}function H_(n,e){let t=z_(n),{state:i}=n,l=hc(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):ep(o,e));if(l.eq(i.selection))return!1;let a;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;o&&o.top>f&&o.bottom<d&&(a=ye.scrollIntoView(l.main.head,{y:"start",yMargin:o.top-f}))}return n.dispatch(zs(i,l),{effects:a}),!0}const mw=n=>H_(n,!1),J0=n=>H_(n,!0);function Yr(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let a=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;a&&e.head!=i.from+a&&(l=Q.cursor(i.from+a))}return l}const Oj=n=>Hs(n,e=>Yr(n,e,!0)),Rj=n=>Hs(n,e=>Yr(n,e,!1)),jj=n=>Hs(n,e=>Yr(n,e,!si(n))),Lj=n=>Hs(n,e=>Yr(n,e,si(n))),Bj=n=>Hs(n,e=>Q.cursor(n.lineBlockAt(e.head).from,1)),zj=n=>Hs(n,e=>Q.cursor(n.lineBlockAt(e.head).to,-1));function Hj(n,e,t){let i=!1,l=hc(n.selection,a=>{let o=hl(n,a.head,-1)||hl(n,a.head,1)||a.head>0&&hl(n,a.head-1,1)||a.head<n.doc.length&&hl(n,a.head+1,-1);if(!o||!o.end)return a;i=!0;let u=o.start.from==a.head?o.end.to:o.end.from;return Q.cursor(u)});return i?(e(zs(n,l)),!0):!1}const Ij=({state:n,dispatch:e})=>Hj(n,e);function hs(n,e,t){let i=hc(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=Q.range(l.head,l.anchor));let a=t(l);return Q.range(l.anchor,a.head,a.goalColumn,a.bidiLevel||void 0,a.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(zs(n.state,i)),!0)}function I_(n,e){return hs(n,e,t=>n.moveByChar(t,e))}const U_=n=>I_(n,!si(n)),q_=n=>I_(n,si(n));function V_(n,e){return hs(n,e,t=>n.moveByGroup(t,e))}const Uj=n=>V_(n,!si(n)),qj=n=>V_(n,si(n)),Vj=n=>{let e=!si(n);return hs(n,e,t=>tp(n.state,t,e))},Gj=n=>{let e=si(n);return hs(n,e,t=>tp(n.state,t,e))};function G_(n,e){return hs(n,e,t=>n.moveVertically(t,e))}const P_=n=>G_(n,!1),Y_=n=>G_(n,!0);function F_(n,e){return hs(n,e,t=>n.moveVertically(t,e,z_(n).height))}const gw=n=>F_(n,!1),yw=n=>F_(n,!0),Pj=n=>hs(n,!0,e=>Yr(n,e,!0)),Yj=n=>hs(n,!1,e=>Yr(n,e,!1)),Fj=n=>{let e=!si(n);return hs(n,e,t=>Yr(n,t,e))},$j=n=>{let e=si(n);return hs(n,e,t=>Yr(n,t,e))},Wj=n=>hs(n,!1,e=>Q.cursor(n.lineBlockAt(e.head).from)),Kj=n=>hs(n,!0,e=>Q.cursor(n.lineBlockAt(e.head).to)),bw=({state:n,dispatch:e})=>(e(zs(n,{anchor:0})),!0),xw=({state:n,dispatch:e})=>(e(zs(n,{anchor:n.doc.length})),!0),vw=({state:n,dispatch:e})=>(e(zs(n,{anchor:n.selection.main.anchor,head:0})),!0),Sw=({state:n,dispatch:e})=>(e(zs(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Xj=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Qj=({state:n,dispatch:e})=>{let t=np(n).map(({from:i,to:l})=>Q.range(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:Q.create(t),userEvent:"select"})),!0},Zj=({state:n,dispatch:e})=>{let t=hc(n.selection,i=>{let l=$n(n),a=l.resolveStack(i.from,1);if(i.empty){let o=l.resolveStack(i.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:u}=o;if((u.from<i.from&&u.to>=i.to||u.to>i.to&&u.from<=i.from)&&o.next)return Q.range(u.to,u.from)}return i});return t.eq(n.selection)?!1:(e(zs(n,t)),!0)};function $_(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let a of t.selection.ranges){let o=t.doc.lineAt(a.head);if(e?o.to<n.state.doc.length:o.from>0)for(let u=a;;){let f=n.moveVertically(u,e);if(f.head<o.from||f.head>o.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==u.head)break;u=f}}}return l.length==i.ranges.length?!1:(n.dispatch(zs(t,Q.create(l,l.length-1))),!0)}const Jj=n=>$_(n,!1),eL=n=>$_(n,!0),tL=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=Q.create([t.main]):t.main.empty||(i=Q.create([Q.cursor(t.main.head)])),i?(e(zs(n,i)),!0):!1};function tf(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(a=>{let{from:o,to:u}=a;if(o==u){let f=e(a);f<o?(t="delete.backward",f=Yh(n,f,!1)):f>o&&(t="delete.forward",f=Yh(n,f,!0)),o=Math.min(o,f),u=Math.max(u,f)}else o=Yh(n,o,!1),u=Yh(n,u,!0);return o==u?{range:a}:{changes:{from:o,to:u},range:Q.cursor(o,o<a.head?-1:1)}});return l.changes.empty?!1:(n.dispatch(i.update(l,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?ye.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Yh(n,e,t){if(n instanceof ye)for(let i of n.state.facet(ye.atomicRanges).map(l=>l(n)))i.between(e,e,(l,a)=>{l<e&&a>e&&(e=t?a:l)});return e}const W_=(n,e,t)=>tf(n,i=>{let l=i.from,{state:a}=n,o=a.doc.lineAt(l),u,f;if(t&&!e&&l>o.from&&l<o.from+200&&!/[^ \t]/.test(u=o.text.slice(0,l-o.from))){if(u[u.length-1]==" ")return l-1;let d=fc(u,a.tabSize),p=d%Cd(a)||Cd(a);for(let b=0;b<p&&u[u.length-1-b]==" ";b++)l--;f=l}else f=Rn(o.text,l-o.from,e,e)+o.from,f==l&&o.number!=(e?a.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(f-o.from,l-o.from))&&(f=Rn(o.text,f-o.from,!1,!1)+o.from);return f}),ey=n=>W_(n,!1,!0),K_=n=>W_(n,!0,!1),X_=(n,e)=>tf(n,t=>{let i=t.head,{state:l}=n,a=l.doc.lineAt(i),o=l.charCategorizer(i);for(let u=null;;){if(i==(e?a.to:a.from)){i==t.head&&a.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=Rn(a.text,i-a.from,e)+a.from,d=a.text.slice(Math.min(i,f)-a.from,Math.max(i,f)-a.from),p=o(d);if(u!=null&&p!=u)break;(d!=" "||i!=t.head)&&(u=p),i=f}return i}),Q_=n=>X_(n,!1),nL=n=>X_(n,!0),iL=n=>tf(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),sL=n=>tf(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),lL=n=>tf(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),rL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:ct.of(["",""])},range:Q.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},aL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,a=n.doc.lineAt(l),o=l==a.from?l-1:Rn(a.text,l-a.from,!1)+a.from,u=l==a.to?l+1:Rn(a.text,l-a.from,!0)+a.from;return{changes:{from:o,to:u,insert:n.doc.slice(l,u).append(n.doc.slice(o,l))},range:Q.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function np(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),a=n.doc.lineAt(i.to);if(!i.empty&&i.to==a.from&&(a=n.doc.lineAt(i.to-1)),t>=l.number){let o=e[e.length-1];o.to=a.to,o.ranges.push(i)}else e.push({from:l.from,to:a.to,ranges:[i]});t=a.number+1}return e}function Z_(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let a of np(n)){if(t?a.to==n.doc.length:a.from==0)continue;let o=n.doc.lineAt(t?a.to+1:a.from-1),u=o.length+1;if(t){i.push({from:a.to,to:o.to},{from:a.from,insert:o.text+n.lineBreak});for(let f of a.ranges)l.push(Q.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:o.from,to:a.from},{from:a.to,insert:n.lineBreak+o.text});for(let f of a.ranges)l.push(Q.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:Q.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const oL=({state:n,dispatch:e})=>Z_(n,e,!1),cL=({state:n,dispatch:e})=>Z_(n,e,!0);function J_(n,e,t){if(n.readOnly)return!1;let i=[];for(let a of np(n))t?i.push({from:a.from,insert:n.doc.slice(a.from,a.to)+n.lineBreak}):i.push({from:a.to,insert:n.lineBreak+n.doc.slice(a.from,a.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const uL=({state:n,dispatch:e})=>J_(n,e,!1),fL=({state:n,dispatch:e})=>J_(n,e,!0),hL=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(np(e).map(({from:l,to:a})=>(l>0?l--:a<e.doc.length&&a++,{from:l,to:a}))),i=hc(e.selection,l=>{let a;if(n.lineWrapping){let o=n.lineBlockAt(l.head),u=n.coordsAtPos(l.head,l.assoc||1);u&&(a=o.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,a)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function dL(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=$n(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),a;return i&&l&&i.to<=e&&l.from>=e&&(a=i.type.prop(it.closedBy))&&a.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const ww=eC(!1),pL=eC(!0);function eC(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:a,to:o}=l,u=e.doc.lineAt(a),f=!n&&a==o&&dL(e,a);n&&(a=o=(o<=u.to?u:e.doc.lineAt(o)).to);let d=new Qd(e,{simulateBreak:a,simulateDoubleBreak:!!f}),p=Ly(d,a);for(p==null&&(p=fc(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));o<u.to&&/\s/.test(u.text[o-u.from]);)o++;f?{from:a,to:o}=f:a>u.from&&a<u.from+100&&!/\S/.test(u.text.slice(0,a))&&(a=u.from);let b=["",Iu(e,p)];return f&&b.push(Iu(e,d.lineIndent(u.from,-1))),{changes:{from:a,to:o,insert:ct.of(b)},range:Q.cursor(a+1+b[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Iy(n,e){let t=-1;return n.changeByRange(i=>{let l=[];for(let o=i.from;o<=i.to;){let u=n.doc.lineAt(o);u.number>t&&(i.empty||i.to>u.from)&&(e(u,l,i),t=u.number),o=u.to+1}let a=n.changes(l);return{changes:l,range:Q.range(a.mapPos(i.anchor,1),a.mapPos(i.head,1))}})}const mL=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Qd(n,{overrideIndentation:a=>{let o=t[a];return o??-1}}),l=Iy(n,(a,o,u)=>{let f=Ly(i,a.from);if(f==null)return;/\S/.test(a.text)||(f=0);let d=/^\s*/.exec(a.text)[0],p=Iu(n,f);(d!=p||u.from<a.from+d.length)&&(t[a.from]=f,o.push({from:a.from,to:a.from+d.length,insert:p}))});return l.changes.empty||e(n.update(l,{userEvent:"indent"})),!0},tC=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Iy(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Xd)})}),{userEvent:"input.indent"})),!0),nC=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Iy(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let a=fc(l,n.tabSize),o=0,u=Iu(n,Math.max(0,a-Cd(n)));for(;o<l.length&&o<u.length&&l.charCodeAt(o)==u.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+l.length,insert:u.slice(o)})}),{userEvent:"delete.dedent"})),!0),gL=n=>(n.setTabFocusMode(),!0),yL=[{key:"Ctrl-b",run:D_,shift:U_,preventDefault:!0},{key:"Ctrl-f",run:O_,shift:q_},{key:"Ctrl-p",run:L_,shift:P_},{key:"Ctrl-n",run:B_,shift:Y_},{key:"Ctrl-a",run:Bj,shift:Wj},{key:"Ctrl-e",run:zj,shift:Kj},{key:"Ctrl-d",run:K_},{key:"Ctrl-h",run:ey},{key:"Ctrl-k",run:iL},{key:"Ctrl-Alt-h",run:Q_},{key:"Ctrl-o",run:rL},{key:"Ctrl-t",run:aL},{key:"Ctrl-v",run:J0}],bL=[{key:"ArrowLeft",run:D_,shift:U_,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Tj,shift:Uj,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:jj,shift:Fj,preventDefault:!0},{key:"ArrowRight",run:O_,shift:q_,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Mj,shift:qj,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Lj,shift:$j,preventDefault:!0},{key:"ArrowUp",run:L_,shift:P_,preventDefault:!0},{mac:"Cmd-ArrowUp",run:bw,shift:vw},{mac:"Ctrl-ArrowUp",run:mw,shift:gw},{key:"ArrowDown",run:B_,shift:Y_,preventDefault:!0},{mac:"Cmd-ArrowDown",run:xw,shift:Sw},{mac:"Ctrl-ArrowDown",run:J0,shift:yw},{key:"PageUp",run:mw,shift:gw},{key:"PageDown",run:J0,shift:yw},{key:"Home",run:Rj,shift:Yj,preventDefault:!0},{key:"Mod-Home",run:bw,shift:vw},{key:"End",run:Oj,shift:Pj,preventDefault:!0},{key:"Mod-End",run:xw,shift:Sw},{key:"Enter",run:ww,shift:ww},{key:"Mod-a",run:Xj},{key:"Backspace",run:ey,shift:ey,preventDefault:!0},{key:"Delete",run:K_,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Q_,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:nL,preventDefault:!0},{mac:"Mod-Backspace",run:sL,preventDefault:!0},{mac:"Mod-Delete",run:lL,preventDefault:!0}].concat(yL.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),xL=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Nj,shift:Vj},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Dj,shift:Gj},{key:"Alt-ArrowUp",run:oL},{key:"Shift-Alt-ArrowUp",run:uL},{key:"Alt-ArrowDown",run:cL},{key:"Shift-Alt-ArrowDown",run:fL},{key:"Mod-Alt-ArrowUp",run:Jj},{key:"Mod-Alt-ArrowDown",run:eL},{key:"Escape",run:tL},{key:"Mod-Enter",run:pL},{key:"Alt-l",mac:"Ctrl-l",run:Qj},{key:"Mod-i",run:Zj,preventDefault:!0},{key:"Mod-[",run:nC},{key:"Mod-]",run:tC},{key:"Mod-Alt-\\",run:mL},{key:"Shift-Mod-k",run:hL},{key:"Shift-Mod-\\",run:Ij},{key:"Mod-/",run:oj},{key:"Alt-A",run:uj},{key:"Ctrl-m",mac:"Shift-Alt-m",run:gL}].concat(bL),vL={key:"Tab",run:tC,shift:nC},kw=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class oc{constructor(e,t,i=0,l=e.length,a,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=a?u=>a(kw(u)):kw,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ki(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=gy(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=ol(e);let l=this.normalize(t);if(l.length)for(let a=0,o=i,u=!0;;a++){let f=l.charCodeAt(a),d=this.match(f,o,u,this.bufferPos+this.bufferStart,a==l.length-1);if(d)return this.value=d,this;if(a==l.length-1)break;u&&a<t.length&&t.charCodeAt(a)==f?o++:u=!1}}}match(e,t,i,l,a){let o=null;for(let u=0;u<this.matches.length;){let f=this.matches[u],d=!1;this.query.charCodeAt(f.index)==e&&(f.index==this.query.length-1?o={from:f.from,to:l,precise:a&&f.precise}:(f.index++,d=!0)),d?u++:this.matches.splice(u,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:l,precise:i&&a}:this.matches.push({from:t,index:1,precise:i})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(oc.prototype[Symbol.iterator]=function(){return this});const iC={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Uy="gm"+(/x/.unicode==null?"":"u");class sC{constructor(e,t,i,l=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=iC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new lC(e,t,i,l,a);this.re=new RegExp(t,Uy+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.iter=e.iter();let o=e.lineAt(l);this.curLineStart=o.from,this.matchPos=jd(e,l),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=jd(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<l||i>this.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Yg=new WeakMap;class Po{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let l=Yg.get(e);if(!l||l.from>=i||l.to<=t){let u=new Po(t,e.sliceString(t,i));return Yg.set(e,u),u}if(l.from==t&&l.to==i)return l;let{text:a,from:o}=l;return o>t&&(a=e.sliceString(t,o)+a,o=t),l.to<i&&(a+=e.sliceString(l.to,i)),Yg.set(e,new Po(o,a)),new Po(t,a.slice(t-o,i-o))}}class lC{constructor(e,t,i,l,a){this.text=e,this.to=a,this.done=!1,this.value=iC,this.matchPos=jd(e,l),this.re=new RegExp(t,Uy+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.flat=Po.get(e,l,this.chunkEnd(l+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=jd(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Po.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sC.prototype[Symbol.iterator]=lC.prototype[Symbol.iterator]=function(){return this});function SL(n){try{return new RegExp(n,Uy),!0}catch{return!1}}function jd(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const wL=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:l}=MO(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return l.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){n.dispatch({effects:i});return}let u=e.doc.lineAt(e.selection.main.head),[,f,d,p,b]=o,x=p?+p.slice(1):0,v=d?+d:u.number;if(d&&b){let A=v/100;f&&(A=A*(f=="-"?-1:1)+u.number/e.doc.lines),v=Math.round(e.doc.lines*A)}else d&&f&&(v=v*(f=="-"?-1:1)+u.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,v))),C=Q.cursor(w.from+Math.max(0,Math.min(x,w.length)));n.dispatch({effects:[i,ye.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},kL={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},AL=be.define({combine(n){return ml(n,kL,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function _L(n){return[NL,EL]}const CL=ze.mark({class:"cm-selectionMatch"}),TL=ze.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Aw(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=$t.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=$t.Word)}function ML(n,e,t,i){return n(e.sliceDoc(t,t+1))==$t.Word&&n(e.sliceDoc(i-1,i))==$t.Word}const EL=rn.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(AL),{state:t}=n,i=t.selection;if(i.ranges.length>1)return ze.none;let l=i.main,a,o=null;if(l.empty){if(!e.highlightWordAroundCursor)return ze.none;let f=t.wordAt(l.head);if(!f)return ze.none;o=t.charCategorizer(l.head),a=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f<e.minSelectionLength||f>200)return ze.none;if(e.wholeWords){if(a=t.sliceDoc(l.from,l.to),o=t.charCategorizer(l.head),!(Aw(o,t,l.from,l.to)&&ML(o,t,l.from,l.to)))return ze.none}else if(a=t.sliceDoc(l.from,l.to),!a)return ze.none}let u=[];for(let f of n.visibleRanges){let d=new oc(t.doc,a,f.from,f.to);for(;!d.next().done;){let{from:p,to:b}=d.value;if((!o||Aw(o,t,p,b))&&(l.empty&&p<=l.from&&b>=l.to?u.push(TL.range(p,b)):(p>=l.to||b<=l.from)&&u.push(CL.range(p,b)),u.length>e.maxMatches))return ze.none}}return ze.set(u)}},{decorations:n=>n.decorations}),NL=ye.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),DL=({state:n,dispatch:e})=>{let{selection:t}=n,i=Q.create(t.ranges.map(l=>n.wordAt(l.head)||Q.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function OL(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),a=l&&l.from==t.from&&l.to==t.to;for(let o=!1,u=new oc(n.doc,e,i[i.length-1].to);;)if(u.next(),u.done){if(o)return null;u=new oc(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(f=>f.from==u.value.from))continue;if(a){let f=n.wordAt(u.value.from);if(!f||f.from!=u.value.from||f.to!=u.value.to)continue}return u.value}}const RL=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(a=>a.from===a.to))return DL({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(a=>n.sliceDoc(a.from,a.to)!=i))return!1;let l=OL(n,i);return l?(e(n.update({selection:n.selection.addRange(Q.range(l.from,l.to),!1),effects:ye.scrollIntoView(l.to)})),!0):!1},dc=be.define({combine(n){return ml(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new $L(e),scrollToMatch:e=>ye.scrollIntoView(e)})}});class rC{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||SL(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
|
|
128
|
-
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new IL(this):new BL(this)}getCursor(e,t=0,i){let l=e.doc?e:pt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?Do(this,l,t,i):No(this,l,t,i)}}class aC{constructor(e){this.spec=e}}function jL(n,e,t){return(i,l,a,o)=>{if(t&&!t(i,l,a,o))return!1;let u=i>=o&&l<=o+a.length?a.slice(i-o,l-o):e.doc.sliceString(i,l);return n(u,e,i,l)}}function No(n,e,t,i){let l;return n.wholeWord&&(l=LL(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=jL(n.test,e,l)),new oc(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:a=>a.toLowerCase(),l)}function LL(n,e){return(t,i,l,a)=>((a>t||a+l.length<i)&&(a=Math.max(0,t-2),l=n.sliceString(a,Math.min(n.length,i+2))),(e(Ld(l,t-a))!=$t.Word||e(Bd(l,t-a))!=$t.Word)&&(e(Bd(l,i-a))!=$t.Word||e(Ld(l,i-a))!=$t.Word))}class BL extends aC{constructor(e){super(e)}nextMatch(e,t,i){let l=No(this.spec,e,i,e.doc.length).nextOverlapping();if(l.done){let a=Math.min(e.doc.length,t+this.spec.unquoted.length);l=No(this.spec,e,0,a).nextOverlapping()}return l.done||l.value.from==t&&l.value.to==i?null:l.value}prevMatchInRange(e,t,i){for(let l=i;;){let a=Math.max(t,l-1e4-this.spec.unquoted.length),o=No(this.spec,e,a,l),u=null;for(;!o.nextOverlapping().done;)u=o.value;if(u)return u;if(a==t)return null;l-=1e4}}prevMatch(e,t,i){let l=this.prevMatchInRange(e,0,t);return l||(l=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),l&&(l.from!=t||l.to!=i)?l:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=No(this.spec,e,0,e.doc.length),l=[];for(;!i.next().done;){if(l.length>=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let a=No(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)l(a.value.from,a.value.to)}}function zL(n,e,t){return(i,l,a)=>(!t||t(i,l,a))&&n(a[0],e,i,l)}function Do(n,e,t,i){let l;return n.wholeWord&&(l=HL(e.charCategorizer(e.selection.main.head))),n.test&&(l=zL(n.test,e,l)),new sC(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Ld(n,e){return n.slice(Rn(n,e,!1),e)}function Bd(n,e){return n.slice(e,Rn(n,e))}function HL(n){return(e,t,i)=>!i[0].length||(n(Ld(i.input,i.index))!=$t.Word||n(Bd(i.input,i.index))!=$t.Word)&&(n(Bd(i.input,i.index+i[0].length))!=$t.Word||n(Ld(i.input,i.index+i[0].length))!=$t.Word)}class IL extends aC{nextMatch(e,t,i){let l=Do(this.spec,e,i,e.doc.length).next();return l.done&&(l=Do(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let a=Math.max(t,i-l*1e4),o=Do(this.spec,e,a,i),u=null;for(;!o.next().done;)u=o.value;if(u&&(a==t||u.from>a+10))return u;if(a==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let a=+i.slice(0,l);if(a>0&&a<e.match.length)return e.match[a]+i.slice(l)}return t})}matchAll(e,t){let i=Do(this.spec,e,0,e.doc.length),l=[];for(;!i.next().done;){if(l.length>=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let a=Do(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!a.next().done;)l(a.value.from,a.value.to)}}const Uu=Ge.define(),qy=Ge.define(),zr=Wn.define({create(n){return new Fg(ty(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Uu)?n=new Fg(t.value.create(),n.panel):t.is(qy)&&(n=new Fg(n.query,t.value?Vy:null));return n},provide:n=>Hu.from(n,e=>e.panel)});class Fg{constructor(e,t){this.query=e,this.panel=t}}const UL=ze.mark({class:"cm-searchMatch"}),qL=ze.mark({class:"cm-searchMatch cm-searchMatch-selected"}),VL=rn.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(zr))}update(n){let e=n.state.field(zr);(e!=n.startState.field(zr)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return ze.none;let{view:t}=this,i=new Pl;for(let l=0,a=t.visibleRanges,o=a.length;l<o;l++){let{from:u,to:f}=a[l];for(;l<o-1&&f>a[l+1].from-500;)f=a[++l].to;n.highlight(t.state,u,f,(d,p)=>{let b=t.state.selection.ranges.some(x=>x.from==d&&x.to==p);i.add(d,p,b?qL:UL)})}return i.finish()}},{decorations:n=>n.decorations});function nf(n){return e=>{let t=e.state.field(zr,!1);return t&&t.query.spec.valid?n(e,t):uC(e)}}const zd=nf((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=Q.single(i.from,i.to),a=n.state.facet(dc);return n.dispatch({selection:l,effects:[Gy(n,i),a.scrollToMatch(l.main,n)],userEvent:"select.search"}),cC(n),!0}),Hd=nf((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let a=Q.single(l.from,l.to),o=n.state.facet(dc);return n.dispatch({selection:a,effects:[Gy(n,l),o.scrollToMatch(a.main,n)],userEvent:"select.search"}),cC(n),!0}),GL=nf((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:Q.create(t.map(i=>Q.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),PL=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,a=[],o=0;for(let u=new oc(n.doc,n.sliceDoc(i,l));!u.next().done;){if(a.length>1e3)return!1;u.value.from==i&&(o=a.length),a.push(Q.range(u.value.from,u.value.to))}return e(n.update({selection:Q.create(a,o),userEvent:"select.search.matches"})),!0},_w=nf((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let a=e.nextMatch(t,i,i);if(!a)return!1;let o=a,u=[],f,d,p=[];o.precise?o.from==i&&o.to==l&&(d=t.toText(e.getReplacement(o)),u.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(t,o.from,o.to),p.push(ye.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let b=n.state.changes(u);return o&&(f=Q.single(o.from,o.to).map(b),p.push(Gy(n,o)),p.push(t.facet(dc).scrollToMatch(f.main,n))),n.dispatch({changes:b,selection:f,effects:p,userEvent:"input.replace"}),!0}),YL=nf((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:a,to:o,precise:u}=l;u&&t.push({from:a,to:o,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:ye.announce.of(i),userEvent:"input.replace.all"}),!0});function Vy(n){return n.state.facet(dc).createPanel(n)}function ty(n,e){var t,i,l,a,o;let u=n.selection.main,f=u.empty||u.to>u.from+100?"":n.sliceDoc(u.from,u.to);if(e&&!f)return e;let d=n.facet(dc);return new rC({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(a=e==null?void 0:e.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function oC(n){let e=jy(n,Vy);return e&&e.dom.querySelector("[main-field]")}function cC(n){let e=oC(n);e&&e==n.root.activeElement&&e.select()}const uC=n=>{let e=n.state.field(zr,!1);if(e&&e.panel){let t=oC(n);if(t&&t!=n.root.activeElement){let i=ty(n.state,e.query.spec);i.valid&&n.dispatch({effects:Uu.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[qy.of(!0),e?Uu.of(ty(n.state,e.query.spec)):Ge.appendConfig.of(KL)]});return!0},fC=n=>{let e=n.state.field(zr,!1);if(!e||!e.panel)return!1;let t=jy(n,Vy);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:qy.of(!1)}),!0},FL=[{key:"Mod-f",run:uC,scope:"editor search-panel"},{key:"F3",run:zd,shift:Hd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:zd,shift:Hd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:fC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:PL},{key:"Mod-Alt-g",run:wL},{key:"Mod-d",run:RL,preventDefault:!0}];class $L{constructor(e){this.view=e;let t=this.query=e.state.field(zr).query.spec;this.commit=this.commit.bind(this),this.searchField=Nt("input",{value:t.search,placeholder:Yi(e,"Find"),"aria-label":Yi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Nt("input",{value:t.replace,placeholder:Yi(e,"Replace"),"aria-label":Yi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Nt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Nt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Nt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,a,o){return Nt("button",{class:"cm-button",name:l,onclick:a,type:"button"},o)}this.dom=Nt("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>zd(e),[Yi(e,"next")]),i("prev",()=>Hd(e),[Yi(e,"previous")]),i("select",()=>GL(e),[Yi(e,"all")]),Nt("label",null,[this.caseField,Yi(e,"match case")]),Nt("label",null,[this.reField,Yi(e,"regexp")]),Nt("label",null,[this.wordField,Yi(e,"by word")]),...e.state.readOnly?[]:[Nt("br"),this.replaceField,i("replace",()=>_w(e),[Yi(e,"replace")]),i("replaceAll",()=>YL(e),[Yi(e,"replace all")])],Nt("button",{name:"close",onclick:()=>fC(e),"aria-label":Yi(e,"close"),type:"button"},["×"])])}commit(){let e=new rC({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Uu.of(e)}))}keydown(e){ID(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Hd:zd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),_w(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Uu)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(dc).top}}function Yi(n,e){return n.state.phrase(e)}const Fh=30,$h=/[\s\.,:;?!]/;function Gy(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,a=Math.max(i.from,e-Fh),o=Math.min(l,t+Fh),u=n.state.sliceDoc(a,o);if(a!=i.from){for(let f=0;f<Fh;f++)if(!$h.test(u[f+1])&&$h.test(u[f])){u=u.slice(f);break}}if(o!=l){for(let f=u.length-1;f>u.length-Fh;f--)if(!$h.test(u[f-1])&&$h.test(u[f])){u=u.slice(0,f);break}}return ye.announce.of(`${n.state.phrase("current match")}. ${u} ${n.state.phrase("on line")} ${i.number}.`)}const WL=ye.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),KL=[zr,$l.low(VL),WL];class hC{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=$n(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),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),a=l.search(dC(e,!1));return a<0?null:{from:i+a,to:this.pos,text:l.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Cw(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function XL(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let a=1;a<l.length;a++)t[l[a]]=!0}let i=Cw(e)+Cw(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function QL(n){let e=n.map(l=>typeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:XL(e);return l=>{let a=l.matchBefore(i);return a||l.explicit?{from:a?a.from:l.pos,options:e,validFor:t}:null}}function Bz(n,e){return t=>{for(let i=$n(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class Tw{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function Da(n){return n.selection.main.from}function dC(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",a=i[i.length-1]!="$";return!l&&!a?n:new RegExp(`${l?"^":""}(?:${i})${a?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Py=Wl.define();function ZL(n,e,t,i){let{main:l}=n.selection,a=t-l.from,o=i-l.from;return{...n.changeByRange(u=>{if(u!=l&&t!=i&&n.sliceDoc(u.from+a,u.from+o)!=n.sliceDoc(t,i))return{range:u};let f=n.toText(e);return{changes:{from:u.from+a,to:i==l.from?u.to:u.from+o,insert:f},range:Q.cursor(u.from+a+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Mw=new WeakMap;function JL(n){if(!Array.isArray(n))return n;let e=Mw.get(n);return e||Mw.set(n,e=QL(n)),e}const Id=Ge.define(),qu=Ge.define();class e3{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 i=ki(e,t),l=ol(i);this.chars.push(i);let a=e.slice(t,t+l),o=a.toUpperCase();this.folded.push(ki(o==a?a.toLowerCase():o,0)),t+=l}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:i,any:l,precise:a,byWord:o}=this;if(t.length==1){let D=ki(e,0),B=ol(D),H=B==e.length?0:-100;if(D!=t[0])if(D==i[0])H+=-200;else return null;return this.ret(H,[0,B])}let u=e.indexOf(this.pattern);if(u==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let f=t.length,d=0;if(u<0){for(let D=0,B=Math.min(e.length,200);D<B&&d<f;){let H=ki(e,D);(H==t[d]||H==i[d])&&(l[d++]=D),D+=ol(H)}if(d<f)return null}let p=0,b=0,x=!1,v=0,w=-1,C=-1,A=/[a-z]/.test(e),E=!0;for(let D=0,B=Math.min(e.length,200),H=0;D<B&&b<f;){let z=ki(e,D);u<0&&(p<f&&z==t[p]&&(a[p++]=D),v<f&&(z==t[v]||z==i[v]?(v==0&&(w=D),C=D+1,v++):v=0));let L,R=z<255?z>=48&&z<=57||z>=97&&z<=122?2:z>=65&&z<=90?1:0:(L=gy(z))!=L.toLowerCase()?1:L!=L.toUpperCase()?2:0;(!D||R==1&&A||H==0&&R!=0)&&(t[b]==z||i[b]==z&&(x=!0)?o[b++]=D:o.length&&(E=!1)),H=R,D+=ol(z)}return b==f&&o[0]==0&&E?this.result(-100+(x?-200:0),o,e):v==f&&w==0?this.ret(-200-e.length+(C==e.length?0:-100),[0,C]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):v==f?this.ret(-900-e.length,[w,C]):b==f?this.result(-100+(x?-200:0)+-700+(E?0:-1100),o,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],a=0;for(let o of t){let u=o+(this.astral?ol(ki(i,o)):1);a&&l[a-1]==o?l[a-1]=u:(l[a++]=o,l[a++]=u)}return this.ret(e-i.length,l)}}class t3{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),i=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,t.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const On=be.define({combine(n){return ml(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:n3,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)=>i=>Ew(e(i),t(i)),optionClass:(e,t)=>i=>Ew(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Ew(n,e){return n?e?n+" "+e:n:e}function n3(n,e,t,i,l,a){let o=n.textDirection==Bt.RTL,u=o,f=!1,d="top",p,b,x=e.left-l.left,v=l.right-e.right,w=i.right-i.left,C=i.bottom-i.top;if(u&&x<Math.min(w,v)?u=!1:!u&&v<Math.min(w,x)&&(u=!0),w<=(u?x:v))p=Math.max(l.top,Math.min(t.top,l.bottom-C))-e.top,b=Math.min(400,u?x:v);else{f=!0,b=Math.min(400,(o?e.right:l.right-e.left)-30);let D=l.bottom-e.bottom;D>=C||D>e.top?p=t.bottom-e.top:(d="bottom",p=e.bottom-t.top)}let A=(e.bottom-e.top)/a.offsetHeight,E=(e.right-e.left)/a.offsetWidth;return{style:`${d}: ${p/A}px; max-width: ${b/E}px`,class:"cm-completionInfo-"+(f?o?"left-narrow":"right-narrow":u?"left":"right")}}const Yy=Ge.define();function i3(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,a){let o=document.createElement("span");o.className="cm-completionLabel";let u=t.displayLabel||t.label,f=0;for(let d=0;d<a.length;){let p=a[d++],b=a[d++];p>f&&o.appendChild(document.createTextNode(u.slice(f,p)));let x=o.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(u.slice(p,b))),x.className="cm-completionMatchedText",f=b}return f<u.length&&o.appendChild(document.createTextNode(u.slice(f))),o},position:50},{render(t){if(!t.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=t.detail,i},position:80}),e.sort((t,i)=>t.position-i.position).map(t=>t.render)}function $g(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class s3{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:a,selected:o}=l.open,u=e.state.facet(On);this.optionContent=i3(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=$g(a.length,o,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let p=f.target,b;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(b=/-(\d+)$/.exec(p.id))&&+b[1]<d.length){this.applyCompletion(e,d[+b[1]]),f.preventDefault();return}if(f.target==this.list){let p=this.list.classList.contains("cm-completionListIncompleteTop")&&f.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&f.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(e.dispatch({effects:Yy.of(p)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(On).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:qu.of(null)})}),this.showOptions(a,l.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 i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:a,selected:o,disabled:u}=i.open;(!l.open||l.open.options!=a)&&(this.range=$g(a.length,o,e.state.facet(On).maxRenderedOptions),this.showOptions(a,i.id)),this.updateSel(),u!=((t=l.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 i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);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=$g(t.options.length,t.selected,this.view.state.facet(On).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:a}=l;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(l);if(!o)return;"then"in o?o.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,l)}).catch(u=>Ci(this.view.state,u,"completion info")):(this.addInfoPane(o,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:a}=e;i.appendChild(l),this.infoDestroy=a||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&r3(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return l.top>Math.min(a.bottom,t.bottom)-10||l.bottom<Math.max(a.top,t.top)+10?null:this.view.state.facet(On).positionInfo(this.view,t,l,i,a,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,i){const l=document.createElement("ul");l.id=t,l.setAttribute("role","listbox"),l.setAttribute("aria-expanded","true"),l.setAttribute("aria-label",this.view.state.phrase("Completions")),l.addEventListener("mousedown",o=>{o.target==l&&o.preventDefault()});let a=null;for(let o=i.from;o<i.to;o++){let{completion:u,match:f}=e[o],{section:d}=u;if(d){let x=typeof d=="string"?d:d.name;if(x!=a&&(o>i.from||i.from==0))if(a=x,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let v=l.appendChild(document.createElement("completion-section"));v.textContent=x}}const p=l.appendChild(document.createElement("li"));p.id=t+"-"+o,p.setAttribute("role","option");let b=this.optionClass(u);b&&(p.className=b);for(let x of this.optionContent){let v=x(u,this.view.state,this.view,f);v&&p.appendChild(v)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&l.classList.add("cm-completionListIncompleteBottom"),l}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function l3(n,e){return t=>new s3(t,n,e)}function r3(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.top<t.top?n.scrollTop-=(t.top-i.top)/l:i.bottom>t.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function Nw(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function a3(n,e){let t=[],i=null,l=null,a=p=>{t.push(p);let{section:b}=p.completion;if(b){i||(i=[]);let x=typeof b=="string"?b:b.name;i.some(v=>v.name==x)||i.push(typeof b=="string"?{name:x}:b)}},o=e.facet(On);for(let p of n)if(p.hasResult()){let b=p.result.getMatch;if(p.result.filter===!1)for(let x of p.result.options)a(new Tw(x,p.source,b?b(x):[],1e9-t.length));else{let x=e.sliceDoc(p.from,p.to),v,w=o.filterStrict?new t3(x):new e3(x);for(let C of p.result.options)if(v=w.match(C.label)){let A=C.displayLabel?b?b(C,v.matched):[]:v.matched,E=v.score+(C.boost||0);if(a(new Tw(C,p.source,A,E)),typeof C.section=="object"&&C.section.rank==="dynamic"){let{name:D}=C.section;l||(l=Object.create(null)),l[D]=Math.max(E,l[D]||-1e9)}}}}if(i){let p=Object.create(null),b=0,x=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.name<w.name?-1:1);for(let v of i.sort(x))b-=1e5,p[v.name]=b;for(let v of t){let{section:w}=v.completion;w&&(v.score+=p[typeof w=="string"?w:w.name])}}let u=[],f=null,d=o.compareCompletions;for(let p of t.sort((b,x)=>x.score-b.score||d(b.completion,x.completion))){let b=p.completion;!f||f.label!=b.label||f.detail!=b.detail||f.type!=null&&b.type!=null&&f.type!=b.type||f.apply!=b.apply||f.boost!=b.boost?u.push(p):Nw(p.completion)>Nw(f)&&(u[u.length-1]=p),f=p.completion}return u}class Lo{constructor(e,t,i,l,a,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=a,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Lo(this.options,Dw(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,a,o){if(l&&!o&&e.some(d=>d.isPending))return l.setDisabled();let u=a3(e,t);if(!u.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(On).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let p=0;p<u.length;p++)if(u[p].completion==d){f=p;break}}return new Lo(u,Dw(i,f),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:d3,above:a.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new Lo(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Lo(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ud{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Ud(f3,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(On),a=(i.override||t.languageDataAt("autocomplete",Da(t)).map(JL)).map(f=>(this.active.find(p=>p.source==f)||new fs(f,this.active.some(p=>p.state!=0)?1:0)).update(e,i));a.length==this.active.length&&a.every((f,d)=>f==this.active[d])&&(a=this.active);let o=this.open,u=e.effects.some(f=>f.is(Fy));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||a.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!o3(a,this.active)||u?o=Lo.build(a,t,this.id,o,i,u):o&&o.disabled&&!a.some(f=>f.isPending)&&(o=null),!o&&a.every(f=>!f.isPending)&&a.some(f=>f.hasResult())&&(a=a.map(f=>f.hasResult()?new fs(f.source,0):f));for(let f of e.effects)f.is(Yy)&&(o=o&&o.setSelected(f.value,this.id));return a==this.active&&o==this.open?this:new Ud(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?c3:u3}}function o3(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;i<e.length&&!e[i].hasResult();)i++;let l=t==n.length,a=i==e.length;if(l||a)return l==a;if(n[t++].result!=e[i++].result)return!1}}const c3={"aria-autocomplete":"list"},u3={};function Dw(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const f3=[];function pC(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Py);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class fs{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=pC(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new fs(l.source,0)),i&4&&l.state==0&&(l=new fs(this.source,1)),l=l.updateFor(e,i);for(let a of e.effects)if(a.is(Id))l=new fs(l.source,1,a.value);else if(a.is(qu))l=new fs(l.source,0);else if(a.is(Fy))for(let o of a.value)o.source==l.source&&(l=o);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Da(e.state))}}class Yo extends fs{constructor(e,t,i,l,a,o){super(e,3,t),this.limit=i,this.result=l,this.from=a,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let a=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),u=Da(e.state);if(u>o||!l||t&2&&(Da(e.startState)==this.from||u<this.limit))return new fs(this.source,t&4?1:0);let f=e.changes.mapPos(this.limit);return h3(l.validFor,e.state,a,o)?new Yo(this.source,this.explicit,f,l,a,o):l.update&&(l=l.update(l,a,o,new hC(e.state,u,!1)))?new Yo(this.source,this.explicit,f,l,l.from,(i=l.to)!==null&&i!==void 0?i:Da(e.state)):new fs(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 Yo(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new fs(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function h3(n,e,t,i){if(!n)return!1;let l=e.sliceDoc(t,i);return typeof n=="function"?n(l,t,i,e):dC(n,!0).test(l)}const Fy=Ge.define({map(n,e){return n.map(t=>t.map(e))}}),Ai=Wn.define({create(){return Ud.start()},update(n,e){return n.update(e)},provide:n=>[Ry.from(n,e=>e.tooltip),ye.contentAttributes.from(n,e=>e.attrs)]});function $y(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ai).active.find(l=>l.source==e.source);return i instanceof Yo?(typeof t=="string"?n.dispatch({...ZL(n.state,t,i.from,i.to),annotations:Py.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const d3=l3(Ai,$y);function Wh(n,e="option"){return t=>{let i=t.state.field(Ai,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<t.state.facet(On).interactionDelay)return!1;let l=1,a;e=="page"&&(a=ZA(t,i.open.tooltip))&&(l=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,u=i.open.selected>-1?i.open.selected+l*(n?1:-1):n?0:o-1;return u<0?u=e=="page"?0:o-1:u>=o&&(u=e=="page"?o-1:0),t.dispatch({effects:Yy.of(u)}),!0}}const p3=n=>{let e=n.state.field(Ai,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(On).interactionDelay?!1:$y(n,e.open.options[e.open.selected])},Wg=n=>n.state.field(Ai,!1)?(n.dispatch({effects:Id.of(!0)}),!0):!1,m3=n=>{let e=n.state.field(Ai,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:qu.of(null)}),!0)};class g3{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const y3=50,b3=1e3,x3=rn.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Ai).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ai),t=n.state.facet(On);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ai)==e)return;let i=n.transactions.some(a=>{let o=pC(a,t);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(i||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>y3&&Date.now()-o.time>b3){for(let u of o.context.abortListeners)try{u()}catch(f){Ci(this.view.state,f)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(a=>a.effects.some(o=>o.is(Id)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let a of n.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ai);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(On).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Da(e),i=new hC(e,t,n.explicit,this.view),l=new g3(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(a=>{l.context.aborted||(l.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:qu.of(null)}),Ci(this.view.state,a)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(On).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(On),i=this.view.state.field(Ai);for(let l=0;l<this.running.length;l++){let a=this.running[l];if(a.done===void 0)continue;if(this.running.splice(l--,1),a.done){let u=Da(a.updates.length?a.updates[0].startState:this.view.state),f=Math.min(u,a.done.from+(a.active.explicit?0:1)),d=new Yo(a.active.source,a.active.explicit,f,a.done,a.done.from,(n=a.done.to)!==null&&n!==void 0?n:u);for(let p of a.updates)d=d.update(p,t);if(d.hasResult()){e.push(d);continue}}let o=i.active.find(u=>u.source==a.active.source);if(o&&o.isPending)if(a.done==null){let u=new fs(a.active.source,0);for(let f of a.updates)u=u.update(f,t);u.isPending||e.push(u)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Fy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ai,!1);if(e&&e.tooltip&&this.view.state.facet(On).closeOnBlur){let t=e.open&&ZA(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:qu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Id.of(!1)}),20),this.composing=0}}}),v3=typeof navigator=="object"&&/Win/.test(navigator.platform),S3=$l.highest(ye.domEventHandlers({keydown(n,e){let t=e.state.field(Ai,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(v3&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(o=>o.source==i.source),a=i.completion.commitCharacters||l.result.commitCharacters;return a&&a.indexOf(n.key)>-1&&$y(e,i),!1}})),mC=ye.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"}}});class w3{constructor(e,t,i,l){this.field=e,this.line=t,this.from=i,this.to=l}}class Wy{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,Gn.TrackDel),i=e.mapPos(this.to,1,Gn.TrackDel);return t==null||i==null?null:new Wy(this.field,t,i)}}class Ky{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],l=[t],a=e.doc.lineAt(t),o=/^\s*/.exec(a.text)[0];for(let f of this.lines){if(i.length){let d=o,p=/^\t*/.exec(f)[0].length;for(let b=0;b<p;b++)d+=e.facet(Xd);l.push(t+d.length-p),f=d+f.slice(p)}i.push(f),t+=f.length+1}let u=this.fieldPositions.map(f=>new Wy(f.field,l[f.line]+f.from,l[f.line]+f.to));return{text:i,ranges:u}}static parse(e){let t=[],i=[],l=[],a;for(let o of e.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let u=a[1]?+a[1]:null,f=a[2]||a[3]||"",d=-1;u===0&&(u=1e9);let p=f.replace(/\\[{}]/g,b=>b[1]);for(let b=0;b<t.length;b++)(u!=null?t[b].seq==u:p&&t[b].name==p)&&(d=b);if(d<0){let b=0;for(;b<t.length&&(u==null||t[b].seq!=null&&t[b].seq<u);)b++;t.splice(b,0,{seq:u,name:p}),d=b;for(let x of l)x.field>=d&&x.field++}for(let b of l)if(b.line==i.length&&b.from>a.index){let x=a[2]?3+(a[1]||"").length:2;b.from-=x,b.to-=x}l.push(new w3(d,i.length,a.index,a.index+p.length)),o=o.slice(0,a.index)+f+o.slice(a.index+a[0].length)}o=o.replace(/\\([{}])/g,(u,f,d)=>{for(let p of l)p.line==i.length&&p.from>d&&(p.from--,p.to--);return f}),i.push(o)}return new Ky(i,l)}}let k3=ze.widget({widget:new class extends gl{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),A3=ze.mark({class:"cm-snippetField"});class pc{constructor(e,t){this.ranges=e,this.active=t,this.deco=ze.set(e.map(i=>(i.from==i.to?k3:A3).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let l=i.map(e);if(!l)return null;t.push(l)}return new pc(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const sf=Ge.define({map(n,e){return n&&n.map(e)}}),_3=Ge.define(),Vu=Wn.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(sf))return t.value;if(t.is(_3)&&n)return new pc(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>ye.decorations.from(n,e=>e?e.deco:ze.none)});function Xy(n,e){return Q.create(n.filter(t=>t.field==e).map(t=>Q.range(t.from,t.to)))}function C3(n){let e=Ky.parse(n);return(t,i,l,a)=>{let{text:o,ranges:u}=e.instantiate(t.state,l),{main:f}=t.state.selection,d={changes:{from:l,to:a==f.from?f.to:a,insert:ct.of(o)},scrollIntoView:!0,annotations:i?[Py.of(i),pn.userEvent.of("input.complete")]:void 0};if(u.length&&(d.selection=Xy(u,0)),u.some(p=>p.field>0)){let p=new pc(u,0),b=d.effects=[sf.of(p)];t.state.field(Vu,!1)===void 0&&b.push(Ge.appendConfig.of([Vu,D3,O3,mC]))}t.dispatch(t.state.update(d))}}function gC(n){return({state:e,dispatch:t})=>{let i=e.field(Vu,!1);if(!i||n<0&&i.active==0)return!1;let l=i.active+n,a=n>0&&!i.ranges.some(o=>o.field==l+n);return t(e.update({selection:Xy(i.ranges,l),effects:sf.of(a?null:new pc(i.ranges,l)),scrollIntoView:!0})),!0}}const T3=({state:n,dispatch:e})=>n.field(Vu,!1)?(e(n.update({effects:sf.of(null)})),!0):!1,M3=gC(1),E3=gC(-1),N3=[{key:"Tab",run:M3,shift:E3},{key:"Escape",run:T3}],Ow=be.define({combine(n){return n.length?n[0]:N3}}),D3=$l.highest(lc.compute([Ow],n=>n.facet(Ow)));function zz(n,e){return{...e,apply:C3(n)}}const O3=ye.domEventHandlers({mousedown(n,e){let t=e.state.field(Vu,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let l=t.ranges.find(a=>a.from<=i&&a.to>=i);return!l||l.field==t.active?!1:(e.dispatch({selection:Xy(t.ranges,l.field),effects:sf.of(t.ranges.some(a=>a.field>l.field)?new pc(t.ranges,l.field):null),scrollIntoView:!0}),!0)}}),Gu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ka=Ge.define({map(n,e){let t=e.mapPos(n,-1,Gn.TrackAfter);return t??void 0}}),Qy=new class extends Ir{};Qy.startSide=1;Qy.endSide=-1;const yC=Wn.define({create(){return nt.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(ka)&&(n=n.update({add:[Qy.range(t.value,t.value+1)]}));return n}});function R3(){return[L3,yC]}const Kg="()[]{}<>«»»«[]{}";function bC(n){for(let e=0;e<Kg.length;e+=2)if(Kg.charCodeAt(e)==n)return Kg.charAt(e+1);return gy(n<128?n:n+1)}function xC(n,e){return n.languageDataAt("closeBrackets",e)[0]||Gu}const j3=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),L3=ye.inputHandler.of((n,e,t,i)=>{if((j3?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&ol(ki(i,0))==1||e!=l.from||t!=l.to)return!1;let a=H3(n.state,i);return a?(n.dispatch(a),!0):!1}),B3=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=xC(n,n.selection.main.head).brackets||Gu.brackets,l=null,a=n.changeByRange(o=>{if(o.empty){let u=I3(n.doc,o.head);for(let f of i)if(f==u&&ip(n.doc,o.head)==bC(ki(f,0)))return{changes:{from:o.head-f.length,to:o.head+f.length},range:Q.cursor(o.head-f.length)}}return{range:l=o}});return l||e(n.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},z3=[{key:"Backspace",run:B3}];function H3(n,e){let t=xC(n,n.selection.main.head),i=t.brackets||Gu.brackets;for(let l of i){let a=bC(ki(l,0));if(e==l)return a==l?V3(n,l,i.indexOf(l+l+l)>-1,t):U3(n,l,a,t.before||Gu.before);if(e==a&&vC(n,n.selection.main.from))return q3(n,l,a)}return null}function vC(n,e){let t=!1;return n.field(yC).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function ip(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ol(ki(t,0)))}function I3(n,e){let t=n.sliceString(e-2,e);return ol(ki(t,0))==t.length?t:t.slice(1)}function U3(n,e,t,i){let l=null,a=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:ka.of(o.to+e.length),range:Q.range(o.anchor+e.length,o.head+e.length)};let u=ip(n.doc,o.head);return!u||/\s/.test(u)||i.indexOf(u)>-1?{changes:{insert:e+t,from:o.head},effects:ka.of(o.head+e.length),range:Q.cursor(o.head+e.length)}:{range:l=o}});return l?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function q3(n,e,t){let i=null,l=n.changeByRange(a=>a.empty&&ip(n.doc,a.head)==t?{changes:{from:a.head,to:a.head+t.length,insert:t},range:Q.cursor(a.head+t.length)}:i={range:a});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function V3(n,e,t,i){let l=i.stringPrefixes||Gu.stringPrefixes,a=null,o=n.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:ka.of(u.to+e.length),range:Q.range(u.anchor+e.length,u.head+e.length)};let f=u.head,d=ip(n.doc,f),p;if(d==e){if(Rw(n,f))return{changes:{insert:e+e,from:f},effects:ka.of(f+e.length),range:Q.cursor(f+e.length)};if(vC(n,f)){let x=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+x.length,insert:x},range:Q.cursor(f+x.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(p=jw(n,f-2*e.length,l))>-1&&Rw(n,p))return{changes:{insert:e+e+e+e,from:f},effects:ka.of(f+e.length),range:Q.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=$t.Word&&jw(n,f,l)>-1&&!G3(n,f,e,l))return{changes:{insert:e+e,from:f},effects:ka.of(f+e.length),range:Q.cursor(f+e.length)}}return{range:a=u}});return a?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Rw(n,e){let t=$n(n).resolveInner(e+1);return t.parent&&t.from==e}function G3(n,e,t,i){let l=$n(n).resolveInner(e,-1),a=i.reduce((o,u)=>Math.max(o,u.length),0);for(let o=0;o<5;o++){let u=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+a)),f=u.indexOf(t);if(!f||f>-1&&i.indexOf(u.slice(0,f))>-1){let p=l.firstChild;for(;p&&p.from==l.from&&p.to-p.from>t.length+f;){if(n.sliceDoc(p.to-t.length,p.to)==t)return!1;p=p.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function jw(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=$t.Word)return e;for(let l of t){let a=e-l.length;if(n.sliceDoc(a,e)==l&&i(n.sliceDoc(a-1,a))!=$t.Word)return a}return-1}function P3(n={}){return[S3,Ai,On.of(n),x3,Y3,mC]}const SC=[{key:"Ctrl-Space",run:Wg},{mac:"Alt-`",run:Wg},{mac:"Alt-i",run:Wg},{key:"Escape",run:m3},{key:"ArrowDown",run:Wh(!0)},{key:"ArrowUp",run:Wh(!1)},{key:"PageDown",run:Wh(!0,"page")},{key:"PageUp",run:Wh(!1,"page")},{key:"Enter",run:p3}],Y3=$l.highest(lc.computeN([On],n=>n.facet(On).defaultKeymap?[SC]:[]));class Lw{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Sa{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(Pu).markerFilter;l&&(e=l(e,i));let a=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),o=new Pl,u=[],f=0,d=i.doc.iter(),p=0,b=i.doc.length;for(let v=0;;){let w=v==a.length?null:a[v];if(!w&&!u.length)break;let C,A;if(u.length)C=f,A=u.reduce((B,H)=>Math.min(B,H.to),w&&w.from>C?w.from:1e8);else{if(C=w.from,C>b)break;A=w.to,u.push(w),v++}for(;v<a.length;){let B=a[v];if(B.from==C&&(B.to>B.from||B.to==C))u.push(B),v++,A=Math.min(B.to,A);else{A=Math.min(B.from,A);break}}A=Math.min(A,b);let E=!1;if(u.some(B=>B.from==C&&(B.to==A||A==b))&&(E=C==A,!E&&A-C<10)){let B=C-(p+d.value.length);B>0&&(d.next(B),p=C);for(let H=C;;){if(H>=A){E=!0;break}if(!d.lineBreak&&p+d.value.length>H)break;H=p+d.value.length,p+=d.value.length,d.next()}}let D=sB(u);if(E)o.add(C,C,ze.widget({widget:new eB(D),diagnostics:u.slice()}));else{let B=u.reduce((H,z)=>z.markClass?H+" "+z.markClass:H,"");o.add(C,A,ze.mark({class:"cm-lintRange cm-lintRange-"+D+B,diagnostics:u.slice(),inclusiveEnd:u.some(H=>H.to>A)}))}if(f=A,f==b)break;for(let B=0;B<u.length;B++)u[B].to<=f&&u.splice(B--,1)}let x=o.finish();return new Sa(x,t,Pr(x))}}function Pr(n,e=null,t=0){let i=null;return n.between(t,1e9,(l,a,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Lw(l,a,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Lw(i.from,a,i.diagnostic)}}),i}function F3(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(Pu).hideOn(n,t,i);if(l!=null)return l;let a=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(wC))||n.changes.touchesRange(a.from,Math.max(a.to,i)))}function $3(n,e){return n.field($i,!1)?e:e.concat(Ge.appendConfig.of(lB))}const wC=Ge.define(),Zy=Ge.define(),kC=Ge.define(),$i=Wn.define({create(){return new Sa(ze.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let a=e.changes.mapPos(n.selected.from,1);i=Pr(t,n.selected.diagnostic,a)||Pr(t,null,a)}!t.size&&l&&e.state.facet(Pu).autoPanel&&(l=null),n=new Sa(t,l,i)}for(let t of e.effects)if(t.is(wC)){let i=e.state.facet(Pu).autoPanel?t.value.length?Yu.open:null:n.panel;n=Sa.init(t.value,i,e.state)}else t.is(Zy)?n=new Sa(n.diagnostics,t.value?Yu.open:null,n.selected):t.is(kC)&&(n=new Sa(n.diagnostics,n.panel,t.value));return n},provide:n=>[Hu.from(n,e=>e.panel),ye.decorations.from(n,e=>e.diagnostics)]}),W3=ze.mark({class:"cm-lintRange cm-lintRange-active"});function K3(n,e,t){let{diagnostics:i}=n.state.field($i),l,a=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:p})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(e<d||t<0)))return l=p.diagnostics,a=f,o=d,!1});let u=n.state.facet(Pu).tooltipFilter;return l&&u&&(l=u(l,n.state)),l?{pos:a,end:o,above:!0,create(){return{dom:X3(n,l)}}}:null}function X3(n,e){return Nt("ul",{class:"cm-tooltip-lint"},e.map(t=>_C(n,t,!1)))}const Q3=n=>{let e=n.state.field($i,!1);(!e||!e.panel)&&n.dispatch({effects:$3(n.state,[Zy.of(!0)])});let t=jy(n,Yu.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Bw=n=>{let e=n.state.field($i,!1);return!e||!e.panel?!1:(n.dispatch({effects:Zy.of(!1)}),!0)},Z3=n=>{let e=n.state.field($i,!1);if(!e)return!1;let t=n.state.selection.main,i=Pr(e.diagnostics,null,t.to+1);return!i&&(i=Pr(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),CO(n,i.from,1,{tooltip:CC,until:l=>l.docChanged||l.newSelection.main.head<i.from||l.newSelection.main.head>i.to}),!0)},J3=[{key:"Mod-Shift-m",run:Q3,preventDefault:!0},{key:"F8",run:Z3}],Pu=be.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...ml(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:zw,tooltipFilter:zw,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,a)=>e(i,l,a)||t(i,l,a):e:t,autoPanel:(e,t)=>e||t})}}});function zw(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function AC(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let l=t[i];if(/[a-zA-Z]/.test(l)&&!e.some(a=>a.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function _C(n,e,t){var i;let l=t?AC(e.actions):[];return Nt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Nt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((a,o)=>{let u=!1,f=v=>{if(v.preventDefault(),u)return;u=!0;let w=Pr(n.state.field($i).diagnostics,e);w&&a.apply(n,w.from,w.to)},{name:d}=a,p=l[o]?d.indexOf(l[o]):-1,b=p<0?d:[d.slice(0,p),Nt("u",d.slice(p,p+1)),d.slice(p+1)],x=a.markClass?" "+a.markClass:"";return Nt("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${p<0?"":` (access key "${l[o]})"`}.`},b)}),e.source&&Nt("div",{class:"cm-diagnosticSource"},e.source))}class eB extends gl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Nt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Hw{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=_C(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Yu{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)Bw(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=AC(a.actions);for(let u=0;u<o.length;u++)if(o[u].toUpperCase().charCodeAt(0)==l.keyCode){let f=Pr(this.view.state.field($i).diagnostics,a);f&&a.actions[u].apply(e,f.from,f.to)}}else return;l.preventDefault()}},i=l=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(l.target)&&this.moveSelection(a)};this.list=Nt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=Nt("div",{class:"cm-panel-lint"},this.list,Nt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Bw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field($i).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field($i),i=0,l=!1,a=null,o=new Set;for(e.between(0,this.view.state.doc.length,(u,f,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let b=-1,x;for(let v=i;v<this.items.length;v++)if(this.items[v].diagnostic==p){b=v;break}b<0?(x=new Hw(this.view,p),this.items.splice(i,0,x),l=!0):(x=this.items[b],b>i&&(this.items.splice(i,b-i),l=!0)),t&&x.diagnostic==t.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),a=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)l=!0,this.items.pop();this.items.length==0&&(this.items.push(new Hw(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),l=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:u,panel:f})=>{let d=f.height/this.list.offsetHeight;u.top<f.top?this.list.scrollTop-=(f.top-u.top)/d:u.bottom>f.bottom&&(this.list.scrollTop+=(u.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field($i),i=Pr(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:kC.of(i)})}static open(e){return new Yu(e)}}function tB(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Kh(n){return tB(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const nB=ye.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Kh("#f11")},".cm-lintRange-warning":{backgroundImage:Kh("orange")},".cm-lintRange-info":{backgroundImage:Kh("#999")},".cm-lintRange-hint":{backgroundImage:Kh("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function iB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function sB(n){let e="hint",t=1;for(let i of n){let l=iB(i.severity);l>t&&(t=l,e=i.severity)}return e}const CC=_O(K3,{hideOn:F3}),lB=[$i,ye.decorations.compute([$i],n=>{let{selected:e,panel:t}=n.field($i);return!e||!t||e.from==e.to?ze.none:ze.set([W3.range(e.from,e.to)])}),CC,nB],rB=[IO(),VO(),nO(),yj(),gR(),YD(),XD(),pt.allowMultipleSelections.of(!0),nR(),g_(vR,{fallback:!0}),TR(),R3(),P3(),pO(),yO(),oO(),_L(),lc.of([...z3,...xL,...FL,...Cj,...hR,...SC,...J3])];function aB({file:n,goto:e,onChange:t,onSave:i,onReload:l,onOverwrite:a,onTogglePreview:o}){const u=Hl(n),f=S_(n.path)&&!n.binary&&!n.tooLarge;return y.jsxs("div",{className:"editor",children:[y.jsxs("div",{className:"editor__bar",children:[y.jsx("span",{className:"editor__path",title:n.path,children:n.path}),y.jsxs("span",{className:"editor__meta",children:[Gg(n.size),n.eol==="crlf"&&" · CRLF"]}),f&&y.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[y.jsx("button",{className:"btn btn--sm"+(n.previewMode?" is-on":""),role:"tab","aria-selected":n.previewMode,onClick:()=>!n.previewMode&&o(n.path),children:"Просмотр"}),y.jsx("button",{className:"btn btn--sm"+(n.previewMode?"":" is-on"),role:"tab","aria-selected":!n.previewMode,onClick:()=>n.previewMode&&o(n.path),children:"Код"})]}),y.jsx("button",{className:"btn btn--sm",disabled:!u,title:"Сохранить (Ctrl+S)",onClick:()=>i(n.path),children:u?"Сохранить":"Сохранено"})]}),n.stale&&y.jsxs("div",{className:"editor__warn",children:[y.jsxs("span",{children:["Файл изменился на диске",u?" — а здесь есть несохранённые правки.":"."]}),y.jsx("button",{className:"btn btn--sm",onClick:()=>l(n.path),children:"Взять с диска"}),u&&y.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>a(n.path),children:"Сохранить поверх"})]}),n.binary?y.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",Gg(n.size)," на диске."]}):n.tooLarge?y.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",Gg(n.size),"). Такие правит агент, а не браузер."]}):f&&n.previewMode?y.jsx(oB,{text:n.text}):y.jsx(uB,{path:n.path,doc:n.text,revision:n.revision,goto:e,onChange:t,onSave:i})]})}function oB({text:n}){const[e,t]=M.useState("");return M.useEffect(()=>{let i=!1;return w_(n).then(l=>{i||t(l)}),()=>{i=!0}},[n]),y.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:e}})}function cB({files:n,activePath:e,busy:t,onSelect:i,onClose:l}){return y.jsxs("div",{className:"worktabs",role:"tablist",children:[y.jsxs("button",{className:"worktab"+(e===null?" is-on":""),role:"tab","aria-selected":e===null,onClick:()=>i(null),children:[y.jsx("span",{className:"worktab__name",children:"Разговор"}),t&&y.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),n.map(a=>y.jsxs("div",{className:"worktab"+(a.path===e?" is-on":""),role:"tab","aria-selected":a.path===e,children:[y.jsx("button",{className:"worktab__name",title:a.path,onClick:()=>i(a.path),children:VR(a.path)}),Hl(a)?y.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${a.path}`,onClick:()=>l(a.path)}):y.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${a.path}`,onClick:()=>l(a.path),children:"✕"})]},a.path))]})}function uB({path:n,doc:e,revision:t,goto:i,onChange:l,onSave:a}){const o=M.useRef(null),u=M.useRef(null),f=M.useRef(new Map),d=M.useRef(new Map),p=M.useRef(new Set),b=M.useRef(new Wu),x=M.useRef(l),v=M.useRef(a),w=M.useRef(n),C=M.useRef(e);x.current=l,v.current=a,w.current=n,C.current=e,M.useEffect(()=>{const E=new ye({parent:o.current??void 0});return u.current=E,()=>{E.destroy(),u.current=null}},[]),M.useEffect(()=>{const E=u.current;if(!E)return;const D=f.current.get(n),B=d.current.get(n)!==t;if(D&&!B)E.setState(D);else{const z=pt.create({doc:C.current,extensions:[rB,$l.highest(lc.of([{key:"Mod-s",preventDefault:!0,run:()=>(v.current(w.current),!0)}])),lc.of([vL]),b.current.of([]),jR,LR,ye.updateListener.of(L=>{L.docChanged&&x.current(w.current,L.state.doc.toString())})]});f.current.set(n,z),d.current.set(n,t),E.setState(z),p.current.delete(n)}if(p.current.has(n))return;let H=!1;return IR(n).then(z=>{H||!z||w.current!==n||(E.dispatch({effects:b.current.reconfigure(z)}),f.current.set(n,E.state),p.current.add(n))}),()=>{H=!0}},[n,t]);const A=M.useRef(0);return M.useEffect(()=>{const E=u.current;if(!E||!i||i.token===A.current)return;A.current=i.token;const D=E.state.doc.lines,B=Math.min(Math.max(i.line,1),D),H=E.state.doc.line(B),z=Math.min(H.from+Math.max(i.column-1,0),H.to);E.dispatch({selection:Q.cursor(z),effects:ye.scrollIntoView(z,{y:"center"})}),E.focus()},[i]),M.useEffect(()=>()=>{const E=u.current;E&&f.current.set(n,E.state)},[n]),y.jsx("div",{className:"editor__code",ref:o})}function Iw({x:n,y:e,items:t,note:i,onClose:l}){const a=M.useRef(null),[o,u]=M.useState({left:n,top:e}),[f,d]=M.useState(()=>{const x=t.findIndex(v=>!v.disabled);return x===-1?0:x});M.useLayoutEffect(()=>{const x=a.current;if(!x)return;const v=x.getBoundingClientRect(),w=8,C=Math.max(w,Math.min(n,window.innerWidth-v.width-w)),A=Math.max(w,Math.min(e,window.innerHeight-v.height-w));u({left:C,top:A})},[n,e]),M.useLayoutEffect(()=>{var x;(x=a.current)==null||x.focus()},[]),M.useLayoutEffect(()=>{function x(w){var C;(C=a.current)!=null&&C.contains(w.target)||l()}function v(){l()}return document.addEventListener("mousedown",x),document.addEventListener("scroll",v,!0),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("scroll",v,!0)}},[l]);function p(x){x.disabled||(x.onSelect(),l())}function b(x){if(x.key==="Escape"){x.preventDefault(),x.stopPropagation(),l();return}const v=t.map((w,C)=>({item:w,index:C})).filter(w=>!w.item.disabled);if(v.length!==0){if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const w=x.key==="ArrowDown"?1:-1,C=v.findIndex(E=>E.index===f),A=v[(((C===-1?0:C)+w)%v.length+v.length)%v.length];A&&d(A.index);return}if(x.key==="Enter"||x.key===" "){x.preventDefault();const w=t[f];w&&p(w)}}}return y.jsxs("div",{ref:a,className:"ctxmenu",style:{left:o.left,top:o.top},role:"menu",tabIndex:-1,onKeyDown:b,children:[i&&y.jsx("div",{className:"ctxmenu__note",children:i}),t.map((x,v)=>y.jsxs("button",{type:"button",role:"menuitem","aria-disabled":x.disabled,className:"ctxmenu__item"+(v===f?" is-cursor":""),onMouseEnter:()=>d(v),onClick:()=>p(x),children:[y.jsx("span",{className:"ctxmenu__label",children:x.label}),x.hint&&y.jsx("span",{className:"ctxmenu__hint",children:x.hint})]},x.id))]})}const TC="ccv:sidebar.collapsed",fB=500;function hB({open:n,connected:e,status:t,workspaces:i,sessions:l,archived:a,activeWorkspaceId:o,activeSessionId:u,onSelectWorkspace:f,onSelectSession:d,onRenameSession:p,onCloseWorkspaces:b,onArchiveSessions:x,onUnarchiveSessions:v,onOpenWorkspace:w,onNewSession:C,onOpenExtensions:A,account:E,onOpenAccount:D,relay:B,onOpenRelay:H,onOpenSettings:z,themeMode:L,onCycleTheme:R}){const[te,fe]=M.useState(null),[Te,he]=M.useState(""),[le,Me]=M.useState(mB),Ae=Te.trim().toLowerCase(),Se=Ae!=="",q=M.useMemo(()=>Se?i.filter(ce=>ce.name.toLowerCase().includes(Ae)||ce.path.toLowerCase().includes(Ae)):i,[i,Ae,Se]),J=M.useMemo(()=>Se?l.filter(ce=>(ce.title??"").toLowerCase().includes(Ae)):l,[l,Ae,Se]),W=M.useMemo(()=>Se?a.filter(ce=>(ce.title??"").toLowerCase().includes(Ae)):a,[a,Ae,Se]);function Ee(ce){Me(Ve=>{const vt=Ve.includes(ce)?Ve.filter($e=>$e!==ce):[...Ve,ce];try{localStorage.setItem(TC,JSON.stringify(vt))}catch{}return vt})}const Ne=ce=>!le.includes(ce),N=qw(q),F=qw(J),[se,ae]=M.useState(null),[de,_e]=M.useState(null),Re=M.useRef(null);function ft(ce,Ve){const vt=ce.touches[0];if(!vt)return;const $e={timer:0,x:vt.clientX,y:vt.clientY,el:ce.currentTarget,fired:!1};$e.timer=window.setTimeout(()=>{$e.fired=!0,Ve($e.x,$e.y,$e.el)},fB),Re.current=$e}function ht(ce){const Ve=Re.current,vt=ce.touches[0];!Ve||!vt||Math.hypot(vt.clientX-Ve.x,vt.clientY-Ve.y)>10&&(window.clearTimeout(Ve.timer),Re.current=null)}function xt(ce){const Ve=Re.current;Ve&&(window.clearTimeout(Ve.timer),Ve.fired&&ce.preventDefault())}function Ye(){var ce;return(ce=Re.current)!=null&&ce.fired?(Re.current=null,!0):!1}function Sn(){const ce=se==null?void 0:se.opener;ae(null),ce!=null&&ce.isConnected&&ce.focus()}function Je(){const ce=de==null?void 0:de.opener;_e(null),ce!=null&&ce.isConnected&&ce.focus()}function we(ce){return{onContextMenu:Ve=>{Ve.preventDefault(),ae({x:Ve.clientX,y:Ve.clientY,opener:Ve.currentTarget,ids:N.targetsFor(ce)})},onTouchStart:Ve=>ft(Ve,(vt,$e,gn)=>ae({x:vt,y:$e,opener:gn,ids:N.targetsFor(ce)})),onTouchMove:ht,onTouchEnd:xt,onTouchCancel:xt}}function xe(ce){return{onContextMenu:Ve=>{Ve.preventDefault(),_e({x:Ve.clientX,y:Ve.clientY,opener:Ve.currentTarget,ids:F.targetsFor(ce)})},onTouchStart:Ve=>ft(Ve,(vt,$e,gn)=>_e({x:vt,y:$e,opener:gn,ids:F.targetsFor(ce)})),onTouchMove:ht,onTouchEnd:xt,onTouchCancel:xt}}const Gt=l.filter(ce=>ce.state!=="closed").length,wn=se?[{id:"close",label:se.ids.length>1?`Закрыть проекты (${se.ids.length})`:"Закрыть проект",onSelect:()=>{b(se.ids),N.clear()}}]:[],qe=se?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(o&&se.ids.includes(o)&&Gt>0?` в нём сейчас незавершённых сессий: ${Gt} — при закрытии они остановятся на хосте.`:""):void 0,jn=de?[...de.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>fe(de.ids[0])}]:[],{id:"archive",label:de.ids.length>1?`Убрать в архив (${de.ids.length})`:"Убрать в архив",onSelect:()=>{x(de.ids),F.clear()}}]:[],Kn=de?"транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.":void 0;return y.jsxs("aside",{className:n?"sidebar sidebar--open":"sidebar",children:[y.jsxs("div",{className:"sidebar__head",children:[y.jsx("span",{className:e?"dot dot--on":"dot",title:t}),y.jsx("span",{className:"brand",children:"Claude Code Visual"}),y.jsx("button",{className:"theme-btn",title:`Тема: ${Vw[L]}`,"aria-label":`Тема: ${Vw[L]}. Переключить`,onClick:R,children:y.jsx(gB,{mode:L})})]}),y.jsxs("div",{className:"fssearch fssearch--sidebar",children:[y.jsx(pB,{}),y.jsx("input",{className:"fssearch__input",type:"text",value:Te,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:ce=>he(ce.target.value),onKeyDown:ce=>{ce.stopPropagation(),ce.key==="Escape"&&(ce.preventDefault(),Te?he(""):ce.currentTarget.blur())}}),Te&&y.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>he(""),children:"✕"})]}),y.jsxs("div",{className:"sidebar__scroll",children:[y.jsx(Xg,{title:"Проекты",count:q.length,open:Ne("workspaces"),onToggle:()=>Ee("workspaces")}),Ne("workspaces")&&y.jsxs(y.Fragment,{children:[q.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:Se?"Ничего не найдено":"Пока ни одного"})}),q.map(ce=>y.jsx("div",{className:Uw(ce.id===o,N.selected.includes(ce.id)),...we(ce),children:y.jsxs("button",{className:"row__main",onClick:Ve=>{Ye()||N.click(Ve,ce,()=>f(ce.id))},children:[y.jsxs("span",{className:"row__title",children:[ce.name,ce.hasClaudeMd&&" ·"]}),y.jsx("span",{className:"row__meta",title:ce.path,children:ce.path})]})},ce.id))]}),o&&y.jsxs(y.Fragment,{children:[y.jsx(Xg,{title:"Сессии",count:J.length,open:Ne("sessions"),onToggle:()=>Ee("sessions")}),Ne("sessions")&&y.jsxs(y.Fragment,{children:[J.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:Se?"Ничего не найдено":"Пока ни одной"})}),J.map(ce=>y.jsx("div",{className:Uw(ce.id===u,F.selected.includes(ce.id)),...te===ce.id?{}:xe(ce),children:te===ce.id?y.jsx("div",{className:"row__main",children:y.jsx(Ed,{value:ce.title??"",onCommit:Ve=>{p(ce,Ve),fe(null)},onCancel:()=>fe(null)})}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:"row__main",onClick:Ve=>{Ye()||F.click(Ve,ce,()=>d(ce))},children:[y.jsx("span",{className:"row__title",children:ce.title??"Без названия"}),y.jsxs("span",{className:"row__meta",children:[yB(ce)," · ",new Date(ce.updatedAt).toLocaleString()]})]}),y.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{Ye()||fe(ce.id)},children:"✎"})]})},ce.id))]}),a.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(Xg,{title:"Архив",count:W.length,open:Ne("archive"),onToggle:()=>Ee("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),Ne("archive")&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),W.length===0&&y.jsx("div",{className:"row",children:y.jsx("span",{className:"row__meta",children:Se?"Ничего не найдено":"Пока пусто"})}),W.map(ce=>y.jsxs("div",{className:ce.id===u?"row row--active":"row",children:[y.jsxs("button",{className:"row__main",onClick:()=>d(ce),children:[y.jsx("span",{className:"row__title",children:ce.title??"Без названия"}),y.jsx("span",{className:"row__meta",children:bB(ce)})]}),y.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>v([ce.id]),children:"Вернуть"})]},ce.id))]})]})]})]}),y.jsxs("div",{className:"sidebar__foot",children:[y.jsxs("button",{className:"account-btn sidebar__wide",title:"Аккаунт Claude",onClick:D,children:[y.jsx("span",{className:E!=null&&E.loggedIn?"dot dot--on":"dot"}),y.jsx("span",{className:"account-btn__id",children:E===null?"Аккаунт":E.loggedIn?E.email||"Вход выполнен":"Войти в аккаунт"}),(E==null?void 0:E.plan)&&y.jsx("span",{className:"chip",children:E.plan})]}),H&&y.jsxs("button",{className:"account-btn sidebar__wide",title:"Доступ с телефона и из браузера",onClick:H,children:[y.jsx("span",{className:B!=null&&B.connected?"dot dot--on":"dot"}),y.jsx("span",{className:"account-btn__id",children:B===null?"Удалённый доступ":B.paired?B.connected?B.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(B==null?void 0:B.connected)&&B.clients>0&&y.jsx("span",{className:"chip",children:B.clients})]}),y.jsx("button",{className:"btn btn--ghost sidebar__wide",disabled:!A,title:"MCP-серверы и плагины",onClick:()=>A==null?void 0:A(),children:"Расширения"}),y.jsx("button",{className:"btn btn--ghost sidebar__wide",title:"Настройки приложения",onClick:z,children:"Настройки"}),y.jsx("button",{className:"btn btn--ghost",onClick:w,children:"+ Проект"}),y.jsx("button",{className:"btn btn--primary",onClick:C,disabled:!o,children:"+ Сессия"})]}),se&&y.jsx(Iw,{x:se.x,y:se.y,items:wn,note:qe,onClose:Sn}),de&&y.jsx(Iw,{x:de.x,y:de.y,items:jn,note:Kn,onClose:Je})]})}function Uw(n,e){const t=["row"];return n&&t.push("row--active"),e&&t.push("row--selected"),t.join(" ")}function qw(n){const[e,t]=M.useState([]),i=M.useRef(null);function l(){t([]),i.current=null}function a(u,f,d){if(u.ctrlKey||u.metaKey){t(p=>p.includes(f.id)?p.filter(b=>b!==f.id):[...p,f.id]),i.current=f.id;return}if(u.shiftKey&&i.current){const p=n.findIndex(x=>x.id===i.current),b=n.findIndex(x=>x.id===f.id);if(p!==-1&&b!==-1){const[x,v]=p<b?[p,b]:[b,p];t(n.slice(x,v+1).map(w=>w.id));return}}l(),i.current=f.id,d()}function o(u){return e.includes(u.id)?e:(t([u.id]),i.current=u.id,[u.id])}return{selected:e,click:a,targetsFor:o,clear:l}}function Xg({title:n,count:e,open:t,onToggle:i,hint:l}){const a=t?`Свернуть «${n}»`:`Развернуть «${n}»`;return y.jsxs("button",{className:"sidebar__section sidebar__section--btn","aria-expanded":t,title:l?`${a} — ${l}`:a,onClick:i,children:[y.jsx(dB,{open:t}),y.jsx("span",{className:"sidebar__section-name",children:n}),y.jsx("span",{className:"sidebar__count",children:e})]})}function dB({open:n}){return y.jsx("svg",{className:n?"sidebar__chev sidebar__chev--open":"sidebar__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function pB(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function mB(){try{const n=localStorage.getItem(TC);if(n===null)return["archive"];const e=JSON.parse(n);return Array.isArray(e)?e.filter(t=>t==="workspaces"||t==="sessions"||t==="archive"):["archive"]}catch{return["archive"]}}const Vw={system:"как в системе",light:"светлая",dark:"тёмная"};function gB({mode:n}){const e={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return n==="dark"?y.jsx("svg",{...e,children:y.jsx("path",{d:"M13.2 9.7A5.4 5.4 0 0 1 6.3 2.8a5.6 5.6 0 1 0 6.9 6.9Z"})}):n==="light"?y.jsxs("svg",{...e,children:[y.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),y.jsx("path",{d:"M8 1.4v1.4M8 13.2v1.4M2.4 8H1M15 8h-1.4M4 4l-1-1M13 13l-1-1M12 4l1-1M3 13l1-1"})]}):y.jsxs("svg",{...e,children:[y.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),y.jsx("path",{d:"M5.6 13.4h4.8"})]})}function yB(n){switch(n.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return"готова";case"starting":return"запускается";case"error":return"ошибка";case"closed":return"на диске"}}function bB(n){const e=n.archivedAuto?"сама, по сроку молчания":"убрана вручную";return n.archivedAt?`${new Date(n.archivedAt).toLocaleString()} · ${e}`:e}const Gw=3,xB=15e5;function MC(n,e){if(!e||typeof e!="object")return null;const t=e,i=typeof t.file_path=="string"?t.file_path:"";if(!i)return null;if(n==="Write"){if(typeof t.content!="string")return null;const l=Qg(t.content).map(a=>({type:"add",text:a}));return{kind:"create",filePath:i,rows:l,added:l.length,removed:0,note:"файл записывается целиком"}}if(n==="Edit"){if(typeof t.old_string!="string"||typeof t.new_string!="string")return null;const l=kB(vB(Qg(t.old_string),Qg(t.new_string)));return{kind:"edit",filePath:i,rows:l,added:l.filter(a=>a.type==="add").length,removed:l.filter(a=>a.type==="del").length,note:t.replace_all===!0?"все вхождения":null}}return null}function Qg(n){if(n==="")return[];const e=n.split(/\r?\n/);return e.length>1&&e[e.length-1]===""&&e.pop(),e}function vB(n,e){let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;let i=n.length,l=e.length;for(;i>t&&l>t&&n[i-1]===e[l-1];)i--,l--;const a=o=>({type:"ctx",text:o});return[...n.slice(0,t).map(a),...SB(n.slice(t,i),e.slice(t,l)),...n.slice(i).map(a)]}function SB(n,e){if(n.length===0&&e.length===0)return[];if(n.length===0)return e.map(p=>({type:"add",text:p}));if(e.length===0)return n.map(p=>({type:"del",text:p}));if((n.length+1)*(e.length+1)>xB)return[...n.map(p=>({type:"del",text:p})),...e.map(p=>({type:"add",text:p}))];const t=n.length,i=e.length,l=i+1,a=new Uint32Array((t+1)*l),o=(p,b)=>a[p*l+b]??0;for(let p=t-1;p>=0;p--)for(let b=i-1;b>=0;b--)a[p*l+b]=n[p]===e[b]?o(p+1,b+1)+1:Math.max(o(p+1,b),o(p,b+1));const u=[];let f=0,d=0;for(;f<t&&d<i;){const p=n[f],b=e[d];p===b?(u.push({type:"ctx",text:p}),f++,d++):o(f+1,d)>=o(f,d+1)?(u.push({type:"del",text:p}),f++):(u.push({type:"add",text:b}),d++)}for(;f<t;)u.push({type:"del",text:n[f++]});for(;d<i;)u.push({type:"add",text:e[d++]});return wB(u)}function wB(n){const e=[];let t=[];function i(){e.push(...t.filter(l=>l.type==="del")),e.push(...t.filter(l=>l.type==="add")),t=[]}for(const l of n)l.type==="ctx"?(i(),e.push(l)):t.push(l);return i(),e}function kB(n){if(!n.some(a=>a.type!=="ctx"))return n;const e=n.map(()=>!1);n.forEach((a,o)=>{if(a.type!=="ctx")for(let u=Math.max(0,o-Gw);u<=Math.min(n.length-1,o+Gw);u++)e[u]=!0});const t=[];let i=[];function l(){i.length===1?t.push(...i):i.length>1&&t.push({type:"gap",text:`⋯ ${i.length} ${AB(i.length)} без изменений`}),i=[]}return n.forEach((a,o)=>{e[o]?(l(),t.push(a)):i.push(a)}),l(),t}function AB(n){const e=n%100;if(e>=11&&e<=14)return"строк";switch(n%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}function Jy({diff:n}){return y.jsxs("div",{className:"diff",children:[y.jsxs("div",{className:"diff__head",children:[y.jsx("span",{className:"diff__path",title:n.filePath,children:n.filePath}),y.jsxs("span",{className:"diff__stat",children:[n.added>0&&y.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&y.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]})]}),n.note&&y.jsx("div",{className:"diff__note",children:n.note}),y.jsx("div",{className:"diff__body",children:n.rows.length===0?y.jsx("div",{className:"diff__row diff__row--gap",children:y.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):n.rows.map((e,t)=>y.jsxs("div",{className:`diff__row diff__row--${e.type}`,children:[y.jsx("span",{className:"diff__mark","aria-hidden":"true",children:e.type==="add"?"+":e.type==="del"?"−":""}),y.jsx("span",{className:"diff__text",children:e.text===""?" ":e.text})]},t))})]})}function _B({waiting:n}){const[e,t]=M.useState(0);return M.useEffect(()=>{const i=window.setInterval(()=>t(l=>l+1),1e3);return()=>window.clearInterval(i)},[]),y.jsxs("div",{className:n?"work work--wait":"work",children:[y.jsxs("span",{className:"work__dots","aria-hidden":"true",children:[y.jsx("span",{className:"work__dot"}),y.jsx("span",{className:"work__dot"}),y.jsx("span",{className:"work__dot"})]}),y.jsx("span",{className:"work__label",children:n?"ждёт разрешения":"думает"}),!n&&y.jsxs("span",{className:"work__time",children:[e," с"]})]})}function eb({items:n,busy:e,waiting:t,empty:i="Сессия пуста. Опишите задачу — Claude Code работает в каталоге проекта с полным набором инструментов."}){const l=M.useRef(null),a=M.useRef(!0);M.useEffect(()=>{const u=l.current;!u||!a.current||(u.scrollTop=u.scrollHeight)},[n,e]);function o(){const u=l.current;u&&(a.current=u.scrollHeight-u.scrollTop-u.clientHeight<80)}return y.jsx("div",{className:"transcript",ref:l,onScroll:o,children:y.jsxs("div",{className:"stream",children:[n.length===0&&y.jsx("p",{className:"empty",children:i}),n.map(u=>y.jsx(CB,{item:u},u.id)),e&&y.jsx(_B,{waiting:t})]})})}function CB({item:n}){switch(n.kind){case"user":return y.jsx("div",{className:"msg--user",children:n.text});case"assistant":return y.jsxs("div",{className:"msg--assistant",children:[y.jsx(TB,{text:n.text}),n.streaming&&y.jsx("span",{className:"caret"})]});case"thinking":return y.jsx("div",{className:"thinking",children:n.text});case"tool":return y.jsx(MB,{item:n});case"result":return y.jsxs("div",{className:"result-line",children:[y.jsx("span",{children:n.isError?"✗ "+n.subtype:"✓ готово"}),y.jsxs("span",{children:[(n.durationMs/1e3).toFixed(1)," с"]}),n.costUsd!==null&&y.jsxs("span",{children:["$",n.costUsd.toFixed(4)]}),y.jsxs("span",{children:["↑",Pw(n.inputTokens)," ↓",Pw(n.outputTokens)]})]});case"notice":return y.jsx("div",{className:n.tone==="error"?"notice notice--error":"notice",children:n.text})}}function TB({text:n}){const[e,t]=M.useState("");return M.useEffect(()=>{let i=!1;return w_(n).then(l=>{i||t(l)}),()=>{i=!0}},[n]),y.jsx("div",{className:"markdown-preview msg--assistant__body",dangerouslySetInnerHTML:{__html:e}})}function MB({item:n}){const[e,t]=M.useState(!1),i=n.result===null,l=MC(n.name,n.input),a=n.name==="AskUserQuestion"?DB(n.input):null;return y.jsxs("div",{className:"tool"+(n.isError?" tool--error":"")+(n.awaitingPermission?" tool--wait":""),children:[y.jsxs("button",{className:"tool__head",onClick:()=>t(o=>!o),children:[y.jsx("span",{className:"tool__name",children:n.name}),y.jsx("span",{className:"tool__arg",children:a?NB(a):EB(n.input)}),y.jsx("span",{className:"tool__status",children:i?"…":n.isError?"ошибка":e?"▴":"▾"})]}),e&&y.jsxs("div",{className:"tool__body",children:[a?y.jsx(OB,{questions:a,answers:n.answers}):l?y.jsx(Jy,{diff:l}):y.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)}),n.result!==null&&(!a||n.isError)&&y.jsx("pre",{className:"code",style:{marginTop:10},children:n.result})]})]})}function EB(n){if(!n||typeof n!="object")return"";const e=n;for(const t of["file_path","command","pattern","path","url","prompt"]){const i=e[t];if(typeof i=="string")return i.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(e).slice(0,160)}function NB(n){var t;const e=n.map(i=>i.header).filter(i=>i.length>0);return e.length===n.length?e.join(" · "):((t=n[0])==null?void 0:t.question.replace(/\s+/g," ").slice(0,160))??""}function DB(n){if(typeof n!="object"||n===null)return null;const e=n.questions;if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const i of e){if(typeof i!="object"||i===null)return null;const{question:l,header:a,options:o,multiSelect:u}=i;if(typeof l!="string"||!Array.isArray(o)||o.length===0)return null;const f=[];for(const d of o){if(typeof d!="object"||d===null)return null;const{label:p,description:b,preview:x}=d;if(typeof p!="string"||typeof b!="string")return null;f.push({label:p,description:b,...typeof x=="string"?{preview:x}:{}})}t.push({question:l,header:typeof a=="string"?a:"",options:f,multiSelect:u===!0})}return t}function OB({questions:n,answers:e}){return y.jsx("div",{className:"tool__questions",children:n.map((t,i)=>y.jsxs("div",{className:"tool__question",children:[y.jsxs("div",{className:"tool__question-head",children:[t.header&&y.jsx("span",{className:"chip chip--accent",children:t.header}),y.jsx("span",{className:"tool__question-text",children:t.question})]}),y.jsx("div",{className:"tool__question-answer",children:e!=null&&e[t.question]?y.jsx("span",{className:"tool__answer-value",children:e[t.question]}):y.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},i))})}function Pw(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}const RB="ccv.dictation.lang",Yw="ru-RU";function jB(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function Fw(){const n=window,e=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(i=>typeof i=="function"),t=e.find(jB);return!t&&e.length>0&&Es("распознавание подменено: родной реализации в странице нет"),t??e[0]??null}function EC(){var n;try{return((n=localStorage.getItem(RB))==null?void 0:n.trim())||Yw}catch{return Yw}}function Es(n,e){e===void 0?console.debug(`[dictation] ${n}`):console.debug(`[dictation] ${n}`,e)}const LB=3,BB=400,zB=5,HB=250,IB=2e3,UB=2e4;async function qB(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const VB={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${EC()}`};function GB(n){const[e]=M.useState(()=>Fw()!==null),[t,i]=M.useState(!1),[l,a]=M.useState(null),o=M.useRef(null),u=M.useRef(!1),f=M.useRef(!1),d=M.useRef(n),p=M.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),b=M.useRef(null),x=M.useRef(!1),v=M.useRef(null),w=M.useCallback(()=>{v.current&&clearTimeout(v.current),v.current=null},[]),C=M.useCallback(()=>{w();const H=async z=>{if(v.current=null,!(!u.current||x.current)){if(!z&&!await qB()){if(Es("ждём ответа на запрос доступа к микрофону"),!u.current||x.current)return;v.current=setTimeout(()=>void H(!0),UB);return}Es("движок не ответил на start()"),u.current=!1,i(!1),a("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};v.current=setTimeout(()=>void H(!1),IB)},[w]);M.useEffect(()=>{d.current=n}),M.useEffect(()=>{const H=Fw();if(!H)return;const z=new H;return z.lang=EC(),z.continuous=!0,z.interimResults=!0,z.onstart=()=>{Es("сессия открыта"),x.current=!0,w(),i(!0)},z.onaudiostart=()=>{Es("пошёл звук с микрофона"),p.current.audio=!0},z.onresult=L=>{var Te;if(f.current)return;let R="",te="";for(let he=L.resultIndex;he<L.results.length;he++){const le=L.results[he];if(!le)continue;const Me=((Te=le[0])==null?void 0:Te.transcript)??"";le.isFinal?R+=Me:te+=Me}const fe=p.current;fe.heard=!0,fe.everHeard=!0,Es("распознано",{final:R,interim:te}),d.current(R,te)},z.onerror=L=>{p.current.lastError=L.error,Es("ошибка движка",L.error),!(L.error==="no-speech"||L.error==="aborted")&&(u.current=!1,i(!1),a(VB[L.error]??`Распознавание не работает: ${L.error}`))},z.onend=()=>{f.current=!1,x.current=!1;const L=p.current,R=Date.now()-L.openedAt;if(Es("сессия закрыта",{мс:R,звук:L.audio,слова:L.heard,ошибка:L.lastError||null}),!u.current){i(!1);return}if(L.dead=!L.audio&&R<BB?L.dead+1:0,L.dead>=zB){u.current=!1,i(!1),a(L.lastError?`Распознавание не работает: ${L.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}L.silent=L.heard?0:L.silent+1,!L.everHeard&&!L.warned&&L.silent>=LB&&(L.warned=!0,a(L.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),b.current=setTimeout(()=>{if(b.current=null,!!u.current){L.openedAt=Date.now(),L.audio=!1,L.heard=!1,L.lastError="",C();try{z.start()}catch{}}},HB)},o.current=z,()=>{u.current=!1,b.current&&clearTimeout(b.current),b.current=null,w(),z.onend=null,z.onresult=null,z.onerror=null,z.onstart=null,z.onaudiostart=null,z.abort(),o.current=null}},[]);const A=M.useCallback(()=>{var H;if(u.current){if(u.current=!1,Es("выключение микрофона"),b.current&&clearTimeout(b.current),b.current=null,w(),!x.current){i(!1);return}(H=o.current)==null||H.stop()}},[]),E=M.useCallback(()=>{const H=o.current;if(H){if(!window.isSecureContext){a("Микрофон доступен только по https или с localhost");return}a(null),u.current=!0,f.current=!1,b.current&&clearTimeout(b.current),b.current=null,p.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},i(!0),Es("включение микрофона",{язык:H.lang}),C();try{H.start()}catch(z){Es("start() не прошёл",z)}}},[C]),D=M.useCallback(()=>{u.current?A():E()},[E,A]),B=M.useCallback(()=>{var H;u.current&&x.current&&(f.current=!0,(H=o.current)==null||H.abort())},[]);return{supported:e,listening:t,error:l,toggle:D,stop:A,drop:B}}const PB="(max-width: 860px)",$w=/^\/(\S*)$/,YB=new Set(["model","permissions"]);function FB(n){return YB.has(n.name)||n.name.startsWith("__")}const $B=new Set(["clear","rename"]),Ww=/(?:^|\s)@([^\s@]*)$/,WB=200,KB=100,XB=190;function NC({disabled:n,busy:e,commands:t,sessionTitle:i,contextResult:l,className:a,placeholder:o,sendLabel:u="Отправить",autoFocus:f=!1,onContextSearch:d,onCommand:p,onSend:b,onInterrupt:x,onEscape:v}){var gn;const w=pk(PB),[C,A]=M.useState(""),[E,D]=M.useState(!1),[B,H]=M.useState(0),z=M.useRef(null),L=M.useRef(null),R=M.useRef(null),[te,fe]=M.useState(0),[Te,he]=M.useState([]),[le,Me]=M.useState(-1),Ae=M.useRef(""),[Se,q]=M.useState(""),J=GB(M.useCallback((K,ue)=>{K&&A(Le=>Zg(Le,K)),q(ue.trim())},[])),W=Se?Zg(C,Se):C;M.useEffect(()=>{J.listening||Se===""||(A(K=>Zg(K,Se)),q(""))},[J.listening,Se]),M.useEffect(()=>{var K;f&&((K=z.current)==null||K.focus())},[f]);const Ee=n?"Выберите сессию":o??"Опишите задачу… («/» — команды, «@» — файлы)",Ne=M.useRef(0),N=M.useCallback(K=>{const ue=parseFloat(getComputedStyle(K).maxHeight),Le=Number.isFinite(ue)&&ue>0?ue:XB;K.style.height="auto";const dt=K.scrollHeight;K.style.height=`${Math.min(dt,Le)}px`,K.style.overflowY=dt>Le?"auto":"hidden";const Wt=R.current;Wt&&(R.current=null,K.setSelectionRange(Wt[0],Wt[1]))},[]);M.useEffect(()=>{const K=z.current;K&&N(K)},[W,Ee,n,N]),M.useEffect(()=>{const K=z.current;if(!K)return;const ue=new ResizeObserver(([Le])=>{const dt=Le==null?void 0:Le.contentRect.width;dt===void 0||Math.abs(dt-Ne.current)<1||(Ne.current=dt,N(K))});return ue.observe(K),()=>ue.disconnect()},[N]);const F=J.stop;M.useEffect(()=>{n&&F()},[n,F]);const se=M.useMemo(()=>J.error?{ok:!1,message:J.error}:null,[J.error]),ae=M.useMemo(()=>{var Le;const K=(Le=$w.exec(C))==null?void 0:Le[1];if(K===void 0)return[];const ue=K.toLowerCase();return t.filter(dt=>!FB(dt)&&Jg(dt,ue)<DC).sort((dt,Wt)=>Jg(dt,ue)-Jg(Wt,ue))},[C,t]),de=!E&&ae.length>0,_e=Math.min(B,ae.length-1),Re=E?null:((gn=Ww.exec(W.slice(0,te)))==null?void 0:gn[1])??null,ft=M.useRef(d);ft.current=d,M.useEffect(()=>{if(Re===null||Re===""||Re.endsWith("/")){ft.current(Re);return}const K=setTimeout(()=>ft.current(Re),WB);return()=>clearTimeout(K)},[Re]);const ht=Re!==null&&(l==null?void 0:l.query)===Re,xt=ht?l.entries:[],Ye=Re!==null,Sn=Ye&&!ht,Je=Math.min(B,Math.max(xt.length-1,0));M.useEffect(()=>{var ue,Le;if(!de&&!Ye)return;const K=de?_e:Je;(Le=(ue=L.current)==null?void 0:ue.children[K])==null||Le.scrollIntoView({block:"nearest"})},[de,Ye,_e,Je]);function we(K,ue){var Le;A(K),fe(ue),R.current=[ue,ue],H(0),D(!1),Se!==""&&(q(""),J.drop()),(Le=z.current)==null||Le.focus()}function xe(){A(""),q(""),H(0),fe(0),D(!1),Me(-1),Ae.current="",J.drop()}function Gt(K){const ue=K.trim();!ue||n||(b(ue),he(Le=>[ue,...Le.filter(dt=>dt!==ue)].slice(0,KB)),xe())}function wn(K){if(K<-1||K>=Te.length)return;le===-1&&(Ae.current=C);const ue=K===-1?Ae.current:Te[K]??"";Me(K),we(ue,ue.length)}function qe(){var dt;const K=((dt=z.current)==null?void 0:dt.selectionStart)??W.length,Le=`${K>0&&!/\s$/.test(W.slice(0,K))?" ":""}@`;we(W.slice(0,K)+Le+W.slice(K),K+Le.length)}function jn(K){var Wt;const ue=(Wt=Ww.exec(W.slice(0,te)))==null?void 0:Wt[1];if(ue===void 0)return;const Le=te-ue.length-1,dt=K.kind==="dir"?`@${K.path}/`:`@${K.path} `;we(W.slice(0,Le)+dt+W.slice(te),Le+dt.length)}function Kn(){var ue;const K=(ue=$w.exec(W.trim()))==null?void 0:ue[1];if(K&&p(K)){xe();return}Gt(W)}function ce(K,ue){A(K),fe(ue),H(0),D(!1),Me(-1),Se!==""&&(q(""),J.drop())}function Ve(K){var dt;const ue=$B.has(K.name)?i:null,Le=`/${K.name} `;A(Le+(ue??"")),fe(Le.length+((ue==null?void 0:ue.length)??0)),ue&&(R.current=[Le.length,Le.length+ue.length]),H(0),(dt=z.current)==null||dt.focus()}function vt(K){if(p(K.name)){A(""),H(0),D(!1);return}K.argumentHint?Ve(K):Gt(`/${K.name}`)}function $e(K){if(de){if(K.key==="ArrowDown")return K.preventDefault(),H(ue=>(Math.min(ue,ae.length-1)+1)%ae.length);if(K.key==="ArrowUp"){K.preventDefault();const ue=ae.length-1;return H(Le=>(Math.min(Le,ue)+ue)%ae.length)}if(K.key==="Enter"&&!K.shiftKey){K.preventDefault();const ue=ae[_e];ue&&vt(ue);return}if(K.key==="Tab"){K.preventDefault();const ue=ae[_e];ue&&Ve(ue);return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),D(!0);return}}if(Ye){if(K.key==="ArrowDown"&&xt.length>0)return K.preventDefault(),H(ue=>(Math.min(ue,xt.length-1)+1)%xt.length);if(K.key==="ArrowUp"&&xt.length>0){K.preventDefault();const ue=xt.length-1;return H(Le=>(Math.min(Le,ue)+ue)%xt.length)}if(K.key==="Enter"&&!K.shiftKey||K.key==="Tab"){const ue=xt[Je];if(ue){K.preventDefault(),jn(ue);return}if(K.key==="Tab")return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),D(!0);return}}if((K.key==="ArrowUp"||K.key==="ArrowDown")&&!K.shiftKey){const ue=K.currentTarget,Le=ue.selectionStart;if(ue.selectionEnd===Le){const dt=K.key==="ArrowUp",Wt=dt?!W.slice(0,Le).includes(`
|
|
129
|
-
`):!W.slice(Le).includes(`
|
|
130
|
-
`),Wi=dt?le+1:le-1;if(Wt&&Wi>=-1&&Wi<Te.length){K.preventDefault(),wn(Wi);return}}}if(K.key==="Escape"&&v){K.preventDefault(),K.stopPropagation(),v();return}K.key==="Enter"&&!K.shiftKey&&!w&&(K.preventDefault(),Kn())}return y.jsx("div",{className:a?`composer ${a}`:"composer",children:y.jsxs("div",{className:"composer__inner",children:[y.jsx(ef,{result:se}),Ye&&!de&&y.jsxs("div",{className:"cmdmenu",role:"listbox",ref:L,children:[xt.map((K,ue)=>y.jsxs("button",{role:"option","aria-selected":ue===Je,className:ue===Je?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>H(ue),onMouseDown:Le=>{Le.preventDefault(),jn(K)},children:[y.jsxs("span",{className:"cmdmenu__name",children:[K.name,K.kind==="dir"?"/":""]}),y.jsx("span",{className:"cmdmenu__desc",children:K.path}),K.ignored&&y.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},K.path)),xt.length===0&&y.jsx("div",{className:"cmdmenu__empty",children:Sn?"ищем…":Re?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),de&&y.jsx("div",{className:"cmdmenu",role:"listbox",ref:L,children:ae.map((K,ue)=>y.jsxs("button",{role:"option","aria-selected":ue===_e,className:ue===_e?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>H(ue),onMouseDown:Le=>{Le.preventDefault(),vt(K)},children:[y.jsxs("span",{className:"cmdmenu__name",children:["/",K.name]}),K.argumentHint&&y.jsx("span",{className:"cmdmenu__hint",children:K.argumentHint}),y.jsx("span",{className:"cmdmenu__desc",children:K.description})]},K.name))}),y.jsxs("div",{className:"composer__field",children:[y.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:n,onClick:qe,children:y.jsx(QB,{})}),y.jsx("textarea",{ref:z,value:W,disabled:n,placeholder:Ee,onChange:K=>ce(K.target.value,K.target.selectionStart),onSelect:K=>fe(K.currentTarget.selectionStart),onKeyDown:$e}),J.supported&&y.jsx("button",{type:"button",className:J.listening?"micbtn is-on":"micbtn",title:J.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":J.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":J.listening,disabled:n,onClick:J.toggle,children:y.jsx(JB,{on:J.listening})}),e?y.jsx("button",{className:"btn",onClick:x,title:"Прервать (Esc)",children:"Стоп"}):y.jsxs("button",{className:"btn btn--primary sendbtn",onClick:Kn,disabled:n||W.trim()==="","aria-label":u,title:u,children:[y.jsx("span",{className:"sendbtn__label",children:u}),y.jsx(ZB,{})]})]})]})})}function Zg(n,e){const t=e.trim();return t===""?n:n===""||/\s$/.test(n)?n+t:`${n} ${t}`}function QB(){return y.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:y.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function ZB(){return y.jsx("svg",{className:"sendbtn__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function JB({on:n}){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:n?"currentColor":"none"}),y.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),y.jsx("path",{d:"M8 12.8v1.5"})]})}const DC=4;function Jg(n,e){const t=n.name.toLowerCase();return t===e?0:t.startsWith(e)?1:n.aliases.some(i=>i.toLowerCase().startsWith(e))?2:t.includes(e)?3:DC}function e4({request:n,queued:e,onDecide:t}){const i=MC(n.toolName,n.input);return y.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:y.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true",children:[y.jsxs("div",{className:"sheet__head",children:["Разрешить действие?",e>0&&` (ещё ${e} в очереди)`]}),y.jsxs("div",{className:"sheet__body",children:[y.jsx("div",{className:"sheet__tool",children:n.toolName}),n.reason&&y.jsx("p",{className:"sheet__reason",children:n.reason}),i?y.jsx(Jy,{diff:i}):y.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)})]}),y.jsxs("div",{className:"sheet__actions",children:[y.jsx("button",{className:"btn",onClick:()=>t(n.requestId,"deny"),children:"Отклонить"}),y.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>t(n.requestId,"allow"),children:"Разрешить"})]})]})})}function t4({request:n,queued:e,onAnswer:t,onDecline:i}){const{questions:l}=n,[a,o]=M.useState(()=>l.map(()=>new Set)),[u,f]=M.useState(()=>l.map(()=>"")),[d,p]=M.useState(()=>Kw(l));M.useEffect(()=>{o(l.map(()=>new Set)),f(l.map(()=>"")),p(Kw(l))},[n.requestId]);const b=M.useMemo(()=>i4(l,a,u),[l,a,u]),x=b!==null;function v(B,H){var z,L;(L=(z=l[B])==null?void 0:z.options[H])!=null&&L.preview&&p(R=>{const te=R.slice();return te[B]=H,te})}function w(B,H,z){o(L=>{const R=L.slice(),te=new Set(R[B]);return z?te.has(H)?te.delete(H):te.add(H):te.has(H)||(te.clear(),te.add(H)),R[B]=te,R}),H!=="other"&&v(B,H)}function C(B,H){f(z=>{const L=z.slice();return L[B]=H,L})}function A(){b&&t(n.requestId,b)}function E(B){B.key==="Enter"&&(B.target.closest("button")||x&&(B.preventDefault(),A()))}function D(B){var R;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(B.key))return;const H=Array.from(B.currentTarget.querySelectorAll("button.qsheet__option")),z=H.indexOf(document.activeElement);if(z===-1)return;B.preventDefault();const L=B.key==="ArrowDown"||B.key==="ArrowRight"?1:-1;(R=H[(z+L+H.length)%H.length])==null||R.focus()}return y.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",children:y.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от Claude",onKeyDown:E,children:[y.jsxs("div",{className:"qsheet__head",children:[y.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),y.jsxs("span",{children:[l.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${l.length})`,e>0&&` — ещё ${e} в очереди`]})]}),y.jsxs("div",{className:"qsheet__body",children:[n.reason&&y.jsx("p",{className:"qsheet__reason",children:n.reason}),l.map((B,H)=>y.jsx(n4,{q:B,qi:H,selected:a[H]??new Set,otherText:u[H]??"",previewIndex:d[H]??null,onToggle:w,onFocusOption:v,onOtherText:C,onOptionsKeyDown:D},H))]}),y.jsxs("div",{className:"qsheet__actions",children:[y.jsx("button",{className:"btn",onClick:()=>i(n.requestId),children:"Не отвечать"}),y.jsx("button",{className:"btn btn--primary",disabled:!x,onClick:A,children:"Ответить"})]})]})})}function n4({q:n,qi:e,selected:t,otherText:i,previewIndex:l,onToggle:a,onFocusOption:o,onOtherText:u,onOptionsKeyDown:f}){var v;const d=n.options.some(w=>w.preview),p=l!==null?(v=n.options[l])==null?void 0:v.preview:void 0,b=t.has("other"),x=n.multiSelect?"checkbox":"radio";return y.jsxs("div",{className:"qsheet__question",children:[y.jsxs("div",{className:"qsheet__qhead",children:[y.jsx("span",{className:"chip chip--accent",children:n.header}),y.jsx("span",{className:"qsheet__qtext",children:n.question})]}),y.jsxs("div",{className:"qsheet__options"+(n.multiSelect?"":" qsheet__options--radio"),role:n.multiSelect?"group":"radiogroup","aria-label":n.question,onKeyDown:f,children:[n.options.map((w,C)=>{const A=t.has(C);return y.jsxs("button",{type:"button",role:x,"aria-checked":A,className:"qsheet__option"+(A?" is-selected":""),onClick:()=>a(e,C,n.multiSelect),onFocus:()=>o(e,C),onMouseEnter:()=>o(e,C),children:[y.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),y.jsxs("span",{className:"qsheet__opt-body",children:[y.jsx("span",{className:"qsheet__opt-label",children:w.label}),y.jsx("span",{className:"qsheet__opt-desc",children:w.description})]})]},C)}),y.jsxs("div",{className:"qsheet__other",children:[y.jsxs("button",{type:"button",role:x,"aria-checked":b,className:"qsheet__option qsheet__option--other"+(b?" is-selected":""),onClick:()=>a(e,"other",n.multiSelect),children:[y.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),y.jsxs("span",{className:"qsheet__opt-body",children:[y.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),y.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),b&&y.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${n.question}»`,value:i,onChange:w=>u(e,w.target.value),autoFocus:!0})]})]}),d&&y.jsx("pre",{className:"qsheet__preview",children:p??""})]})}function Kw(n){return n.map(e=>{const t=e.options.findIndex(i=>i.preview);return t===-1?null:t})}function i4(n,e,t){const i={};for(let l=0;l<n.length;l++){const a=n[l];if(!a)continue;const o=e[l]??new Set,u=[];for(let f=0;f<a.options.length;f++){const d=a.options[f];d&&o.has(f)&&u.push(d.label)}if(o.has("other")){const f=(t[l]??"").trim();f&&u.push(f)}if(u.length===0)return null;i[a.question]=u.join(", ")}return i}function OC({path:n}){const[e,t]=M.useState(!1),[i,l]=M.useState(!1),a=M.useRef(null);M.useEffect(()=>{if(!e)return;function u(f){var d;(d=a.current)!=null&&d.contains(f.target)||t(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e]),M.useEffect(()=>{if(!i)return;const u=setTimeout(()=>l(!1),1600);return()=>clearTimeout(u)},[i]),M.useEffect(()=>t(!1),[n]);async function o(){await s4(n)&&l(!0)}return y.jsxs("div",{ref:a,className:"cwd",children:[y.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":e,title:e?"Свернуть путь":`Полный путь: ${n}`,onClick:()=>t(u=>!u),onKeyDown:u=>{u.key!=="Escape"||!e||(u.preventDefault(),u.stopPropagation(),t(!1))},children:[y.jsx(l4,{open:e}),y.jsx("span",{className:"cwd__short",children:n})]}),e&&y.jsxs("div",{className:"cwd__pop",children:[y.jsx("span",{className:"cwd__full",children:n}),y.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void o(),children:i?"Скопировано":"Копировать"})]})]})}async function s4(n){try{return await navigator.clipboard.writeText(n),!0}catch{}const e=document.createElement("textarea");e.value=n,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e);try{return e.select(),document.execCommand("copy")}catch{return!1}finally{e.remove()}}function l4({open:n}){return y.jsx("svg",{className:n?"cwd__chev cwd__chev--open":"cwd__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function cc({value:n,options:e,onChange:t,className:i,title:l,ariaLabel:a,placeholder:o="—"}){const[u,f]=M.useState(!1),[d,p]=M.useState(0),b=M.useRef(null),x=M.useRef(null),v=e.find(A=>A.value===n)??null;M.useEffect(()=>{if(!u)return;const A=e.findIndex(E=>E.value===n);p(A===-1?0:A)},[u]),M.useEffect(()=>{if(!u)return;function A(E){var D;(D=b.current)!=null&&D.contains(E.target)||f(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[u]),M.useEffect(()=>{var A,E;u&&((E=(A=x.current)==null?void 0:A.querySelector(".is-cursor"))==null||E.scrollIntoView({block:"nearest"}))},[u,d]);function w(A){f(!1),A.value!==n&&t(A.value)}function C(A){if(A.key==="Escape"){if(!u)return;A.preventDefault(),A.stopPropagation(),f(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!u)return f(!0);const E=A.key==="ArrowDown"?1:e.length-1;return p(D=>(D+E)%e.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!u)return f(!0);const E=e[d];E&&w(E)}}return y.jsxs("div",{ref:b,className:"select"+(u?" select--open":"")+(i?` ${i}`:""),children:[y.jsxs("button",{type:"button",className:"select__trigger",title:l,"aria-label":a??l,"aria-haspopup":"listbox","aria-expanded":u,onClick:()=>f(A=>!A),onKeyDown:C,children:[y.jsx("span",{className:"select__value",children:(v==null?void 0:v.label)??o}),y.jsx(r4,{})]}),u&&y.jsx("div",{ref:x,className:"select__menu",role:"listbox","aria-label":a??l,children:e.map((A,E)=>y.jsxs("button",{type:"button",role:"option","aria-selected":A.value===n,className:"select__option"+(E===d?" is-cursor":"")+(A.value===n?" is-on":""),onMouseEnter:()=>p(E),onClick:()=>w(A),children:[y.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===n?"✓":""}),y.jsx("span",{className:"select__label",children:A.label}),A.hint&&y.jsx("span",{className:"select__hint",children:A.hint})]},A.value))})]})}function r4(){return y.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const a4=["low","medium","high"];function RC({models:n,value:e,effort:t,ultracode:i,thinking:l,switchOnFlag:a,className:o,onModel:u,onEffort:f,onUltracode:d,onThinking:p,onSwitchOnFlag:b}){const[x,v]=M.useState(!1),[w,C]=M.useState(0),A=M.useRef(null),E=M.useRef(null),D=n.find(R=>R.value===e)??null,B=D&&D.supportsEffort?D.effortLevels.length>0?D.effortLevels:a4:[],H=B.includes("xhigh");M.useEffect(()=>{if(!x)return;const R=n.findIndex(te=>te.value===e);C(R===-1?0:R)},[x]),M.useEffect(()=>{if(!x)return;function R(te){var fe;(fe=A.current)!=null&&fe.contains(te.target)||v(!1)}return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[x]),M.useEffect(()=>{var R,te;x&&((te=(R=E.current)==null?void 0:R.querySelector(".is-cursor"))==null||te.scrollIntoView({block:"nearest"}))},[x,w]);function z(R){v(!1),R.value!==e&&u(R.value)}function L(R){if(R.key==="Escape"){if(!x)return;R.preventDefault(),R.stopPropagation(),v(!1);return}if(R.key==="ArrowDown"||R.key==="ArrowUp"){if(R.preventDefault(),!x)return v(!0);if(n.length===0)return;const te=R.key==="ArrowDown"?1:n.length-1;return C(fe=>(fe+te)%n.length)}if(R.key==="Enter"||R.key===" "){if(R.preventDefault(),!x)return v(!0);const te=n[w];te&&z(te)}}return y.jsxs("div",{ref:A,className:"select"+(x?" select--open":"")+(o?` ${o}`:""),children:[y.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":x,onClick:()=>v(R=>!R),onKeyDown:L,children:[y.jsx("span",{className:"select__value",children:(D==null?void 0:D.displayName)??e??"—"}),i?y.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):B.length>0&&t&&y.jsx("span",{className:"select__suffix",children:t}),y.jsx(o4,{})]}),x&&y.jsxs("div",{ref:E,className:"select__menu modelmenu",role:"menu",children:[y.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((R,te)=>y.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":R.value===e,className:"select__option"+(te===w?" is-cursor":"")+(R.value===e?" is-on":""),onMouseEnter:()=>C(te),onClick:()=>z(R),children:[y.jsx("span",{className:"select__check","aria-hidden":"true",children:R.value===e?"✓":""}),y.jsx("span",{className:"select__label",children:R.displayName}),R.description&&y.jsx("span",{className:"select__hint",children:R.description})]},R.value)),B.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"modelmenu__sep",role:"separator"}),y.jsxs("div",{className:"modelmenu__row",children:[y.jsxs("span",{className:"modelmenu__label",children:["Усилие",y.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),y.jsx("span",{className:"modelmenu__levels",children:B.map(R=>y.jsx("button",{type:"button",role:"menuitemradio","aria-checked":R===t,className:R===t?"modelmenu__level is-on":"modelmenu__level",onClick:()=>f(R),children:R},R))})]}),H&&y.jsx(e0,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:i,onToggle:()=>d(!i)})]}),y.jsx("div",{className:"modelmenu__sep",role:"separator"}),(D==null?void 0:D.supportsThinking)!==!1&&y.jsx(e0,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:l,onToggle:()=>p(!l)}),y.jsx(e0,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:a,onToggle:()=>b(!a)})]})]})}function e0({label:n,desc:e,on:t,onToggle:i}){return y.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":t,className:"modelmenu__row modelmenu__row--btn",onClick:i,children:[y.jsxs("span",{className:"modelmenu__label",children:[n,y.jsx("span",{className:"modelmenu__desc",children:e})]}),y.jsx("span",{className:t?"switch is-on":"switch","aria-hidden":"true",children:y.jsx("span",{className:"switch__knob"})})]})}function o4(){return y.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ls({title:n,children:e,actions:t,className:i,sheet:l=!1,onClose:a}){const o=M.useRef(null);return M.useEffect(()=>{function u(f){if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),a();return}if(f.key!=="Tab")return;const d=o.current;if(!d)return;const p=d.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),b=p[0],x=p[p.length-1];!b||!x||(f.shiftKey&&document.activeElement===b?(f.preventDefault(),x.focus()):!f.shiftKey&&document.activeElement===x&&(f.preventDefault(),b.focus()))}return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[a]),y.jsx("div",{className:l?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&a()},children:y.jsxs("div",{ref:o,className:i?`modal ${i}`:"modal",role:"dialog","aria-modal":"true","aria-label":n,children:[y.jsxs("div",{className:"modal__head",children:[y.jsx("h2",{className:"modal__title",children:n}),y.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:a,children:"✕"})]}),y.jsx("div",{className:"modal__body",children:e}),t&&y.jsx("div",{className:"modal__actions",children:t})]})})}function c4({candidates:n,searching:e,agentItems:t,agentBusy:i,error:l,roots:a,created:o,onSearch:u,onAskAgent:f,onInterrupt:d,onSubmit:p,onCreate:b,onClose:x}){const[v,w]=M.useState("open"),[C,A]=M.useState(""),[E,D]=M.useState(!1),[B,H]=M.useState(""),[z,L]=M.useState(""),[R,te]=M.useState({git:!0,claudeMd:!0,readme:!0}),fe=C.trim(),Te=fe!=="",he=B.trim(),le=z.trim(),Me=he!==""&&le!=="";M.useEffect(()=>{B===""&&a.length>0&&H(a[0])},[a]);const Ae=M.useRef(u);Ae.current=u,M.useEffect(()=>{if(v!=="open")return;const W=C.trim(),Ee=setTimeout(()=>Ae.current(W),200);return()=>clearTimeout(Ee)},[C,v]);function Se(){Te&&p(fe)}function q(){Me&&b(he,le,R)}function J(){Te&&(D(!0),f(fe))}return o?y.jsxs(Ls,{title:"Новый проект",onClose:x,actions:y.jsx("button",{className:"btn btn--primary",onClick:x,autoFocus:!0,children:"Понятно"}),children:[y.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),y.jsx("p",{className:"newproj__preview",children:o.path}),y.jsx("div",{className:"modal__error",children:y.jsx("ul",{className:"newproj__warnings",children:o.warnings.map(W=>y.jsx("li",{children:W},W))})}),y.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):y.jsxs(Ls,{title:"Новый проект",className:E&&v==="open"?"modal--wide":void 0,onClose:x,actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:x,children:"Отмена"}),v==="open"?y.jsxs(y.Fragment,{children:[i?y.jsx("button",{className:"btn",onClick:d,children:"Остановить"}):y.jsx("button",{className:"btn",disabled:!Te,onClick:J,title:"Найти по описанию",children:"Попросить агента"}),y.jsx("button",{className:"btn btn--primary",disabled:!Te,onClick:Se,children:"Открыть"})]}):y.jsx("button",{className:"btn btn--primary",disabled:!Me,onClick:q,children:"Создать"})]}),children:[y.jsxs("div",{className:"tabs",children:[y.jsx(Xw,{label:"Открыть",on:v==="open",onClick:()=>w("open")}),y.jsx(Xw,{label:"Создать",on:v==="create",onClick:()=>w("create")})]}),v==="open"?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),y.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),y.jsx("input",{id:"workspace-path",className:"input input--mono",value:C,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:W=>A(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),Se())}}),l&&y.jsx("p",{className:"modal__error",children:l}),n.length>0&&y.jsx("ul",{className:"finds",children:n.map(W=>y.jsx("li",{children:y.jsxs("button",{className:"find",disabled:W.open,title:W.open?"Этот проект уже открыт":W.path,onClick:()=>A(W.path),onDoubleClick:()=>p(W.path),children:[y.jsx("span",{className:"find__name",children:W.name}),y.jsx("span",{className:"find__path",children:W.path}),y.jsx("span",{className:"find__note",children:h4(W)})]})},W.path))}),n.length===0&&Te&&!e&&!E&&y.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),E&&y.jsx("div",{className:"finds__agent",children:y.jsx(eb,{items:t,busy:i,waiting:!1,empty:"Агент ищет…"})})]}):y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),y.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),y.jsx("input",{id:"workspace-parent",className:"input input--mono",value:B,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:W=>H(W.target.value)}),a.length>0&&y.jsx("div",{className:"newproj__roots",children:a.map(W=>y.jsx("button",{type:"button",className:W===he?"newproj__root is-on":"newproj__root",title:W,onClick:()=>H(W),children:f4(W)},W))}),y.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),y.jsx("input",{id:"workspace-name",className:"input input--mono",value:z,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:W=>L(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),q())}}),y.jsx("p",{className:"newproj__preview",children:Me?u4(he,le):"Каталог появится здесь"}),l&&y.jsx("p",{className:"modal__error",children:l}),y.jsxs("div",{className:"newproj__opts",children:[y.jsx(t0,{label:"git init",desc:"панель истории работает сразу",on:R.git,onToggle:()=>te(W=>({...W,git:!W.git}))}),y.jsx(t0,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:R.claudeMd,onToggle:()=>te(W=>({...W,claudeMd:!W.claudeMd}))}),y.jsx(t0,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:R.readme,onToggle:()=>te(W=>({...W,readme:!W.readme}))})]})]})]})}function Xw({label:n,on:e,onClick:t}){return y.jsx("button",{type:"button",className:e?"tabs__tab is-on":"tabs__tab","aria-pressed":e,onClick:t,children:n})}function t0({label:n,desc:e,on:t,onToggle:i}){return y.jsxs("button",{type:"button",role:"checkbox","aria-checked":t,className:"newproj__opt",onClick:i,children:[y.jsxs("span",{className:"newproj__optlabel",children:[n,y.jsx("span",{className:"newproj__optdesc",children:e})]}),y.jsx("span",{className:t?"switch is-on":"switch","aria-hidden":"true",children:y.jsx("span",{className:"switch__knob"})})]})}function u4(n,e){const t=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+t+e}function f4(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/).filter(Boolean);return t.length<=2?n:`…${e}${t.slice(-2).join(e)}`}function h4(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${d4(n.sessions)}${p4(n.lastUsedAt)}`}function d4(n){const e=n%10,t=n%100;return t>=11&&t<=14?`${n} сессий`:e===1?`${n} сессия`:e>=2&&e<=4?`${n} сессии`:`${n} сессий`}function p4(n){if(!n)return"";const e=Math.floor((Date.now()-n)/864e5);return e<=0?" · сегодня":e===1?" · вчера":e<30?` · ${e} дн. назад`:` · ${new Date(n).toLocaleDateString("ru-RU")}`}const tb=7;function m4(n){const e=[],t=[];let i=1;for(const l of n){const a=e.slice();let o=e.indexOf(l.hash);o===-1&&(o=Qw(e),e[o]=l.hash);const[u,...f]=l.parents;e[o]=u??null;const d=[];u!==void 0&&d.push({from:o,to:o});for(const x of f){let v=e.indexOf(x);v===-1&&(v=Qw(e),e[v]=x),d.push({from:o,to:v})}const p=[];for(let x=0;x<a.length;x++)a[x]===l.hash&&(p.push({from:x,to:o}),x!==o&&(e[x]=null));const b=[];for(let x=0;x<a.length;x++){const v=a[x];!v||v===l.hash||x===o||e[x]===v&&b.push(x)}g4(e),i=Math.max(i,e.length,o+1),t.push({commit:l,col:o,up:p,down:d,through:b})}return{rows:t,columns:Math.min(i,tb)}}function Qw(n){const e=n.indexOf(null);return e!==-1?e:(n.push(null),n.length-1)}function g4(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}const jC=1500;function y4(n){const e=[];let t=!1;for(const i of n.patch.split(`
|
|
131
|
-
`)){if(e.length>=jC){t=!0;break}if(i.startsWith("@@"))e.push({type:"gap",text:b4(i)});else if(i.startsWith("+"))e.push({type:"add",text:i.slice(1)});else if(i.startsWith("-"))e.push({type:"del",text:i.slice(1)});else{if(i.startsWith("\\"))continue;(i!==""||e.length>0)&&e.push({type:"ctx",text:i.startsWith(" ")?i.slice(1):i})}}return{kind:"patch",filePath:n.path||n.oldPath,rows:e,added:n.added,removed:n.removed,note:x4(n,t)}}function b4(n){const e=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(n);if(!e)return n;const t=Number(e[1]),i=e[2]===void 0?1:Number(e[2]),l=(e[3]??"").trim(),a=i>1?`строки ${t}–${t+i-1}`:`строка ${t}`;return l?`⋯ ${a} · ${l}`:`⋯ ${a}`}function x4(n,e){const t=[];return n.status==="added"&&t.push("новый файл"),n.status==="deleted"&&t.push("файл удалён"),n.status==="renamed"&&t.push(`переименован из ${n.oldPath}`),n.binary?t.push("двоичный файл"):n.patch===""&&t.push("содержимое не показано"),e&&t.push(`показаны первые ${jC} строк`),t.length>0?t.join(" · "):null}function v4({open:n,state:e,result:t,selected:i,onRefresh:l,onShow:a,onCheckout:o,onClose:u}){const f=m4((e==null?void 0:e.commits)??[]),d=[...e!=null&&e.detached?[{value:"",label:`отделён · ${e.head.slice(0,8)}`}]:[],...((e==null?void 0:e.branches)??[]).map(p=>({value:p.name,label:p.name,hint:p.hash.slice(0,8)}))];return y.jsxs("aside",{className:n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git","aria-label":"История git",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(_4,{}),y.jsx("span",{className:"sidepane__title",children:"История"}),y.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:l,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:u,children:"✕"})]}),e===null?y.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):e.available?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"gitbar",children:[y.jsx(cc,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:e.detached?"":e.branch,options:d,onChange:p=>{p&&o(p,`ветку ${p}`)}}),e.ahead>0&&y.jsxs("span",{className:"chip",title:`${e.ahead} — столько коммитов не отправлено`,children:["↑",e.ahead]}),e.behind>0&&y.jsxs("span",{className:"chip",title:`${e.behind} — столько коммитов не забрано`,children:["↓",e.behind]})]}),e.detached&&y.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),y.jsxs("div",{className:"sidepane__scroll",children:[y.jsx("button",{className:"gitrow gitrow--work"+(i===""?" is-on":""),onClick:()=>a(""),children:y.jsxs("span",{className:"gitrow__body",children:[y.jsx("span",{className:"gitrow__subject",children:e.changed.length>0?`Рабочее дерево · ${e.changed.length} ${M4(e.changed.length)}`:"Рабочее дерево чистое"}),y.jsx("span",{className:"gitrow__meta",children:e.changed.length>0?e.changed.slice(0,4).map(p=>T4(p.path)).join(", "):"незакоммиченных изменений нет"})]})}),f.rows.map(p=>y.jsx(S4,{row:p,columns:f.columns,head:p.commit.hash===e.head,local:e.hasRemote&&!p.commit.pushed,active:i===p.commit.hash,onOpen:()=>a(p.commit.hash)},p.commit.hash)),f.rows.length===0&&y.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):y.jsx("p",{className:"sidepane__empty",children:e.message||"Это не git-репозиторий"}),y.jsx(ef,{result:t})]})}const gu=50,Zw=13;function S4({row:n,columns:e,head:t,local:i,active:l,onOpen:a}){const{commit:o}=n,u=o.refs.map(C4).filter(Boolean);return y.jsxs("button",{className:"gitrow"+(l?" is-on":""),title:i?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:a,children:[y.jsx(w4,{row:n,columns:e,head:t,local:i}),y.jsxs("span",{className:"gitrow__body",children:[y.jsxs("span",{className:"gitrow__subject",children:[u.map(f=>y.jsx("span",{className:"gitrow__ref",children:f},f)),o.subject]}),y.jsxs("span",{className:"gitrow__meta",children:[o.shortHash," · ",o.author," · ",E4(o.date),i&&y.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]})}function w4({row:n,columns:e,head:t,local:i}){const l=e*Zw+6,a=gu/2,o=d=>8+Math.min(d,tb-1)*Zw,u=i?"3.5 2.5":void 0,f=Xh(n.col);return y.jsxs("svg",{className:"gitgraph",width:l,height:gu,viewBox:`0 0 ${l} ${gu}`,"aria-hidden":"true",children:[n.through.map(d=>y.jsx("line",{x1:o(d),y1:0,x2:o(d),y2:gu,style:{stroke:Xh(d)}},`t${d}`)),n.up.map((d,p)=>y.jsx("path",{d:`M${o(d.from)} 0 L${o(d.from)} ${a-12} L${o(d.to)} ${a}`,fill:"none",style:{stroke:Xh(d.from),strokeDasharray:u}},`u${p}`)),n.down.map((d,p)=>y.jsx("path",{d:`M${o(d.from)} ${a} L${o(d.to)} ${a+12} L${o(d.to)} ${gu}`,fill:"none",style:{stroke:Xh(d.to),strokeDasharray:u}},`d${p}`)),t&&y.jsx("circle",{className:"gitgraph__head",cx:o(n.col),cy:a,r:n.commit.parents.length>1?7.4:6.6}),y.jsx("circle",{className:"gitgraph__dot",cx:o(n.col),cy:a,r:n.commit.parents.length>1?4.6:3.6,style:{stroke:f,fill:i?void 0:f}})]})}function Xh(n){return`var(--lane-${n%tb})`}function k4({detail:n,local:e,onCheckout:t,onClose:i}){const l=n.hash==="";return y.jsxs(Ls,{className:"modal--wide",title:l?"Незакоммиченные изменения":`Коммит ${n.shortHash}`,onClose:i,actions:y.jsxs(y.Fragment,{children:[!l&&y.jsx("button",{className:"btn",onClick:()=>t(n.hash,`коммит ${n.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),y.jsx("button",{className:"btn btn--primary",onClick:i,children:"Закрыть"})]}),children:[!l&&y.jsxs("div",{className:"commit__head",children:[y.jsx("p",{className:"commit__subject",children:n.subject}),y.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",N4(n.date)," ·"," ",y.jsx("span",{className:"commit__hash",children:n.hash})]}),e&&y.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),n.parents.length>0&&y.jsxs("p",{className:"commit__meta",children:[n.parents.length>1?"слияние: ":"родитель: ",n.parents.map(a=>a.slice(0,8)).join(", ")]}),n.body&&y.jsx("pre",{className:"commit__body",children:n.body})]}),n.truncated&&y.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),n.files.length===0?y.jsx("p",{className:"modal__text",children:"Изменений нет."}):n.files.map(a=>y.jsx(A4,{file:a,defaultOpen:n.files.length<=3},a.path+a.oldPath))]})}function A4({file:n,defaultOpen:e}){const[t,i]=M.useState(e);return y.jsxs("div",{className:"commit__file",children:[y.jsxs("button",{className:"commit__filehead",onClick:()=>i(l=>!l),children:[y.jsx("span",{className:"commit__filepath",children:n.path||n.oldPath}),y.jsxs("span",{className:"diff__stat",children:[n.added>0&&y.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&y.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]}),y.jsx("span",{className:"tool__status",children:t?"▴":"▾"})]}),t&&y.jsx(Jy,{diff:y4(n)})]})}function _4(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),y.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),y.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),y.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function C4(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function T4(n){const e=n.split("/");return e[e.length-1]??n}function M4(n){const e=n%100;if(e>=11&&e<=14)return"файлов";switch(n%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function E4(n){const e=Date.parse(n);if(Number.isNaN(e))return n;const t=Math.round((Date.now()-e)/6e4);if(t<1)return"только что";if(t<60)return`${t} мин назад`;const i=Math.round(t/60);if(i<24)return`${i} ч назад`;const l=Math.round(i/24);return l<30?`${l} дн назад`:new Date(e).toLocaleDateString()}function N4(n){const e=Date.parse(n);return Number.isNaN(e)?n:new Date(e).toLocaleString()}function D4({open:n,items:e,busy:t,ready:i,commands:l,contextResult:a,models:o,model:u,effort:f,ultracode:d,thinking:p,switchOnFlag:b,onContextSearch:x,onCommand:v,onModel:w,onEffort:C,onUltracode:A,onThinking:E,onSwitchOnFlag:D,onAsk:B,onInterrupt:H,onReset:z,onClose:L}){return y.jsxs("aside",{className:n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask","aria-label":"Вопрос на полях",children:[y.jsxs("div",{className:"sidepane__head",children:[y.jsx(O4,{}),y.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),y.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:e.length===0,onClick:z,children:"↻"}),y.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:L,children:"✕"})]}),o.length>0&&y.jsxs("div",{className:"sidepane__tools",children:[y.jsx(RC,{className:"select--compact",models:o,value:u,effort:f,ultracode:d,thinking:p,switchOnFlag:b,onModel:w,onEffort:C,onUltracode:A,onThinking:E,onSwitchOnFlag:D}),y.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),y.jsx(eb,{items:e,busy:t,waiting:!1,empty:i?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),y.jsx(NC,{className:"composer--side",disabled:!i,busy:t,commands:l,sessionTitle:null,contextResult:a,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,onContextSearch:x,onCommand:v,onSend:B,onInterrupt:H,onEscape:t?H:L})]})}function O4(){return y.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),y.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const R4=75,j4=90;function LC({usage:n}){if(!(n!=null&&n.available))return null;const e=[];return n.fiveHour&&e.push({key:"five",label:"5 ч",window:n.fiveHour}),n.sevenDay&&e.push({key:"week",label:"нед",window:n.sevenDay}),e.length===0?null:y.jsx("div",{className:"usage",title:z4(n),"aria-label":`Расход лимитов плана${n.plan?` ${n.plan}`:""}`,children:e.map(t=>y.jsx(L4,{label:t.label,window:t.window},t.key))})}function L4({label:n,window:e}){const t=Math.round(e.utilization),i=H4(e.resetsAt);return y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"usage__label",children:n}),y.jsx("span",{className:"usage__track",role:"progressbar","aria-label":n,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,children:y.jsx("span",{className:`usage__fill${B4(t)}`,style:{width:`${t}%`}})}),y.jsxs("span",{className:"usage__pct",children:[t,"%"]}),y.jsx("span",{className:"usage__reset",title:HC(e.resetsAt)||void 0,children:i&&`↻ ${i}`})]})}function B4(n){return n>=j4?" usage__fill--over":n>=R4?" usage__fill--warn":""}function z4(n){const e=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],t=(i,l)=>{if(!l)return;const a=HC(l.resetsAt);e.push(`${i}: ${Math.round(l.utilization)}%${a?`, ${a}`:""}`)};return t("5 часов",n.fiveHour),t("Неделя",n.sevenDay),t("Неделя, Opus",n.sevenDayOpus),e.join(`
|
|
132
|
-
`)}function BC(n){if(!n)return null;const e=new Date(n);return Number.isNaN(e.getTime())?null:e}function zC(n){return n.getTime()-Date.now()<1440*60*1e3}function H4(n){const e=BC(n);return e?zC(e)?e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function HC(n){const e=BC(n);return e?`обнулится ${zC(e)?`в ${e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:e.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function IC(){const[n,e]=M.useState(()=>new Date);return M.useEffect(()=>{let t=0;const i=()=>{const a=new Date;e(a),t=window.setTimeout(i,6e4-(a.getSeconds()*1e3+a.getMilliseconds()))};i();const l=()=>{document.hidden||(window.clearTimeout(t),i())};return document.addEventListener("visibilitychange",l),()=>{window.clearTimeout(t),document.removeEventListener("visibilitychange",l)}},[]),y.jsxs("time",{className:"clock",dateTime:n.toISOString(),title:I4(n),children:[y.jsx("span",{className:"clock__time",children:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),y.jsx("span",{className:"clock__date",children:n.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function I4(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function U4({onClose:n,permission:e,model:t,usage:i,cwd:l,costLabel:a,onRename:o}){return y.jsx(Ls,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:y.jsxs("div",{className:"sessionmenu",children:[e&&y.jsx(To,{label:"Режим прав",children:e}),y.jsx(To,{label:"Модель",children:t}),(i==null?void 0:i.available)&&(i.fiveHour||i.sevenDay)&&y.jsx(To,{label:"Лимиты плана",children:y.jsx(LC,{usage:i})}),y.jsx(To,{label:"Время",children:y.jsx(IC,{})}),a&&y.jsx(To,{label:"Стоимость хода",children:y.jsx("span",{className:"badge badge--cost",children:a})}),l&&y.jsx(To,{label:"Каталог проекта",children:y.jsx(OC,{path:l})}),o&&y.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:o,children:"Переименовать сессию"})]})})}function To({label:n,children:e}){return y.jsxs("div",{className:"sessionmenu__row",children:[y.jsx("span",{className:"sessionmenu__label",children:n}),e]})}function q4({tab:n,servers:e,plugins:t,marketplaces:i,catalog:l,result:a,actions:o,onTab:u,onClose:f}){const d=[{id:"mcp",label:"MCP-серверы",count:e.length},{id:"plugins",label:"Плагины",count:t.length},{id:"catalog",label:"Каталог",count:l.length}];return y.jsxs(Ls,{title:"Расширения",className:"modal--wide",onClose:f,children:[y.jsx("div",{className:"tabs",role:"tablist",children:d.map(p=>y.jsxs("button",{role:"tab","aria-selected":n===p.id,className:n===p.id?"tabs__tab is-on":"tabs__tab",onClick:()=>u(p.id),children:[p.label,y.jsx("span",{className:"tabs__count",children:p.count})]},p.id))}),n==="mcp"&&y.jsx(V4,{servers:e,actions:o}),n==="plugins"&&y.jsx($4,{plugins:t,marketplaces:i,actions:o}),n==="catalog"&&y.jsx(W4,{catalog:l,hasMarketplaces:i.length>0,actions:o,onMarketplaces:()=>u("plugins")}),y.jsx(ef,{result:a})]})}function V4({servers:n,actions:e}){const[t,i]=M.useState(!1);return y.jsxs(y.Fragment,{children:[n.length===0&&!t&&y.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",y.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",y.jsx("code",{children:"claude mcp list"}),"."]}),y.jsx("ul",{className:"extlist",children:n.map(l=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:l.name}),y.jsx("span",{className:`chip chip--${P4(l.status)}`,children:G4[l.status]}),l.scope&&y.jsx("span",{className:"chip",children:l.scope}),l.transport&&y.jsx("span",{className:"chip",children:l.transport})]}),l.target&&y.jsx("div",{className:"extlist__meta",title:l.target,children:l.target}),l.error&&y.jsx("div",{className:"extlist__error",children:l.error}),l.tools.length>0&&y.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",l.tools.length," · ",l.tools.slice(0,6).join(", "),l.tools.length>6&&"…"]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"reconnect"),children:"Переподключить"}),l.status==="disabled"?y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"enable"),children:"Включить"}):y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>e.mcpAction(l.name,"disable"),children:"Выключить"}),l.editable&&y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>e.mcpRemove(l.name),children:"Удалить"})]})]},l.name))}),t?y.jsx(Y4,{onCancel:()=>i(!1),onSubmit:(l,a)=>{e.mcpAdd(l,a),i(!1)}}):y.jsx("div",{className:"extbar",children:y.jsx("button",{className:"btn btn--primary",onClick:()=>i(!0),children:"+ Сервер"})})]})}const G4={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function P4(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function Y4({onSubmit:n,onCancel:e}){const[t,i]=M.useState(""),[l,a]=M.useState("stdio"),[o,u]=M.useState(""),[f,d]=M.useState(""),[p,b]=M.useState(""),x=l==="stdio",v=t.trim()!==""&&(x?o.trim()!=="":f.trim()!=="");function w(){if(v)if(x){const[C,...A]=F4(o);n(t.trim(),{transport:"stdio",command:C??"",args:A,env:Jw(p)})}else n(t.trim(),{transport:l,url:f.trim(),headers:Jw(p)})}return y.jsxs("div",{className:"extform extform--card",children:[y.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),y.jsx("input",{id:"mcp-name",className:"input input--mono",value:t,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:C=>i(C.target.value)}),y.jsx("label",{className:"field",children:"Транспорт"}),y.jsx(cc,{title:"Транспорт",value:l,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:C=>a(C)}),x?y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),y.jsx("input",{id:"mcp-command",className:"input input--mono",value:o,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:C=>u(C.target.value)})]}):y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),y.jsx("input",{id:"mcp-url",className:"input input--mono",value:f,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:C=>d(C.target.value)})]}),y.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[x?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),y.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:p,spellCheck:!1,placeholder:x?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:C=>b(C.target.value)}),y.jsxs("div",{className:"extbar",children:[y.jsx("button",{className:"btn",onClick:e,children:"Отмена"}),y.jsx("button",{className:"btn btn--primary",disabled:!v,onClick:w,children:"Подключить"})]})]})}function Jw(n){const e={};for(const t of n.split(`
|
|
133
|
-
`)){const i=t.trim();if(!i)continue;const l=i.indexOf("="),a=i.indexOf(":"),o=l===-1?a:a===-1?l:Math.min(l,a);o<=0||(e[i.slice(0,o).trim()]=i.slice(o+1).trim())}return e}function F4(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(e=>e.replace(/^["']|["']$/g,""))}function $4({plugins:n,marketplaces:e,actions:t}){const[i,l]=M.useState("");return y.jsxs(y.Fragment,{children:[n.length===0&&y.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),y.jsx("ul",{className:"extlist",children:n.map(a=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:a.name}),y.jsx("span",{className:a.enabled?"chip chip--ok":"chip chip--mute",children:a.enabled?"включён":"выключен"}),a.version&&a.version!=="unknown"&&y.jsx("span",{className:"chip",children:a.version}),a.scope&&y.jsx("span",{className:"chip",children:a.scope})]}),a.marketplace&&y.jsx("div",{className:"extlist__meta",children:a.marketplace}),a.mcpServers.length>0&&y.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",a.mcpServers.join(", ")]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>t.pluginToggle(a.id,!a.enabled),children:a.enabled?"Выключить":"Включить"}),y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>t.pluginUninstall(a.id),children:"Удалить"})]})]},a.id))}),y.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),y.jsx("ul",{className:"extlist",children:e.map(a=>y.jsxs("li",{className:"extlist__row",children:[y.jsx("div",{className:"extlist__head",children:y.jsx("span",{className:"extlist__name",children:a.name})}),a.source&&y.jsx("div",{className:"extlist__meta",children:a.source}),y.jsx("div",{className:"extlist__actions",children:y.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>t.marketplaceRemove(a.name),children:"Отключить"})})]},a.name))}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{className:"input input--mono",value:i,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:a=>l(a.target.value),onKeyDown:a=>{a.key!=="Enter"||i.trim()===""||(a.preventDefault(),t.marketplaceAdd(i.trim()),l(""))}}),y.jsx("button",{className:"btn",disabled:i.trim()==="",onClick:()=>{t.marketplaceAdd(i.trim()),l("")},children:"Добавить"})]})]})}const yu=30;function W4({catalog:n,hasMarketplaces:e,actions:t,onMarketplaces:i}){const[l,a]=M.useState(""),[o,u]=M.useState(""),[f,d]=M.useState(yu),[p,b]=M.useState(""),x=M.useMemo(()=>[...new Set(n.map(C=>C.category).filter(Boolean))].sort(),[n]),v=M.useMemo(()=>{const w=l.trim().toLowerCase();return n.filter(C=>o&&C.category!==o?!1:w?`${C.name} ${C.displayName} ${C.description} ${C.author}`.toLowerCase().includes(w):!0)},[n,l,o]);return n.length===0?y.jsxs("p",{className:"modal__text",children:[e?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",y.jsx("button",{className:"linkish",onClick:i,children:"Подключить маркетплейс"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"catalog__filters",children:[y.jsx("input",{className:"input",value:l,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:w=>{a(w.target.value),d(yu)}}),y.jsx(cc,{title:"Категория",value:o,options:[{value:"",label:"все категории"},...x.map(w=>({value:w,label:w}))],onChange:w=>{u(w),d(yu)}})]}),v.length===0?y.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):y.jsx("ul",{className:"extlist",children:v.slice(0,f).map(w=>y.jsxs("li",{className:"extlist__row",children:[y.jsxs("div",{className:"extlist__head",children:[y.jsx("span",{className:"extlist__name",children:w.name}),w.installed&&y.jsx("span",{className:"chip chip--ok",children:"установлен"}),w.version&&y.jsx("span",{className:"chip",children:w.version}),w.category&&y.jsx("span",{className:"chip",children:w.category})]}),w.description&&y.jsx("div",{className:"catalog__desc",children:w.description}),y.jsxs("div",{className:"extlist__meta",children:[w.author&&`${w.author} · `,w.marketplace]}),y.jsxs("div",{className:"extlist__actions",children:[y.jsx("button",{className:"btn btn--ghost btn--sm",disabled:w.installed,onClick:()=>t.pluginInstall(w.id),children:w.installed?"Уже стоит":"Установить"}),w.homepage&&y.jsx("a",{className:"btn btn--ghost btn--sm",href:w.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},w.id))}),v.length>f&&y.jsx("div",{className:"extbar",children:y.jsxs("button",{className:"btn",onClick:()=>d(w=>w+yu),children:["Ещё ",Math.min(yu,v.length-f)," из ",v.length-f]})}),y.jsxs("div",{className:"extform",children:[y.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{id:"plugin-spec",className:"input input--mono",value:p,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:w=>b(w.target.value),onKeyDown:w=>{w.key!=="Enter"||p.trim()===""||(w.preventDefault(),t.pluginInstall(p.trim()),b(""))}}),y.jsx("button",{className:"btn",disabled:p.trim()==="",onClick:()=>{t.pluginInstall(p.trim()),b("")},children:"Установить"})]})]})]})}function K4({status:n,login:e,actions:t,runningSessions:i,onClose:l}){const[a,o]=M.useState(""),[u,f]=M.useState(!1),[d,p]=M.useState(!1),b=M.useMemo(()=>{if(e.error)return{ok:!1,message:e.error};const w=e.output.trim();return w===""?null:{ok:!0,message:w}},[e.error,e.output]);function x(){a.trim()!==""&&(t.submitCode(a.trim()),o(""))}function v(){if(i>0){f(!1),p(!0);return}t.login("claudeai",!0)}return y.jsxs(Ls,{title:"Аккаунт",onClose:l,children:[n===null?y.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):n.loggedIn?y.jsxs("div",{className:"account",children:[y.jsx("div",{className:"account__id",children:n.email||"Вход выполнен"}),y.jsxs("div",{className:"account__chips",children:[y.jsx("span",{className:"chip chip--ok",children:Q4[n.method]??n.method}),n.plan&&y.jsx("span",{className:"chip",children:n.plan})]}),n.organization&&y.jsx("div",{className:"extlist__meta",children:n.organization})]}):y.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",y.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),e.active?y.jsx(Z4,{login:e,code:a,onCode:o,onSubmit:x,onCancel:t.cancel}):y.jsxs(y.Fragment,{children:[y.jsx(ef,{result:b}),d&&y.jsx("p",{className:"account__warn",role:"alert",children:X4(i)}),y.jsx("div",{className:"extbar",children:n!=null&&n.loggedIn?y.jsxs(y.Fragment,{children:[d?y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>p(!1),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>{p(!1),t.login("claudeai",!0)},children:"Всё равно сменить"})]}):y.jsx("button",{className:"btn",onClick:v,children:"Сменить аккаунт"}),u?y.jsx("button",{className:"btn btn--danger",autoFocus:!0,onClick:()=>{f(!1),t.logout()},children:"Точно выйти?"}):y.jsx("button",{className:"btn",onClick:()=>{p(!1),f(!0)},children:"Выйти"})]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>t.login("console",!1),children:"Через Console"}),y.jsx("button",{className:"btn btn--primary",onClick:()=>t.login("claudeai",!1),children:"Войти"})]})})]})]})}function X4(n){const e=n%10,t=n%100,i=e===1&&t!==11,l=i?"сессия":e>=2&&e<=4&&(t<12||t>14)?"сессии":"сессий";return`${n} ${l} сейчас ${i?"работает":"работают"} — смена аккаунта может ${i?"её":"их"} прервать.`}const Q4={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function Z4({login:n,code:e,onCode:t,onSubmit:i,onCancel:l}){return y.jsxs("div",{className:"account__flow",children:[n.url?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"field",children:"Откройте ссылку и подтвердите вход"}),y.jsx("a",{className:"account__link",href:n.url,target:"_blank",rel:"noreferrer",children:n.url})]}):y.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),n.awaitingCode&&y.jsxs(y.Fragment,{children:[y.jsx("label",{className:"field",htmlFor:"auth-code",children:"Код со страницы авторизации"}),y.jsxs("div",{className:"extform__row",children:[y.jsx("input",{id:"auth-code",className:"input input--mono",value:e,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"вставьте код",onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),i())}}),y.jsx("button",{className:"btn btn--primary",disabled:e.trim()==="",onClick:i,children:"Готово"})]})]}),n.output.trim()!==""&&y.jsx("pre",{className:"account__log",children:n.output.trim()}),y.jsx("div",{className:"extbar",children:y.jsx("button",{className:"btn",onClick:l,children:"Отменить вход"})})]})}function J4({state:n,onPair:e,onUnpair:t,onClose:i}){const[l,a]=M.useState(""),[o,u]=M.useState(""),[f,d]=M.useState(!1),p=M.useRef(null),b=(n==null?void 0:n.paired)===!0;M.useEffect(()=>{var v;b||(v=p.current)==null||v.focus()},[b]),M.useEffect(()=>{d(!1),b&&a("")},[b,n==null?void 0:n.error]);const x=(n==null?void 0:n.url)??"https://claudevisual.com";return y.jsx(Ls,{title:"Удалённый доступ",onClose:i,children:b?y.jsxs("div",{className:"relay",children:[y.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",y.jsx("b",{children:ek(x)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),y.jsxs("dl",{className:"relay__facts",children:[y.jsxs("div",{children:[y.jsx("dt",{children:"Имя"}),y.jsx("dd",{children:(n==null?void 0:n.name)??"—"})]}),y.jsxs("div",{children:[y.jsx("dt",{children:"Связь"}),y.jsxs("dd",{children:[y.jsx("span",{className:n!=null&&n.connected?"dot dot--on":"dot"})," ",n!=null&&n.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),y.jsxs("div",{children:[y.jsx("dt",{children:"Подключено"}),y.jsxs("dd",{children:[(n==null?void 0:n.clients)??0," вкладок"]})]})]}),(n==null?void 0:n.error)&&y.jsx("p",{className:"relay__error",children:n.error}),y.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),y.jsx("button",{className:"btn btn--danger",onClick:t,children:"Отвязать компьютер"})]}):y.jsxs("div",{className:"relay",children:[y.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),y.jsxs("ol",{className:"relay__steps",children:[y.jsxs("li",{children:["Откройте ",y.jsx("b",{children:ek(x)})," и войдите (или зарегистрируйтесь)."]}),y.jsxs("li",{children:["Нажмите ",y.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),y.jsx("li",{children:"Введите его сюда."})]}),y.jsxs("form",{className:"relay__form",onSubmit:v=>{v.preventDefault(),l.trim()&&(d(!0),e(l.trim(),o.trim()))},children:[y.jsxs("label",{className:"field",children:[y.jsx("span",{children:"Код сопряжения"}),y.jsx("input",{ref:p,className:"input relay__code",value:l,onChange:v=>a(v.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),y.jsxs("label",{className:"field",children:[y.jsx("span",{children:"Как назвать этот компьютер"}),y.jsx("input",{className:"input",value:o,onChange:v=>u(v.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(n==null?void 0:n.error)&&y.jsx("p",{className:"relay__error",children:n.error}),y.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!l.trim()||f,children:f?"Связываем…":"Связать"})]})]})})}function ek(n){try{return new URL(n).host}catch{return n}}const Qh=3600*1e3,ez=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],Bo={"6h":6*Qh,"24h":24*Qh,"48h":48*Qh,"168h":168*Qh,never:0};function tz(n){return Bo[n]??Bo["48h"]}function nz(n){const e=Object.entries(Bo).find(([,t])=>t===n);return e?e[0]:Object.keys(Bo).reduce((t,i)=>Math.abs(Bo[i]-n)<Math.abs(Bo[t]-n)?i:t)}const iz=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],zo={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function sz(n){return zo[n]??zo.off}function lz(n){const e=Object.entries(zo).find(([,t])=>t===n);return e?e[0]:Object.keys(zo).reduce((t,i)=>Math.abs(zo[i]-n)<Math.abs(zo[t]-n)?i:t)}const rz=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function az({settings:n,onChange:e,onClose:t}){const i=n===null;return y.jsx(Ls,{title:"Настройки",onClose:t,children:y.jsxs("div",{className:"settings",children:[y.jsxs("section",{className:"settings__section",children:[y.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),y.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),i?y.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):y.jsx(cc,{className:"settings__select",value:nz(n.autoArchiveAfterMs),options:ez,onChange:l=>e({autoArchiveAfterMs:tz(l)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),y.jsxs("section",{className:"settings__section",children:[y.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),y.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),i?y.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):y.jsx(cc,{className:"settings__select",value:lz(n.autoSaveAfterPauseMs),options:iz,onChange:l=>e({autoSaveAfterPauseMs:sz(l)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),y.jsxs("section",{className:"settings__section",children:[y.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),y.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),y.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:rz.map(l=>{const a=!i&&n.folderAccess===l.value;return y.jsxs("button",{type:"button",role:"radio","aria-checked":a,disabled:i,className:"access__card"+(a?" is-on":"")+(l.risky?" access__card--risky":""),onClick:()=>e({folderAccess:l.value}),children:[y.jsx("span",{className:"access__radio","aria-hidden":"true"}),y.jsxs("span",{className:"access__body",children:[y.jsxs("span",{className:"access__title",children:[l.title,l.risky&&y.jsx("span",{className:"access__risk",children:"самое широкое"})]}),y.jsx("span",{className:"access__desc",children:l.description})]})]},l.value)})})]})]})})}const oz=16;function cz({pane:n,width:e,onResize:t,onReset:i}){const l=Ea[n],a=M.useRef(null);function o(p){if(p.button!==0)return;const b=document.querySelector(".main"),x=b?Math.max(0,b.getBoundingClientRect().width-L2):0;a.current={x:p.clientX,width:e,max:Math.min(l.max,e+x)},p.currentTarget.setPointerCapture(p.pointerId),document.body.classList.add("is-resizing"),p.preventDefault()}function u(p){const b=a.current;if(!b)return;const x=l.side==="left"?p.clientX-b.x:b.x-p.clientX;t(Math.min(b.max,b.width+x))}function f(p){a.current&&(a.current=null,p.currentTarget.hasPointerCapture(p.pointerId)&&p.currentTarget.releasePointerCapture(p.pointerId),document.body.classList.remove("is-resizing"))}function d(p){const b=p.key==="ArrowRight"?1:p.key==="ArrowLeft"?-1:0;b!==0&&(p.preventDefault(),t(e+b*oz*(l.side==="left"?1:-1)))}return y.jsx("div",{className:`pane-resizer pane-resizer--${n} pane-resizer--${l.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${l.label}`,"aria-valuenow":e,"aria-valuemin":l.min,"aria-valuemax":l.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:o,onPointerMove:u,onPointerUp:f,onPointerCancel:f,onDoubleClick:i,onKeyDown:d,children:y.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const uz=2e5,fz=75,hz=90;function dz({tokens:n}){if(n===null)return null;const e=Math.min(100,Math.round(n/uz*100));return y.jsxs("div",{className:"contextbar","aria-label":`Занято контекста: ${e}%`,children:[y.jsx("span",{className:"contextbar__label",children:"контекст"}),y.jsx("span",{className:"contextbar__track",role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:y.jsx("span",{className:`contextbar__fill${pz(e)}`,style:{width:`${e}%`}})}),y.jsxs("span",{className:"contextbar__pct",children:[e,"%"]})]})}function pz(n){return n>=hz?" contextbar__fill--over":n>=fz?" contextbar__fill--warn":""}const mz=[{value:"default",hint:"спрашивать перед каждым действием"},{value:"acceptEdits",hint:"правки файлов без подтверждения"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"auto",hint:"спрашивать только о рискованном — решает сам"},{value:"bypassPermissions",hint:"ничего не спрашивать"}],gz={mcp:"mcp",plugins:"plugins",plugin:"plugins"},tk=[{name:"login",description:"Войти в аккаунт Claude — окно приложения",argumentHint:"",aliases:["signin","вход"]},{name:"switch-account",description:"Сменить аккаунт: выйти и войти заново",argumentHint:"",aliases:["account","аккаунт"]},{name:"logout",description:"Выйти из аккаунта Claude",argumentHint:"",aliases:["signout","выход"]}],yz={active:!1,url:"",awaitingCode:!1,output:"",error:null};function nk(n,e,t){if(n===null)return null;const i=n.lastIndexOf("/");if(i===-1&&n!=="")return e;const l=t[i===-1?"":n.slice(0,i)];if(!l)return null;const a=n.slice(i+1).toLowerCase();return a===""?{query:n,entries:l}:{query:n,entries:l.filter(o=>o.name.toLowerCase().includes(a)).sort((o,u)=>ik(o.name,a)-ik(u.name,a))}}function ik(n,e){return n.toLowerCase().startsWith(e)?0:1}function sk(n,e){const t=n.find(l=>l.value===e)??n.find(l=>l.resolvedModel===e),i=e&&!t?e:null;return{rows:[...i?[{value:i,resolvedModel:i,displayName:i,description:"задана в настройках",supportsEffort:!1,effortLevels:[],supportsThinking:!0,supportsAutoMode:!1}]:[],...n],selected:(t==null?void 0:t.value)??i??(n.some(l=>l.value==="default")?"default":"")}}function bz(){const n=M.useRef(null),[e,t]=M.useState(!1),[i,l]=M.useState("Нет связи с хостом"),[a,o]=M.useState(null),[u,f]=M.useState(!1),d=M.useMemo(()=>fk()==="relay",[]),[p,b]=M.useState([]),[x,v]=M.useState([]),[w,C]=M.useState([]),[A,E]=M.useState(null),[D,B]=M.useState(null),[H,z]=M.useState(null),[L,R]=M.useState(Gi),[te,fe]=M.useState(!1),[Te,he]=M.useState(!1),le=pk("(max-width: 860px)"),[Me,Ae]=M.useState(!1);M.useEffect(()=>{le||Ae(!1)},[le]);const[Se,q]=M.useState(!1),[J,W]=M.useState([]),[Ee,Ne]=M.useState(!1),[N,F]=M.useState(Gi),[se,ae]=M.useState(null),[de,_e]=M.useState(null),[Re,ft]=M.useState([]),[ht,xt]=M.useState(null),[Ye,Sn]=M.useState(null),[Je,we]=M.useState([]),[xe,Gt]=M.useState([]),[wn,qe]=M.useState([]),[jn,Kn]=M.useState([]),[ce,Ve]=M.useState(null),[vt,$e]=M.useState(!1),[gn,K]=M.useState(null),[ue,Le]=M.useState(null),[dt,Wt]=M.useState(!1),[Wi,Kl]=M.useState(yz),[ds,kn]=M.useState(null),[Ei,,yn]=R2(),Is=H2(),[Xn,An]=M.useState(!1),[Xt,Us]=M.useState(null),[ps,Qn]=M.useState(null),[yl,li]=M.useState(null),[Xl,Ln]=M.useState(null),[ri,mi]=M.useState(null),[Bn,qs]=M.useState(!1),[Ni,Ki]=M.useState({}),[ms,Xi]=M.useState([""]),[Vs,_n]=M.useState([]),[ai,Dt]=M.useState(null),[Qe,tn]=M.useState(null),[gs,bl]=M.useState(null),[ys,Gs]=M.useState(null),[Ps,xl]=M.useState(null),[Di,bs]=M.useState({}),[Qi,Cn]=M.useState({}),[kt,Zn]=M.useState(!1),[Ha,oi]=M.useState(null),[Oi,Ql]=M.useState(null),Zl=M.useRef(0),Zi=M.useRef(null),[xs,Ri]=M.useState(!1),[gi,an]=M.useState(null),[zt,vl]=M.useState(Gi),[ji,vs]=M.useState(null),[Ss,yi]=M.useState({}),Ys=M.useRef([]),Ot=M.useRef(null),Tn=M.useRef(null),Jl=M.useRef(0);Ot.current=D,Tn.current=A,Jl.current=L.lastSeq;const Mn=M.useRef(null),Li=M.useRef(0);Li.current=zt.lastSeq;const oe=M.useRef(null),T=M.useRef(""),U=M.useRef(null),ie=M.useRef([]),ke=M.useRef([""]);ie.current=Vs,ke.current=ms;const Oe=M.useRef(new Map),Be=M.useRef(new Set),St=M.useRef(null),Pt=M.useRef(null),bn=M.useRef(0);M.useEffect(()=>{const k=D2();if(!k)return;n.current=k;const Z=()=>{t(k.connected),l(k.statusText)};k.onStatus(Z),k.onReconnect(()=>{Z();const Yt=Ot.current;Yt&&k.send({type:"session.sync",sessionId:Yt,sinceSeq:Jl.current});const He=Mn.current;He&&k.send({type:"session.sync",sessionId:He,sinceSeq:Li.current})});const ve=k.on(Yt=>Ht(Yt));k.connect();const We=window.setInterval(()=>{Z(),k.connected&&k.send({type:"ping",nonce:Date.now()})},15e3);return()=>{ve(),window.clearInterval(We),k.close()}},[]);const Ht=M.useCallback(k=>{var Z,ve,We,Yt;switch(k.type){case"hello.ok":t(!0);break;case"workspace.list":{b(k.workspaces),E(Ze=>{var Qt;return Ze??((Qt=k.workspaces[0])==null?void 0:Qt.id)??null});const He=U.current;if(!He)break;const Ke=k.workspaces.find(Ze=>wz(Ze.path,He));if(!Ke)break;U.current=null,q(!1),E(Ke.id);break}case"workspace.candidates":if(k.query.trim()!==T.current)break;W(k.candidates),k.source==="host"&&Ne(!1);break;case"finder.opened":oe.current=k.sessionId;break;case"workspace.roots":ft(k.roots);break;case"workspace.created":if(E(k.workspace.id),k.warnings.length===0){q(!1),_e(null);break}xt({path:k.workspace.path,warnings:k.warnings});break;case"session.list":if(k.workspaceId!==Tn.current)break;v(k.sessions),C(k.archived);break;case"session.summary":if(k.session.id===oe.current){ae(k.session);break}if(k.session.parentSessionId){k.session.id===Mn.current&&vs(k.session);break}v(He=>{const Ke=He.findIndex(Qt=>Qt.id===k.session.id);if(Ke===-1)return[k.session,...He];const Ze=He.slice();return Ze[Ke]=k.session,Ze}),B(He=>He??k.session.id);break;case"usage.state":k.sessionId===Ot.current&&kn(k.usage);break;case"session.capabilities":k.sessionId===Ot.current&&z(k.capabilities);break;case"session.events":if(k.sessionId===Mn.current){vl(He=>pg(He,k.entries));break}if(k.sessionId===oe.current){F(He=>pg(He,k.entries));break}if(k.sessionId!==Ot.current)break;R(He=>pg(He,k.entries));break;case"side.opened":{if(k.parentSessionId!==Ot.current)break;Mn.current=k.sessionId,an(k.sessionId);const He=Ys.current;Ys.current=[];for(const Ke of He)Ke(k.sessionId);break}case"side.closed":if(k.parentSessionId!==Ot.current)break;Mn.current=null,an(null),vl(Gi),vs(null);break;case"git.state":if(k.workspaceId!==Tn.current)break;Us(k.state);break;case"git.commit":if(k.workspaceId!==Tn.current)break;Qn(k.detail);break;case"git.result":if(k.workspaceId!==Tn.current)break;Ln({ok:k.ok,message:k.message}),k.ok&&(Qn(null),li(null));break;case"fs.dir":if(k.workspaceId!==Tn.current)break;Ki(He=>({...He,[k.path]:k.entries}));break;case"fs.search":if(k.workspaceId!==Tn.current)break;if(k.scope!=="tree"){const He=k.scope;Cn(Ke=>({...Ke,[He]:{query:k.query,entries:k.entries}}));break}xl({query:k.query,entries:k.entries,truncated:k.truncated});break;case"fs.grep":if(k.workspaceId!==Tn.current)break;oi({query:k.query,matches:k.matches,truncated:k.truncated});break;case"fs.file":{if(k.workspaceId!==Tn.current)break;const He=Be.current.delete(k.file.path);_n(Ze=>{const Qt=Ze.findIndex(Sf=>Sf.path===k.file.path);if(Qt===-1)return[...Ze,pw(k.file,++bn.current)];const ci=Ze[Qt],Zr=Ze.slice();return Zr[Qt]=ci.saved===k.file.content&&!Hl(ci)?{...ci,mtime:k.file.mtime,size:k.file.size,stale:!1}:pw(k.file,++bn.current),Zr}),He&&Dt(k.file.path);const Ke=Zi.current;Ke&&Ke.path===k.file.path&&(Zi.current=null,Ql({...Ke,token:++Zl.current}));break}case"fs.saved":{if(k.workspaceId!==Tn.current)break;const He=Oe.current.get(k.path);Oe.current.delete(k.path);const Ke=He!==void 0;_n(Qt=>Qt.map(ci=>ci.path!==k.path?ci:Ke?{...ci,saved:He,mtime:k.mtime,size:k.size,stale:!1}:{...ci,stale:!0}));const Ze=ie.current.find(Qt=>Qt.path===k.path);!Ke&&Ze&&!Hl(Ze)&&((Z=n.current)==null||Z.send({type:"fs.read",workspaceId:k.workspaceId,path:k.path})),(ve=n.current)==null||ve.send({type:"git.state",workspaceId:k.workspaceId});break}case"fs.result":{if(k.workspaceId!==Tn.current)break;if(tn({ok:k.ok,message:k.message}),k.ok||Oe.current.delete(k.path),k.conflict&&_n(Ke=>Ke.map(Ze=>Ze.path===k.path?{...Ze,stale:!0}:Ze)),Pt.current===k.path){const Ke=Pt.current;Pt.current=null,k.ok&&(Be.current.add(Ke),(We=n.current)==null||We.send({type:"fs.read",workspaceId:k.workspaceId,path:Ke}))}const He=St.current;if(k.ok&&He&&He.to===k.path){St.current=null;const Ke=Ze=>Ze===He.from?He.to:Ze.startsWith(`${He.from}/`)?He.to+Ze.slice(He.from.length):Ze;_n(Ze=>Ze.map(Qt=>({...Qt,path:Ke(Qt.path)}))),Dt(Ze=>Ze===null?null:Ke(Ze)),Xi(Ze=>Ze.map(Ke)),Ki(Ze=>{const Qt={};for(const[ci,Zr]of Object.entries(Ze))ci===He.from||ci.startsWith(`${He.from}/`)||(Qt[ci]=Zr);return Qt})}k.ok&&((Yt=n.current)==null||Yt.send({type:"git.state",workspaceId:k.workspaceId}));break}case"mcp.list":k.sessionId===Ot.current&&we(k.servers);break;case"plugin.list":if(k.sessionId!==Ot.current)break;Gt(k.plugins),qe(k.marketplaces),Kn(k.catalog);break;case"operation.result":k.sessionId===Ot.current&&Ve(k.result);break;case"auth.status":K(k.status);break;case"relay.state":o(k.state);break;case"settings.state":Le(k.settings);break;case"auth.login":Kl(k.state),k.state.active&&$e(!0);break;case"session.closed":v(He=>He.map(Ke=>Ke.id===k.sessionId?{...Ke,state:"closed"}:Ke));break;case"error":console.error("[host]",k.message,k.context??""),(k.context==="workspace.open"||k.context==="workspace.create")&&(U.current=null,_e(k.message));break}},[]),re=M.useCallback(k=>{var Z;(Z=n.current)==null||Z.send(k)},[]);M.useEffect(()=>{A&&re({type:"session.list",workspaceId:A})},[A,re]),M.useEffect(()=>{Se&&re({type:"workspace.roots"})},[Se,re]),M.useEffect(()=>{D&&re({type:"usage.get",sessionId:D})},[D,re]);const pe=M.useMemo(()=>x.find(k=>k.id===D)??null,[x,D]);function er(k){U.current=k,_e(null),re({type:"workspace.open",path:k})}function tr(k,Z,ve){_e(null),re({type:"workspace.create",parent:k,name:Z,init:ve})}function lf(k){if(T.current=k,!k){W([]),Ne(!1);return}Ne(!0),re({type:"workspace.find",query:k})}function mc(k){T.current=k,F(Gi),re({type:"workspace.find.agent",query:k})}function rf(){q(!1),_e(null),xt(null),W([]),F(Gi),ae(null),T.current="",U.current=null}function ws(){const k=Ot.current;k&&Mn.current&&re({type:"side.reset",sessionId:k}),Mn.current=null,an(null),vl(Gi),vs(null),yi({}),Ys.current=[]}function ks(k){re({type:"workspace.close",workspaceIds:k}),!(!A||!k.includes(A))&&(ws(),E(null),B(null),v([]),C([]),R(Gi),z(null),he(!1))}function gc(k){!A||(re({type:"session.archive",workspaceId:A,sessionIds:k}),!(D&&(k.includes(D)||(pe==null?void 0:pe.claudeSessionId)&&k.includes(pe.claudeSessionId))))||(ws(),B(null),R(Gi),z(null),he(!1))}function Fr(){A&&(ws(),B(null),z(null),R(Gi),he(!1),re({type:"session.start",workspaceId:A}),fe(!1))}function Fs(k){if(fe(!1),ws(),R(Gi),z(null),he(!1),k.state==="closed"){B(null),re({type:"session.start",workspaceId:k.workspaceId,resume:k.id});return}B(k.id),re({type:"session.sync",sessionId:k.id,sinceSeq:0})}function Ia(k,Z){re({type:"session.rename",sessionId:k.id,title:Z,workspaceId:k.workspaceId}),v(ve=>ve.map(We=>We.id===k.id?{...We,title:Z}:We))}function $r(k){D&&(fe(!1),Ve(null),Sn(k),re({type:"mcp.list",sessionId:D}),re({type:"plugin.list",sessionId:D}))}const af={mcpAction:(k,Z)=>{D&&(re({type:"mcp.action",sessionId:D,name:k,action:Z}),Sn(null))},mcpAdd:(k,Z)=>{D&&re({type:"mcp.add",sessionId:D,name:k,draft:Z})},mcpRemove:k=>{D&&re({type:"mcp.remove",sessionId:D,name:k})},pluginInstall:k=>{D&&re({type:"plugin.install",sessionId:D,spec:k})},pluginUninstall:k=>{D&&re({type:"plugin.uninstall",sessionId:D,id:k})},pluginToggle:(k,Z)=>{D&&re({type:"plugin.toggle",sessionId:D,id:k,enabled:Z})},marketplaceAdd:k=>{D&&re({type:"marketplace.add",sessionId:D,source:k})},marketplaceRemove:k=>{D&&re({type:"marketplace.remove",sessionId:D,name:k})}};function Wr(){fe(!1),$e(!0),re({type:"auth.status"})}const nr={login:(k,Z)=>re({type:"auth.login",mode:k,switchAccount:Z}),submitCode:k=>re({type:"auth.code",code:k}),cancel:()=>re({type:"auth.cancel"}),logout:()=>re({type:"auth.logout"})};function of(){fe(!1),Wt(!0),re({type:"settings.get"})}function Jn(k){Le(Z=>Z&&{...Z,...k}),re({type:"settings.update",settings:k})}function Sl(k){D&&re({type:"side.ask",sessionId:D,text:k})}function Ua(){D&&(re({type:"side.reset",sessionId:D}),Mn.current=null,an(null),vl(Gi),vs(null),yi({}),Ys.current=[])}function As(k){const Z=Mn.current;if(Z){k(Z);return}const ve=Ot.current;ve&&(Ys.current.push(k),re({type:"side.open",sessionId:ve}))}function cf(){A&&re({type:"git.state",workspaceId:A})}function yc(k){A&&(li(k),re({type:"git.show",workspaceId:A,ref:k}))}function qa(k,Z){Ln(null),mi({target:k,label:Z})}function Kr(){!A||!ri||(re({type:"git.checkout",workspaceId:A,target:ri.target}),mi(null))}M.useEffect(()=>{if(!(!Bn||!A))for(const k of ms)k in Ni||re({type:"fs.list",workspaceId:A,path:k})},[Bn,ms,Ni,A,re]);function Va(k){Xi(Z=>Z.includes(k)?Z.filter(ve=>ve!==k):[...Z,k])}function uf(k){if(!k){xl(null);return}A&&re({type:"fs.search",workspaceId:A,query:k})}function sp(k){if(!k){oi(null);return}A&&re({type:"fs.grep",workspaceId:A,query:k})}const ff=M.useCallback((k,Z)=>{bs(Yt=>({...Yt,[k]:Z}));const ve=Tn.current;if(Z===null||!ve)return;const We=Z.lastIndexOf("/");if(We!==-1){re({type:"fs.list",workspaceId:ve,path:Z.slice(0,We)});return}if(Z===""){re({type:"fs.list",workspaceId:ve,path:""});return}re({type:"fs.search",workspaceId:ve,query:Z,scope:k})},[re]),lp=M.useMemo(()=>nk(Di.mention??null,Qi.mention??null,Ni),[Di.mention,Qi.mention,Ni]),bc=M.useMemo(()=>nk(Di.side??null,Qi.side??null,Ni),[Di.side,Qi.side,Ni]);function rp(k){xc(k.path,{line:k.line,column:k.column})}function ap(k){const Z=[];let ve=Go(k.path);for(;Z.push(ve),!!ve;)ve=Go(ve);Xi(We=>{const Yt=new Set(We);for(const He of Z)Yt.add(He);return k.kind==="dir"&&Yt.add(k.path),[...Yt]}),k.kind==="file"&&xc(k.path)}function xc(k,Z){if(ie.current.find(We=>We.path===k)){Dt(k),Z&&Ql({path:k,...Z,token:++Zl.current});return}A&&(Z&&(Zi.current={path:k,...Z}),Be.current.add(k),re({type:"fs.read",workspaceId:A,path:k}))}function vc(k,Z=!1){const ve=ie.current,We=ve.find(Ke=>Ke.path===k);if(We&&Hl(We)&&!Z){Gs(k);return}Gs(null);const Yt=ve.findIndex(Ke=>Ke.path===k),He=ve.filter(Ke=>Ke.path!==k);_n(He),Dt(Ke=>{var Ze;return Ke===k?((Ze=He[Math.min(Yt,He.length-1)])==null?void 0:Ze.path)??null:Ke})}function Ga(k,Z=!1){const ve=ie.current.find(We=>We.path===k);!ve||!A||!Z&&!Hl(ve)||(Oe.current.set(k,ve.text),re({type:"fs.write",workspaceId:A,path:k,content:ve.text,eol:ve.eol,baseMtime:ve.mtime,...Z?{force:!0}:{}}))}function hf(k){A&&re({type:"fs.read",workspaceId:A,path:k})}const op=M.useRef(new Map);function cp(k){const Z=op.current,ve=Z.get(k);ve&&clearTimeout(ve);const We=(ue==null?void 0:ue.autoSaveAfterPauseMs)??0;We<=0||Z.set(k,setTimeout(()=>{Z.delete(k);const Yt=ie.current.find(He=>He.path===k);Yt&&Hl(Yt)&&!Yt.stale&&Ga(k)},We))}function up(k,Z,ve){if(!A)return;const We=k?`${k}/${ve}`:ve;tn(null),Z==="file"&&(Pt.current=We),re({type:"fs.create",workspaceId:A,path:We,kind:Z})}function fp(k,Z){if(!A)return;const ve=Go(k),We=ve?`${ve}/${Z}`:Z;tn(null),St.current={from:k,to:We},re({type:"fs.rename",workspaceId:A,path:k,to:We})}function Sc(k,Z){if(!A)return;const ve=k.slice(k.lastIndexOf("/")+1),We=Z?`${Z}/${ve}`:ve;We!==k&&(tn(null),St.current={from:k,to:We},re({type:"fs.rename",workspaceId:A,path:k,to:We}))}function hp(k){A&&(tn(null),bl(null),re({type:"fs.delete",workspaceId:A,path:k.path}),_n(Z=>Z.filter(ve=>ve.path!==k.path&&!ve.path.startsWith(`${k.path}/`))),Dt(Z=>Z&&(Z===k.path||Z.startsWith(`${k.path}/`))?null:Z))}function dp(){Ki({}),Xi([""]),_n([]),Dt(null),tn(null),xl(null),oi(null),bs({}),Cn({}),Ql(null),Be.current.clear(),Oe.current.clear(),Zi.current=null,St.current=null,Pt.current=null}function pp(k,Z){D&&re({type:"permission.respond",sessionId:D,requestId:k,decision:Z})}function df(k,Z){D&&re({type:"permission.respond",sessionId:D,requestId:k,decision:"allow",answers:Z})}function mp(k){D&&re({type:"permission.respond",sessionId:D,requestId:k,decision:"deny",reason:"Пользователь не стал отвечать на вопросы"})}M.useEffect(()=>{function k(Z){if(Z.key!=="Escape"||!D||L.pending.length>0)return;const ve=Z.target;ve instanceof HTMLElement&&ve.closest(".sidepane, .editor")||re({type:"control.interrupt",sessionId:D})}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[D,L.pending.length,re]);const pf=M.useMemo(()=>{const k=(H==null?void 0:H.commands)??[];return k.length===0?k:[...k,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...tk]},[H]);function mf(k){const Z=gz[k];return Z?($r(Z),!0):tk.some(ve=>ve.name===k)?(Wr(),k==="logout"&&nr.logout(),k==="switch-account"&&nr.login("claudeai",!0),!0):!1}const Pa=(pe==null?void 0:pe.state)==="waiting_permission",_s=(pe==null?void 0:pe.state)==="running"||Pa,$s=L.pending[0]??null;M.useEffect(()=>{!Xn&&!Bn||!A||_s||re({type:"git.state",workspaceId:A})},[Xn,Bn,A,_s,re]),M.useEffect(()=>{if(!(_s||!A)){Bn&&Ki(k=>{const Z={};for(const[ve,We]of Object.entries(k))ke.current.includes(ve)||(Z[ve]=We);return Z});for(const k of ie.current)Hl(k)||re({type:"fs.read",workspaceId:A,path:k.path})}},[_s,A,Bn,re]);const wc=(pe==null?void 0:pe.cwd)??(H==null?void 0:H.cwd)??null,gf=(H==null?void 0:H.models)??[],Ya=(pe==null?void 0:pe.model)??(H==null?void 0:H.model)??null,{rows:Fa,selected:Xr}=sk(gf,Ya),Qr=ji?{model:ji.model,effort:ji.effort,ultracode:ji.ultracode,thinking:ji.thinking,switchOnFlag:ji.switchModelsOnFlag}:{model:Ss.model??Ya,effort:Ss.effort??(pe==null?void 0:pe.effort)??null,ultracode:Ss.ultracode??(pe==null?void 0:pe.ultracode)??!1,thinking:Ss.thinking??(pe==null?void 0:pe.thinking)??!0,switchOnFlag:Ss.switchOnFlag??(pe==null?void 0:pe.switchModelsOnFlag)??!0},kc=sk(gf,Qr.model),yf=(ji==null?void 0:ji.state)==="running",$a=ai?Vs.find(k=>k.path===ai)??null:null,bf=new Set(Vs.filter(Hl).map(k=>k.path)),ir=k=>y.jsx(cz,{pane:k,width:Is.widths[k],onResize:Z=>Is.setWidth(k,Z),onReset:()=>Is.reset(k)}),wl=H&&y.jsx(cc,{title:"Режим прав",value:(pe==null?void 0:pe.permissionMode)??"default",options:mz.map(k=>({value:k.value,label:k.value,hint:k.hint})),onChange:k=>{D&&re({type:"control.set_mode",sessionId:D,mode:k})}}),xf=Fa.length>0?y.jsx(RC,{models:Fa,value:Xr,effort:(pe==null?void 0:pe.effort)??null,ultracode:(pe==null?void 0:pe.ultracode)??!1,thinking:(pe==null?void 0:pe.thinking)??!0,switchOnFlag:(pe==null?void 0:pe.switchModelsOnFlag)??!0,onModel:k=>{!D||!k||re({type:"control.set_model",sessionId:D,model:k})},onEffort:k=>{D&&re({type:"control.set_effort",sessionId:D,effort:k})},onUltracode:k=>{D&&re({type:"control.set_ultracode",sessionId:D,enabled:k})},onThinking:k=>{D&&re({type:"control.set_thinking",sessionId:D,enabled:k})},onSwitchOnFlag:k=>{D&&re({type:"control.set_flag_switch",sessionId:D,enabled:k})}}):Ya&&y.jsx("span",{className:"badge",children:Ya}),vf=_s&&y.jsx("span",{className:Pa?"badge badge--wait":"badge badge--live",children:Pa?"ждёт":"работает"}),Ac=pe&&pe.totalCostUsd>0?`$${pe.totalCostUsd.toFixed(3)}`:null,_c=y.jsx("button",{className:xs?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":xs,onClick:()=>Ri(k=>!k),children:y.jsx(kz,{})});return y.jsxs("div",{className:"app",style:Is.style,children:[y.jsx(hB,{open:te,connected:e,status:i,workspaces:p,sessions:x.filter(k=>k.workspaceId===A),archived:w.filter(k=>k.workspaceId===A),activeWorkspaceId:A,activeSessionId:D,onCloseWorkspaces:ks,onArchiveSessions:gc,onUnarchiveSessions:k=>{A&&re({type:"session.unarchive",workspaceId:A,sessionIds:k})},onSelectWorkspace:k=>{ws(),dp(),E(k),B(null),R(Gi),z(null),he(!1),Us(null),Qn(null),li(null),Ln(null)},onSelectSession:Fs,onRenameSession:Ia,onOpenWorkspace:()=>q(!0),onNewSession:Fr,onOpenExtensions:D?()=>$r("mcp"):null,account:gn,onOpenAccount:Wr,relay:a,onOpenRelay:d?null:()=>f(!0),onOpenSettings:of,themeMode:Ei,onCycleTheme:yn}),ir("sidebar"),te&&y.jsx("div",{className:"scrim",onClick:()=>fe(!1)}),y.jsx($R,{open:Bn,tree:Ni,expanded:new Set(ms),activePath:ai,dirty:bf,gitChanges:(Xt==null?void 0:Xt.changed)??[],result:Qe,searchResult:Ps,onSearch:uf,onReveal:ap,onToggle:Va,onOpen:xc,onCreate:up,onRename:fp,onMove:Sc,onDelete:bl,onRefresh:()=>{tn(null),Ki({}),cf()},onClose:()=>qs(!1)}),Bn&&ir("files"),y.jsx(sj,{open:kt,result:Ha,onSearch:sp,onOpenMatch:rp,onClose:()=>Zn(!1)}),kt&&ir("search"),y.jsx(v4,{open:Xn,state:Xt,result:Xl,selected:yl,onRefresh:cf,onShow:yc,onCheckout:qa,onClose:()=>An(!1)}),Xn&&ir("git"),y.jsxs("main",{className:"main",children:[y.jsxs("header",{className:"topbar",children:[y.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>fe(!0),children:"☰"}),y.jsx("button",{className:Bn?"pane-btn is-on":"pane-btn",title:"Файлы проекта","aria-label":"Файлы проекта","aria-pressed":Bn,onClick:()=>{qs(k=>!k),An(!1),Zn(!1)},children:y.jsx(xz,{})}),y.jsx("button",{className:kt?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","aria-label":"Поиск по тексту в проекте","aria-pressed":kt,onClick:()=>{Zn(k=>!k),qs(!1),An(!1)},children:y.jsx(vz,{})}),y.jsx("button",{className:Xn?"pane-btn is-on":"pane-btn",title:"История git","aria-label":"История git","aria-pressed":Xn,onClick:()=>{An(k=>!k),qs(!1),Zn(!1)},children:y.jsx(Sz,{})}),le&&_c,le&&y.jsx("button",{className:Me?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":Me,onClick:()=>Ae(!0),children:y.jsx(Az,{})}),y.jsxs("div",{className:"topbar__id",children:[Te&&pe?y.jsx(Ed,{className:"rename--title",value:pe.title??"",onCommit:k=>{Ia(pe,k),he(!1)},onCancel:()=>he(!1)}):y.jsx("button",{className:"topbar__title",disabled:!pe||le,title:pe&&!le?"Переименовать сессию":void 0,onClick:()=>he(!0),children:(pe==null?void 0:pe.title)??"Claude Code Visual"}),le?vf:wc&&y.jsx(OC,{path:wc})]}),!le&&y.jsxs("div",{className:"topbar__tools",children:[y.jsx(LC,{usage:ds}),y.jsx(IC,{}),wl,xf,vf,Ac&&y.jsx("span",{className:"badge badge--cost",children:Ac}),_c]})]}),y.jsx(dz,{tokens:L.contextTokens}),le&&Me&&y.jsx(U4,{onClose:()=>Ae(!1),permission:wl,model:xf,usage:ds,cwd:wc,costLabel:Ac,onRename:pe?()=>{he(!0),Ae(!1)}:null}),Vs.length>0&&y.jsx(cB,{files:Vs,activePath:ai,busy:_s,onSelect:Dt,onClose:k=>vc(k)}),$a?y.jsx(aB,{file:$a,goto:(Oi==null?void 0:Oi.path)===$a.path?Oi:null,onChange:(k,Z)=>{_n(ve=>ve.map(We=>We.path===k?{...We,text:Z}:We)),cp(k)},onSave:k=>Ga(k),onReload:hf,onOverwrite:k=>Ga(k,!0),onTogglePreview:k=>_n(Z=>Z.map(ve=>ve.path===k?{...ve,previewMode:!ve.previewMode}:ve))}):y.jsxs(y.Fragment,{children:[y.jsx(eb,{items:L.items,busy:_s,waiting:Pa}),y.jsx(NC,{disabled:!D,busy:_s,commands:pf,sessionTitle:(pe==null?void 0:pe.title)??null,contextResult:lp,onContextSearch:k=>ff("mention",k),onCommand:mf,onSend:k=>{D&&re({type:"prompt.send",sessionId:D,text:k})},onInterrupt:()=>{D&&re({type:"control.interrupt",sessionId:D})}})]})]}),y.jsx(D4,{open:xs,items:zt.items,busy:yf,ready:D!==null,commands:pf,contextResult:bc,models:kc.rows,model:kc.selected,effort:Qr.effort,ultracode:Qr.ultracode,thinking:Qr.thinking,switchOnFlag:Qr.switchOnFlag,onContextSearch:k=>ff("side",k),onCommand:mf,onModel:k=>{k&&(yi(Z=>({...Z,model:k})),As(Z=>re({type:"control.set_model",sessionId:Z,model:k})))},onEffort:k=>{yi(Z=>({...Z,effort:k,ultracode:!1})),As(Z=>re({type:"control.set_effort",sessionId:Z,effort:k}))},onUltracode:k=>{yi(Z=>({...Z,ultracode:k,...k?{effort:"xhigh"}:{}})),As(Z=>re({type:"control.set_ultracode",sessionId:Z,enabled:k}))},onThinking:k=>{yi(Z=>({...Z,thinking:k})),As(Z=>re({type:"control.set_thinking",sessionId:Z,enabled:k}))},onSwitchOnFlag:k=>{yi(Z=>({...Z,switchOnFlag:k})),As(Z=>re({type:"control.set_flag_switch",sessionId:Z,enabled:k}))},onAsk:Sl,onInterrupt:()=>{gi&&re({type:"control.interrupt",sessionId:gi})},onReset:Ua,onClose:()=>Ri(!1)}),xs&&ir("ask"),(Xn||xs||Bn||kt)&&y.jsx("div",{className:"scrim scrim--pane",onClick:()=>{An(!1),Ri(!1),qs(!1),Zn(!1)}}),ps&&y.jsx(k4,{detail:ps,local:((Xt==null?void 0:Xt.hasRemote)??!1)&&(Xt==null?void 0:Xt.commits.some(k=>k.hash===ps.hash&&!k.pushed))===!0,onCheckout:qa,onClose:()=>{Qn(null),li(null)}}),ri&&y.jsxs(Ls,{title:"Переключить рабочее дерево?",onClose:()=>mi(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>mi(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:Kr,children:"Переключиться"})]}),children:[y.jsxs("p",{className:"modal__text",children:["git переключится на ",ri.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),_s&&y.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),Xt&&Xt.changed.length>0&&y.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",Xt.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),gs&&y.jsx(Ls,{title:gs.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>bl(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>bl(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:()=>hp(gs),children:"Удалить"})]}),children:y.jsxs("p",{className:"modal__text",children:[gs.path," будет удалён с диска",gs.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),ys&&y.jsx(Ls,{title:"Закрыть без сохранения?",onClose:()=>Gs(null),actions:y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",onClick:()=>Gs(null),children:"Отмена"}),y.jsx("button",{className:"btn btn--warn",onClick:()=>vc(ys,!0),children:"Закрыть"}),y.jsx("button",{className:"btn btn--primary",onClick:()=>{Ga(ys),vc(ys,!0)},children:"Сохранить и закрыть"})]}),children:y.jsxs("p",{className:"modal__text",children:["В ",ys," есть несохранённые правки."]})}),Ye&&y.jsx(q4,{tab:Ye,servers:Je,plugins:xe,marketplaces:wn,catalog:jn,result:ce,actions:af,onTab:Sn,onClose:()=>Sn(null)}),vt&&y.jsx(K4,{status:gn,login:Wi,actions:nr,runningSessions:x.filter(k=>k.state==="running"||k.state==="waiting_permission").length,onClose:()=>$e(!1)}),u&&y.jsx(J4,{state:a,onPair:(k,Z)=>re({type:"relay.pair",code:k,...Z?{name:Z}:{}}),onUnpair:()=>re({type:"relay.unpair"}),onClose:()=>f(!1)}),dt&&y.jsx(az,{settings:ue,onChange:Jn,onClose:()=>Wt(!1)}),Se&&y.jsx(c4,{candidates:J,searching:Ee,agentItems:N.items,agentBusy:(se==null?void 0:se.state)==="running",error:de,roots:Re,created:ht,onSearch:lf,onAskAgent:mc,onInterrupt:()=>{const k=oe.current;k&&re({type:"control.interrupt",sessionId:k})},onSubmit:er,onCreate:tr,onClose:rf}),$s!=null&&$s.questions&&$s.questions.length>0?y.jsx(t4,{request:{...$s,questions:$s.questions},queued:L.pending.length-1,onAnswer:df,onDecline:mp}):$s&&y.jsx(e4,{request:$s,queued:L.pending.length-1,onDecide:pp})]})}function xz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),y.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function vz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),y.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function Sz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),y.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),y.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),y.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function wz(n,e){return lk(n)===lk(e)}function lk(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function kz(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),y.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}function Az(){return y.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[y.jsx("circle",{cx:"3.2",cy:"8",r:"1.5"}),y.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),y.jsx("circle",{cx:"12.8",cy:"8",r:"1.5"})]})}const UC=document.getElementById("root");if(!UC)throw new Error("#root not found");A2.createRoot(UC).render(y.jsx(M.StrictMode,{children:y.jsx(bz,{})}));export{QL as A,Tz as B,hC as C,zz as D,Q as E,Rz as F,MR as G,PO as H,Lt as I,aE as J,Dz as L,Mi as N,pE as P,as as T,$0 as a,Lz as b,jz as c,it as d,Mk as e,sR as f,dn as g,$l as h,WO as i,iR as j,lc as k,$n as l,fc as m,js as n,Xd as o,Mz as p,GO as q,pt as r,CE as s,Y as t,jo as u,ye as v,l_ as w,_d as x,Oz as y,Bz as z};
|