interceptr 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function i(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=i(r);fetch(r.href,a)}})();var bp={exports:{}},Ua={};var T1;function bO(){if(T1)return Ua;T1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,r,a){var o=null;if(a!==void 0&&(o=""+a),r.key!==void 0&&(o=""+r.key),"key"in r){a={};for(var c in r)c!=="key"&&(a[c]=r[c])}else a=r;return r=a.ref,{$$typeof:t,type:n,key:o,ref:r!==void 0?r:null,props:a}}return Ua.Fragment=e,Ua.jsx=i,Ua.jsxs=i,Ua}var O1;function vO(){return O1||(O1=1,bp.exports=bO()),bp.exports}var b=vO(),vp={exports:{}},ve={};var E1;function SO(){if(E1)return ve;E1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=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(){}},k=Object.assign,C={};function M(N,Q,$){this.props=N,this.context=Q,this.refs=C,this.updater=$||w}M.prototype.isReactComponent={},M.prototype.setState=function(N,Q){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,Q,"setState")},M.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function T(){}T.prototype=M.prototype;function j(N,Q,$){this.props=N,this.context=Q,this.refs=C,this.updater=$||w}var L=j.prototype=new T;L.constructor=j,k(L,M.prototype),L.isPureReactComponent=!0;var D=Array.isArray;function U(){}var H={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function J(N,Q,$){var re=$.ref;return{$$typeof:t,type:N,key:Q,ref:re!==void 0?re:null,props:$}}function ue(N,Q){return J(N.type,Q,N.props)}function ae(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function F(N){var Q={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function($){return Q[$]})}var ee=/\/+/g;function fe(N,Q){return typeof N=="object"&&N!==null&&N.key!=null?F(""+N.key):Q.toString(36)}function de(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(U,U):(N.status="pending",N.then(function(Q){N.status==="pending"&&(N.status="fulfilled",N.value=Q)},function(Q){N.status==="pending"&&(N.status="rejected",N.reason=Q)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function P(N,Q,$,re,be){var ke=typeof N;(ke==="undefined"||ke==="boolean")&&(N=null);var ze=!1;if(N===null)ze=!0;else switch(ke){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(N.$$typeof){case t:case e:ze=!0;break;case p:return ze=N._init,P(ze(N._payload),Q,$,re,be)}}if(ze)return be=be(N),ze=re===""?"."+fe(N,0):re,D(be)?($="",ze!=null&&($=ze.replace(ee,"$&/")+"/"),P(be,Q,$,"",function(Gl){return Gl})):be!=null&&(ae(be)&&(be=ue(be,$+(be.key==null||N&&N.key===be.key?"":(""+be.key).replace(ee,"$&/")+"/")+ze)),Q.push(be)),1;ze=0;var Gt=re===""?".":re+":";if(D(N))for(var ut=0;ut<N.length;ut++)re=N[ut],ke=Gt+fe(re,ut),ze+=P(re,Q,$,ke,be);else if(ut=v(N),typeof ut=="function")for(N=ut.call(N),ut=0;!(re=N.next()).done;)re=re.value,ke=Gt+fe(re,ut++),ze+=P(re,Q,$,ke,be);else if(ke==="object"){if(typeof N.then=="function")return P(de(N),Q,$,re,be);throw Q=String(N),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ze}function X(N,Q,$){if(N==null)return N;var re=[],be=0;return P(N,re,"","",function(ke){return Q.call($,ke,be++)}),re}function ne(N){if(N._status===-1){var Q=N._result;Q=Q(),Q.then(function($){(N._status===0||N._status===-1)&&(N._status=1,N._result=$)},function($){(N._status===0||N._status===-1)&&(N._status=2,N._result=$)}),N._status===-1&&(N._status=0,N._result=Q)}if(N._status===1)return N._result.default;throw N._result}var ce=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=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(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},ye={map:X,forEach:function(N,Q,$){X(N,function(){Q.apply(this,arguments)},$)},count:function(N){var Q=0;return X(N,function(){Q++}),Q},toArray:function(N){return X(N,function(Q){return Q})||[]},only:function(N){if(!ae(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return ve.Activity=g,ve.Children=ye,ve.Component=M,ve.Fragment=i,ve.Profiler=r,ve.PureComponent=j,ve.StrictMode=n,ve.Suspense=h,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ve.__COMPILER_RUNTIME={__proto__:null,c:function(N){return H.H.useMemoCache(N)}},ve.cache=function(N){return function(){return N.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(N,Q,$){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var re=k({},N.props),be=N.key;if(Q!=null)for(ke in Q.key!==void 0&&(be=""+Q.key),Q)!Z.call(Q,ke)||ke==="key"||ke==="__self"||ke==="__source"||ke==="ref"&&Q.ref===void 0||(re[ke]=Q[ke]);var ke=arguments.length-2;if(ke===1)re.children=$;else if(1<ke){for(var ze=Array(ke),Gt=0;Gt<ke;Gt++)ze[Gt]=arguments[Gt+2];re.children=ze}return J(N.type,be,re)},ve.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},ve.createElement=function(N,Q,$){var re,be={},ke=null;if(Q!=null)for(re in Q.key!==void 0&&(ke=""+Q.key),Q)Z.call(Q,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(be[re]=Q[re]);var ze=arguments.length-2;if(ze===1)be.children=$;else if(1<ze){for(var Gt=Array(ze),ut=0;ut<ze;ut++)Gt[ut]=arguments[ut+2];be.children=Gt}if(N&&N.defaultProps)for(re in ze=N.defaultProps,ze)be[re]===void 0&&(be[re]=ze[re]);return J(N,ke,be)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(N){return{$$typeof:c,render:N}},ve.isValidElement=ae,ve.lazy=function(N){return{$$typeof:p,_payload:{_status:-1,_result:N},_init:ne}},ve.memo=function(N,Q){return{$$typeof:d,type:N,compare:Q===void 0?null:Q}},ve.startTransition=function(N){var Q=H.T,$={};H.T=$;try{var re=N(),be=H.S;be!==null&&be($,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(U,ce)}catch(ke){ce(ke)}finally{Q!==null&&$.types!==null&&(Q.types=$.types),H.T=Q}},ve.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ve.use=function(N){return H.H.use(N)},ve.useActionState=function(N,Q,$){return H.H.useActionState(N,Q,$)},ve.useCallback=function(N,Q){return H.H.useCallback(N,Q)},ve.useContext=function(N){return H.H.useContext(N)},ve.useDebugValue=function(){},ve.useDeferredValue=function(N,Q){return H.H.useDeferredValue(N,Q)},ve.useEffect=function(N,Q){return H.H.useEffect(N,Q)},ve.useEffectEvent=function(N){return H.H.useEffectEvent(N)},ve.useId=function(){return H.H.useId()},ve.useImperativeHandle=function(N,Q,$){return H.H.useImperativeHandle(N,Q,$)},ve.useInsertionEffect=function(N,Q){return H.H.useInsertionEffect(N,Q)},ve.useLayoutEffect=function(N,Q){return H.H.useLayoutEffect(N,Q)},ve.useMemo=function(N,Q){return H.H.useMemo(N,Q)},ve.useOptimistic=function(N,Q){return H.H.useOptimistic(N,Q)},ve.useReducer=function(N,Q,$){return H.H.useReducer(N,Q,$)},ve.useRef=function(N){return H.H.useRef(N)},ve.useState=function(N){return H.H.useState(N)},ve.useSyncExternalStore=function(N,Q,$){return H.H.useSyncExternalStore(N,Q,$)},ve.useTransition=function(){return H.H.useTransition()},ve.version="19.2.4",ve}var N1;function kg(){return N1||(N1=1,vp.exports=SO()),vp.exports}var E=kg(),Sp={exports:{}},qa={},wp={exports:{}},kp={};var R1;function wO(){return R1||(R1=1,(function(t){function e(P,X){var ne=P.length;P.push(X);e:for(;0<ne;){var ce=ne-1>>>1,ye=P[ce];if(0<r(ye,X))P[ce]=X,P[ne]=ye,ne=ce;else break e}}function i(P){return P.length===0?null:P[0]}function n(P){if(P.length===0)return null;var X=P[0],ne=P.pop();if(ne!==X){P[0]=ne;e:for(var ce=0,ye=P.length,N=ye>>>1;ce<N;){var Q=2*(ce+1)-1,$=P[Q],re=Q+1,be=P[re];if(0>r($,ne))re<ye&&0>r(be,$)?(P[ce]=be,P[re]=ne,ce=re):(P[ce]=$,P[Q]=ne,ce=Q);else if(re<ye&&0>r(be,ne))P[ce]=be,P[re]=ne,ce=re;else break e}}return X}function r(P,X){var ne=P.sortIndex-X.sortIndex;return ne!==0?ne:P.id-X.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var h=[],d=[],p=1,g=null,x=3,v=!1,w=!1,k=!1,C=!1,M=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function L(P){for(var X=i(d);X!==null;){if(X.callback===null)n(d);else if(X.startTime<=P)n(d),X.sortIndex=X.expirationTime,e(h,X);else break;X=i(d)}}function D(P){if(k=!1,L(P),!w)if(i(h)!==null)w=!0,U||(U=!0,F());else{var X=i(d);X!==null&&de(D,X.startTime-P)}}var U=!1,H=-1,Z=5,J=-1;function ue(){return C?!0:!(t.unstable_now()-J<Z)}function ae(){if(C=!1,U){var P=t.unstable_now();J=P;var X=!0;try{e:{w=!1,k&&(k=!1,T(H),H=-1),v=!0;var ne=x;try{t:{for(L(P),g=i(h);g!==null&&!(g.expirationTime>P&&ue());){var ce=g.callback;if(typeof ce=="function"){g.callback=null,x=g.priorityLevel;var ye=ce(g.expirationTime<=P);if(P=t.unstable_now(),typeof ye=="function"){g.callback=ye,L(P),X=!0;break t}g===i(h)&&n(h),L(P)}else n(h);g=i(h)}if(g!==null)X=!0;else{var N=i(d);N!==null&&de(D,N.startTime-P),X=!1}}break e}finally{g=null,x=ne,v=!1}X=void 0}}finally{X?F():U=!1}}}var F;if(typeof j=="function")F=function(){j(ae)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,fe=ee.port2;ee.port1.onmessage=ae,F=function(){fe.postMessage(null)}}else F=function(){M(ae,0)};function de(P,X){H=M(function(){P(t.unstable_now())},X)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(P){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var ne=x;x=X;try{return P()}finally{x=ne}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(P,X){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ne=x;x=P;try{return X()}finally{x=ne}},t.unstable_scheduleCallback=function(P,X,ne){var ce=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ce+ne:ce):ne=ce,P){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=ne+ye,P={id:p++,callback:X,priorityLevel:P,startTime:ne,expirationTime:ye,sortIndex:-1},ne>ce?(P.sortIndex=ne,e(d,P),i(h)===null&&P===i(d)&&(k?(T(H),H=-1):k=!0,de(D,ne-ce))):(P.sortIndex=ye,e(h,P),w||v||(w=!0,U||(U=!0,F()))),P},t.unstable_shouldYield=ue,t.unstable_wrapCallback=function(P){var X=x;return function(){var ne=x;x=X;try{return P.apply(this,arguments)}finally{x=ne}}}})(kp)),kp}var D1;function kO(){return D1||(D1=1,wp.exports=wO()),wp.exports}var Cp={exports:{}},qt={};var j1;function CO(){if(j1)return qt;j1=1;var t=kg();function e(h){var d="https://react.dev/errors/"+h;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 #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(h,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:h,containerInfo:d,implementation:p}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,qt.createPortal=function(h,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(h,d,null,p)},qt.flushSync=function(h){var d=o.T,p=n.p;try{if(o.T=null,n.p=2,h)return h()}finally{o.T=d,n.p=p,n.d.f()}},qt.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(h,d))},qt.prefetchDNS=function(h){typeof h=="string"&&n.d.D(h)},qt.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):p==="script"&&n.d.X(h,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},qt.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);n.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(h)},qt.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin);n.d.L(h,p,{crossOrigin:g,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})}},qt.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=c(d.as,d.crossOrigin);n.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(h)},qt.requestFormReset=function(h){n.d.r(h)},qt.unstable_batchedUpdates=function(h,d){return h(d)},qt.useFormState=function(h,d,p){return o.H.useFormState(h,d,p)},qt.useFormStatus=function(){return o.H.useHostTransitionStatus()},qt.version="19.2.4",qt}var L1;function AO(){if(L1)return Cp.exports;L1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Cp.exports=CO(),Cp.exports}var B1;function MO(){if(B1)return qa;B1=1;var t=kO(),e=kg(),i=AO();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var l=s,u=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(u=l.return),s=l.return;while(s)}return l.tag===3?u:null}function o(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function h(s){if(a(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=a(s),l===null)throw Error(n(188));return l!==s?null:s}for(var u=s,f=l;;){var m=u.return;if(m===null)break;var y=m.alternate;if(y===null){if(f=m.return,f!==null){u=f;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===u)return h(m),s;if(y===f)return h(m),l;y=y.sibling}throw Error(n(188))}if(u.return!==f.return)u=m,f=y;else{for(var S=!1,A=m.child;A;){if(A===u){S=!0,u=m,f=y;break}if(A===f){S=!0,f=m,u=y;break}A=A.sibling}if(!S){for(A=y.child;A;){if(A===u){S=!0,u=y,f=m;break}if(A===f){S=!0,f=y,u=m;break}A=A.sibling}if(!S)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:l}function p(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=p(s),l!==null)return l;s=s.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),j=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function F(s){return s===null||typeof s!="object"?null:(s=ae&&s[ae]||s["@@iterator"],typeof s=="function"?s:null)}var ee=Symbol.for("react.client.reference");function fe(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ee?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case k:return"Fragment";case M:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case U:return"SuspenseList";case J:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case j:return s.displayName||"Context";case T:return(s._context.displayName||"Context")+".Consumer";case L:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case H:return l=s.displayName||null,l!==null?l:fe(s.type)||"Memo";case Z:l=s._payload,s=s._init;try{return fe(s(l))}catch{}}return null}var de=Array.isArray,P=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},ce=[],ye=-1;function N(s){return{current:s}}function Q(s){0>ye||(s.current=ce[ye],ce[ye]=null,ye--)}function $(s,l){ye++,ce[ye]=s.current,s.current=l}var re=N(null),be=N(null),ke=N(null),ze=N(null);function Gt(s,l){switch($(ke,l),$(be,s),$(re,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?Xb(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=Xb(l),s=Zb(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q(re),$(re,s)}function ut(){Q(re),Q(be),Q(ke)}function Gl(s){s.memoizedState!==null&&$(ze,s);var l=re.current,u=Zb(l,s.type);l!==u&&($(be,s),$(re,u))}function Io(s){be.current===s&&(Q(re),Q(be)),ze.current===s&&(Q(ze),Ba._currentValue=ne)}var ef,M0;function Vr(s){if(ef===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);ef=l&&l[1]||"",M0=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+ef+s+M0}var tf=!1;function nf(s,l){if(!s||tf)return"";tf=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(l){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(V){var q=V}Reflect.construct(s,[],K)}else{try{K.call()}catch(V){q=V}s.call(K.prototype)}}else{try{throw Error()}catch(V){q=V}(K=s())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(V){if(V&&q&&typeof V.stack=="string")return[V.stack,q.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=f.DetermineComponentFrameRoot(),S=y[0],A=y[1];if(S&&A){var O=S.split(`
4
+ `),_=A.split(`
5
+ `);for(m=f=0;f<O.length&&!O[f].includes("DetermineComponentFrameRoot");)f++;for(;m<_.length&&!_[m].includes("DetermineComponentFrameRoot");)m++;if(f===O.length||m===_.length)for(f=O.length-1,m=_.length-1;1<=f&&0<=m&&O[f]!==_[m];)m--;for(;1<=f&&0<=m;f--,m--)if(O[f]!==_[m]){if(f!==1||m!==1)do if(f--,m--,0>m||O[f]!==_[m]){var G=`
6
+ `+O[f].replace(" at new "," at ");return s.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",s.displayName)),G}while(1<=f&&0<=m);break}}}finally{tf=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Vr(u):""}function XA(s,l){switch(s.tag){case 26:case 27:case 5:return Vr(s.type);case 16:return Vr("Lazy");case 13:return s.child!==l&&l!==null?Vr("Suspense Fallback"):Vr("Suspense");case 19:return Vr("SuspenseList");case 0:case 15:return nf(s.type,!1);case 11:return nf(s.type.render,!1);case 1:return nf(s.type,!0);case 31:return Vr("Activity");default:return""}}function T0(s){try{var l="",u=null;do l+=XA(s,u),u=s,s=s.return;while(s);return l}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var rf=Object.prototype.hasOwnProperty,sf=t.unstable_scheduleCallback,lf=t.unstable_cancelCallback,ZA=t.unstable_shouldYield,JA=t.unstable_requestPaint,di=t.unstable_now,$A=t.unstable_getCurrentPriorityLevel,O0=t.unstable_ImmediatePriority,E0=t.unstable_UserBlockingPriority,Qo=t.unstable_NormalPriority,eM=t.unstable_LowPriority,N0=t.unstable_IdlePriority,tM=t.log,iM=t.unstable_setDisableYieldValue,Yl=null,pi=null;function Jn(s){if(typeof tM=="function"&&iM(s),pi&&typeof pi.setStrictMode=="function")try{pi.setStrictMode(Yl,s)}catch{}}var mi=Math.clz32?Math.clz32:sM,nM=Math.log,rM=Math.LN2;function sM(s){return s>>>=0,s===0?32:31-(nM(s)/rM|0)|0}var Go=256,Yo=262144,Ko=4194304;function Ir(s){var l=s&42;if(l!==0)return l;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 Wo(s,l,u){var f=s.pendingLanes;if(f===0)return 0;var m=0,y=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var A=f&134217727;return A!==0?(f=A&~y,f!==0?m=Ir(f):(S&=A,S!==0?m=Ir(S):u||(u=A&~s,u!==0&&(m=Ir(u))))):(A=f&~y,A!==0?m=Ir(A):S!==0?m=Ir(S):u||(u=f&~s,u!==0&&(m=Ir(u)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,u=l&-l,y>=u||y===32&&(u&4194048)!==0)?l:m}function Kl(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function lM(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 R0(){var s=Ko;return Ko<<=1,(Ko&62914560)===0&&(Ko=4194304),s}function af(s){for(var l=[],u=0;31>u;u++)l.push(s);return l}function Wl(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function aM(s,l,u,f,m,y){var S=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var A=s.entanglements,O=s.expirationTimes,_=s.hiddenUpdates;for(u=S&~u;0<u;){var G=31-mi(u),K=1<<G;A[G]=0,O[G]=-1;var q=_[G];if(q!==null)for(_[G]=null,G=0;G<q.length;G++){var V=q[G];V!==null&&(V.lane&=-536870913)}u&=~K}f!==0&&D0(s,f,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(S&~l))}function D0(s,l,u){s.pendingLanes|=l,s.suspendedLanes&=~l;var f=31-mi(l);s.entangledLanes|=l,s.entanglements[f]=s.entanglements[f]|1073741824|u&261930}function j0(s,l){var u=s.entangledLanes|=l;for(s=s.entanglements;u;){var f=31-mi(u),m=1<<f;m&l|s[f]&l&&(s[f]|=l),u&=~m}}function L0(s,l){var u=l&-l;return u=(u&42)!==0?1:of(u),(u&(s.suspendedLanes|l))!==0?0:u}function of(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 uf(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function B0(){var s=X.p;return s!==0?s:(s=window.event,s===void 0?32:v1(s.type))}function z0(s,l){var u=X.p;try{return X.p=s,l()}finally{X.p=u}}var $n=Math.random().toString(36).slice(2),Rt="__reactFiber$"+$n,$t="__reactProps$"+$n,Ts="__reactContainer$"+$n,cf="__reactEvents$"+$n,oM="__reactListeners$"+$n,uM="__reactHandles$"+$n,_0="__reactResources$"+$n,Xl="__reactMarker$"+$n;function hf(s){delete s[Rt],delete s[$t],delete s[cf],delete s[oM],delete s[uM]}function Os(s){var l=s[Rt];if(l)return l;for(var u=s.parentNode;u;){if(l=u[Ts]||u[Rt]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(s=r1(s);s!==null;){if(u=s[Rt])return u;s=r1(s)}return l}s=u,u=s.parentNode}return null}function Es(s){if(s=s[Rt]||s[Ts]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Zl(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Ns(s){var l=s[_0];return l||(l=s[_0]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Mt(s){s[Xl]=!0}var H0=new Set,U0={};function Qr(s,l){Rs(s,l),Rs(s+"Capture",l)}function Rs(s,l){for(U0[s]=l,s=0;s<l.length;s++)H0.add(l[s])}var cM=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]*$"),q0={},P0={};function hM(s){return rf.call(P0,s)?!0:rf.call(q0,s)?!1:cM.test(s)?P0[s]=!0:(q0[s]=!0,!1)}function Xo(s,l,u){if(hM(l))if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var f=l.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+u)}}function Zo(s,l,u){if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+u)}}function Cn(s,l,u,f){if(f===null)s.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(l,u,""+f)}}function Oi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function F0(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function fM(s,l,u){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var m=f.get,y=f.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(S){u=""+S,y.call(this,S)}}),Object.defineProperty(s,l,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(S){u=""+S},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function ff(s){if(!s._valueTracker){var l=F0(s)?"checked":"value";s._valueTracker=fM(s,l,""+s[l])}}function V0(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var u=l.getValue(),f="";return s&&(f=F0(s)?s.checked?"true":"false":s.value),s=f,s!==u?(l.setValue(s),!0):!1}function Jo(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 dM=/[\n"\\]/g;function Ei(s){return s.replace(dM,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function df(s,l,u,f,m,y,S,A){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),l!=null?S==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Oi(l)):s.value!==""+Oi(l)&&(s.value=""+Oi(l)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),l!=null?pf(s,S,Oi(l)):u!=null?pf(s,S,Oi(u)):f!=null&&s.removeAttribute("value"),m==null&&y!=null&&(s.defaultChecked=!!y),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?s.name=""+Oi(A):s.removeAttribute("name")}function I0(s,l,u,f,m,y,S,A){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),l!=null||u!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){ff(s);return}u=u!=null?""+Oi(u):"",l=l!=null?""+Oi(l):u,A||l===s.value||(s.value=l),s.defaultValue=l}f=f??m,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=A?s.checked:!!f,s.defaultChecked=!!f,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),ff(s)}function pf(s,l,u){l==="number"&&Jo(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Ds(s,l,u,f){if(s=s.options,l){l={};for(var m=0;m<u.length;m++)l["$"+u[m]]=!0;for(u=0;u<s.length;u++)m=l.hasOwnProperty("$"+s[u].value),s[u].selected!==m&&(s[u].selected=m),m&&f&&(s[u].defaultSelected=!0)}else{for(u=""+Oi(u),l=null,m=0;m<s.length;m++){if(s[m].value===u){s[m].selected=!0,f&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function Q0(s,l,u){if(l!=null&&(l=""+Oi(l),l!==s.value&&(s.value=l),u==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=u!=null?""+Oi(u):""}function G0(s,l,u,f){if(l==null){if(f!=null){if(u!=null)throw Error(n(92));if(de(f)){if(1<f.length)throw Error(n(93));f=f[0]}u=f}u==null&&(u=""),l=u}u=Oi(l),s.defaultValue=u,f=s.textContent,f===u&&f!==""&&f!==null&&(s.value=f),ff(s)}function js(s,l){if(l){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=l;return}}s.textContent=l}var pM=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 Y0(s,l,u){var f=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":f?s.setProperty(l,u):typeof u!="number"||u===0||pM.has(l)?l==="float"?s.cssFloat=u:s[l]=(""+u).trim():s[l]=u+"px"}function K0(s,l,u){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||l!=null&&l.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var m in l)f=l[m],l.hasOwnProperty(m)&&u[m]!==f&&Y0(s,m,f)}else for(var y in l)l.hasOwnProperty(y)&&Y0(s,y,l[y])}function mf(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 mM=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"]]),gM=/^[\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 $o(s){return gM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function An(){}var gf=null;function yf(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ls=null,Bs=null;function W0(s){var l=Es(s);if(l&&(s=l.stateNode)){var u=s[$t]||null;e:switch(s=l.stateNode,l.type){case"input":if(df(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ei(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var f=u[l];if(f!==s&&f.form===s.form){var m=f[$t]||null;if(!m)throw Error(n(90));df(f,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<u.length;l++)f=u[l],f.form===s.form&&V0(f)}break e;case"textarea":Q0(s,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&Ds(s,!!u.multiple,l,!1)}}}var xf=!1;function X0(s,l,u){if(xf)return s(l,u);xf=!0;try{var f=s(l);return f}finally{if(xf=!1,(Ls!==null||Bs!==null)&&(qu(),Ls&&(l=Ls,s=Bs,Bs=Ls=null,W0(l),s)))for(l=0;l<s.length;l++)W0(s[l])}}function Jl(s,l){var u=s.stateNode;if(u===null)return null;var f=u[$t]||null;if(f===null)return null;u=f[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,l,typeof u));return u}var Mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bf=!1;if(Mn)try{var $l={};Object.defineProperty($l,"passive",{get:function(){bf=!0}}),window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{bf=!1}var er=null,vf=null,eu=null;function Z0(){if(eu)return eu;var s,l=vf,u=l.length,f,m="value"in er?er.value:er.textContent,y=m.length;for(s=0;s<u&&l[s]===m[s];s++);var S=u-s;for(f=1;f<=S&&l[u-f]===m[y-f];f++);return eu=m.slice(s,1<f?1-f:void 0)}function tu(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function iu(){return!0}function J0(){return!1}function ei(s){function l(u,f,m,y,S){this._reactName=u,this._targetInst=m,this.type=f,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(u=s[A],this[A]=u?u(y):y[A]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?iu:J0,this.isPropagationStopped=J0,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=iu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=iu)},persist:function(){},isPersistent:iu}),l}var Gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nu=ei(Gr),ea=g({},Gr,{view:0,detail:0}),yM=ei(ea),Sf,wf,ta,ru=g({},ea,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cf,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!==ta&&(ta&&s.type==="mousemove"?(Sf=s.screenX-ta.screenX,wf=s.screenY-ta.screenY):wf=Sf=0,ta=s),Sf)},movementY:function(s){return"movementY"in s?s.movementY:wf}}),$0=ei(ru),xM=g({},ru,{dataTransfer:0}),bM=ei(xM),vM=g({},ea,{relatedTarget:0}),kf=ei(vM),SM=g({},Gr,{animationName:0,elapsedTime:0,pseudoElement:0}),wM=ei(SM),kM=g({},Gr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),CM=ei(kM),AM=g({},Gr,{data:0}),ey=ei(AM),MM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TM={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"},OM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function EM(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=OM[s])?!!l[s]:!1}function Cf(){return EM}var NM=g({},ea,{key:function(s){if(s.key){var l=MM[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=tu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?TM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cf,charCode:function(s){return s.type==="keypress"?tu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?tu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),RM=ei(NM),DM=g({},ru,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ty=ei(DM),jM=g({},ea,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cf}),LM=ei(jM),BM=g({},Gr,{propertyName:0,elapsedTime:0,pseudoElement:0}),zM=ei(BM),_M=g({},ru,{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}),HM=ei(_M),UM=g({},Gr,{newState:0,oldState:0}),qM=ei(UM),PM=[9,13,27,32],Af=Mn&&"CompositionEvent"in window,ia=null;Mn&&"documentMode"in document&&(ia=document.documentMode);var FM=Mn&&"TextEvent"in window&&!ia,iy=Mn&&(!Af||ia&&8<ia&&11>=ia),ny=" ",ry=!1;function sy(s,l){switch(s){case"keyup":return PM.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ly(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var zs=!1;function VM(s,l){switch(s){case"compositionend":return ly(l);case"keypress":return l.which!==32?null:(ry=!0,ny);case"textInput":return s=l.data,s===ny&&ry?null:s;default:return null}}function IM(s,l){if(zs)return s==="compositionend"||!Af&&sy(s,l)?(s=Z0(),eu=vf=er=null,zs=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return iy&&l.locale!=="ko"?null:l.data;default:return null}}var QM={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 ay(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!QM[s.type]:l==="textarea"}function oy(s,l,u,f){Ls?Bs?Bs.push(f):Bs=[f]:Ls=f,l=Yu(l,"onChange"),0<l.length&&(u=new nu("onChange","change",null,u,f),s.push({event:u,listeners:l}))}var na=null,ra=null;function GM(s){Ib(s,0)}function su(s){var l=Zl(s);if(V0(l))return s}function uy(s,l){if(s==="change")return l}var cy=!1;if(Mn){var Mf;if(Mn){var Tf="oninput"in document;if(!Tf){var hy=document.createElement("div");hy.setAttribute("oninput","return;"),Tf=typeof hy.oninput=="function"}Mf=Tf}else Mf=!1;cy=Mf&&(!document.documentMode||9<document.documentMode)}function fy(){na&&(na.detachEvent("onpropertychange",dy),ra=na=null)}function dy(s){if(s.propertyName==="value"&&su(ra)){var l=[];oy(l,ra,s,yf(s)),X0(GM,l)}}function YM(s,l,u){s==="focusin"?(fy(),na=l,ra=u,na.attachEvent("onpropertychange",dy)):s==="focusout"&&fy()}function KM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return su(ra)}function WM(s,l){if(s==="click")return su(l)}function XM(s,l){if(s==="input"||s==="change")return su(l)}function ZM(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var gi=typeof Object.is=="function"?Object.is:ZM;function sa(s,l){if(gi(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var u=Object.keys(s),f=Object.keys(l);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var m=u[f];if(!rf.call(l,m)||!gi(s[m],l[m]))return!1}return!0}function py(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function my(s,l){var u=py(s);s=0;for(var f;u;){if(u.nodeType===3){if(f=s+u.textContent.length,s<=l&&f>=l)return{node:u,offset:l-s};s=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=py(u)}}function gy(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?gy(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function yy(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=Jo(s.document);l instanceof s.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)s=l.contentWindow;else break;l=Jo(s.document)}return l}function Of(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var JM=Mn&&"documentMode"in document&&11>=document.documentMode,_s=null,Ef=null,la=null,Nf=!1;function xy(s,l,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Nf||_s==null||_s!==Jo(f)||(f=_s,"selectionStart"in f&&Of(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),la&&sa(la,f)||(la=f,f=Yu(Ef,"onSelect"),0<f.length&&(l=new nu("onSelect","select",null,l,u),s.push({event:l,listeners:f}),l.target=_s)))}function Yr(s,l){var u={};return u[s.toLowerCase()]=l.toLowerCase(),u["Webkit"+s]="webkit"+l,u["Moz"+s]="moz"+l,u}var Hs={animationend:Yr("Animation","AnimationEnd"),animationiteration:Yr("Animation","AnimationIteration"),animationstart:Yr("Animation","AnimationStart"),transitionrun:Yr("Transition","TransitionRun"),transitionstart:Yr("Transition","TransitionStart"),transitioncancel:Yr("Transition","TransitionCancel"),transitionend:Yr("Transition","TransitionEnd")},Rf={},by={};Mn&&(by=document.createElement("div").style,"AnimationEvent"in window||(delete Hs.animationend.animation,delete Hs.animationiteration.animation,delete Hs.animationstart.animation),"TransitionEvent"in window||delete Hs.transitionend.transition);function Kr(s){if(Rf[s])return Rf[s];if(!Hs[s])return s;var l=Hs[s],u;for(u in l)if(l.hasOwnProperty(u)&&u in by)return Rf[s]=l[u];return s}var vy=Kr("animationend"),Sy=Kr("animationiteration"),wy=Kr("animationstart"),$M=Kr("transitionrun"),eT=Kr("transitionstart"),tT=Kr("transitioncancel"),ky=Kr("transitionend"),Cy=new Map,Df="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(" ");Df.push("scrollEnd");function Gi(s,l){Cy.set(s,l),Qr(l,[s])}var lu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=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(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ni=[],Us=0,jf=0;function au(){for(var s=Us,l=jf=Us=0;l<s;){var u=Ni[l];Ni[l++]=null;var f=Ni[l];Ni[l++]=null;var m=Ni[l];Ni[l++]=null;var y=Ni[l];if(Ni[l++]=null,f!==null&&m!==null){var S=f.pending;S===null?m.next=m:(m.next=S.next,S.next=m),f.pending=m}y!==0&&Ay(u,m,y)}}function ou(s,l,u,f){Ni[Us++]=s,Ni[Us++]=l,Ni[Us++]=u,Ni[Us++]=f,jf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Lf(s,l,u,f){return ou(s,l,u,f),uu(s)}function Wr(s,l){return ou(s,null,null,l),uu(s)}function Ay(s,l,u){s.lanes|=u;var f=s.alternate;f!==null&&(f.lanes|=u);for(var m=!1,y=s.return;y!==null;)y.childLanes|=u,f=y.alternate,f!==null&&(f.childLanes|=u),y.tag===22&&(s=y.stateNode,s===null||s._visibility&1||(m=!0)),s=y,y=y.return;return s.tag===3?(y=s.stateNode,m&&l!==null&&(m=31-mi(u),s=y.hiddenUpdates,f=s[m],f===null?s[m]=[l]:f.push(l),l.lane=u|536870912),y):null}function uu(s){if(50<Oa)throw Oa=0,Vd=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var qs={};function iT(s,l,u,f){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(s,l,u,f){return new iT(s,l,u,f)}function Bf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Tn(s,l){var u=s.alternate;return u===null?(u=yi(s.tag,l,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=l,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,l=s.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function My(s,l){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,l=u.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function cu(s,l,u,f,m,y){var S=0;if(f=s,typeof s=="function")Bf(s)&&(S=1);else if(typeof s=="string")S=aO(s,u,re.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case J:return s=yi(31,u,l,m),s.elementType=J,s.lanes=y,s;case k:return Xr(u.children,m,y,l);case C:S=8,m|=24;break;case M:return s=yi(12,u,l,m|2),s.elementType=M,s.lanes=y,s;case D:return s=yi(13,u,l,m),s.elementType=D,s.lanes=y,s;case U:return s=yi(19,u,l,m),s.elementType=U,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case j:S=10;break e;case T:S=9;break e;case L:S=11;break e;case H:S=14;break e;case Z:S=16,f=null;break e}S=29,u=Error(n(130,s===null?"null":typeof s,"")),f=null}return l=yi(S,u,l,m),l.elementType=s,l.type=f,l.lanes=y,l}function Xr(s,l,u,f){return s=yi(7,s,f,l),s.lanes=u,s}function zf(s,l,u){return s=yi(6,s,null,l),s.lanes=u,s}function Ty(s){var l=yi(18,null,null,0);return l.stateNode=s,l}function _f(s,l,u){return l=yi(4,s.children!==null?s.children:[],s.key,l),l.lanes=u,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var Oy=new WeakMap;function Ri(s,l){if(typeof s=="object"&&s!==null){var u=Oy.get(s);return u!==void 0?u:(l={value:s,source:l,stack:T0(l)},Oy.set(s,l),l)}return{value:s,source:l,stack:T0(l)}}var Ps=[],Fs=0,hu=null,aa=0,Di=[],ji=0,tr=null,rn=1,sn="";function On(s,l){Ps[Fs++]=aa,Ps[Fs++]=hu,hu=s,aa=l}function Ey(s,l,u){Di[ji++]=rn,Di[ji++]=sn,Di[ji++]=tr,tr=s;var f=rn;s=sn;var m=32-mi(f)-1;f&=~(1<<m),u+=1;var y=32-mi(l)+m;if(30<y){var S=m-m%5;y=(f&(1<<S)-1).toString(32),f>>=S,m-=S,rn=1<<32-mi(l)+m|u<<m|f,sn=y+s}else rn=1<<y|u<<m|f,sn=s}function Hf(s){s.return!==null&&(On(s,1),Ey(s,1,0))}function Uf(s){for(;s===hu;)hu=Ps[--Fs],Ps[Fs]=null,aa=Ps[--Fs],Ps[Fs]=null;for(;s===tr;)tr=Di[--ji],Di[ji]=null,sn=Di[--ji],Di[ji]=null,rn=Di[--ji],Di[ji]=null}function Ny(s,l){Di[ji++]=rn,Di[ji++]=sn,Di[ji++]=tr,rn=l.id,sn=l.overflow,tr=s}var Dt=null,$e=null,Le=!1,ir=null,Li=!1,qf=Error(n(519));function nr(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oa(Ri(l,s)),qf}function Ry(s){var l=s.stateNode,u=s.type,f=s.memoizedProps;switch(l[Rt]=s,l[$t]=f,u){case"dialog":Ne("cancel",l),Ne("close",l);break;case"iframe":case"object":case"embed":Ne("load",l);break;case"video":case"audio":for(u=0;u<Na.length;u++)Ne(Na[u],l);break;case"source":Ne("error",l);break;case"img":case"image":case"link":Ne("error",l),Ne("load",l);break;case"details":Ne("toggle",l);break;case"input":Ne("invalid",l),I0(l,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ne("invalid",l);break;case"textarea":Ne("invalid",l),G0(l,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||f.suppressHydrationWarning===!0||Kb(l.textContent,u)?(f.popover!=null&&(Ne("beforetoggle",l),Ne("toggle",l)),f.onScroll!=null&&Ne("scroll",l),f.onScrollEnd!=null&&Ne("scrollend",l),f.onClick!=null&&(l.onclick=An),l=!0):l=!1,l||nr(s,!0)}function Dy(s){for(Dt=s.return;Dt;)switch(Dt.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Dt=Dt.return}}function Vs(s){if(s!==Dt)return!1;if(!Le)return Dy(s),Le=!0,!1;var l=s.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||rp(s.type,s.memoizedProps)),u=!u),u&&$e&&nr(s),Dy(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=n1(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=n1(s)}else l===27?(l=$e,yr(s.type)?(s=up,up=null,$e=s):$e=l):$e=Dt?zi(s.stateNode.nextSibling):null;return!0}function Zr(){$e=Dt=null,Le=!1}function Pf(){var s=ir;return s!==null&&(ri===null?ri=s:ri.push.apply(ri,s),ir=null),s}function oa(s){ir===null?ir=[s]:ir.push(s)}var Ff=N(null),Jr=null,En=null;function rr(s,l,u){$(Ff,l._currentValue),l._currentValue=u}function Nn(s){s._currentValue=Ff.current,Q(Ff)}function Vf(s,l,u){for(;s!==null;){var f=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,f!==null&&(f.childLanes|=l)):f!==null&&(f.childLanes&l)!==l&&(f.childLanes|=l),s===u)break;s=s.return}}function If(s,l,u,f){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var y=m.dependencies;if(y!==null){var S=m.child;y=y.firstContext;e:for(;y!==null;){var A=y;y=m;for(var O=0;O<l.length;O++)if(A.context===l[O]){y.lanes|=u,A=y.alternate,A!==null&&(A.lanes|=u),Vf(y.return,u,s),f||(S=null);break e}y=A.next}}else if(m.tag===18){if(S=m.return,S===null)throw Error(n(341));S.lanes|=u,y=S.alternate,y!==null&&(y.lanes|=u),Vf(S,u,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 Is(s,l,u,f){s=null;for(var m=l,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(n(387));if(S=S.memoizedProps,S!==null){var A=m.type;gi(m.pendingProps.value,S.value)||(s!==null?s.push(A):s=[A])}}else if(m===ze.current){if(S=m.alternate,S===null)throw Error(n(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Ba):s=[Ba])}m=m.return}s!==null&&If(l,s,u,f),l.flags|=262144}function fu(s){for(s=s.firstContext;s!==null;){if(!gi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function $r(s){Jr=s,En=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function jt(s){return jy(Jr,s)}function du(s,l){return Jr===null&&$r(s),jy(s,l)}function jy(s,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},En===null){if(s===null)throw Error(n(308));En=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else En=En.next=l;return u}var nT=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(u,f){s.push(f)}};this.abort=function(){l.aborted=!0,s.forEach(function(u){return u()})}},rT=t.unstable_scheduleCallback,sT=t.unstable_NormalPriority,mt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qf(){return{controller:new nT,data:new Map,refCount:0}}function ua(s){s.refCount--,s.refCount===0&&rT(sT,function(){s.controller.abort()})}var ca=null,Gf=0,Qs=0,Gs=null;function lT(s,l){if(ca===null){var u=ca=[];Gf=0,Qs=Wd(),Gs={status:"pending",value:void 0,then:function(f){u.push(f)}}}return Gf++,l.then(Ly,Ly),l}function Ly(){if(--Gf===0&&ca!==null){Gs!==null&&(Gs.status="fulfilled");var s=ca;ca=null,Qs=0,Gs=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function aT(s,l){var u=[],f={status:"pending",value:null,reason:null,then:function(m){u.push(m)}};return s.then(function(){f.status="fulfilled",f.value=l;for(var m=0;m<u.length;m++)(0,u[m])(l)},function(m){for(f.status="rejected",f.reason=m,m=0;m<u.length;m++)(0,u[m])(void 0)}),f}var By=P.S;P.S=function(s,l){xb=di(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&lT(s,l),By!==null&&By(s,l)};var es=N(null);function Yf(){var s=es.current;return s!==null?s:We.pooledCache}function pu(s,l){l===null?$(es,es.current):$(es,l.pool)}function zy(){var s=Yf();return s===null?null:{parent:mt._currentValue,pool:s}}var Ys=Error(n(460)),Kf=Error(n(474)),mu=Error(n(542)),gu={then:function(){}};function _y(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Hy(s,l,u){switch(u=s[u],u===void 0?s.push(l):u!==l&&(l.then(An,An),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,qy(s),s;default:if(typeof l.status=="string")l.then(An,An);else{if(s=We,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(f){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=f}},function(f){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=f}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,qy(s),s}throw is=l,Ys}}function ts(s){try{var l=s._init;return l(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(is=u,Ys):u}}var is=null;function Uy(){if(is===null)throw Error(n(459));var s=is;return is=null,s}function qy(s){if(s===Ys||s===mu)throw Error(n(483))}var Ks=null,ha=0;function yu(s){var l=ha;return ha+=1,Ks===null&&(Ks=[]),Hy(Ks,s,l)}function fa(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function xu(s,l){throw l.$$typeof===x?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function Py(s){function l(B,R){if(s){var z=B.deletions;z===null?(B.deletions=[R],B.flags|=16):z.push(R)}}function u(B,R){if(!s)return null;for(;R!==null;)l(B,R),R=R.sibling;return null}function f(B){for(var R=new Map;B!==null;)B.key!==null?R.set(B.key,B):R.set(B.index,B),B=B.sibling;return R}function m(B,R){return B=Tn(B,R),B.index=0,B.sibling=null,B}function y(B,R,z){return B.index=z,s?(z=B.alternate,z!==null?(z=z.index,z<R?(B.flags|=67108866,R):z):(B.flags|=67108866,R)):(B.flags|=1048576,R)}function S(B){return s&&B.alternate===null&&(B.flags|=67108866),B}function A(B,R,z,Y){return R===null||R.tag!==6?(R=zf(z,B.mode,Y),R.return=B,R):(R=m(R,z),R.return=B,R)}function O(B,R,z,Y){var me=z.type;return me===k?G(B,R,z.props.children,Y,z.key):R!==null&&(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===Z&&ts(me)===R.type)?(R=m(R,z.props),fa(R,z),R.return=B,R):(R=cu(z.type,z.key,z.props,null,B.mode,Y),fa(R,z),R.return=B,R)}function _(B,R,z,Y){return R===null||R.tag!==4||R.stateNode.containerInfo!==z.containerInfo||R.stateNode.implementation!==z.implementation?(R=_f(z,B.mode,Y),R.return=B,R):(R=m(R,z.children||[]),R.return=B,R)}function G(B,R,z,Y,me){return R===null||R.tag!==7?(R=Xr(z,B.mode,Y,me),R.return=B,R):(R=m(R,z),R.return=B,R)}function K(B,R,z){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=zf(""+R,B.mode,z),R.return=B,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return z=cu(R.type,R.key,R.props,null,B.mode,z),fa(z,R),z.return=B,z;case w:return R=_f(R,B.mode,z),R.return=B,R;case Z:return R=ts(R),K(B,R,z)}if(de(R)||F(R))return R=Xr(R,B.mode,z,null),R.return=B,R;if(typeof R.then=="function")return K(B,yu(R),z);if(R.$$typeof===j)return K(B,du(B,R),z);xu(B,R)}return null}function q(B,R,z,Y){var me=R!==null?R.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return me!==null?null:A(B,R,""+z,Y);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case v:return z.key===me?O(B,R,z,Y):null;case w:return z.key===me?_(B,R,z,Y):null;case Z:return z=ts(z),q(B,R,z,Y)}if(de(z)||F(z))return me!==null?null:G(B,R,z,Y,null);if(typeof z.then=="function")return q(B,R,yu(z),Y);if(z.$$typeof===j)return q(B,R,du(B,z),Y);xu(B,z)}return null}function V(B,R,z,Y,me){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return B=B.get(z)||null,A(R,B,""+Y,me);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return B=B.get(Y.key===null?z:Y.key)||null,O(R,B,Y,me);case w:return B=B.get(Y.key===null?z:Y.key)||null,_(R,B,Y,me);case Z:return Y=ts(Y),V(B,R,z,Y,me)}if(de(Y)||F(Y))return B=B.get(z)||null,G(R,B,Y,me,null);if(typeof Y.then=="function")return V(B,R,z,yu(Y),me);if(Y.$$typeof===j)return V(B,R,z,du(R,Y),me);xu(R,Y)}return null}function oe(B,R,z,Y){for(var me=null,_e=null,he=R,Ae=R=0,je=null;he!==null&&Ae<z.length;Ae++){he.index>Ae?(je=he,he=null):je=he.sibling;var He=q(B,he,z[Ae],Y);if(He===null){he===null&&(he=je);break}s&&he&&He.alternate===null&&l(B,he),R=y(He,R,Ae),_e===null?me=He:_e.sibling=He,_e=He,he=je}if(Ae===z.length)return u(B,he),Le&&On(B,Ae),me;if(he===null){for(;Ae<z.length;Ae++)he=K(B,z[Ae],Y),he!==null&&(R=y(he,R,Ae),_e===null?me=he:_e.sibling=he,_e=he);return Le&&On(B,Ae),me}for(he=f(he);Ae<z.length;Ae++)je=V(he,B,Ae,z[Ae],Y),je!==null&&(s&&je.alternate!==null&&he.delete(je.key===null?Ae:je.key),R=y(je,R,Ae),_e===null?me=je:_e.sibling=je,_e=je);return s&&he.forEach(function(wr){return l(B,wr)}),Le&&On(B,Ae),me}function xe(B,R,z,Y){if(z==null)throw Error(n(151));for(var me=null,_e=null,he=R,Ae=R=0,je=null,He=z.next();he!==null&&!He.done;Ae++,He=z.next()){he.index>Ae?(je=he,he=null):je=he.sibling;var wr=q(B,he,He.value,Y);if(wr===null){he===null&&(he=je);break}s&&he&&wr.alternate===null&&l(B,he),R=y(wr,R,Ae),_e===null?me=wr:_e.sibling=wr,_e=wr,he=je}if(He.done)return u(B,he),Le&&On(B,Ae),me;if(he===null){for(;!He.done;Ae++,He=z.next())He=K(B,He.value,Y),He!==null&&(R=y(He,R,Ae),_e===null?me=He:_e.sibling=He,_e=He);return Le&&On(B,Ae),me}for(he=f(he);!He.done;Ae++,He=z.next())He=V(he,B,Ae,He.value,Y),He!==null&&(s&&He.alternate!==null&&he.delete(He.key===null?Ae:He.key),R=y(He,R,Ae),_e===null?me=He:_e.sibling=He,_e=He);return s&&he.forEach(function(xO){return l(B,xO)}),Le&&On(B,Ae),me}function Ye(B,R,z,Y){if(typeof z=="object"&&z!==null&&z.type===k&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case v:e:{for(var me=z.key;R!==null;){if(R.key===me){if(me=z.type,me===k){if(R.tag===7){u(B,R.sibling),Y=m(R,z.props.children),Y.return=B,B=Y;break e}}else if(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===Z&&ts(me)===R.type){u(B,R.sibling),Y=m(R,z.props),fa(Y,z),Y.return=B,B=Y;break e}u(B,R);break}else l(B,R);R=R.sibling}z.type===k?(Y=Xr(z.props.children,B.mode,Y,z.key),Y.return=B,B=Y):(Y=cu(z.type,z.key,z.props,null,B.mode,Y),fa(Y,z),Y.return=B,B=Y)}return S(B);case w:e:{for(me=z.key;R!==null;){if(R.key===me)if(R.tag===4&&R.stateNode.containerInfo===z.containerInfo&&R.stateNode.implementation===z.implementation){u(B,R.sibling),Y=m(R,z.children||[]),Y.return=B,B=Y;break e}else{u(B,R);break}else l(B,R);R=R.sibling}Y=_f(z,B.mode,Y),Y.return=B,B=Y}return S(B);case Z:return z=ts(z),Ye(B,R,z,Y)}if(de(z))return oe(B,R,z,Y);if(F(z)){if(me=F(z),typeof me!="function")throw Error(n(150));return z=me.call(z),xe(B,R,z,Y)}if(typeof z.then=="function")return Ye(B,R,yu(z),Y);if(z.$$typeof===j)return Ye(B,R,du(B,z),Y);xu(B,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,R!==null&&R.tag===6?(u(B,R.sibling),Y=m(R,z),Y.return=B,B=Y):(u(B,R),Y=zf(z,B.mode,Y),Y.return=B,B=Y),S(B)):u(B,R)}return function(B,R,z,Y){try{ha=0;var me=Ye(B,R,z,Y);return Ks=null,me}catch(he){if(he===Ys||he===mu)throw he;var _e=yi(29,he,null,B.mode);return _e.lanes=Y,_e.return=B,_e}}}var ns=Py(!0),Fy=Py(!1),sr=!1;function Wf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xf(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function lr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ar(s,l,u){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(qe&2)!==0){var m=f.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),f.pending=l,l=uu(s),Ay(s,null,u),l}return ou(s,f,l,u),uu(s)}function da(s,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,j0(s,u)}}function Zf(s,l){var u=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var m=null,y=null;if(u=u.firstBaseUpdate,u!==null){do{var S={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};y===null?m=y=S:y=y.next=S,u=u.next}while(u!==null);y===null?m=y=l:y=y.next=l}else m=y=l;u={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=l}var Jf=!1;function pa(){if(Jf){var s=Gs;if(s!==null)throw s}}function ma(s,l,u,f){Jf=!1;var m=s.updateQueue;sr=!1;var y=m.firstBaseUpdate,S=m.lastBaseUpdate,A=m.shared.pending;if(A!==null){m.shared.pending=null;var O=A,_=O.next;O.next=null,S===null?y=_:S.next=_,S=O;var G=s.alternate;G!==null&&(G=G.updateQueue,A=G.lastBaseUpdate,A!==S&&(A===null?G.firstBaseUpdate=_:A.next=_,G.lastBaseUpdate=O))}if(y!==null){var K=m.baseState;S=0,G=_=O=null,A=y;do{var q=A.lane&-536870913,V=q!==A.lane;if(V?(De&q)===q:(f&q)===q){q!==0&&q===Qs&&(Jf=!0),G!==null&&(G=G.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var oe=s,xe=A;q=l;var Ye=u;switch(xe.tag){case 1:if(oe=xe.payload,typeof oe=="function"){K=oe.call(Ye,K,q);break e}K=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=xe.payload,q=typeof oe=="function"?oe.call(Ye,K,q):oe,q==null)break e;K=g({},K,q);break e;case 2:sr=!0}}q=A.callback,q!==null&&(s.flags|=64,V&&(s.flags|=8192),V=m.callbacks,V===null?m.callbacks=[q]:V.push(q))}else V={lane:q,tag:A.tag,payload:A.payload,callback:A.callback,next:null},G===null?(_=G=V,O=K):G=G.next=V,S|=q;if(A=A.next,A===null){if(A=m.shared.pending,A===null)break;V=A,A=V.next,V.next=null,m.lastBaseUpdate=V,m.shared.pending=null}}while(!0);G===null&&(O=K),m.baseState=O,m.firstBaseUpdate=_,m.lastBaseUpdate=G,y===null&&(m.shared.lanes=0),fr|=S,s.lanes=S,s.memoizedState=K}}function Vy(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function Iy(s,l){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Vy(u[s],l)}var Ws=N(null),bu=N(0);function Qy(s,l){s=Un,$(bu,s),$(Ws,l),Un=s|l.baseLanes}function $f(){$(bu,Un),$(Ws,Ws.current)}function ed(){Un=bu.current,Q(Ws),Q(bu)}var xi=N(null),Bi=null;function or(s){var l=s.alternate;$(ct,ct.current&1),$(xi,s),Bi===null&&(l===null||Ws.current!==null||l.memoizedState!==null)&&(Bi=s)}function td(s){$(ct,ct.current),$(xi,s),Bi===null&&(Bi=s)}function Gy(s){s.tag===22?($(ct,ct.current),$(xi,s),Bi===null&&(Bi=s)):ur()}function ur(){$(ct,ct.current),$(xi,xi.current)}function bi(s){Q(xi),Bi===s&&(Bi=null),Q(ct)}var ct=N(0);function vu(s){for(var l=s;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||ap(u)||op(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Rn=0,Ce=null,Qe=null,gt=null,Su=!1,Xs=!1,rs=!1,wu=0,ga=0,Zs=null,oT=0;function st(){throw Error(n(321))}function id(s,l){if(l===null)return!1;for(var u=0;u<l.length&&u<s.length;u++)if(!gi(s[u],l[u]))return!1;return!0}function nd(s,l,u,f,m,y){return Rn=y,Ce=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,P.H=s===null||s.memoizedState===null?Ex:xd,rs=!1,y=u(f,m),rs=!1,Xs&&(y=Ky(l,u,f,m)),Yy(s),y}function Yy(s){P.H=ba;var l=Qe!==null&&Qe.next!==null;if(Rn=0,gt=Qe=Ce=null,Su=!1,ga=0,Zs=null,l)throw Error(n(300));s===null||yt||(s=s.dependencies,s!==null&&fu(s)&&(yt=!0))}function Ky(s,l,u,f){Ce=s;var m=0;do{if(Xs&&(Zs=null),ga=0,Xs=!1,25<=m)throw Error(n(301));if(m+=1,gt=Qe=null,s.updateQueue!=null){var y=s.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}P.H=Nx,y=l(u,f)}while(Xs);return y}function uT(){var s=P.H,l=s.useState()[0];return l=typeof l.then=="function"?ya(l):l,s=s.useState()[0],(Qe!==null?Qe.memoizedState:null)!==s&&(Ce.flags|=1024),l}function rd(){var s=wu!==0;return wu=0,s}function sd(s,l,u){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~u}function ld(s){if(Su){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Su=!1}Rn=0,gt=Qe=Ce=null,Xs=!1,ga=wu=0,Zs=null}function Yt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Ce.memoizedState=gt=s:gt=gt.next=s,gt}function ht(){if(Qe===null){var s=Ce.alternate;s=s!==null?s.memoizedState:null}else s=Qe.next;var l=gt===null?Ce.memoizedState:gt.next;if(l!==null)gt=l,Qe=s;else{if(s===null)throw Ce.alternate===null?Error(n(467)):Error(n(310));Qe=s,s={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},gt===null?Ce.memoizedState=gt=s:gt=gt.next=s}return gt}function ku(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ya(s){var l=ga;return ga+=1,Zs===null&&(Zs=[]),s=Hy(Zs,s,l),l=Ce,(gt===null?l.memoizedState:gt.next)===null&&(l=l.alternate,P.H=l===null||l.memoizedState===null?Ex:xd),s}function Cu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return ya(s);if(s.$$typeof===j)return jt(s)}throw Error(n(438,String(s)))}function ad(s){var l=null,u=Ce.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var f=Ce.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(l={data:f.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=ku(),Ce.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(s),f=0;f<s;f++)u[f]=ue;return l.index++,u}function Dn(s,l){return typeof l=="function"?l(s):l}function Au(s){var l=ht();return od(l,Qe,s)}function od(s,l,u){var f=s.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=u;var m=s.baseQueue,y=f.pending;if(y!==null){if(m!==null){var S=m.next;m.next=y.next,y.next=S}l.baseQueue=m=y,f.pending=null}if(y=s.baseState,m===null)s.memoizedState=y;else{l=m.next;var A=S=null,O=null,_=l,G=!1;do{var K=_.lane&-536870913;if(K!==_.lane?(De&K)===K:(Rn&K)===K){var q=_.revertLane;if(q===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),K===Qs&&(G=!0);else if((Rn&q)===q){_=_.next,q===Qs&&(G=!0);continue}else K={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},O===null?(A=O=K,S=y):O=O.next=K,Ce.lanes|=q,fr|=q;K=_.action,rs&&u(y,K),y=_.hasEagerState?_.eagerState:u(y,K)}else q={lane:K,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},O===null?(A=O=q,S=y):O=O.next=q,Ce.lanes|=K,fr|=K;_=_.next}while(_!==null&&_!==l);if(O===null?S=y:O.next=A,!gi(y,s.memoizedState)&&(yt=!0,G&&(u=Gs,u!==null)))throw u;s.memoizedState=y,s.baseState=S,s.baseQueue=O,f.lastRenderedState=y}return m===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function ud(s){var l=ht(),u=l.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var f=u.dispatch,m=u.pending,y=l.memoizedState;if(m!==null){u.pending=null;var S=m=m.next;do y=s(y,S.action),S=S.next;while(S!==m);gi(y,l.memoizedState)||(yt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),u.lastRenderedState=y}return[y,f]}function Wy(s,l,u){var f=Ce,m=ht(),y=Le;if(y){if(u===void 0)throw Error(n(407));u=u()}else u=l();var S=!gi((Qe||m).memoizedState,u);if(S&&(m.memoizedState=u,yt=!0),m=m.queue,fd(Jy.bind(null,f,m,s),[s]),m.getSnapshot!==l||S||gt!==null&&gt.memoizedState.tag&1){if(f.flags|=2048,Js(9,{destroy:void 0},Zy.bind(null,f,m,u,l),null),We===null)throw Error(n(349));y||(Rn&127)!==0||Xy(f,l,u)}return u}function Xy(s,l,u){s.flags|=16384,s={getSnapshot:l,value:u},l=Ce.updateQueue,l===null?(l=ku(),Ce.updateQueue=l,l.stores=[s]):(u=l.stores,u===null?l.stores=[s]:u.push(s))}function Zy(s,l,u,f){l.value=u,l.getSnapshot=f,$y(l)&&ex(s)}function Jy(s,l,u){return u(function(){$y(l)&&ex(s)})}function $y(s){var l=s.getSnapshot;s=s.value;try{var u=l();return!gi(s,u)}catch{return!0}}function ex(s){var l=Wr(s,2);l!==null&&si(l,s,2)}function cd(s){var l=Yt();if(typeof s=="function"){var u=s;if(s=u(),rs){Jn(!0);try{u()}finally{Jn(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:s},l}function tx(s,l,u,f){return s.baseState=u,od(s,Qe,typeof f=="function"?f:Dn)}function cT(s,l,u,f,m){if(Ou(s))throw Error(n(485));if(s=l.action,s!==null){var y={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};P.T!==null?u(!0):y.isTransition=!1,f(y),u=l.pending,u===null?(y.next=l.pending=y,ix(l,y)):(y.next=u.next,l.pending=u.next=y)}}function ix(s,l){var u=l.action,f=l.payload,m=s.state;if(l.isTransition){var y=P.T,S={};P.T=S;try{var A=u(m,f),O=P.S;O!==null&&O(S,A),nx(s,l,A)}catch(_){hd(s,l,_)}finally{y!==null&&S.types!==null&&(y.types=S.types),P.T=y}}else try{y=u(m,f),nx(s,l,y)}catch(_){hd(s,l,_)}}function nx(s,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){rx(s,l,f)},function(f){return hd(s,l,f)}):rx(s,l,u)}function rx(s,l,u){l.status="fulfilled",l.value=u,sx(l),s.state=u,l=s.pending,l!==null&&(u=l.next,u===l?s.pending=null:(u=u.next,l.next=u,ix(s,u)))}function hd(s,l,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do l.status="rejected",l.reason=u,sx(l),l=l.next;while(l!==f)}s.action=null}function sx(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function lx(s,l){return l}function ax(s,l){if(Le){var u=We.formState;if(u!==null){e:{var f=Ce;if(Le){if($e){t:{for(var m=$e,y=Li;m.nodeType!==8;){if(!y){m=null;break t}if(m=zi(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){$e=zi(m.nextSibling),f=m.data==="F!";break e}}nr(f)}f=!1}f&&(l=u[0])}}return u=Yt(),u.memoizedState=u.baseState=l,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lx,lastRenderedState:l},u.queue=f,u=Mx.bind(null,Ce,f),f.dispatch=u,f=cd(!1),y=yd.bind(null,Ce,!1,f.queue),f=Yt(),m={state:l,dispatch:null,action:s,pending:null},f.queue=m,u=cT.bind(null,Ce,m,y,u),m.dispatch=u,f.memoizedState=s,[l,u,!1]}function ox(s){var l=ht();return ux(l,Qe,s)}function ux(s,l,u){if(l=od(s,l,lx)[0],s=Au(Dn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var f=ya(l)}catch(S){throw S===Ys?mu:S}else f=l;l=ht();var m=l.queue,y=m.dispatch;return u!==l.memoizedState&&(Ce.flags|=2048,Js(9,{destroy:void 0},hT.bind(null,m,u),null)),[f,y,s]}function hT(s,l){s.action=l}function cx(s){var l=ht(),u=Qe;if(u!==null)return ux(l,u,s);ht(),l=l.memoizedState,u=ht();var f=u.queue.dispatch;return u.memoizedState=s,[l,f,!1]}function Js(s,l,u,f){return s={tag:s,create:u,deps:f,inst:l,next:null},l=Ce.updateQueue,l===null&&(l=ku(),Ce.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=s.next=s:(f=u.next,u.next=s,s.next=f,l.lastEffect=s),s}function hx(){return ht().memoizedState}function Mu(s,l,u,f){var m=Yt();Ce.flags|=s,m.memoizedState=Js(1|l,{destroy:void 0},u,f===void 0?null:f)}function Tu(s,l,u,f){var m=ht();f=f===void 0?null:f;var y=m.memoizedState.inst;Qe!==null&&f!==null&&id(f,Qe.memoizedState.deps)?m.memoizedState=Js(l,y,u,f):(Ce.flags|=s,m.memoizedState=Js(1|l,y,u,f))}function fx(s,l){Mu(8390656,8,s,l)}function fd(s,l){Tu(2048,8,s,l)}function fT(s){Ce.flags|=4;var l=Ce.updateQueue;if(l===null)l=ku(),Ce.updateQueue=l,l.events=[s];else{var u=l.events;u===null?l.events=[s]:u.push(s)}}function dx(s){var l=ht().memoizedState;return fT({ref:l,nextImpl:s}),function(){if((qe&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function px(s,l){return Tu(4,2,s,l)}function mx(s,l){return Tu(4,4,s,l)}function gx(s,l){if(typeof l=="function"){s=s();var u=l(s);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function yx(s,l,u){u=u!=null?u.concat([s]):null,Tu(4,4,gx.bind(null,l,s),u)}function dd(){}function xx(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;return l!==null&&id(l,f[1])?f[0]:(u.memoizedState=[s,l],s)}function bx(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;if(l!==null&&id(l,f[1]))return f[0];if(f=s(),rs){Jn(!0);try{s()}finally{Jn(!1)}}return u.memoizedState=[f,l],f}function pd(s,l,u){return u===void 0||(Rn&1073741824)!==0&&(De&261930)===0?s.memoizedState=l:(s.memoizedState=u,s=vb(),Ce.lanes|=s,fr|=s,u)}function vx(s,l,u,f){return gi(u,l)?u:Ws.current!==null?(s=pd(s,u,f),gi(s,l)||(yt=!0),s):(Rn&42)===0||(Rn&1073741824)!==0&&(De&261930)===0?(yt=!0,s.memoizedState=u):(s=vb(),Ce.lanes|=s,fr|=s,l)}function Sx(s,l,u,f,m){var y=X.p;X.p=y!==0&&8>y?y:8;var S=P.T,A={};P.T=A,yd(s,!1,l,u);try{var O=m(),_=P.S;if(_!==null&&_(A,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var G=aT(O,f);xa(s,l,G,wi(s))}else xa(s,l,f,wi(s))}catch(K){xa(s,l,{then:function(){},status:"rejected",reason:K},wi())}finally{X.p=y,S!==null&&A.types!==null&&(S.types=A.types),P.T=S}}function dT(){}function md(s,l,u,f){if(s.tag!==5)throw Error(n(476));var m=wx(s).queue;Sx(s,m,l,ne,u===null?dT:function(){return kx(s),u(f)})}function wx(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:ne},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:u},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function kx(s){var l=wx(s);l.next===null&&(l=s.alternate.memoizedState),xa(s,l.next.queue,{},wi())}function gd(){return jt(Ba)}function Cx(){return ht().memoizedState}function Ax(){return ht().memoizedState}function pT(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var u=wi();s=lr(u);var f=ar(l,s,u);f!==null&&(si(f,l,u),da(f,l,u)),l={cache:Qf()},s.payload=l;return}l=l.return}}function mT(s,l,u){var f=wi();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ou(s)?Tx(l,u):(u=Lf(s,l,u,f),u!==null&&(si(u,s,f),Ox(u,l,f)))}function Mx(s,l,u){var f=wi();xa(s,l,u,f)}function xa(s,l,u,f){var m={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ou(s))Tx(l,m);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var S=l.lastRenderedState,A=y(S,u);if(m.hasEagerState=!0,m.eagerState=A,gi(A,S))return ou(s,l,m,0),We===null&&au(),!1}catch{}if(u=Lf(s,l,m,f),u!==null)return si(u,s,f),Ox(u,l,f),!0}return!1}function yd(s,l,u,f){if(f={lane:2,revertLane:Wd(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Ou(s)){if(l)throw Error(n(479))}else l=Lf(s,u,f,2),l!==null&&si(l,s,2)}function Ou(s){var l=s.alternate;return s===Ce||l!==null&&l===Ce}function Tx(s,l){Xs=Su=!0;var u=s.pending;u===null?l.next=l:(l.next=u.next,u.next=l),s.pending=l}function Ox(s,l,u){if((u&4194048)!==0){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,j0(s,u)}}var ba={readContext:jt,use:Cu,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};ba.useEffectEvent=st;var Ex={readContext:jt,use:Cu,useCallback:function(s,l){return Yt().memoizedState=[s,l===void 0?null:l],s},useContext:jt,useEffect:fx,useImperativeHandle:function(s,l,u){u=u!=null?u.concat([s]):null,Mu(4194308,4,gx.bind(null,l,s),u)},useLayoutEffect:function(s,l){return Mu(4194308,4,s,l)},useInsertionEffect:function(s,l){Mu(4,2,s,l)},useMemo:function(s,l){var u=Yt();l=l===void 0?null:l;var f=s();if(rs){Jn(!0);try{s()}finally{Jn(!1)}}return u.memoizedState=[f,l],f},useReducer:function(s,l,u){var f=Yt();if(u!==void 0){var m=u(l);if(rs){Jn(!0);try{u(l)}finally{Jn(!1)}}}else m=l;return f.memoizedState=f.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},f.queue=s,s=s.dispatch=mT.bind(null,Ce,s),[f.memoizedState,s]},useRef:function(s){var l=Yt();return s={current:s},l.memoizedState=s},useState:function(s){s=cd(s);var l=s.queue,u=Mx.bind(null,Ce,l);return l.dispatch=u,[s.memoizedState,u]},useDebugValue:dd,useDeferredValue:function(s,l){var u=Yt();return pd(u,s,l)},useTransition:function(){var s=cd(!1);return s=Sx.bind(null,Ce,s.queue,!0,!1),Yt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,u){var f=Ce,m=Yt();if(Le){if(u===void 0)throw Error(n(407));u=u()}else{if(u=l(),We===null)throw Error(n(349));(De&127)!==0||Xy(f,l,u)}m.memoizedState=u;var y={value:u,getSnapshot:l};return m.queue=y,fx(Jy.bind(null,f,y,s),[s]),f.flags|=2048,Js(9,{destroy:void 0},Zy.bind(null,f,y,u,l),null),u},useId:function(){var s=Yt(),l=We.identifierPrefix;if(Le){var u=sn,f=rn;u=(f&~(1<<32-mi(f)-1)).toString(32)+u,l="_"+l+"R_"+u,u=wu++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=oT++,l="_"+l+"r_"+u.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:gd,useFormState:ax,useActionState:ax,useOptimistic:function(s){var l=Yt();l.memoizedState=l.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=yd.bind(null,Ce,!0,u),u.dispatch=l,[s,l]},useMemoCache:ad,useCacheRefresh:function(){return Yt().memoizedState=pT.bind(null,Ce)},useEffectEvent:function(s){var l=Yt(),u={impl:s};return l.memoizedState=u,function(){if((qe&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},xd={readContext:jt,use:Cu,useCallback:xx,useContext:jt,useEffect:fd,useImperativeHandle:yx,useInsertionEffect:px,useLayoutEffect:mx,useMemo:bx,useReducer:Au,useRef:hx,useState:function(){return Au(Dn)},useDebugValue:dd,useDeferredValue:function(s,l){var u=ht();return vx(u,Qe.memoizedState,s,l)},useTransition:function(){var s=Au(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:ya(s),l]},useSyncExternalStore:Wy,useId:Cx,useHostTransitionStatus:gd,useFormState:ox,useActionState:ox,useOptimistic:function(s,l){var u=ht();return tx(u,Qe,s,l)},useMemoCache:ad,useCacheRefresh:Ax};xd.useEffectEvent=dx;var Nx={readContext:jt,use:Cu,useCallback:xx,useContext:jt,useEffect:fd,useImperativeHandle:yx,useInsertionEffect:px,useLayoutEffect:mx,useMemo:bx,useReducer:ud,useRef:hx,useState:function(){return ud(Dn)},useDebugValue:dd,useDeferredValue:function(s,l){var u=ht();return Qe===null?pd(u,s,l):vx(u,Qe.memoizedState,s,l)},useTransition:function(){var s=ud(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:ya(s),l]},useSyncExternalStore:Wy,useId:Cx,useHostTransitionStatus:gd,useFormState:cx,useActionState:cx,useOptimistic:function(s,l){var u=ht();return Qe!==null?tx(u,Qe,s,l):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:ad,useCacheRefresh:Ax};Nx.useEffectEvent=dx;function bd(s,l,u,f){l=s.memoizedState,u=u(f,l),u=u==null?l:g({},l,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var vd={enqueueSetState:function(s,l,u){s=s._reactInternals;var f=wi(),m=lr(f);m.payload=l,u!=null&&(m.callback=u),l=ar(s,m,f),l!==null&&(si(l,s,f),da(l,s,f))},enqueueReplaceState:function(s,l,u){s=s._reactInternals;var f=wi(),m=lr(f);m.tag=1,m.payload=l,u!=null&&(m.callback=u),l=ar(s,m,f),l!==null&&(si(l,s,f),da(l,s,f))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var u=wi(),f=lr(u);f.tag=2,l!=null&&(f.callback=l),l=ar(s,f,u),l!==null&&(si(l,s,u),da(l,s,u))}};function Rx(s,l,u,f,m,y,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,y,S):l.prototype&&l.prototype.isPureReactComponent?!sa(u,f)||!sa(m,y):!0}function Dx(s,l,u,f){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,f),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,f),l.state!==s&&vd.enqueueReplaceState(l,l.state,null)}function ss(s,l){var u=l;if("ref"in l){u={};for(var f in l)f!=="ref"&&(u[f]=l[f])}if(s=s.defaultProps){u===l&&(u=g({},u));for(var m in s)u[m]===void 0&&(u[m]=s[m])}return u}function jx(s){lu(s)}function Lx(s){console.error(s)}function Bx(s){lu(s)}function Eu(s,l){try{var u=s.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(f){setTimeout(function(){throw f})}}function zx(s,l,u){try{var f=s.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Sd(s,l,u){return u=lr(u),u.tag=3,u.payload={element:null},u.callback=function(){Eu(s,l)},u}function _x(s){return s=lr(s),s.tag=3,s}function Hx(s,l,u,f){var m=u.type.getDerivedStateFromError;if(typeof m=="function"){var y=f.value;s.payload=function(){return m(y)},s.callback=function(){zx(l,u,f)}}var S=u.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){zx(l,u,f),typeof m!="function"&&(dr===null?dr=new Set([this]):dr.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function gT(s,l,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(l=u.alternate,l!==null&&Is(l,u,m,!0),u=xi.current,u!==null){switch(u.tag){case 31:case 13:return Bi===null?Pu():u.alternate===null&&lt===0&&(lt=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===gu?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([f]):l.add(f),Gd(s,f,m)),!1;case 22:return u.flags|=65536,f===gu?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([f]):u.add(f)),Gd(s,f,m)),!1}throw Error(n(435,u.tag))}return Gd(s,f,m),Pu(),!1}if(Le)return l=xi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,f!==qf&&(s=Error(n(422),{cause:f}),oa(Ri(s,u)))):(f!==qf&&(l=Error(n(423),{cause:f}),oa(Ri(l,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=Ri(f,u),m=Sd(s.stateNode,f,m),Zf(s,m),lt!==4&&(lt=2)),!1;var y=Error(n(520),{cause:f});if(y=Ri(y,u),Ta===null?Ta=[y]:Ta.push(y),lt!==4&&(lt=2),l===null)return!0;f=Ri(f,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,s=m&-m,u.lanes|=s,s=Sd(u.stateNode,f,s),Zf(u,s),!1;case 1:if(l=u.type,y=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(dr===null||!dr.has(y))))return u.flags|=65536,m&=-m,u.lanes|=m,m=_x(m),Hx(m,s,u,f),Zf(u,m),!1}u=u.return}while(u!==null);return!1}var wd=Error(n(461)),yt=!1;function Lt(s,l,u,f){l.child=s===null?Fy(l,null,u,f):ns(l,s.child,u,f)}function Ux(s,l,u,f,m){u=u.render;var y=l.ref;if("ref"in f){var S={};for(var A in f)A!=="ref"&&(S[A]=f[A])}else S=f;return $r(l),f=nd(s,l,u,S,y,m),A=rd(),s!==null&&!yt?(sd(s,l,m),jn(s,l,m)):(Le&&A&&Hf(l),l.flags|=1,Lt(s,l,f,m),l.child)}function qx(s,l,u,f,m){if(s===null){var y=u.type;return typeof y=="function"&&!Bf(y)&&y.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=y,Px(s,l,y,f,m)):(s=cu(u.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,!Nd(s,m)){var S=y.memoizedProps;if(u=u.compare,u=u!==null?u:sa,u(S,f)&&s.ref===l.ref)return jn(s,l,m)}return l.flags|=1,s=Tn(y,f),s.ref=l.ref,s.return=l,l.child=s}function Px(s,l,u,f,m){if(s!==null){var y=s.memoizedProps;if(sa(y,f)&&s.ref===l.ref)if(yt=!1,l.pendingProps=f=y,Nd(s,m))(s.flags&131072)!==0&&(yt=!0);else return l.lanes=s.lanes,jn(s,l,m)}return kd(s,l,u,f,m)}function Fx(s,l,u,f){var m=f.children,y=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|u:u,s!==null){for(f=l.child=s.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;f=m&~y}else f=0,l.child=null;return Vx(s,l,y,u,f)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&pu(l,y!==null?y.cachePool:null),y!==null?Qy(l,y):$f(),Gy(l);else return f=l.lanes=536870912,Vx(s,l,y!==null?y.baseLanes|u:u,u,f)}else y!==null?(pu(l,y.cachePool),Qy(l,y),ur(),l.memoizedState=null):(s!==null&&pu(l,null),$f(),ur());return Lt(s,l,m,u),l.child}function va(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Vx(s,l,u,f,m){var y=Yf();return y=y===null?null:{parent:mt._currentValue,pool:y},l.memoizedState={baseLanes:u,cachePool:y},s!==null&&pu(l,null),$f(),Gy(l),s!==null&&Is(s,l,f,!0),l.childLanes=m,null}function Nu(s,l){return l=Du({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function Ix(s,l,u){return ns(l,s.child,null,u),s=Nu(l,l.pendingProps),s.flags|=2,bi(l),l.memoizedState=null,s}function yT(s,l,u){var f=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Le){if(f.mode==="hidden")return s=Nu(l,f),l.lanes=536870912,va(null,s);if(td(l),(s=$e)?(s=i1(s,Li),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tr!==null?{id:rn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},u=Ty(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return l.lanes=536870912,null}return Nu(l,f)}var y=s.memoizedState;if(y!==null){var S=y.dehydrated;if(td(l),m)if(l.flags&256)l.flags&=-257,l=Ix(s,l,u);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if(yt||Is(s,l,u,!1),m=(u&s.childLanes)!==0,yt||m){if(f=We,f!==null&&(S=L0(f,u),S!==0&&S!==y.retryLane))throw y.retryLane=S,Wr(s,S),si(f,s,S),wd;Pu(),l=Ix(s,l,u)}else s=y.treeContext,$e=zi(S.nextSibling),Dt=l,Le=!0,ir=null,Li=!1,s!==null&&Ny(l,s),l=Nu(l,f),l.flags|=4096;return l}return s=Tn(s.child,{mode:f.mode,children:f.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Ru(s,l){var u=l.ref;if(u===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(s===null||s.ref!==u)&&(l.flags|=4194816)}}function kd(s,l,u,f,m){return $r(l),u=nd(s,l,u,f,void 0,m),f=rd(),s!==null&&!yt?(sd(s,l,m),jn(s,l,m)):(Le&&f&&Hf(l),l.flags|=1,Lt(s,l,u,m),l.child)}function Qx(s,l,u,f,m,y){return $r(l),l.updateQueue=null,u=Ky(l,f,u,m),Yy(s),f=rd(),s!==null&&!yt?(sd(s,l,y),jn(s,l,y)):(Le&&f&&Hf(l),l.flags|=1,Lt(s,l,u,y),l.child)}function Gx(s,l,u,f,m){if($r(l),l.stateNode===null){var y=qs,S=u.contextType;typeof S=="object"&&S!==null&&(y=jt(S)),y=new u(f,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=vd,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=f,y.state=l.memoizedState,y.refs={},Wf(l),S=u.contextType,y.context=typeof S=="object"&&S!==null?jt(S):qs,y.state=l.memoizedState,S=u.getDerivedStateFromProps,typeof S=="function"&&(bd(l,u,S,f),y.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&vd.enqueueReplaceState(y,y.state,null),ma(l,f,y,m),pa(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),f=!0}else if(s===null){y=l.stateNode;var A=l.memoizedProps,O=ss(u,A);y.props=O;var _=y.context,G=u.contextType;S=qs,typeof G=="object"&&G!==null&&(S=jt(G));var K=u.getDerivedStateFromProps;G=typeof K=="function"||typeof y.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,G||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A||_!==S)&&Dx(l,y,f,S),sr=!1;var q=l.memoizedState;y.state=q,ma(l,f,y,m),pa(),_=l.memoizedState,A||q!==_||sr?(typeof K=="function"&&(bd(l,u,K,f),_=l.memoizedState),(O=sr||Rx(l,u,O,f,q,_,S))?(G||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(l.flags|=4194308)):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=f,l.memoizedState=_),y.props=f,y.state=_,y.context=S,f=O):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),f=!1)}else{y=l.stateNode,Xf(s,l),S=l.memoizedProps,G=ss(u,S),y.props=G,K=l.pendingProps,q=y.context,_=u.contextType,O=qs,typeof _=="object"&&_!==null&&(O=jt(_)),A=u.getDerivedStateFromProps,(_=typeof A=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==K||q!==O)&&Dx(l,y,f,O),sr=!1,q=l.memoizedState,y.state=q,ma(l,f,y,m),pa();var V=l.memoizedState;S!==K||q!==V||sr||s!==null&&s.dependencies!==null&&fu(s.dependencies)?(typeof A=="function"&&(bd(l,u,A,f),V=l.memoizedState),(G=sr||Rx(l,u,G,f,q,V,O)||s!==null&&s.dependencies!==null&&fu(s.dependencies))?(_||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,V,O),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,V,O)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===s.memoizedProps&&q===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&q===s.memoizedState||(l.flags|=1024),l.memoizedProps=f,l.memoizedState=V),y.props=f,y.state=V,y.context=O,f=G):(typeof y.componentDidUpdate!="function"||S===s.memoizedProps&&q===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&q===s.memoizedState||(l.flags|=1024),f=!1)}return y=f,Ru(s,l),f=(l.flags&128)!==0,y||f?(y=l.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,s!==null&&f?(l.child=ns(l,s.child,null,m),l.child=ns(l,null,u,m)):Lt(s,l,u,m),l.memoizedState=y.state,s=l.child):s=jn(s,l,m),s}function Yx(s,l,u,f){return Zr(),l.flags|=256,Lt(s,l,u,f),l.child}var Cd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ad(s){return{baseLanes:s,cachePool:zy()}}function Md(s,l,u){return s=s!==null?s.childLanes&~u:0,l&&(s|=Si),s}function Kx(s,l,u){var f=l.pendingProps,m=!1,y=(l.flags&128)!==0,S;if((S=y)||(S=s!==null&&s.memoizedState===null?!1:(ct.current&2)!==0),S&&(m=!0,l.flags&=-129),S=(l.flags&32)!==0,l.flags&=-33,s===null){if(Le){if(m?or(l):ur(),(s=$e)?(s=i1(s,Li),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tr!==null?{id:rn,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},u=Ty(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return op(s)?l.lanes=32:l.lanes=536870912,null}var A=f.children;return f=f.fallback,m?(ur(),m=l.mode,A=Du({mode:"hidden",children:A},m),f=Xr(f,m,u,null),A.return=l,f.return=l,A.sibling=f,l.child=A,f=l.child,f.memoizedState=Ad(u),f.childLanes=Md(s,S,u),l.memoizedState=Cd,va(null,f)):(or(l),Td(l,A))}var O=s.memoizedState;if(O!==null&&(A=O.dehydrated,A!==null)){if(y)l.flags&256?(or(l),l.flags&=-257,l=Od(s,l,u)):l.memoizedState!==null?(ur(),l.child=s.child,l.flags|=128,l=null):(ur(),A=f.fallback,m=l.mode,f=Du({mode:"visible",children:f.children},m),A=Xr(A,m,u,null),A.flags|=2,f.return=l,A.return=l,f.sibling=A,l.child=f,ns(l,s.child,null,u),f=l.child,f.memoizedState=Ad(u),f.childLanes=Md(s,S,u),l.memoizedState=Cd,l=va(null,f));else if(or(l),op(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var _=S.dgst;S=_,f=Error(n(419)),f.stack="",f.digest=S,oa({value:f,source:null,stack:null}),l=Od(s,l,u)}else if(yt||Is(s,l,u,!1),S=(u&s.childLanes)!==0,yt||S){if(S=We,S!==null&&(f=L0(S,u),f!==0&&f!==O.retryLane))throw O.retryLane=f,Wr(s,f),si(S,s,f),wd;ap(A)||Pu(),l=Od(s,l,u)}else ap(A)?(l.flags|=192,l.child=s.child,l=null):(s=O.treeContext,$e=zi(A.nextSibling),Dt=l,Le=!0,ir=null,Li=!1,s!==null&&Ny(l,s),l=Td(l,f.children),l.flags|=4096);return l}return m?(ur(),A=f.fallback,m=l.mode,O=s.child,_=O.sibling,f=Tn(O,{mode:"hidden",children:f.children}),f.subtreeFlags=O.subtreeFlags&65011712,_!==null?A=Tn(_,A):(A=Xr(A,m,u,null),A.flags|=2),A.return=l,f.return=l,f.sibling=A,l.child=f,va(null,f),f=l.child,A=s.child.memoizedState,A===null?A=Ad(u):(m=A.cachePool,m!==null?(O=mt._currentValue,m=m.parent!==O?{parent:O,pool:O}:m):m=zy(),A={baseLanes:A.baseLanes|u,cachePool:m}),f.memoizedState=A,f.childLanes=Md(s,S,u),l.memoizedState=Cd,va(s.child,f)):(or(l),u=s.child,s=u.sibling,u=Tn(u,{mode:"visible",children:f.children}),u.return=l,u.sibling=null,s!==null&&(S=l.deletions,S===null?(l.deletions=[s],l.flags|=16):S.push(s)),l.child=u,l.memoizedState=null,u)}function Td(s,l){return l=Du({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Du(s,l){return s=yi(22,s,null,l),s.lanes=0,s}function Od(s,l,u){return ns(l,s.child,null,u),s=Td(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function Wx(s,l,u){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),Vf(s.return,l,u)}function Ed(s,l,u,f,m,y){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:m,treeForkCount:y}:(S.isBackwards=l,S.rendering=null,S.renderingStartTime=0,S.last=f,S.tail=u,S.tailMode=m,S.treeForkCount=y)}function Xx(s,l,u){var f=l.pendingProps,m=f.revealOrder,y=f.tail;f=f.children;var S=ct.current,A=(S&2)!==0;if(A?(S=S&1|2,l.flags|=128):S&=1,$(ct,S),Lt(s,l,f,u),f=Le?aa:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Wx(s,u,l);else if(s.tag===19)Wx(s,u,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(u=l.child,m=null;u!==null;)s=u.alternate,s!==null&&vu(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=l.child,l.child=null):(m=u.sibling,u.sibling=null),Ed(l,!1,m,u,y,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&vu(s)===null){l.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}Ed(l,!0,u,null,y,f);break;case"together":Ed(l,!1,null,null,void 0,f);break;default:l.memoizedState=null}return l.child}function jn(s,l,u){if(s!==null&&(l.dependencies=s.dependencies),fr|=l.lanes,(u&l.childLanes)===0)if(s!==null){if(Is(s,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,u=Tn(s,s.pendingProps),l.child=u,u.return=l;s.sibling!==null;)s=s.sibling,u=u.sibling=Tn(s,s.pendingProps),u.return=l;u.sibling=null}return l.child}function Nd(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&fu(s)))}function xT(s,l,u){switch(l.tag){case 3:Gt(l,l.stateNode.containerInfo),rr(l,mt,s.memoizedState.cache),Zr();break;case 27:case 5:Gl(l);break;case 4:Gt(l,l.stateNode.containerInfo);break;case 10:rr(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,td(l),null;break;case 13:var f=l.memoizedState;if(f!==null)return f.dehydrated!==null?(or(l),l.flags|=128,null):(u&l.child.childLanes)!==0?Kx(s,l,u):(or(l),s=jn(s,l,u),s!==null?s.sibling:null);or(l);break;case 19:var m=(s.flags&128)!==0;if(f=(u&l.childLanes)!==0,f||(Is(s,l,u,!1),f=(u&l.childLanes)!==0),m){if(f)return Xx(s,l,u);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),$(ct,ct.current),f)break;return null;case 22:return l.lanes=0,Fx(s,l,u,l.pendingProps);case 24:rr(l,mt,s.memoizedState.cache)}return jn(s,l,u)}function Zx(s,l,u){if(s!==null)if(s.memoizedProps!==l.pendingProps)yt=!0;else{if(!Nd(s,u)&&(l.flags&128)===0)return yt=!1,xT(s,l,u);yt=(s.flags&131072)!==0}else yt=!1,Le&&(l.flags&1048576)!==0&&Ey(l,aa,l.index);switch(l.lanes=0,l.tag){case 16:e:{var f=l.pendingProps;if(s=ts(l.elementType),l.type=s,typeof s=="function")Bf(s)?(f=ss(s,f),l.tag=1,l=Gx(null,l,s,f,u)):(l.tag=0,l=kd(null,l,s,f,u));else{if(s!=null){var m=s.$$typeof;if(m===L){l.tag=11,l=Ux(null,l,s,f,u);break e}else if(m===H){l.tag=14,l=qx(null,l,s,f,u);break e}}throw l=fe(s)||s,Error(n(306,l,""))}}return l;case 0:return kd(s,l,l.type,l.pendingProps,u);case 1:return f=l.type,m=ss(f,l.pendingProps),Gx(s,l,f,m,u);case 3:e:{if(Gt(l,l.stateNode.containerInfo),s===null)throw Error(n(387));f=l.pendingProps;var y=l.memoizedState;m=y.element,Xf(s,l),ma(l,f,null,u);var S=l.memoizedState;if(f=S.cache,rr(l,mt,f),f!==y.cache&&If(l,[mt],u,!0),pa(),f=S.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:S.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=Yx(s,l,f,u);break e}else if(f!==m){m=Ri(Error(n(424)),l),oa(m),l=Yx(s,l,f,u);break e}else for(s=l.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,$e=zi(s.firstChild),Dt=l,Le=!0,ir=null,Li=!0,u=Fy(l,null,f,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Zr(),f===m){l=jn(s,l,u);break e}Lt(s,l,f,u)}l=l.child}return l;case 26:return Ru(s,l),s===null?(u=o1(l.type,null,l.pendingProps,null))?l.memoizedState=u:Le||(u=l.type,s=l.pendingProps,f=Ku(ke.current).createElement(u),f[Rt]=l,f[$t]=s,Bt(f,u,s),Mt(f),l.stateNode=f):l.memoizedState=o1(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return Gl(l),s===null&&Le&&(f=l.stateNode=s1(l.type,l.pendingProps,ke.current),Dt=l,Li=!0,m=$e,yr(l.type)?(up=m,$e=zi(f.firstChild)):$e=m),Lt(s,l,l.pendingProps.children,u),Ru(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Le&&((m=f=$e)&&(f=KT(f,l.type,l.pendingProps,Li),f!==null?(l.stateNode=f,Dt=l,$e=zi(f.firstChild),Li=!1,m=!0):m=!1),m||nr(l)),Gl(l),m=l.type,y=l.pendingProps,S=s!==null?s.memoizedProps:null,f=y.children,rp(m,y)?f=null:S!==null&&rp(m,S)&&(l.flags|=32),l.memoizedState!==null&&(m=nd(s,l,uT,null,null,u),Ba._currentValue=m),Ru(s,l),Lt(s,l,f,u),l.child;case 6:return s===null&&Le&&((s=u=$e)&&(u=WT(u,l.pendingProps,Li),u!==null?(l.stateNode=u,Dt=l,$e=null,s=!0):s=!1),s||nr(l)),null;case 13:return Kx(s,l,u);case 4:return Gt(l,l.stateNode.containerInfo),f=l.pendingProps,s===null?l.child=ns(l,null,f,u):Lt(s,l,f,u),l.child;case 11:return Ux(s,l,l.type,l.pendingProps,u);case 7:return Lt(s,l,l.pendingProps,u),l.child;case 8:return Lt(s,l,l.pendingProps.children,u),l.child;case 12:return Lt(s,l,l.pendingProps.children,u),l.child;case 10:return f=l.pendingProps,rr(l,l.type,f.value),Lt(s,l,f.children,u),l.child;case 9:return m=l.type._context,f=l.pendingProps.children,$r(l),m=jt(m),f=f(m),l.flags|=1,Lt(s,l,f,u),l.child;case 14:return qx(s,l,l.type,l.pendingProps,u);case 15:return Px(s,l,l.type,l.pendingProps,u);case 19:return Xx(s,l,u);case 31:return yT(s,l,u);case 22:return Fx(s,l,u,l.pendingProps);case 24:return $r(l),f=jt(mt),s===null?(m=Yf(),m===null&&(m=We,y=Qf(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=u),m=y),l.memoizedState={parent:f,cache:m},Wf(l),rr(l,mt,m)):((s.lanes&u)!==0&&(Xf(s,l),ma(l,null,null,u),pa()),m=s.memoizedState,y=l.memoizedState,m.parent!==f?(m={parent:f,cache:f},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),rr(l,mt,f)):(f=y.cache,rr(l,mt,f),f!==m.cache&&If(l,[mt],u,!0))),Lt(s,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function Ln(s){s.flags|=4}function Rd(s,l,u,f,m){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(Cb())s.flags|=8192;else throw is=gu,Kf}else s.flags&=-16777217}function Jx(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!d1(l))if(Cb())s.flags|=8192;else throw is=gu,Kf}function ju(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?R0():536870912,s.lanes|=l,il|=l)}function Sa(s,l){if(!Le)switch(s.tailMode){case"hidden":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function et(s){var l=s.alternate!==null&&s.alternate.child===s.child,u=0,f=0;if(l)for(var m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags&65011712,f|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=f,s.childLanes=u,l}function bT(s,l,u){var f=l.pendingProps;switch(Uf(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(l),null;case 1:return et(l),null;case 3:return u=l.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Nn(mt),ut(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Vs(l)?Ln(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Pf())),et(l),null;case 26:var m=l.type,y=l.memoizedState;return s===null?(Ln(l),y!==null?(et(l),Jx(l,y)):(et(l),Rd(l,m,null,f,u))):y?y!==s.memoizedState?(Ln(l),et(l),Jx(l,y)):(et(l),l.flags&=-16777217):(s=s.memoizedProps,s!==f&&Ln(l),et(l),Rd(l,m,s,f,u)),null;case 27:if(Io(l),u=ke.current,m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return et(l),null}s=re.current,Vs(l)?Ry(l):(s=s1(m,f,u),l.stateNode=s,Ln(l))}return et(l),null;case 5:if(Io(l),m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return et(l),null}if(y=re.current,Vs(l))Ry(l);else{var S=Ku(ke.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?S.createElement("select",{is:f.is}):S.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?S.createElement(m,{is:f.is}):S.createElement(m)}}y[Rt]=l,y[$t]=f;e:for(S=l.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===l)break e;for(;S.sibling===null;){if(S.return===null||S.return===l)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}l.stateNode=y;e:switch(Bt(y,m,f),m){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ln(l)}}return et(l),Rd(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,u),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==f&&Ln(l);else{if(typeof f!="string"&&l.stateNode===null)throw Error(n(166));if(s=ke.current,Vs(l)){if(s=l.stateNode,u=l.memoizedProps,f=null,m=Dt,m!==null)switch(m.tag){case 27:case 5:f=m.memoizedProps}s[Rt]=l,s=!!(s.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||Kb(s.nodeValue,u)),s||nr(l,!0)}else s=Ku(s).createTextNode(f),s[Rt]=l,l.stateNode=s}return et(l),null;case 31:if(u=l.memoizedState,s===null||s.memoizedState!==null){if(f=Vs(l),u!==null){if(s===null){if(!f)throw Error(n(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[Rt]=l}else Zr(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;et(l),s=!1}else u=Pf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return l.flags&256?(bi(l),l):(bi(l),null);if((l.flags&128)!==0)throw Error(n(558))}return et(l),null;case 13:if(f=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Vs(l),f!==null&&f.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[Rt]=l}else Zr(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;et(l),m=!1}else m=Pf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(bi(l),l):(bi(l),null)}return bi(l),(l.flags&128)!==0?(l.lanes=u,l):(u=f!==null,s=s!==null&&s.memoizedState!==null,u&&(f=l.child,m=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(m=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==m&&(f.flags|=2048)),u!==s&&u&&(l.child.flags|=8192),ju(l,l.updateQueue),et(l),null);case 4:return ut(),s===null&&$d(l.stateNode.containerInfo),et(l),null;case 10:return Nn(l.type),et(l),null;case 19:if(Q(ct),f=l.memoizedState,f===null)return et(l),null;if(m=(l.flags&128)!==0,y=f.rendering,y===null)if(m)Sa(f,!1);else{if(lt!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(y=vu(s),y!==null){for(l.flags|=128,Sa(f,!1),s=y.updateQueue,l.updateQueue=s,ju(l,s),l.subtreeFlags=0,s=u,u=l.child;u!==null;)My(u,s),u=u.sibling;return $(ct,ct.current&1|2),Le&&On(l,f.treeForkCount),l.child}s=s.sibling}f.tail!==null&&di()>Hu&&(l.flags|=128,m=!0,Sa(f,!1),l.lanes=4194304)}else{if(!m)if(s=vu(y),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,ju(l,s),Sa(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Le)return et(l),null}else 2*di()-f.renderingStartTime>Hu&&u!==536870912&&(l.flags|=128,m=!0,Sa(f,!1),l.lanes=4194304);f.isBackwards?(y.sibling=l.child,l.child=y):(s=f.last,s!==null?s.sibling=y:l.child=y,f.last=y)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=di(),s.sibling=null,u=ct.current,$(ct,m?u&1|2:u&1),Le&&On(l,f.treeForkCount),s):(et(l),null);case 22:case 23:return bi(l),ed(),f=l.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(l.flags|=8192):f&&(l.flags|=8192),f?(u&536870912)!==0&&(l.flags&128)===0&&(et(l),l.subtreeFlags&6&&(l.flags|=8192)):et(l),u=l.updateQueue,u!==null&&ju(l,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),f=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==u&&(l.flags|=2048),s!==null&&Q(es),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),Nn(mt),et(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function vT(s,l){switch(Uf(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Nn(mt),ut(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return Io(l),null;case 31:if(l.memoizedState!==null){if(bi(l),l.alternate===null)throw Error(n(340));Zr()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(bi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Zr()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return Q(ct),null;case 4:return ut(),null;case 10:return Nn(l.type),null;case 22:case 23:return bi(l),ed(),s!==null&&Q(es),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Nn(mt),null;case 25:return null;default:return null}}function $x(s,l){switch(Uf(l),l.tag){case 3:Nn(mt),ut();break;case 26:case 27:case 5:Io(l);break;case 4:ut();break;case 31:l.memoizedState!==null&&bi(l);break;case 13:bi(l);break;case 19:Q(ct);break;case 10:Nn(l.type);break;case 22:case 23:bi(l),ed(),s!==null&&Q(es);break;case 24:Nn(mt)}}function wa(s,l){try{var u=l.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var m=f.next;u=m;do{if((u.tag&s)===s){f=void 0;var y=u.create,S=u.inst;f=y(),S.destroy=f}u=u.next}while(u!==m)}}catch(A){Ie(l,l.return,A)}}function cr(s,l,u){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var y=m.next;f=y;do{if((f.tag&s)===s){var S=f.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,m=l;var O=u,_=A;try{_()}catch(G){Ie(m,O,G)}}}f=f.next}while(f!==y)}}catch(G){Ie(l,l.return,G)}}function eb(s){var l=s.updateQueue;if(l!==null){var u=s.stateNode;try{Iy(l,u)}catch(f){Ie(s,s.return,f)}}}function tb(s,l,u){u.props=ss(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){Ie(s,l,f)}}function ka(s,l){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof u=="function"?s.refCleanup=u(f):u.current=f}}catch(m){Ie(s,l,m)}}function ln(s,l){var u=s.ref,f=s.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(m){Ie(s,l,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(m){Ie(s,l,m)}else u.current=null}function ib(s){var l=s.type,u=s.memoizedProps,f=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(m){Ie(s,s.return,m)}}function Dd(s,l,u){try{var f=s.stateNode;FT(f,s.type,u,l),f[$t]=l}catch(m){Ie(s,s.return,m)}}function nb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yr(s.type)||s.tag===4}function jd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||nb(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&&yr(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 Ld(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(s),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=An));else if(f!==4&&(f===27&&yr(s.type)&&(u=s.stateNode,l=null),s=s.child,s!==null))for(Ld(s,l,u),s=s.sibling;s!==null;)Ld(s,l,u),s=s.sibling}function Lu(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?u.insertBefore(s,l):u.appendChild(s);else if(f!==4&&(f===27&&yr(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Lu(s,l,u),s=s.sibling;s!==null;)Lu(s,l,u),s=s.sibling}function rb(s){var l=s.stateNode,u=s.memoizedProps;try{for(var f=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);Bt(l,f,u),l[Rt]=s,l[$t]=u}catch(y){Ie(s,s.return,y)}}var Bn=!1,xt=!1,Bd=!1,sb=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function ST(s,l){if(s=s.containerInfo,ip=tc,s=yy(s),Of(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var m=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{u.nodeType,y.nodeType}catch{u=null;break e}var S=0,A=-1,O=-1,_=0,G=0,K=s,q=null;t:for(;;){for(var V;K!==u||m!==0&&K.nodeType!==3||(A=S+m),K!==y||f!==0&&K.nodeType!==3||(O=S+f),K.nodeType===3&&(S+=K.nodeValue.length),(V=K.firstChild)!==null;)q=K,K=V;for(;;){if(K===s)break t;if(q===u&&++_===m&&(A=S),q===y&&++G===f&&(O=S),(V=K.nextSibling)!==null)break;K=q,q=K.parentNode}K=V}u=A===-1||O===-1?null:{start:A,end:O}}else u=null}u=u||{start:0,end:0}}else u=null;for(np={focusedElem:s,selectionRange:u},tc=!1,Tt=l;Tt!==null;)if(l=Tt,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Tt=s;else for(;Tt!==null;){switch(l=Tt,y=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)m=s[u],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&y!==null){s=void 0,u=l,m=y.memoizedProps,y=y.memoizedState,f=u.stateNode;try{var oe=ss(u.type,m);s=f.getSnapshotBeforeUpdate(oe,y),f.__reactInternalSnapshotBeforeUpdate=s}catch(xe){Ie(u,u.return,xe)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,u=s.nodeType,u===9)lp(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":lp(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(n(163))}if(s=l.sibling,s!==null){s.return=l.return,Tt=s;break}Tt=l.return}}function lb(s,l,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:_n(s,u),f&4&&wa(5,u);break;case 1:if(_n(s,u),f&4)if(s=u.stateNode,l===null)try{s.componentDidMount()}catch(S){Ie(u,u.return,S)}else{var m=ss(u.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Ie(u,u.return,S)}}f&64&&eb(u),f&512&&ka(u,u.return);break;case 3:if(_n(s,u),f&64&&(s=u.updateQueue,s!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{Iy(s,l)}catch(S){Ie(u,u.return,S)}}break;case 27:l===null&&f&4&&rb(u);case 26:case 5:_n(s,u),l===null&&f&4&&ib(u),f&512&&ka(u,u.return);break;case 12:_n(s,u);break;case 31:_n(s,u),f&4&&ub(s,u);break;case 13:_n(s,u),f&4&&cb(s,u),f&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=NT.bind(null,u),XT(s,u))));break;case 22:if(f=u.memoizedState!==null||Bn,!f){l=l!==null&&l.memoizedState!==null||xt,m=Bn;var y=xt;Bn=f,(xt=l)&&!y?Hn(s,u,(u.subtreeFlags&8772)!==0):_n(s,u),Bn=m,xt=y}break;case 30:break;default:_n(s,u)}}function ab(s){var l=s.alternate;l!==null&&(s.alternate=null,ab(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&hf(l)),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 it=null,ti=!1;function zn(s,l,u){for(u=u.child;u!==null;)ob(s,l,u),u=u.sibling}function ob(s,l,u){if(pi&&typeof pi.onCommitFiberUnmount=="function")try{pi.onCommitFiberUnmount(Yl,u)}catch{}switch(u.tag){case 26:xt||ln(u,l),zn(s,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:xt||ln(u,l);var f=it,m=ti;yr(u.type)&&(it=u.stateNode,ti=!1),zn(s,l,u),Da(u.stateNode),it=f,ti=m;break;case 5:xt||ln(u,l);case 6:if(f=it,m=ti,it=null,zn(s,l,u),it=f,ti=m,it!==null)if(ti)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(u.stateNode)}catch(y){Ie(u,l,y)}else try{it.removeChild(u.stateNode)}catch(y){Ie(u,l,y)}break;case 18:it!==null&&(ti?(s=it,e1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),cl(s)):e1(it,u.stateNode));break;case 4:f=it,m=ti,it=u.stateNode.containerInfo,ti=!0,zn(s,l,u),it=f,ti=m;break;case 0:case 11:case 14:case 15:cr(2,u,l),xt||cr(4,u,l),zn(s,l,u);break;case 1:xt||(ln(u,l),f=u.stateNode,typeof f.componentWillUnmount=="function"&&tb(u,l,f)),zn(s,l,u);break;case 21:zn(s,l,u);break;case 22:xt=(f=xt)||u.memoizedState!==null,zn(s,l,u),xt=f;break;default:zn(s,l,u)}}function ub(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{cl(s)}catch(u){Ie(l,l.return,u)}}}function cb(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{cl(s)}catch(u){Ie(l,l.return,u)}}function wT(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new sb),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new sb),l;default:throw Error(n(435,s.tag))}}function Bu(s,l){var u=wT(s);l.forEach(function(f){if(!u.has(f)){u.add(f);var m=RT.bind(null,s,f);f.then(m,m)}})}function ii(s,l){var u=l.deletions;if(u!==null)for(var f=0;f<u.length;f++){var m=u[f],y=s,S=l,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(yr(A.type)){it=A.stateNode,ti=!1;break e}break;case 5:it=A.stateNode,ti=!1;break e;case 3:case 4:it=A.stateNode.containerInfo,ti=!0;break e}A=A.return}if(it===null)throw Error(n(160));ob(y,S,m),it=null,ti=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)hb(l,s),l=l.sibling}var Yi=null;function hb(s,l){var u=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ii(l,s),ni(s),f&4&&(cr(3,s,s.return),wa(3,s),cr(5,s,s.return));break;case 1:ii(l,s),ni(s),f&512&&(xt||u===null||ln(u,u.return)),f&64&&Bn&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var m=Yi;if(ii(l,s),ni(s),f&512&&(xt||u===null||ln(u,u.return)),f&4){var y=u!==null?u.memoizedState:null;if(f=s.memoizedState,u===null)if(f===null)if(s.stateNode===null){e:{f=s.type,u=s.memoizedProps,m=m.ownerDocument||m;t:switch(f){case"title":y=m.getElementsByTagName("title")[0],(!y||y[Xl]||y[Rt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(f),m.head.insertBefore(y,m.querySelector("head > title"))),Bt(y,f,u),y[Rt]=s,Mt(y),f=y;break e;case"link":var S=h1("link","href",m).get(f+(u.href||""));if(S){for(var A=0;A<S.length;A++)if(y=S[A],y.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&y.getAttribute("rel")===(u.rel==null?null:u.rel)&&y.getAttribute("title")===(u.title==null?null:u.title)&&y.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){S.splice(A,1);break t}}y=m.createElement(f),Bt(y,f,u),m.head.appendChild(y);break;case"meta":if(S=h1("meta","content",m).get(f+(u.content||""))){for(A=0;A<S.length;A++)if(y=S[A],y.getAttribute("content")===(u.content==null?null:""+u.content)&&y.getAttribute("name")===(u.name==null?null:u.name)&&y.getAttribute("property")===(u.property==null?null:u.property)&&y.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&y.getAttribute("charset")===(u.charSet==null?null:u.charSet)){S.splice(A,1);break t}}y=m.createElement(f),Bt(y,f,u),m.head.appendChild(y);break;default:throw Error(n(468,f))}y[Rt]=s,Mt(y),f=y}s.stateNode=f}else f1(m,s.type,s.stateNode);else s.stateNode=c1(m,f,s.memoizedProps);else y!==f?(y===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):y.count--,f===null?f1(m,s.type,s.stateNode):c1(m,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Dd(s,s.memoizedProps,u.memoizedProps)}break;case 27:ii(l,s),ni(s),f&512&&(xt||u===null||ln(u,u.return)),u!==null&&f&4&&Dd(s,s.memoizedProps,u.memoizedProps);break;case 5:if(ii(l,s),ni(s),f&512&&(xt||u===null||ln(u,u.return)),s.flags&32){m=s.stateNode;try{js(m,"")}catch(oe){Ie(s,s.return,oe)}}f&4&&s.stateNode!=null&&(m=s.memoizedProps,Dd(s,m,u!==null?u.memoizedProps:m)),f&1024&&(Bd=!0);break;case 6:if(ii(l,s),ni(s),f&4){if(s.stateNode===null)throw Error(n(162));f=s.memoizedProps,u=s.stateNode;try{u.nodeValue=f}catch(oe){Ie(s,s.return,oe)}}break;case 3:if(Zu=null,m=Yi,Yi=Wu(l.containerInfo),ii(l,s),Yi=m,ni(s),f&4&&u!==null&&u.memoizedState.isDehydrated)try{cl(l.containerInfo)}catch(oe){Ie(s,s.return,oe)}Bd&&(Bd=!1,fb(s));break;case 4:f=Yi,Yi=Wu(s.stateNode.containerInfo),ii(l,s),ni(s),Yi=f;break;case 12:ii(l,s),ni(s);break;case 31:ii(l,s),ni(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Bu(s,f)));break;case 13:ii(l,s),ni(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(_u=di()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Bu(s,f)));break;case 22:m=s.memoizedState!==null;var O=u!==null&&u.memoizedState!==null,_=Bn,G=xt;if(Bn=_||m,xt=G||O,ii(l,s),xt=G,Bn=_,ni(s),f&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(u===null||O||Bn||xt||ls(s)),u=null,l=s;;){if(l.tag===5||l.tag===26){if(u===null){O=u=l;try{if(y=O.stateNode,m)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=O.stateNode;var K=O.memoizedProps.style,q=K!=null&&K.hasOwnProperty("display")?K.display:null;A.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(oe){Ie(O,O.return,oe)}}}else if(l.tag===6){if(u===null){O=l;try{O.stateNode.nodeValue=m?"":O.memoizedProps}catch(oe){Ie(O,O.return,oe)}}}else if(l.tag===18){if(u===null){O=l;try{var V=O.stateNode;m?t1(V,!0):t1(O.stateNode,!1)}catch(oe){Ie(O,O.return,oe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}f&4&&(f=s.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,Bu(s,u))));break;case 19:ii(l,s),ni(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Bu(s,f)));break;case 30:break;case 21:break;default:ii(l,s),ni(s)}}function ni(s){var l=s.flags;if(l&2){try{for(var u,f=s.return;f!==null;){if(nb(f)){u=f;break}f=f.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var m=u.stateNode,y=jd(s);Lu(s,y,m);break;case 5:var S=u.stateNode;u.flags&32&&(js(S,""),u.flags&=-33);var A=jd(s);Lu(s,A,S);break;case 3:case 4:var O=u.stateNode.containerInfo,_=jd(s);Ld(s,_,O);break;default:throw Error(n(161))}}catch(G){Ie(s,s.return,G)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function fb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;fb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function _n(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)lb(s,l.alternate,l),l=l.sibling}function ls(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:cr(4,l,l.return),ls(l);break;case 1:ln(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&tb(l,l.return,u),ls(l);break;case 27:Da(l.stateNode);case 26:case 5:ln(l,l.return),ls(l);break;case 22:l.memoizedState===null&&ls(l);break;case 30:ls(l);break;default:ls(l)}s=s.sibling}}function Hn(s,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var f=l.alternate,m=s,y=l,S=y.flags;switch(y.tag){case 0:case 11:case 15:Hn(m,y,u),wa(4,y);break;case 1:if(Hn(m,y,u),f=y,m=f.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(_){Ie(f,f.return,_)}if(f=y,m=f.updateQueue,m!==null){var A=f.stateNode;try{var O=m.shared.hiddenCallbacks;if(O!==null)for(m.shared.hiddenCallbacks=null,m=0;m<O.length;m++)Vy(O[m],A)}catch(_){Ie(f,f.return,_)}}u&&S&64&&eb(y),ka(y,y.return);break;case 27:rb(y);case 26:case 5:Hn(m,y,u),u&&f===null&&S&4&&ib(y),ka(y,y.return);break;case 12:Hn(m,y,u);break;case 31:Hn(m,y,u),u&&S&4&&ub(m,y);break;case 13:Hn(m,y,u),u&&S&4&&cb(m,y);break;case 22:y.memoizedState===null&&Hn(m,y,u),ka(y,y.return);break;case 30:break;default:Hn(m,y,u)}l=l.sibling}}function zd(s,l){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&ua(u))}function _d(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&ua(s))}function Ki(s,l,u,f){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)db(s,l,u,f),l=l.sibling}function db(s,l,u,f){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Ki(s,l,u,f),m&2048&&wa(9,l);break;case 1:Ki(s,l,u,f);break;case 3:Ki(s,l,u,f),m&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&ua(s)));break;case 12:if(m&2048){Ki(s,l,u,f),s=l.stateNode;try{var y=l.memoizedProps,S=y.id,A=y.onPostCommit;typeof A=="function"&&A(S,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(O){Ie(l,l.return,O)}}else Ki(s,l,u,f);break;case 31:Ki(s,l,u,f);break;case 13:Ki(s,l,u,f);break;case 23:break;case 22:y=l.stateNode,S=l.alternate,l.memoizedState!==null?y._visibility&2?Ki(s,l,u,f):Ca(s,l):y._visibility&2?Ki(s,l,u,f):(y._visibility|=2,$s(s,l,u,f,(l.subtreeFlags&10256)!==0||!1)),m&2048&&zd(S,l);break;case 24:Ki(s,l,u,f),m&2048&&_d(l.alternate,l);break;default:Ki(s,l,u,f)}}function $s(s,l,u,f,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=s,S=l,A=u,O=f,_=S.flags;switch(S.tag){case 0:case 11:case 15:$s(y,S,A,O,m),wa(8,S);break;case 23:break;case 22:var G=S.stateNode;S.memoizedState!==null?G._visibility&2?$s(y,S,A,O,m):Ca(y,S):(G._visibility|=2,$s(y,S,A,O,m)),m&&_&2048&&zd(S.alternate,S);break;case 24:$s(y,S,A,O,m),m&&_&2048&&_d(S.alternate,S);break;default:$s(y,S,A,O,m)}l=l.sibling}}function Ca(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=s,f=l,m=f.flags;switch(f.tag){case 22:Ca(u,f),m&2048&&zd(f.alternate,f);break;case 24:Ca(u,f),m&2048&&_d(f.alternate,f);break;default:Ca(u,f)}l=l.sibling}}var Aa=8192;function el(s,l,u){if(s.subtreeFlags&Aa)for(s=s.child;s!==null;)pb(s,l,u),s=s.sibling}function pb(s,l,u){switch(s.tag){case 26:el(s,l,u),s.flags&Aa&&s.memoizedState!==null&&oO(u,Yi,s.memoizedState,s.memoizedProps);break;case 5:el(s,l,u);break;case 3:case 4:var f=Yi;Yi=Wu(s.stateNode.containerInfo),el(s,l,u),Yi=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Aa,Aa=16777216,el(s,l,u),Aa=f):el(s,l,u));break;default:el(s,l,u)}}function mb(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function Ma(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];Tt=f,yb(f,s)}mb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)gb(s),s=s.sibling}function gb(s){switch(s.tag){case 0:case 11:case 15:Ma(s),s.flags&2048&&cr(9,s,s.return);break;case 3:Ma(s);break;case 12:Ma(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,zu(s)):Ma(s);break;default:Ma(s)}}function zu(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];Tt=f,yb(f,s)}mb(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:cr(8,l,l.return),zu(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,zu(l));break;default:zu(l)}s=s.sibling}}function yb(s,l){for(;Tt!==null;){var u=Tt;switch(u.tag){case 0:case 11:case 15:cr(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:ua(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Tt=f;else e:for(u=s;Tt!==null;){f=Tt;var m=f.sibling,y=f.return;if(ab(f),f===u){Tt=null;break e}if(m!==null){m.return=y,Tt=m;break e}Tt=y}}}var kT={getCacheForType:function(s){var l=jt(mt),u=l.data.get(s);return u===void 0&&(u=s(),l.data.set(s,u)),u},cacheSignal:function(){return jt(mt).controller.signal}},CT=typeof WeakMap=="function"?WeakMap:Map,qe=0,We=null,Ee=null,De=0,Ve=0,vi=null,hr=!1,tl=!1,Hd=!1,Un=0,lt=0,fr=0,as=0,Ud=0,Si=0,il=0,Ta=null,ri=null,qd=!1,_u=0,xb=0,Hu=1/0,Uu=null,dr=null,St=0,pr=null,nl=null,qn=0,Pd=0,Fd=null,bb=null,Oa=0,Vd=null;function wi(){return(qe&2)!==0&&De!==0?De&-De:P.T!==null?Wd():B0()}function vb(){if(Si===0)if((De&536870912)===0||Le){var s=Yo;Yo<<=1,(Yo&3932160)===0&&(Yo=262144),Si=s}else Si=536870912;return s=xi.current,s!==null&&(s.flags|=32),Si}function si(s,l,u){(s===We&&(Ve===2||Ve===9)||s.cancelPendingCommit!==null)&&(rl(s,0),mr(s,De,Si,!1)),Wl(s,u),((qe&2)===0||s!==We)&&(s===We&&((qe&2)===0&&(as|=u),lt===4&&mr(s,De,Si,!1)),an(s))}function Sb(s,l,u){if((qe&6)!==0)throw Error(n(327));var f=!u&&(l&127)===0&&(l&s.expiredLanes)===0||Kl(s,l),m=f?TT(s,l):Qd(s,l,!0),y=f;do{if(m===0){tl&&!f&&mr(s,l,0,!1);break}else{if(u=s.current.alternate,y&&!AT(u)){m=Qd(s,l,!1),y=!1;continue}if(m===2){if(y=l,s.errorRecoveryDisabledLanes&y)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){l=S;e:{var A=s;m=Ta;var O=A.current.memoizedState.isDehydrated;if(O&&(rl(A,S).flags|=256),S=Qd(A,S,!1),S!==2){if(Hd&&!O){A.errorRecoveryDisabledLanes|=y,as|=y,m=4;break e}y=ri,ri=m,y!==null&&(ri===null?ri=y:ri.push.apply(ri,y))}m=S}if(y=!1,m!==2)continue}}if(m===1){rl(s,0),mr(s,l,0,!0);break}e:{switch(f=s,y=m,y){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:mr(f,l,Si,!hr);break e;case 2:ri=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(m=_u+300-di(),10<m)){if(mr(f,l,Si,!hr),Wo(f,0,!0)!==0)break e;qn=l,f.timeoutHandle=Jb(wb.bind(null,f,u,ri,Uu,qd,l,Si,as,il,hr,y,"Throttled",-0,0),m);break e}wb(f,u,ri,Uu,qd,l,Si,as,il,hr,y,null,-0,0)}}break}while(!0);an(s)}function wb(s,l,u,f,m,y,S,A,O,_,G,K,q,V){if(s.timeoutHandle=-1,K=l.subtreeFlags,K&8192||(K&16785408)===16785408){K={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:An},pb(l,y,K);var oe=(y&62914560)===y?_u-di():(y&4194048)===y?xb-di():0;if(oe=uO(K,oe),oe!==null){qn=y,s.cancelPendingCommit=oe(Nb.bind(null,s,l,y,u,f,m,S,A,O,G,K,null,q,V)),mr(s,y,S,!_);return}}Nb(s,l,y,u,f,m,S,A,O)}function AT(s){for(var l=s;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var m=u[f],y=m.getSnapshot;m=m.value;try{if(!gi(y(),m))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function mr(s,l,u,f){l&=~Ud,l&=~as,s.suspendedLanes|=l,s.pingedLanes&=~l,f&&(s.warmLanes|=l),f=s.expirationTimes;for(var m=l;0<m;){var y=31-mi(m),S=1<<y;f[y]=-1,m&=~S}u!==0&&D0(s,u,l)}function qu(){return(qe&6)===0?(Ea(0),!1):!0}function Id(){if(Ee!==null){if(Ve===0)var s=Ee.return;else s=Ee,En=Jr=null,ld(s),Ks=null,ha=0,s=Ee;for(;s!==null;)$x(s.alternate,s),s=s.return;Ee=null}}function rl(s,l){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,QT(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),qn=0,Id(),We=s,Ee=u=Tn(s.current,null),De=l,Ve=0,vi=null,hr=!1,tl=Kl(s,l),Hd=!1,il=Si=Ud=as=fr=lt=0,ri=Ta=null,qd=!1,(l&8)!==0&&(l|=l&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=l;0<f;){var m=31-mi(f),y=1<<m;l|=s[m],f&=~y}return Un=l,au(),u}function kb(s,l){Ce=null,P.H=ba,l===Ys||l===mu?(l=Uy(),Ve=3):l===Kf?(l=Uy(),Ve=4):Ve=l===wd?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,vi=l,Ee===null&&(lt=1,Eu(s,Ri(l,s.current)))}function Cb(){var s=xi.current;return s===null?!0:(De&4194048)===De?Bi===null:(De&62914560)===De||(De&536870912)!==0?s===Bi:!1}function Ab(){var s=P.H;return P.H=ba,s===null?ba:s}function Mb(){var s=P.A;return P.A=kT,s}function Pu(){lt=4,hr||(De&4194048)!==De&&xi.current!==null||(tl=!0),(fr&134217727)===0&&(as&134217727)===0||We===null||mr(We,De,Si,!1)}function Qd(s,l,u){var f=qe;qe|=2;var m=Ab(),y=Mb();(We!==s||De!==l)&&(Uu=null,rl(s,l)),l=!1;var S=lt;e:do try{if(Ve!==0&&Ee!==null){var A=Ee,O=vi;switch(Ve){case 8:Id(),S=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(l=!0);var _=Ve;if(Ve=0,vi=null,sl(s,A,O,_),u&&tl){S=0;break e}break;default:_=Ve,Ve=0,vi=null,sl(s,A,O,_)}}MT(),S=lt;break}catch(G){kb(s,G)}while(!0);return l&&s.shellSuspendCounter++,En=Jr=null,qe=f,P.H=m,P.A=y,Ee===null&&(We=null,De=0,au()),S}function MT(){for(;Ee!==null;)Tb(Ee)}function TT(s,l){var u=qe;qe|=2;var f=Ab(),m=Mb();We!==s||De!==l?(Uu=null,Hu=di()+500,rl(s,l)):tl=Kl(s,l);e:do try{if(Ve!==0&&Ee!==null){l=Ee;var y=vi;t:switch(Ve){case 1:Ve=0,vi=null,sl(s,l,y,1);break;case 2:case 9:if(_y(y)){Ve=0,vi=null,Ob(l);break}l=function(){Ve!==2&&Ve!==9||We!==s||(Ve=7),an(s)},y.then(l,l);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:_y(y)?(Ve=0,vi=null,Ob(l)):(Ve=0,vi=null,sl(s,l,y,7));break;case 5:var S=null;switch(Ee.tag){case 26:S=Ee.memoizedState;case 5:case 27:var A=Ee;if(S?d1(S):A.stateNode.complete){Ve=0,vi=null;var O=A.sibling;if(O!==null)Ee=O;else{var _=A.return;_!==null?(Ee=_,Fu(_)):Ee=null}break t}}Ve=0,vi=null,sl(s,l,y,5);break;case 6:Ve=0,vi=null,sl(s,l,y,6);break;case 8:Id(),lt=6;break e;default:throw Error(n(462))}}OT();break}catch(G){kb(s,G)}while(!0);return En=Jr=null,P.H=f,P.A=m,qe=u,Ee!==null?0:(We=null,De=0,au(),lt)}function OT(){for(;Ee!==null&&!ZA();)Tb(Ee)}function Tb(s){var l=Zx(s.alternate,s,Un);s.memoizedProps=s.pendingProps,l===null?Fu(s):Ee=l}function Ob(s){var l=s,u=l.alternate;switch(l.tag){case 15:case 0:l=Qx(u,l,l.pendingProps,l.type,void 0,De);break;case 11:l=Qx(u,l,l.pendingProps,l.type.render,l.ref,De);break;case 5:ld(l);default:$x(u,l),l=Ee=My(l,Un),l=Zx(u,l,Un)}s.memoizedProps=s.pendingProps,l===null?Fu(s):Ee=l}function sl(s,l,u,f){En=Jr=null,ld(l),Ks=null,ha=0;var m=l.return;try{if(gT(s,m,l,u,De)){lt=1,Eu(s,Ri(u,s.current)),Ee=null;return}}catch(y){if(m!==null)throw Ee=m,y;lt=1,Eu(s,Ri(u,s.current)),Ee=null;return}l.flags&32768?(Le||f===1?s=!0:tl||(De&536870912)!==0?s=!1:(hr=s=!0,(f===2||f===9||f===3||f===6)&&(f=xi.current,f!==null&&f.tag===13&&(f.flags|=16384))),Eb(l,s)):Fu(l)}function Fu(s){var l=s;do{if((l.flags&32768)!==0){Eb(l,hr);return}s=l.return;var u=bT(l.alternate,l,Un);if(u!==null){Ee=u;return}if(l=l.sibling,l!==null){Ee=l;return}Ee=l=s}while(l!==null);lt===0&&(lt=5)}function Eb(s,l){do{var u=vT(s.alternate,s);if(u!==null){u.flags&=32767,Ee=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(s=s.sibling,s!==null)){Ee=s;return}Ee=s=u}while(s!==null);lt=6,Ee=null}function Nb(s,l,u,f,m,y,S,A,O){s.cancelPendingCommit=null;do Vu();while(St!==0);if((qe&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(y=l.lanes|l.childLanes,y|=jf,aM(s,u,y,S,A,O),s===We&&(Ee=We=null,De=0),nl=l,pr=s,qn=u,Pd=y,Fd=m,bb=f,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,DT(Qo,function(){return Bb(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||f){f=P.T,P.T=null,m=X.p,X.p=2,S=qe,qe|=4;try{ST(s,l,u)}finally{qe=S,X.p=m,P.T=f}}St=1,Rb(),Db(),jb()}}function Rb(){if(St===1){St=0;var s=pr,l=nl,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=P.T,P.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{hb(l,s);var y=np,S=yy(s.containerInfo),A=y.focusedElem,O=y.selectionRange;if(S!==A&&A&&A.ownerDocument&&gy(A.ownerDocument.documentElement,A)){if(O!==null&&Of(A)){var _=O.start,G=O.end;if(G===void 0&&(G=_),"selectionStart"in A)A.selectionStart=_,A.selectionEnd=Math.min(G,A.value.length);else{var K=A.ownerDocument||document,q=K&&K.defaultView||window;if(q.getSelection){var V=q.getSelection(),oe=A.textContent.length,xe=Math.min(O.start,oe),Ye=O.end===void 0?xe:Math.min(O.end,oe);!V.extend&&xe>Ye&&(S=Ye,Ye=xe,xe=S);var B=my(A,xe),R=my(A,Ye);if(B&&R&&(V.rangeCount!==1||V.anchorNode!==B.node||V.anchorOffset!==B.offset||V.focusNode!==R.node||V.focusOffset!==R.offset)){var z=K.createRange();z.setStart(B.node,B.offset),V.removeAllRanges(),xe>Ye?(V.addRange(z),V.extend(R.node,R.offset)):(z.setEnd(R.node,R.offset),V.addRange(z))}}}}for(K=[],V=A;V=V.parentNode;)V.nodeType===1&&K.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<K.length;A++){var Y=K[A];Y.element.scrollLeft=Y.left,Y.element.scrollTop=Y.top}}tc=!!ip,np=ip=null}finally{qe=m,X.p=f,P.T=u}}s.current=l,St=2}}function Db(){if(St===2){St=0;var s=pr,l=nl,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=P.T,P.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{lb(s,l.alternate,l)}finally{qe=m,X.p=f,P.T=u}}St=3}}function jb(){if(St===4||St===3){St=0,JA();var s=pr,l=nl,u=qn,f=bb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?St=5:(St=0,nl=pr=null,Lb(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(dr=null),uf(u),l=l.stateNode,pi&&typeof pi.onCommitFiberRoot=="function")try{pi.onCommitFiberRoot(Yl,l,void 0,(l.current.flags&128)===128)}catch{}if(f!==null){l=P.T,m=X.p,X.p=2,P.T=null;try{for(var y=s.onRecoverableError,S=0;S<f.length;S++){var A=f[S];y(A.value,{componentStack:A.stack})}}finally{P.T=l,X.p=m}}(qn&3)!==0&&Vu(),an(s),m=s.pendingLanes,(u&261930)!==0&&(m&42)!==0?s===Vd?Oa++:(Oa=0,Vd=s):Oa=0,Ea(0)}}function Lb(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,ua(l)))}function Vu(){return Rb(),Db(),jb(),Bb()}function Bb(){if(St!==5)return!1;var s=pr,l=Pd;Pd=0;var u=uf(qn),f=P.T,m=X.p;try{X.p=32>u?32:u,P.T=null,u=Fd,Fd=null;var y=pr,S=qn;if(St=0,nl=pr=null,qn=0,(qe&6)!==0)throw Error(n(331));var A=qe;if(qe|=4,gb(y.current),db(y,y.current,S,u),qe=A,Ea(0,!1),pi&&typeof pi.onPostCommitFiberRoot=="function")try{pi.onPostCommitFiberRoot(Yl,y)}catch{}return!0}finally{X.p=m,P.T=f,Lb(s,l)}}function zb(s,l,u){l=Ri(u,l),l=Sd(s.stateNode,l,2),s=ar(s,l,2),s!==null&&(Wl(s,2),an(s))}function Ie(s,l,u){if(s.tag===3)zb(s,s,u);else for(;l!==null;){if(l.tag===3){zb(l,s,u);break}else if(l.tag===1){var f=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(dr===null||!dr.has(f))){s=Ri(u,s),u=_x(2),f=ar(l,u,2),f!==null&&(Hx(u,f,l,s),Wl(f,2),an(f));break}}l=l.return}}function Gd(s,l,u){var f=s.pingCache;if(f===null){f=s.pingCache=new CT;var m=new Set;f.set(l,m)}else m=f.get(l),m===void 0&&(m=new Set,f.set(l,m));m.has(u)||(Hd=!0,m.add(u),s=ET.bind(null,s,l,u),l.then(s,s))}function ET(s,l,u){var f=s.pingCache;f!==null&&f.delete(l),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,We===s&&(De&u)===u&&(lt===4||lt===3&&(De&62914560)===De&&300>di()-_u?(qe&2)===0&&rl(s,0):Ud|=u,il===De&&(il=0)),an(s)}function _b(s,l){l===0&&(l=R0()),s=Wr(s,l),s!==null&&(Wl(s,l),an(s))}function NT(s){var l=s.memoizedState,u=0;l!==null&&(u=l.retryLane),_b(s,u)}function RT(s,l){var u=0;switch(s.tag){case 31:case 13:var f=s.stateNode,m=s.memoizedState;m!==null&&(u=m.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(l),_b(s,u)}function DT(s,l){return sf(s,l)}var Iu=null,ll=null,Yd=!1,Qu=!1,Kd=!1,gr=0;function an(s){s!==ll&&s.next===null&&(ll===null?Iu=ll=s:ll=ll.next=s),Qu=!0,Yd||(Yd=!0,LT())}function Ea(s,l){if(!Kd&&Qu){Kd=!0;do for(var u=!1,f=Iu;f!==null;){if(s!==0){var m=f.pendingLanes;if(m===0)var y=0;else{var S=f.suspendedLanes,A=f.pingedLanes;y=(1<<31-mi(42|s)+1)-1,y&=m&~(S&~A),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(u=!0,Pb(f,y))}else y=De,y=Wo(f,f===We?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||Kl(f,y)||(u=!0,Pb(f,y));f=f.next}while(u);Kd=!1}}function jT(){Hb()}function Hb(){Qu=Yd=!1;var s=0;gr!==0&&IT()&&(s=gr);for(var l=di(),u=null,f=Iu;f!==null;){var m=f.next,y=Ub(f,l);y===0?(f.next=null,u===null?Iu=m:u.next=m,m===null&&(ll=u)):(u=f,(s!==0||(y&3)!==0)&&(Qu=!0)),f=m}St!==0&&St!==5||Ea(s),gr!==0&&(gr=0)}function Ub(s,l){for(var u=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var S=31-mi(y),A=1<<S,O=m[S];O===-1?((A&u)===0||(A&f)!==0)&&(m[S]=lM(A,l)):O<=l&&(s.expiredLanes|=A),y&=~A}if(l=We,u=De,u=Wo(s,s===l?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,u===0||s===l&&(Ve===2||Ve===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&lf(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||Kl(s,u)){if(l=u&-u,l===s.callbackPriority)return l;switch(f!==null&&lf(f),uf(u)){case 2:case 8:u=E0;break;case 32:u=Qo;break;case 268435456:u=N0;break;default:u=Qo}return f=qb.bind(null,s),u=sf(u,f),s.callbackPriority=l,s.callbackNode=u,l}return f!==null&&f!==null&&lf(f),s.callbackPriority=2,s.callbackNode=null,2}function qb(s,l){if(St!==0&&St!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Vu()&&s.callbackNode!==u)return null;var f=De;return f=Wo(s,s===We?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(Sb(s,f,l),Ub(s,di()),s.callbackNode!=null&&s.callbackNode===u?qb.bind(null,s):null)}function Pb(s,l){if(Vu())return null;Sb(s,l,!0)}function LT(){GT(function(){(qe&6)!==0?sf(O0,jT):Hb()})}function Wd(){if(gr===0){var s=Qs;s===0&&(s=Go,Go<<=1,(Go&261888)===0&&(Go=256)),gr=s}return gr}function Fb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:$o(""+s)}function Vb(s,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,s.id&&u.setAttribute("form",s.id),l.parentNode.insertBefore(u,l),s=new FormData(s),u.parentNode.removeChild(u),s}function BT(s,l,u,f,m){if(l==="submit"&&u&&u.stateNode===m){var y=Fb((m[$t]||null).action),S=f.submitter;S&&(l=(l=S[$t]||null)?Fb(l.formAction):S.getAttribute("formAction"),l!==null&&(y=l,S=null));var A=new nu("action","action",null,f,m);s.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(gr!==0){var O=S?Vb(m,S):new FormData(m);md(u,{pending:!0,data:O,method:m.method,action:y},null,O)}}else typeof y=="function"&&(A.preventDefault(),O=S?Vb(m,S):new FormData(m),md(u,{pending:!0,data:O,method:m.method,action:y},y,O))},currentTarget:m}]})}}for(var Xd=0;Xd<Df.length;Xd++){var Zd=Df[Xd],zT=Zd.toLowerCase(),_T=Zd[0].toUpperCase()+Zd.slice(1);Gi(zT,"on"+_T)}Gi(vy,"onAnimationEnd"),Gi(Sy,"onAnimationIteration"),Gi(wy,"onAnimationStart"),Gi("dblclick","onDoubleClick"),Gi("focusin","onFocus"),Gi("focusout","onBlur"),Gi($M,"onTransitionRun"),Gi(eT,"onTransitionStart"),Gi(tT,"onTransitionCancel"),Gi(ky,"onTransitionEnd"),Rs("onMouseEnter",["mouseout","mouseover"]),Rs("onMouseLeave",["mouseout","mouseover"]),Rs("onPointerEnter",["pointerout","pointerover"]),Rs("onPointerLeave",["pointerout","pointerover"]),Qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Na="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(" "),HT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Na));function Ib(s,l){l=(l&4)!==0;for(var u=0;u<s.length;u++){var f=s[u],m=f.event;f=f.listeners;e:{var y=void 0;if(l)for(var S=f.length-1;0<=S;S--){var A=f[S],O=A.instance,_=A.currentTarget;if(A=A.listener,O!==y&&m.isPropagationStopped())break e;y=A,m.currentTarget=_;try{y(m)}catch(G){lu(G)}m.currentTarget=null,y=O}else for(S=0;S<f.length;S++){if(A=f[S],O=A.instance,_=A.currentTarget,A=A.listener,O!==y&&m.isPropagationStopped())break e;y=A,m.currentTarget=_;try{y(m)}catch(G){lu(G)}m.currentTarget=null,y=O}}}}function Ne(s,l){var u=l[cf];u===void 0&&(u=l[cf]=new Set);var f=s+"__bubble";u.has(f)||(Qb(l,s,2,!1),u.add(f))}function Jd(s,l,u){var f=0;l&&(f|=4),Qb(u,s,f,l)}var Gu="_reactListening"+Math.random().toString(36).slice(2);function $d(s){if(!s[Gu]){s[Gu]=!0,H0.forEach(function(u){u!=="selectionchange"&&(HT.has(u)||Jd(u,!1,s),Jd(u,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Gu]||(l[Gu]=!0,Jd("selectionchange",!1,l))}}function Qb(s,l,u,f){switch(v1(l)){case 2:var m=fO;break;case 8:m=dO;break;default:m=pp}u=m.bind(null,l,u,s),m=void 0,!bf||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),f?m!==void 0?s.addEventListener(l,u,{capture:!0,passive:m}):s.addEventListener(l,u,!0):m!==void 0?s.addEventListener(l,u,{passive:m}):s.addEventListener(l,u,!1)}function ep(s,l,u,f,m){var y=f;if((l&1)===0&&(l&2)===0&&f!==null)e:for(;;){if(f===null)return;var S=f.tag;if(S===3||S===4){var A=f.stateNode.containerInfo;if(A===m)break;if(S===4)for(S=f.return;S!==null;){var O=S.tag;if((O===3||O===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;A!==null;){if(S=Os(A),S===null)return;if(O=S.tag,O===5||O===6||O===26||O===27){f=y=S;continue e}A=A.parentNode}}f=f.return}X0(function(){var _=y,G=yf(u),K=[];e:{var q=Cy.get(s);if(q!==void 0){var V=nu,oe=s;switch(s){case"keypress":if(tu(u)===0)break e;case"keydown":case"keyup":V=RM;break;case"focusin":oe="focus",V=kf;break;case"focusout":oe="blur",V=kf;break;case"beforeblur":case"afterblur":V=kf;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=$0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=bM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=LM;break;case vy:case Sy:case wy:V=wM;break;case ky:V=zM;break;case"scroll":case"scrollend":V=yM;break;case"wheel":V=HM;break;case"copy":case"cut":case"paste":V=CM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=ty;break;case"toggle":case"beforetoggle":V=qM}var xe=(l&4)!==0,Ye=!xe&&(s==="scroll"||s==="scrollend"),B=xe?q!==null?q+"Capture":null:q;xe=[];for(var R=_,z;R!==null;){var Y=R;if(z=Y.stateNode,Y=Y.tag,Y!==5&&Y!==26&&Y!==27||z===null||B===null||(Y=Jl(R,B),Y!=null&&xe.push(Ra(R,Y,z))),Ye)break;R=R.return}0<xe.length&&(q=new V(q,oe,null,u,G),K.push({event:q,listeners:xe}))}}if((l&7)===0){e:{if(q=s==="mouseover"||s==="pointerover",V=s==="mouseout"||s==="pointerout",q&&u!==gf&&(oe=u.relatedTarget||u.fromElement)&&(Os(oe)||oe[Ts]))break e;if((V||q)&&(q=G.window===G?G:(q=G.ownerDocument)?q.defaultView||q.parentWindow:window,V?(oe=u.relatedTarget||u.toElement,V=_,oe=oe?Os(oe):null,oe!==null&&(Ye=a(oe),xe=oe.tag,oe!==Ye||xe!==5&&xe!==27&&xe!==6)&&(oe=null)):(V=null,oe=_),V!==oe)){if(xe=$0,Y="onMouseLeave",B="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(xe=ty,Y="onPointerLeave",B="onPointerEnter",R="pointer"),Ye=V==null?q:Zl(V),z=oe==null?q:Zl(oe),q=new xe(Y,R+"leave",V,u,G),q.target=Ye,q.relatedTarget=z,Y=null,Os(G)===_&&(xe=new xe(B,R+"enter",oe,u,G),xe.target=z,xe.relatedTarget=Ye,Y=xe),Ye=Y,V&&oe)t:{for(xe=UT,B=V,R=oe,z=0,Y=B;Y;Y=xe(Y))z++;Y=0;for(var me=R;me;me=xe(me))Y++;for(;0<z-Y;)B=xe(B),z--;for(;0<Y-z;)R=xe(R),Y--;for(;z--;){if(B===R||R!==null&&B===R.alternate){xe=B;break t}B=xe(B),R=xe(R)}xe=null}else xe=null;V!==null&&Gb(K,q,V,xe,!1),oe!==null&&Ye!==null&&Gb(K,Ye,oe,xe,!0)}}e:{if(q=_?Zl(_):window,V=q.nodeName&&q.nodeName.toLowerCase(),V==="select"||V==="input"&&q.type==="file")var _e=uy;else if(ay(q))if(cy)_e=XM;else{_e=KM;var he=YM}else V=q.nodeName,!V||V.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?_&&mf(_.elementType)&&(_e=uy):_e=WM;if(_e&&(_e=_e(s,_))){oy(K,_e,u,G);break e}he&&he(s,q,_),s==="focusout"&&_&&q.type==="number"&&_.memoizedProps.value!=null&&pf(q,"number",q.value)}switch(he=_?Zl(_):window,s){case"focusin":(ay(he)||he.contentEditable==="true")&&(_s=he,Ef=_,la=null);break;case"focusout":la=Ef=_s=null;break;case"mousedown":Nf=!0;break;case"contextmenu":case"mouseup":case"dragend":Nf=!1,xy(K,u,G);break;case"selectionchange":if(JM)break;case"keydown":case"keyup":xy(K,u,G)}var Ae;if(Af)e:{switch(s){case"compositionstart":var je="onCompositionStart";break e;case"compositionend":je="onCompositionEnd";break e;case"compositionupdate":je="onCompositionUpdate";break e}je=void 0}else zs?sy(s,u)&&(je="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(je="onCompositionStart");je&&(iy&&u.locale!=="ko"&&(zs||je!=="onCompositionStart"?je==="onCompositionEnd"&&zs&&(Ae=Z0()):(er=G,vf="value"in er?er.value:er.textContent,zs=!0)),he=Yu(_,je),0<he.length&&(je=new ey(je,s,null,u,G),K.push({event:je,listeners:he}),Ae?je.data=Ae:(Ae=ly(u),Ae!==null&&(je.data=Ae)))),(Ae=FM?VM(s,u):IM(s,u))&&(je=Yu(_,"onBeforeInput"),0<je.length&&(he=new ey("onBeforeInput","beforeinput",null,u,G),K.push({event:he,listeners:je}),he.data=Ae)),BT(K,s,_,u,G)}Ib(K,l)})}function Ra(s,l,u){return{instance:s,listener:l,currentTarget:u}}function Yu(s,l){for(var u=l+"Capture",f=[];s!==null;){var m=s,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Jl(s,u),m!=null&&f.unshift(Ra(s,m,y)),m=Jl(s,l),m!=null&&f.push(Ra(s,m,y))),s.tag===3)return f;s=s.return}return[]}function UT(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Gb(s,l,u,f,m){for(var y=l._reactName,S=[];u!==null&&u!==f;){var A=u,O=A.alternate,_=A.stateNode;if(A=A.tag,O!==null&&O===f)break;A!==5&&A!==26&&A!==27||_===null||(O=_,m?(_=Jl(u,y),_!=null&&S.unshift(Ra(u,_,O))):m||(_=Jl(u,y),_!=null&&S.push(Ra(u,_,O)))),u=u.return}S.length!==0&&s.push({event:l,listeners:S})}var qT=/\r\n?/g,PT=/\u0000|\uFFFD/g;function Yb(s){return(typeof s=="string"?s:""+s).replace(qT,`
9
+ `).replace(PT,"")}function Kb(s,l){return l=Yb(l),Yb(s)===l}function Ge(s,l,u,f,m,y){switch(u){case"children":typeof f=="string"?l==="body"||l==="textarea"&&f===""||js(s,f):(typeof f=="number"||typeof f=="bigint")&&l!=="body"&&js(s,""+f);break;case"className":Zo(s,"class",f);break;case"tabIndex":Zo(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Zo(s,u,f);break;case"style":K0(s,f,y);break;case"data":if(l!=="object"){Zo(s,"data",f);break}case"src":case"href":if(f===""&&(l!=="a"||u!=="href")){s.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=$o(""+f),s.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(u,"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 y=="function"&&(u==="formAction"?(l!=="input"&&Ge(s,l,"name",m.name,m,null),Ge(s,l,"formEncType",m.formEncType,m,null),Ge(s,l,"formMethod",m.formMethod,m,null),Ge(s,l,"formTarget",m.formTarget,m,null)):(Ge(s,l,"encType",m.encType,m,null),Ge(s,l,"method",m.method,m,null),Ge(s,l,"target",m.target,m,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=$o(""+f),s.setAttribute(u,f);break;case"onClick":f!=null&&(s.onclick=An);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}u=$o(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""+f):s.removeAttribute(u);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":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":f===!0?s.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,f):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(u,f):s.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(u):s.setAttribute(u,f);break;case"popover":Ne("beforetoggle",s),Ne("toggle",s),Xo(s,"popover",f);break;case"xlinkActuate":Cn(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Cn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Cn(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Cn(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Cn(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Cn(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Cn(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Cn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Cn(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Xo(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=mM.get(u)||u,Xo(s,u,f))}}function tp(s,l,u,f,m,y){switch(u){case"style":K0(s,f,y);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"children":typeof f=="string"?js(s,f):(typeof f=="number"||typeof f=="bigint")&&js(s,""+f);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"onClick":f!=null&&(s.onclick=An);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!U0.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(m=u.endsWith("Capture"),l=u.slice(2,m?u.length-7:void 0),y=s[$t]||null,y=y!=null?y[u]:null,typeof y=="function"&&s.removeEventListener(l,y,m),typeof f=="function")){typeof y!="function"&&y!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(l,f,m);break e}u in s?s[u]=f:f===!0?s.setAttribute(u,""):Xo(s,u,f)}}}function Bt(s,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",s),Ne("load",s);var f=!1,m=!1,y;for(y in u)if(u.hasOwnProperty(y)){var S=u[y];if(S!=null)switch(y){case"src":f=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,y,S,u,null)}}m&&Ge(s,l,"srcSet",u.srcSet,u,null),f&&Ge(s,l,"src",u.src,u,null);return;case"input":Ne("invalid",s);var A=y=S=m=null,O=null,_=null;for(f in u)if(u.hasOwnProperty(f)){var G=u[f];if(G!=null)switch(f){case"name":m=G;break;case"type":S=G;break;case"checked":O=G;break;case"defaultChecked":_=G;break;case"value":y=G;break;case"defaultValue":A=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(n(137,l));break;default:Ge(s,l,f,G,u,null)}}I0(s,y,A,O,_,S,m,!1);return;case"select":Ne("invalid",s),f=S=y=null;for(m in u)if(u.hasOwnProperty(m)&&(A=u[m],A!=null))switch(m){case"value":y=A;break;case"defaultValue":S=A;break;case"multiple":f=A;default:Ge(s,l,m,A,u,null)}l=y,u=S,s.multiple=!!f,l!=null?Ds(s,!!f,l,!1):u!=null&&Ds(s,!!f,u,!0);return;case"textarea":Ne("invalid",s),y=m=f=null;for(S in u)if(u.hasOwnProperty(S)&&(A=u[S],A!=null))switch(S){case"value":f=A;break;case"defaultValue":m=A;break;case"children":y=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:Ge(s,l,S,A,u,null)}G0(s,f,m,y);return;case"option":for(O in u)u.hasOwnProperty(O)&&(f=u[O],f!=null)&&(O==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":Ge(s,l,O,f,u,null));return;case"dialog":Ne("beforetoggle",s),Ne("toggle",s),Ne("cancel",s),Ne("close",s);break;case"iframe":case"object":Ne("load",s);break;case"video":case"audio":for(f=0;f<Na.length;f++)Ne(Na[f],s);break;case"image":Ne("error",s),Ne("load",s);break;case"details":Ne("toggle",s);break;case"embed":case"source":case"link":Ne("error",s),Ne("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(_ in u)if(u.hasOwnProperty(_)&&(f=u[_],f!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,_,f,u,null)}return;default:if(mf(l)){for(G in u)u.hasOwnProperty(G)&&(f=u[G],f!==void 0&&tp(s,l,G,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Ge(s,l,A,f,u,null))}function FT(s,l,u,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,S=null,A=null,O=null,_=null,G=null;for(V in u){var K=u[V];if(u.hasOwnProperty(V)&&K!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":O=K;default:f.hasOwnProperty(V)||Ge(s,l,V,null,f,K)}}for(var q in f){var V=f[q];if(K=u[q],f.hasOwnProperty(q)&&(V!=null||K!=null))switch(q){case"type":y=V;break;case"name":m=V;break;case"checked":_=V;break;case"defaultChecked":G=V;break;case"value":S=V;break;case"defaultValue":A=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(n(137,l));break;default:V!==K&&Ge(s,l,q,V,f,K)}}df(s,S,A,O,_,G,y,m);return;case"select":V=S=A=q=null;for(y in u)if(O=u[y],u.hasOwnProperty(y)&&O!=null)switch(y){case"value":break;case"multiple":V=O;default:f.hasOwnProperty(y)||Ge(s,l,y,null,f,O)}for(m in f)if(y=f[m],O=u[m],f.hasOwnProperty(m)&&(y!=null||O!=null))switch(m){case"value":q=y;break;case"defaultValue":A=y;break;case"multiple":S=y;default:y!==O&&Ge(s,l,m,y,f,O)}l=A,u=S,f=V,q!=null?Ds(s,!!u,q,!1):!!f!=!!u&&(l!=null?Ds(s,!!u,l,!0):Ds(s,!!u,u?[]:"",!1));return;case"textarea":V=q=null;for(A in u)if(m=u[A],u.hasOwnProperty(A)&&m!=null&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ge(s,l,A,null,f,m)}for(S in f)if(m=f[S],y=u[S],f.hasOwnProperty(S)&&(m!=null||y!=null))switch(S){case"value":q=m;break;case"defaultValue":V=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==y&&Ge(s,l,S,m,f,y)}Q0(s,q,V);return;case"option":for(var oe in u)q=u[oe],u.hasOwnProperty(oe)&&q!=null&&!f.hasOwnProperty(oe)&&(oe==="selected"?s.selected=!1:Ge(s,l,oe,null,f,q));for(O in f)q=f[O],V=u[O],f.hasOwnProperty(O)&&q!==V&&(q!=null||V!=null)&&(O==="selected"?s.selected=q&&typeof q!="function"&&typeof q!="symbol":Ge(s,l,O,q,f,V));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 xe in u)q=u[xe],u.hasOwnProperty(xe)&&q!=null&&!f.hasOwnProperty(xe)&&Ge(s,l,xe,null,f,q);for(_ in f)if(q=f[_],V=u[_],f.hasOwnProperty(_)&&q!==V&&(q!=null||V!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(n(137,l));break;default:Ge(s,l,_,q,f,V)}return;default:if(mf(l)){for(var Ye in u)q=u[Ye],u.hasOwnProperty(Ye)&&q!==void 0&&!f.hasOwnProperty(Ye)&&tp(s,l,Ye,void 0,f,q);for(G in f)q=f[G],V=u[G],!f.hasOwnProperty(G)||q===V||q===void 0&&V===void 0||tp(s,l,G,q,f,V);return}}for(var B in u)q=u[B],u.hasOwnProperty(B)&&q!=null&&!f.hasOwnProperty(B)&&Ge(s,l,B,null,f,q);for(K in f)q=f[K],V=u[K],!f.hasOwnProperty(K)||q===V||q==null&&V==null||Ge(s,l,K,q,f,V)}function Wb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var m=u[f],y=m.transferSize,S=m.initiatorType,A=m.duration;if(y&&A&&Wb(S)){for(S=0,A=m.responseEnd,f+=1;f<u.length;f++){var O=u[f],_=O.startTime;if(_>A)break;var G=O.transferSize,K=O.initiatorType;G&&Wb(K)&&(O=O.responseEnd,S+=G*(O<A?1:(A-_)/(O-_)))}if(--f,l+=8*(y+S)/(m.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var ip=null,np=null;function Ku(s){return s.nodeType===9?s:s.ownerDocument}function Xb(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 Zb(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function rp(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var sp=null;function IT(){var s=window.event;return s&&s.type==="popstate"?s===sp?!1:(sp=s,!0):(sp=null,!1)}var Jb=typeof setTimeout=="function"?setTimeout:void 0,QT=typeof clearTimeout=="function"?clearTimeout:void 0,$b=typeof Promise=="function"?Promise:void 0,GT=typeof queueMicrotask=="function"?queueMicrotask:typeof $b<"u"?function(s){return $b.resolve(null).then(s).catch(YT)}:Jb;function YT(s){setTimeout(function(){throw s})}function yr(s){return s==="head"}function e1(s,l){var u=l,f=0;do{var m=u.nextSibling;if(s.removeChild(u),m&&m.nodeType===8)if(u=m.data,u==="/$"||u==="/&"){if(f===0){s.removeChild(m),cl(l);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")Da(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,Da(u);for(var y=u.firstChild;y;){var S=y.nextSibling,A=y.nodeName;y[Xl]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&y.rel.toLowerCase()==="stylesheet"||u.removeChild(y),y=S}}else u==="body"&&Da(s.ownerDocument.body);u=m}while(u);cl(l)}function t1(s,l){var u=s;s=0;do{var f=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=f}while(u)}function lp(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":lp(u),hf(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function KT(s,l,u,f){for(;s.nodeType===1;){var m=u;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[Xl])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(y=s.getAttribute("rel"),y==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(y!==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(y=s.getAttribute("src"),(y!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===y)return s}else return s;if(s=zi(s.nextSibling),s===null)break}return null}function WT(s,l,u){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=zi(s.nextSibling),s===null))return null;return s}function i1(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=zi(s.nextSibling),s===null))return null;return s}function ap(s){return s.data==="$?"||s.data==="$~"}function op(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function XT(s,l){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||u.readyState!=="loading")l();else{var f=function(){l(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function zi(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var up=null;function n1(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(l===0)return zi(s.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}s=s.nextSibling}return null}function r1(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return s;l--}else u!=="/$"&&u!=="/&"||l++}s=s.previousSibling}return null}function s1(s,l,u){switch(l=Ku(u),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function Da(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);hf(s)}var _i=new Map,l1=new Set;function Wu(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Pn=X.d;X.d={f:ZT,r:JT,D:$T,C:eO,L:tO,m:iO,X:rO,S:nO,M:sO};function ZT(){var s=Pn.f(),l=qu();return s||l}function JT(s){var l=Es(s);l!==null&&l.tag===5&&l.type==="form"?kx(l):Pn.r(s)}var al=typeof document>"u"?null:document;function a1(s,l,u){var f=al;if(f&&typeof l=="string"&&l){var m=Ei(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),l1.has(m)||(l1.add(m),s={rel:s,crossOrigin:u,href:l},f.querySelector(m)===null&&(l=f.createElement("link"),Bt(l,"link",s),Mt(l),f.head.appendChild(l)))}}function $T(s){Pn.D(s),a1("dns-prefetch",s,null)}function eO(s,l){Pn.C(s,l),a1("preconnect",s,l)}function tO(s,l,u){Pn.L(s,l,u);var f=al;if(f&&s&&l){var m='link[rel="preload"][as="'+Ei(l)+'"]';l==="image"&&u&&u.imageSrcSet?(m+='[imagesrcset="'+Ei(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(m+='[imagesizes="'+Ei(u.imageSizes)+'"]')):m+='[href="'+Ei(s)+'"]';var y=m;switch(l){case"style":y=ol(s);break;case"script":y=ul(s)}_i.has(y)||(s=g({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:s,as:l},u),_i.set(y,s),f.querySelector(m)!==null||l==="style"&&f.querySelector(ja(y))||l==="script"&&f.querySelector(La(y))||(l=f.createElement("link"),Bt(l,"link",s),Mt(l),f.head.appendChild(l)))}}function iO(s,l){Pn.m(s,l);var u=al;if(u&&s){var f=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+Ei(f)+'"][href="'+Ei(s)+'"]',y=m;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ul(s)}if(!_i.has(y)&&(s=g({rel:"modulepreload",href:s},l),_i.set(y,s),u.querySelector(m)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(La(y)))return}f=u.createElement("link"),Bt(f,"link",s),Mt(f),u.head.appendChild(f)}}}function nO(s,l,u){Pn.S(s,l,u);var f=al;if(f&&s){var m=Ns(f).hoistableStyles,y=ol(s);l=l||"default";var S=m.get(y);if(!S){var A={loading:0,preload:null};if(S=f.querySelector(ja(y)))A.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":l},u),(u=_i.get(y))&&cp(s,u);var O=S=f.createElement("link");Mt(O),Bt(O,"link",s),O._p=new Promise(function(_,G){O.onload=_,O.onerror=G}),O.addEventListener("load",function(){A.loading|=1}),O.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Xu(S,l,f)}S={type:"stylesheet",instance:S,count:1,state:A},m.set(y,S)}}}function rO(s,l){Pn.X(s,l);var u=al;if(u&&s){var f=Ns(u).hoistableScripts,m=ul(s),y=f.get(m);y||(y=u.querySelector(La(m)),y||(s=g({src:s,async:!0},l),(l=_i.get(m))&&hp(s,l),y=u.createElement("script"),Mt(y),Bt(y,"link",s),u.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(m,y))}}function sO(s,l){Pn.M(s,l);var u=al;if(u&&s){var f=Ns(u).hoistableScripts,m=ul(s),y=f.get(m);y||(y=u.querySelector(La(m)),y||(s=g({src:s,async:!0,type:"module"},l),(l=_i.get(m))&&hp(s,l),y=u.createElement("script"),Mt(y),Bt(y,"link",s),u.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(m,y))}}function o1(s,l,u,f){var m=(m=ke.current)?Wu(m):null;if(!m)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=ol(u.href),u=Ns(m).hoistableStyles,f=u.get(l),f||(f={type:"style",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=ol(u.href);var y=Ns(m).hoistableStyles,S=y.get(s);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,S),(y=m.querySelector(ja(s)))&&!y._p&&(S.instance=y,S.state.loading=5),_i.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},_i.set(s,u),y||lO(m,s,u,S.state))),l&&f===null)throw Error(n(528,""));return S}if(l&&f!==null)throw Error(n(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=ul(u),u=Ns(m).hoistableScripts,f=u.get(l),f||(f={type:"script",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function ol(s){return'href="'+Ei(s)+'"'}function ja(s){return'link[rel="stylesheet"]['+s+"]"}function u1(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function lO(s,l,u,f){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?f.loading=1:(l=s.createElement("link"),f.preload=l,l.addEventListener("load",function(){return f.loading|=1}),l.addEventListener("error",function(){return f.loading|=2}),Bt(l,"link",u),Mt(l),s.head.appendChild(l))}function ul(s){return'[src="'+Ei(s)+'"]'}function La(s){return"script[async]"+s}function c1(s,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var f=s.querySelector('style[data-href~="'+Ei(u.href)+'"]');if(f)return l.instance=f,Mt(f),f;var m=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),Mt(f),Bt(f,"style",m),Xu(f,u.precedence,s),l.instance=f;case"stylesheet":m=ol(u.href);var y=s.querySelector(ja(m));if(y)return l.state.loading|=4,l.instance=y,Mt(y),y;f=u1(u),(m=_i.get(m))&&cp(f,m),y=(s.ownerDocument||s).createElement("link"),Mt(y);var S=y;return S._p=new Promise(function(A,O){S.onload=A,S.onerror=O}),Bt(y,"link",f),l.state.loading|=4,Xu(y,u.precedence,s),l.instance=y;case"script":return y=ul(u.src),(m=s.querySelector(La(y)))?(l.instance=m,Mt(m),m):(f=u,(m=_i.get(y))&&(f=g({},u),hp(f,m)),s=s.ownerDocument||s,m=s.createElement("script"),Mt(m),Bt(m,"link",f),s.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(f=l.instance,l.state.loading|=4,Xu(f,u.precedence,s));return l.instance}function Xu(s,l,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=f.length?f[f.length-1]:null,y=m,S=0;S<f.length;S++){var A=f[S];if(A.dataset.precedence===l)y=A;else if(y!==m)break}y?y.parentNode.insertBefore(s,y.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(s,l.firstChild))}function cp(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function hp(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Zu=null;function h1(s,l,u){if(Zu===null){var f=new Map,m=Zu=new Map;m.set(u,f)}else m=Zu,f=m.get(u),f||(f=new Map,m.set(u,f));if(f.has(s))return f;for(f.set(s,null),u=u.getElementsByTagName(s),m=0;m<u.length;m++){var y=u[m];if(!(y[Xl]||y[Rt]||s==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(l)||"";S=s+S;var A=f.get(S);A?A.push(y):f.set(S,[y])}}return f}function f1(s,l,u){s=s.ownerDocument||s,s.head.insertBefore(u,l==="title"?s.querySelector("head > title"):null)}function aO(s,l,u){if(u===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(s=l.disabled,typeof l.precedence=="string"&&s==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function d1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function oO(s,l,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var m=ol(f.href),y=l.querySelector(ja(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Ju.bind(s),l.then(s,s)),u.state.loading|=4,u.instance=y,Mt(y);return}y=l.ownerDocument||l,f=u1(f),(m=_i.get(m))&&cp(f,m),y=y.createElement("link"),Mt(y);var S=y;S._p=new Promise(function(A,O){S.onload=A,S.onerror=O}),Bt(y,"link",f),u.instance=y}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Ju.bind(s),l.addEventListener("load",u),l.addEventListener("error",u))}}var fp=0;function uO(s,l){return s.stylesheets&&s.count===0&&ec(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var f=setTimeout(function(){if(s.stylesheets&&ec(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+l);0<s.imgBytes&&fp===0&&(fp=62500*VT());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&ec(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>fp?50:800)+l);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(m)}}:null}function Ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ec(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var $u=null;function ec(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,$u=new Map,l.forEach(cO,s),$u=null,Ju.call(s))}function cO(s,l){if(!(l.state.loading&4)){var u=$u.get(s);if(u)var f=u.get(null);else{u=new Map,$u.set(s,u);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var S=m[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(u.set(S.dataset.precedence,S),f=S)}f&&u.set(null,f)}m=l.instance,S=m.getAttribute("data-precedence"),y=u.get(S)||f,y===f&&u.set(null,m),u.set(S,m),this.count++,f=Ju.bind(this),m.addEventListener("load",f),m.addEventListener("error",f),y?y.parentNode.insertBefore(m,y.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),l.state.loading|=4}}var Ba={$$typeof:j,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function hO(s,l,u,f,m,y,S,A,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=af(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=af(0),this.hiddenUpdates=af(null),this.identifierPrefix=f,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function p1(s,l,u,f,m,y,S,A,O,_,G,K){return s=new hO(s,l,u,S,O,_,G,K,A),l=1,y===!0&&(l|=24),y=yi(3,null,null,l),s.current=y,y.stateNode=s,l=Qf(),l.refCount++,s.pooledCache=l,l.refCount++,y.memoizedState={element:f,isDehydrated:u,cache:l},Wf(y),s}function m1(s){return s?(s=qs,s):qs}function g1(s,l,u,f,m,y){m=m1(m),f.context===null?f.context=m:f.pendingContext=m,f=lr(l),f.payload={element:u},y=y===void 0?null:y,y!==null&&(f.callback=y),u=ar(s,f,l),u!==null&&(si(u,s,l),da(u,s,l))}function y1(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<l?u:l}}function dp(s,l){y1(s,l),(s=s.alternate)&&y1(s,l)}function x1(s){if(s.tag===13||s.tag===31){var l=Wr(s,67108864);l!==null&&si(l,s,67108864),dp(s,67108864)}}function b1(s){if(s.tag===13||s.tag===31){var l=wi();l=of(l);var u=Wr(s,l);u!==null&&si(u,s,l),dp(s,l)}}var tc=!0;function fO(s,l,u,f){var m=P.T;P.T=null;var y=X.p;try{X.p=2,pp(s,l,u,f)}finally{X.p=y,P.T=m}}function dO(s,l,u,f){var m=P.T;P.T=null;var y=X.p;try{X.p=8,pp(s,l,u,f)}finally{X.p=y,P.T=m}}function pp(s,l,u,f){if(tc){var m=mp(f);if(m===null)ep(s,l,f,ic,u),S1(s,f);else if(mO(m,s,l,u,f))f.stopPropagation();else if(S1(s,f),l&4&&-1<pO.indexOf(s)){for(;m!==null;){var y=Es(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=Ir(y.pendingLanes);if(S!==0){var A=y;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var O=1<<31-mi(S);A.entanglements[1]|=O,S&=~O}an(y),(qe&6)===0&&(Hu=di()+500,Ea(0))}}break;case 31:case 13:A=Wr(y,2),A!==null&&si(A,y,2),qu(),dp(y,2)}if(y=mp(f),y===null&&ep(s,l,f,ic,u),y===m)break;m=y}m!==null&&f.stopPropagation()}else ep(s,l,f,null,u)}}function mp(s){return s=yf(s),gp(s)}var ic=null;function gp(s){if(ic=null,s=Os(s),s!==null){var l=a(s);if(l===null)s=null;else{var u=l.tag;if(u===13){if(s=o(l),s!==null)return s;s=null}else if(u===31){if(s=c(l),s!==null)return s;s=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return ic=s,null}function v1(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($A()){case O0:return 2;case E0:return 8;case Qo:case eM:return 32;case N0:return 268435456;default:return 32}default:return 32}}var yp=!1,xr=null,br=null,vr=null,za=new Map,_a=new Map,Sr=[],pO="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 S1(s,l){switch(s){case"focusin":case"focusout":xr=null;break;case"dragenter":case"dragleave":br=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":za.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":_a.delete(l.pointerId)}}function Ha(s,l,u,f,m,y){return s===null||s.nativeEvent!==y?(s={blockedOn:l,domEventName:u,eventSystemFlags:f,nativeEvent:y,targetContainers:[m]},l!==null&&(l=Es(l),l!==null&&x1(l)),s):(s.eventSystemFlags|=f,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function mO(s,l,u,f,m){switch(l){case"focusin":return xr=Ha(xr,s,l,u,f,m),!0;case"dragenter":return br=Ha(br,s,l,u,f,m),!0;case"mouseover":return vr=Ha(vr,s,l,u,f,m),!0;case"pointerover":var y=m.pointerId;return za.set(y,Ha(za.get(y)||null,s,l,u,f,m)),!0;case"gotpointercapture":return y=m.pointerId,_a.set(y,Ha(_a.get(y)||null,s,l,u,f,m)),!0}return!1}function w1(s){var l=Os(s.target);if(l!==null){var u=a(l);if(u!==null){if(l=u.tag,l===13){if(l=o(u),l!==null){s.blockedOn=l,z0(s.priority,function(){b1(u)});return}}else if(l===31){if(l=c(u),l!==null){s.blockedOn=l,z0(s.priority,function(){b1(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function nc(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var u=mp(s.nativeEvent);if(u===null){u=s.nativeEvent;var f=new u.constructor(u.type,u);gf=f,u.target.dispatchEvent(f),gf=null}else return l=Es(u),l!==null&&x1(l),s.blockedOn=u,!1;l.shift()}return!0}function k1(s,l,u){nc(s)&&u.delete(l)}function gO(){yp=!1,xr!==null&&nc(xr)&&(xr=null),br!==null&&nc(br)&&(br=null),vr!==null&&nc(vr)&&(vr=null),za.forEach(k1),_a.forEach(k1)}function rc(s,l){s.blockedOn===l&&(s.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,gO)))}var sc=null;function C1(s){sc!==s&&(sc=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){sc===s&&(sc=null);for(var l=0;l<s.length;l+=3){var u=s[l],f=s[l+1],m=s[l+2];if(typeof f!="function"){if(gp(f||u)===null)continue;break}var y=Es(u);y!==null&&(s.splice(l,3),l-=3,md(y,{pending:!0,data:m,method:u.method,action:f},f,m))}}))}function cl(s){function l(O){return rc(O,s)}xr!==null&&rc(xr,s),br!==null&&rc(br,s),vr!==null&&rc(vr,s),za.forEach(l),_a.forEach(l);for(var u=0;u<Sr.length;u++){var f=Sr[u];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Sr.length&&(u=Sr[0],u.blockedOn===null);)w1(u),u.blockedOn===null&&Sr.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var m=u[f],y=u[f+1],S=m[$t]||null;if(typeof y=="function")S||C1(u);else if(S){var A=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[$t]||null)A=S.formAction;else if(gp(m)!==null)continue}else A=S.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),C1(u)}}}function A1(){function s(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function xp(s){this._internalRoot=s}lc.prototype.render=xp.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,f=wi();g1(u,f,s,l,null,null)},lc.prototype.unmount=xp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;g1(s.current,2,null,s,null,null),qu(),l[Ts]=null}};function lc(s){this._internalRoot=s}lc.prototype.unstable_scheduleHydration=function(s){if(s){var l=B0();s={blockedOn:null,target:s,priority:l};for(var u=0;u<Sr.length&&l!==0&&l<Sr[u].priority;u++);Sr.splice(u,0,s),u===0&&w1(s)}};var M1=e.version;if(M1!=="19.2.4")throw Error(n(527,M1,"19.2.4"));X.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=d(l),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var yO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ac=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ac.isDisabled&&ac.supportsFiber)try{Yl=ac.inject(yO),pi=ac}catch{}}return qa.createRoot=function(s,l){if(!r(s))throw Error(n(299));var u=!1,f="",m=jx,y=Lx,S=Bx;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(S=l.onRecoverableError)),l=p1(s,1,!1,null,null,u,f,null,m,y,S,A1),s[Ts]=l.current,$d(s),new xp(l)},qa.hydrateRoot=function(s,l,u){if(!r(s))throw Error(n(299));var f=!1,m="",y=jx,S=Lx,A=Bx,O=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(m=u.identifierPrefix),u.onUncaughtError!==void 0&&(y=u.onUncaughtError),u.onCaughtError!==void 0&&(S=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(O=u.formState)),l=p1(s,1,!0,l,u??null,f,m,O,y,S,A,A1),l.context=m1(null),u=l.current,f=wi(),f=of(f),m=lr(f),m.callback=null,ar(u,m,f),u=f,l.current.lanes=u,Wl(l,u),an(l),s[Ts]=l.current,$d(s),new lc(l)},qa.version="19.2.4",qa}var z1;function TO(){if(z1)return Sp.exports;z1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sp.exports=MO(),Sp.exports}var OO=TO();var _1="popstate";function H1(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function EO(t={}){function e(n,r){let a=r.state?.masked,{pathname:o,search:c,hash:h}=a||n.location;return fm("",{pathname:o,search:c,hash:h},r.state&&r.state.usr||null,r.state&&r.state.key||"default",a?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function i(n,r){return typeof r=="string"?r:oo(r)}return RO(e,i,null,t)}function rt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Ji(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function NO(){return Math.random().toString(36).substring(2,10)}function U1(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function fm(t,e,i=null,n,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Hl(e):e,state:i,key:e&&e.key||n||NO(),unstable_mask:r}}function oo({pathname:t="/",search:e="",hash:i=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Hl(t){let e={};if(t){let i=t.indexOf("#");i>=0&&(e.hash=t.substring(i),t=t.substring(0,i));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function RO(t,e,i,n={}){let{window:r=document.defaultView,v5Compat:a=!1}=n,o=r.history,c="POP",h=null,d=p();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function p(){return(o.state||{idx:null}).idx}function g(){c="POP";let C=p(),M=C==null?null:C-d;d=C,h&&h({action:c,location:k.location,delta:M})}function x(C,M){c="PUSH";let T=H1(C)?C:fm(k.location,C,M);d=p()+1;let j=U1(T,d),L=k.createHref(T.unstable_mask||T);try{o.pushState(j,"",L)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;r.location.assign(L)}a&&h&&h({action:c,location:k.location,delta:1})}function v(C,M){c="REPLACE";let T=H1(C)?C:fm(k.location,C,M);d=p();let j=U1(T,d),L=k.createHref(T.unstable_mask||T);o.replaceState(j,"",L),a&&h&&h({action:c,location:k.location,delta:0})}function w(C){return DO(C)}let k={get action(){return c},get location(){return t(r,o)},listen(C){if(h)throw new Error("A history only accepts one active listener");return r.addEventListener(_1,g),h=C,()=>{r.removeEventListener(_1,g),h=null}},createHref(C){return e(r,C)},createURL:w,encodeLocation(C){let M=w(C);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(C){return o.go(C)}};return k}function DO(t,e=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),rt(i,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:oo(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=i+n),new URL(n,i)}function y2(t,e,i="/"){return jO(t,e,i,!1)}function jO(t,e,i,n){let r=typeof e=="string"?Hl(e):e,a=Gn(r.pathname||"/",i);if(a==null)return null;let o=x2(t);LO(o);let c=null;for(let h=0;c==null&&h<o.length;++h){let d=QO(a);c=VO(o[h],d,n)}return c}function x2(t,e=[],i=[],n="",r=!1){let a=(o,c,h=r,d)=>{let p={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&h)return;rt(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let g=xn([n,p.relativePath]),x=i.concat(p);o.children&&o.children.length>0&&(rt(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),x2(o.children,e,x,g,h)),!(o.path==null&&!o.index)&&e.push({path:g,score:PO(g,o.index),routesMeta:x})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))a(o,c);else for(let h of b2(o.path))a(o,c,!0,h)}),e}function b2(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),a=i.replace(/\?$/,"");if(n.length===0)return r?[a,""]:[a];let o=b2(n.join("/")),c=[];return c.push(...o.map(h=>h===""?a:[a,h].join("/"))),r&&c.push(...o),c.map(h=>t.startsWith("/")&&h===""?"/":h)}function LO(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:FO(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}var BO=/^:[\w-]+$/,zO=3,_O=2,HO=1,UO=10,qO=-2,q1=t=>t==="*";function PO(t,e){let i=t.split("/"),n=i.length;return i.some(q1)&&(n+=qO),e&&(n+=_O),i.filter(r=>!q1(r)).reduce((r,a)=>r+(BO.test(a)?zO:a===""?HO:UO),n)}function FO(t,e){return t.length===e.length&&t.slice(0,-1).every((n,r)=>n===e[r])?t[t.length-1]-e[e.length-1]:0}function VO(t,e,i=!1){let{routesMeta:n}=t,r={},a="/",o=[];for(let c=0;c<n.length;++c){let h=n[c],d=c===n.length-1,p=a==="/"?e:e.slice(a.length)||"/",g=Gc({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),x=h.route;if(!g&&d&&i&&!n[n.length-1].route.index&&(g=Gc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!g)return null;Object.assign(r,g.params),o.push({params:r,pathname:xn([a,g.pathname]),pathnameBase:WO(xn([a,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(a=xn([a,g.pathnameBase]))}return o}function Gc(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,n]=IO(t.path,t.caseSensitive,t.end),r=e.match(i);if(!r)return null;let a=r[0],o=a.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((d,{paramName:p,isOptional:g},x)=>{if(p==="*"){let w=c[x]||"";o=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[x];return g&&!v?d[p]=void 0:d[p]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:t}}function IO(t,e=!1,i=!0){Ji(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,h,d,p)=>{if(n.push({paramName:c,isOptional:h!=null}),h){let g=p.charAt(d+o.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function QO(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ji(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Gn(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let i=e.endsWith("/")?e.length-1:e.length,n=t.charAt(i);return n&&n!=="/"?null:t.slice(i)||"/"}var GO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function YO(t,e="/"){let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?Hl(t):t,a;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?a=P1(i.substring(1),"/"):a=P1(i,e)):a=e,{pathname:a,search:XO(n),hash:ZO(r)}}function P1(t,e){let i=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?i.length>1&&i.pop():r!=="."&&i.push(r)}),i.length>1?i.join("/"):"/"}function Ap(t,e,i,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function KO(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function Cg(t){let e=KO(t);return e.map((i,n)=>n===e.length-1?i.pathname:i.pathnameBase)}function Dh(t,e,i,n=!1){let r;typeof t=="string"?r=Hl(t):(r={...t},rt(!r.pathname||!r.pathname.includes("?"),Ap("?","pathname","search",r)),rt(!r.pathname||!r.pathname.includes("#"),Ap("#","pathname","hash",r)),rt(!r.search||!r.search.includes("#"),Ap("#","search","hash",r)));let a=t===""||r.pathname==="",o=a?"/":r.pathname,c;if(o==null)c=i;else{let g=e.length-1;if(!n&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),g-=1;r.pathname=x.join("/")}c=g>=0?e[g]:"/"}let h=YO(r,c),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var xn=t=>t.join("/").replace(/\/\/+/g,"/"),WO=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),XO=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ZO=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,JO=class{constructor(t,e,i,n=!1){this.status=t,this.statusText=e||"",this.internal=n,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function $O(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function eE(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var v2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function S2(t,e){let i=t;if(typeof i!="string"||!GO.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let n=i,r=!1;if(v2)try{let a=new URL(window.location.href),o=i.startsWith("//")?new URL(a.protocol+i):new URL(i),c=Gn(o.pathname,e);o.origin===a.origin&&c!=null?i=c+o.search+o.hash:r=!0}catch{Ji(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:r,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var w2=["POST","PUT","PATCH","DELETE"];new Set(w2);var tE=["GET",...w2];new Set(tE);var Ul=E.createContext(null);Ul.displayName="DataRouter";var jh=E.createContext(null);jh.displayName="DataRouterState";var iE=E.createContext(!1),k2=E.createContext({isTransitioning:!1});k2.displayName="ViewTransition";var nE=E.createContext(new Map);nE.displayName="Fetchers";var rE=E.createContext(null);rE.displayName="Await";var Ti=E.createContext(null);Ti.displayName="Navigation";var jo=E.createContext(null);jo.displayName="Location";var en=E.createContext({outlet:null,matches:[],isDataRoute:!1});en.displayName="Route";var Ag=E.createContext(null);Ag.displayName="RouteError";var C2="REACT_ROUTER_ERROR",sE="REDIRECT",lE="ROUTE_ERROR_RESPONSE";function aE(t){if(t.startsWith(`${C2}:${sE}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function oE(t){if(t.startsWith(`${C2}:${lE}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new JO(e.status,e.statusText,e.data)}catch{}}function uE(t,{relative:e}={}){rt(ql(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:n}=E.useContext(Ti),{hash:r,pathname:a,search:o}=Lo(t,{relative:e}),c=a;return i!=="/"&&(c=a==="/"?i:xn([i,a])),n.createHref({pathname:c,search:o,hash:r})}function ql(){return E.useContext(jo)!=null}function Zn(){return rt(ql(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(jo).location}var A2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function M2(t){E.useContext(Ti).static||E.useLayoutEffect(t)}function T2(){let{isDataRoute:t}=E.useContext(en);return t?CE():cE()}function cE(){rt(ql(),"useNavigate() may be used only in the context of a <Router> component.");let t=E.useContext(Ul),{basename:e,navigator:i}=E.useContext(Ti),{matches:n}=E.useContext(en),{pathname:r}=Zn(),a=JSON.stringify(Cg(n)),o=E.useRef(!1);return M2(()=>{o.current=!0}),E.useCallback((h,d={})=>{if(Ji(o.current,A2),!o.current)return;if(typeof h=="number"){i.go(h);return}let p=Dh(h,JSON.parse(a),r,d.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:xn([e,p.pathname])),(d.replace?i.replace:i.push)(p,d.state,d)},[e,i,a,r,t])}var hE=E.createContext(null);function fE(t){let e=E.useContext(en).outlet;return E.useMemo(()=>e&&E.createElement(hE.Provider,{value:t},e),[e,t])}function Lo(t,{relative:e}={}){let{matches:i}=E.useContext(en),{pathname:n}=Zn(),r=JSON.stringify(Cg(i));return E.useMemo(()=>Dh(t,JSON.parse(r),n,e==="path"),[t,r,n,e])}function dE(t,e){return O2(t,e)}function O2(t,e,i){rt(ql(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=E.useContext(Ti),{matches:r}=E.useContext(en),a=r[r.length-1],o=a?a.params:{},c=a?a.pathname:"/",h=a?a.pathnameBase:"/",d=a&&a.route;{let C=d&&d.path||"";N2(c,!d||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let p=Zn(),g;if(e){let C=typeof e=="string"?Hl(e):e;rt(h==="/"||C.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",v=x;if(h!=="/"){let C=h.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=y2(t,{pathname:v});Ji(d||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ji(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let k=xE(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},o,C.params),pathname:xn([h,n.encodeLocation?n.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:xn([h,n.encodeLocation?n.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,i);return e&&k?E.createElement(jo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function pE(){let t=kE(),e=$O(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:a},"ErrorBoundary")," or"," ",E.createElement("code",{style:a},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),i?E.createElement("pre",{style:r},i):null,o)}var mE=E.createElement(pE,null),E2=class extends E.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const i=oE(t.digest);i&&(t=i)}let e=t!==void 0?E.createElement(en.Provider,{value:this.props.routeContext},E.createElement(Ag.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?E.createElement(gE,{error:t},e):e}};E2.contextType=iE;var Mp=new WeakMap;function gE({children:t,error:e}){let{basename:i}=E.useContext(Ti);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=aE(e.digest);if(n){let r=Mp.get(e);if(r)throw r;let a=S2(n.location,i);if(v2&&!Mp.get(e))if(a.isExternal||n.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:n.replace}));throw Mp.set(e,o),o}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return t}function yE({routeContext:t,match:e,children:i}){let n=E.useContext(Ul);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),E.createElement(en.Provider,{value:t},i)}function xE(t,e=[],i){let n=i?.state;if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let r=t,a=n?.errors;if(a!=null){let p=r.findIndex(g=>g.route.id&&a?.[g.route.id]!==void 0);rt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),r=r.slice(0,Math.min(r.length,p+1))}let o=!1,c=-1;if(i&&n){o=n.renderFallback;for(let p=0;p<r.length;p++){let g=r[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=p),g.route.id){let{loaderData:x,errors:v}=n,w=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||w){i.isStatic&&(o=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let h=i?.onError,d=n&&h?(p,g)=>{h(p,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:eE(n.matches),errorInfo:g})}:void 0;return r.reduceRight((p,g,x)=>{let v,w=!1,k=null,C=null;n&&(v=a&&g.route.id?a[g.route.id]:void 0,k=g.route.errorElement||mE,o&&(c<0&&x===0?(N2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):c===x&&(w=!0,C=g.route.hydrateFallbackElement||null)));let M=e.concat(r.slice(0,x+1)),T=()=>{let j;return v?j=k:w?j=C:g.route.Component?j=E.createElement(g.route.Component,null):g.route.element?j=g.route.element:j=p,E.createElement(yE,{match:g,routeContext:{outlet:p,matches:M,isDataRoute:n!=null},children:j})};return n&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?E.createElement(E2,{location:n.location,revalidation:n.revalidation,component:k,error:v,children:T(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):T()},null)}function Mg(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bE(t){let e=E.useContext(Ul);return rt(e,Mg(t)),e}function vE(t){let e=E.useContext(jh);return rt(e,Mg(t)),e}function SE(t){let e=E.useContext(en);return rt(e,Mg(t)),e}function Tg(t){let e=SE(t),i=e.matches[e.matches.length-1];return rt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function wE(){return Tg("useRouteId")}function kE(){let t=E.useContext(Ag),e=vE("useRouteError"),i=Tg("useRouteError");return t!==void 0?t:e.errors?.[i]}function CE(){let{router:t}=bE("useNavigate"),e=Tg("useNavigate"),i=E.useRef(!1);return M2(()=>{i.current=!0}),E.useCallback(async(r,a={})=>{Ji(i.current,A2),i.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...a}))},[t,e])}var F1={};function N2(t,e,i){!e&&!F1[t]&&(F1[t]=!0,Ji(!1,i))}E.memo(AE);function AE({routes:t,future:e,state:i,isStatic:n,onError:r}){return O2(t,void 0,{state:i,isStatic:n,onError:r})}function ME({to:t,replace:e,state:i,relative:n}){rt(ql(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=E.useContext(Ti);Ji(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=E.useContext(en),{pathname:o}=Zn(),c=T2(),h=Dh(t,Cg(a),o,n==="path"),d=JSON.stringify(h);return E.useEffect(()=>{c(JSON.parse(d),{replace:e,state:i,relative:n})},[c,d,n,e,i]),null}function TE(t){return fE(t.context)}function Lc(t){rt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function OE({basename:t="/",children:e=null,location:i,navigationType:n="POP",navigator:r,static:a=!1,unstable_useTransitions:o}){rt(!ql(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),h=E.useMemo(()=>({basename:c,navigator:r,static:a,unstable_useTransitions:o,future:{}}),[c,r,a,o]);typeof i=="string"&&(i=Hl(i));let{pathname:d="/",search:p="",hash:g="",state:x=null,key:v="default",unstable_mask:w}=i,k=E.useMemo(()=>{let C=Gn(d,c);return C==null?null:{location:{pathname:C,search:p,hash:g,state:x,key:v,unstable_mask:w},navigationType:n}},[c,d,p,g,x,v,n,w]);return Ji(k!=null,`<Router basename="${c}"> is not able to match the URL "${d}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:E.createElement(Ti.Provider,{value:h},E.createElement(jo.Provider,{children:e,value:k}))}function EE({children:t,location:e}){return dE(dm(t),e)}function dm(t,e=[]){let i=[];return E.Children.forEach(t,(n,r)=>{if(!E.isValidElement(n))return;let a=[...e,r];if(n.type===E.Fragment){i.push.apply(i,dm(n.props.children,a));return}rt(n.type===Lc,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),rt(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=dm(n.props.children,a)),i.push(o)}),i}var Bc="get",zc="application/x-www-form-urlencoded";function Lh(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function NE(t){return Lh(t)&&t.tagName.toLowerCase()==="button"}function RE(t){return Lh(t)&&t.tagName.toLowerCase()==="form"}function DE(t){return Lh(t)&&t.tagName.toLowerCase()==="input"}function jE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function LE(t,e){return t.button===0&&(!e||e==="_self")&&!jE(t)}var oc=null;function BE(){if(oc===null)try{new FormData(document.createElement("form"),0),oc=!1}catch{oc=!0}return oc}var zE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Tp(t){return t!=null&&!zE.has(t)?(Ji(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zc}"`),null):t}function _E(t,e){let i,n,r,a,o;if(RE(t)){let c=t.getAttribute("action");n=c?Gn(c,e):null,i=t.getAttribute("method")||Bc,r=Tp(t.getAttribute("enctype"))||zc,a=new FormData(t)}else if(NE(t)||DE(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=t.getAttribute("formaction")||c.getAttribute("action");if(n=h?Gn(h,e):null,i=t.getAttribute("formmethod")||c.getAttribute("method")||Bc,r=Tp(t.getAttribute("formenctype"))||Tp(c.getAttribute("enctype"))||zc,a=new FormData(c,t),!BE()){let{name:d,type:p,value:g}=t;if(p==="image"){let x=d?`${d}.`:"";a.append(`${x}x`,"0"),a.append(`${x}y`,"0")}else d&&a.append(d,g)}}else{if(Lh(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Bc,n=null,r=zc,o=t}return a&&r==="text/plain"&&(o=a,a=void 0),{action:n,method:i.toLowerCase(),encType:r,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Og(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function HE(t,e,i,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${n}`:r.pathname=`${r.pathname}.${n}`:r.pathname==="/"?r.pathname=`_root.${n}`:e&&Gn(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function UE(t,e){if(t.id in e)return e[t.id];try{let i=await import(t.module);return e[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function qE(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function PE(t,e,i){let n=await Promise.all(t.map(async r=>{let a=e.routes[r.route.id];if(a){let o=await UE(a,i);return o.links?o.links():[]}return[]}));return QE(n.flat(1).filter(qE).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function V1(t,e,i,n,r,a){let o=(h,d)=>i[d]?h.route.id!==i[d].route.id:!0,c=(h,d)=>i[d].pathname!==h.pathname||i[d].route.path?.endsWith("*")&&i[d].params["*"]!==h.params["*"];return a==="assets"?e.filter((h,d)=>o(h,d)||c(h,d)):a==="data"?e.filter((h,d)=>{let p=n.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(o(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let g=h.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function FE(t,e,{includeHydrateFallback:i}={}){return VE(t.map(n=>{let r=e.routes[n.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),i&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))}function VE(t){return[...new Set(t)]}function IE(t){let e={},i=Object.keys(t).sort();for(let n of i)e[n]=t[n];return e}function QE(t,e){let i=new Set;return new Set(e),t.reduce((n,r)=>{let a=JSON.stringify(IE(r));return i.has(a)||(i.add(a),n.push({key:a,link:r})),n},[])}function R2(){let t=E.useContext(Ul);return Og(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function GE(){let t=E.useContext(jh);return Og(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Eg=E.createContext(void 0);Eg.displayName="FrameworkContext";function D2(){let t=E.useContext(Eg);return Og(t,"You must render this element inside a <HydratedRouter> element"),t}function YE(t,e){let i=E.useContext(Eg),[n,r]=E.useState(!1),[a,o]=E.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:g}=e,x=E.useRef(null);E.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let k=M=>{M.forEach(T=>{o(T.isIntersecting)})},C=new IntersectionObserver(k,{threshold:.5});return x.current&&C.observe(x.current),()=>{C.disconnect()}}},[t]),E.useEffect(()=>{if(n){let k=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(k)}}},[n]);let v=()=>{r(!0)},w=()=>{r(!1),o(!1)};return i?t!=="intent"?[a,x,{}]:[a,x,{onFocus:Pa(c,v),onBlur:Pa(h,w),onMouseEnter:Pa(d,v),onMouseLeave:Pa(p,w),onTouchStart:Pa(g,v)}]:[!1,x,{}]}function Pa(t,e){return i=>{t&&t(i),i.defaultPrevented||e(i)}}function KE({page:t,...e}){let{router:i}=R2(),n=E.useMemo(()=>y2(i.routes,t,i.basename),[i.routes,t,i.basename]);return n?E.createElement(XE,{page:t,matches:n,...e}):null}function WE(t){let{manifest:e,routeModules:i}=D2(),[n,r]=E.useState([]);return E.useEffect(()=>{let a=!1;return PE(t,e,i).then(o=>{a||r(o)}),()=>{a=!0}},[t,e,i]),n}function XE({page:t,matches:e,...i}){let n=Zn(),{future:r,manifest:a,routeModules:o}=D2(),{basename:c}=R2(),{loaderData:h,matches:d}=GE(),p=E.useMemo(()=>V1(t,e,d,a,n,"data"),[t,e,d,a,n]),g=E.useMemo(()=>V1(t,e,d,a,n,"assets"),[t,e,d,a,n]),x=E.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let k=new Set,C=!1;if(e.forEach(T=>{let j=a.routes[T.route.id];!j||!j.hasLoader||(!p.some(L=>L.route.id===T.route.id)&&T.route.id in h&&o[T.route.id]?.shouldRevalidate||j.hasClientLoader?C=!0:k.add(T.route.id))}),k.size===0)return[];let M=HE(t,c,r.unstable_trailingSlashAwareDataRequests,"data");return C&&k.size>0&&M.searchParams.set("_routes",e.filter(T=>k.has(T.route.id)).map(T=>T.route.id).join(",")),[M.pathname+M.search]},[c,r.unstable_trailingSlashAwareDataRequests,h,n,a,p,e,t,o]),v=E.useMemo(()=>FE(g,a),[g,a]),w=WE(g);return E.createElement(E.Fragment,null,x.map(k=>E.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...i})),v.map(k=>E.createElement("link",{key:k,rel:"modulepreload",href:k,...i})),w.map(({key:k,link:C})=>E.createElement("link",{key:k,nonce:i.nonce,...C,crossOrigin:C.crossOrigin??i.crossOrigin})))}function ZE(...t){return e=>{t.forEach(i=>{typeof i=="function"?i(e):i!=null&&(i.current=e)})}}var JE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{JE&&(window.__reactRouterVersion="7.13.1")}catch{}function $E({basename:t,children:e,unstable_useTransitions:i,window:n}){let r=E.useRef();r.current==null&&(r.current=EO({window:n,v5Compat:!0}));let a=r.current,[o,c]=E.useState({action:a.action,location:a.location}),h=E.useCallback(d=>{i===!1?c(d):E.startTransition(()=>c(d))},[i]);return E.useLayoutEffect(()=>a.listen(h),[a,h]),E.createElement(OE,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:i})}var j2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,L2=E.forwardRef(function({onClick:e,discover:i="render",prefetch:n="none",relative:r,reloadDocument:a,replace:o,unstable_mask:c,state:h,target:d,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...w},k){let{basename:C,navigator:M,unstable_useTransitions:T}=E.useContext(Ti),j=typeof p=="string"&&j2.test(p),L=S2(p,C);p=L.to;let D=uE(p,{relative:r}),U=Zn(),H=null;if(c){let de=Dh(c,[],U.unstable_mask?U.unstable_mask.pathname:"/",!0);C!=="/"&&(de.pathname=de.pathname==="/"?C:xn([C,de.pathname])),H=M.createHref(de)}let[Z,J,ue]=YE(n,w),ae=nN(p,{replace:o,unstable_mask:c,state:h,target:d,preventScrollReset:g,relative:r,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:T});function F(de){e&&e(de),de.defaultPrevented||ae(de)}let ee=!(L.isExternal||a),fe=E.createElement("a",{...w,...ue,href:(ee?H:void 0)||L.absoluteURL||D,onClick:ee?F:e,ref:ZE(k,J),target:d,"data-discover":!j&&i==="render"?"true":void 0});return Z&&!j?E.createElement(E.Fragment,null,fe,E.createElement(KE,{page:D})):fe});L2.displayName="Link";var eN=E.forwardRef(function({"aria-current":e="page",caseSensitive:i=!1,className:n="",end:r=!1,style:a,to:o,viewTransition:c,children:h,...d},p){let g=Lo(o,{relative:d.relative}),x=Zn(),v=E.useContext(jh),{navigator:w,basename:k}=E.useContext(Ti),C=v!=null&&oN(g)&&c===!0,M=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,T=x.pathname,j=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;i||(T=T.toLowerCase(),j=j?j.toLowerCase():null,M=M.toLowerCase()),j&&k&&(j=Gn(j,k)||j);const L=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let D=T===M||!r&&T.startsWith(M)&&T.charAt(L)==="/",U=j!=null&&(j===M||!r&&j.startsWith(M)&&j.charAt(M.length)==="/"),H={isActive:D,isPending:U,isTransitioning:C},Z=D?e:void 0,J;typeof n=="function"?J=n(H):J=[n,D?"active":null,U?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ue=typeof a=="function"?a(H):a;return E.createElement(L2,{...d,"aria-current":Z,className:J,ref:p,style:ue,to:o,viewTransition:c},typeof h=="function"?h(H):h)});eN.displayName="NavLink";var tN=E.forwardRef(({discover:t="render",fetcherKey:e,navigate:i,reloadDocument:n,replace:r,state:a,method:o=Bc,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},w)=>{let{unstable_useTransitions:k}=E.useContext(Ti),C=lN(),M=aN(c,{relative:d}),T=o.toLowerCase()==="get"?"get":"post",j=typeof c=="string"&&j2.test(c),L=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let U=D.nativeEvent.submitter,H=U?.getAttribute("formmethod")||o,Z=()=>C(U||D.currentTarget,{fetcherKey:e,method:H,navigate:i,replace:r,state:a,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&i!==!1?E.startTransition(()=>Z()):Z()};return E.createElement("form",{ref:w,method:T,action:M,onSubmit:n?h:L,...v,"data-discover":!j&&t==="render"?"true":void 0})});tN.displayName="Form";function iN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B2(t){let e=E.useContext(Ul);return rt(e,iN(t)),e}function nN(t,{target:e,replace:i,unstable_mask:n,state:r,preventScrollReset:a,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let p=T2(),g=Zn(),x=Lo(t,{relative:o});return E.useCallback(v=>{if(LE(v,e)){v.preventDefault();let w=i!==void 0?i:oo(g)===oo(x),k=()=>p(t,{replace:w,unstable_mask:n,state:r,preventScrollReset:a,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:h});d?E.startTransition(()=>k()):k()}},[g,p,x,i,n,r,e,t,a,o,c,h,d])}var rN=0,sN=()=>`__${String(++rN)}__`;function lN(){let{router:t}=B2("useSubmit"),{basename:e}=E.useContext(Ti),i=wE(),n=t.fetch,r=t.navigate;return E.useCallback(async(a,o={})=>{let{action:c,method:h,encType:d,formData:p,body:g}=_E(a,e);if(o.navigate===!1){let x=o.fetcherKey||sN();await n(x,i,o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:g,formMethod:o.method||h,formEncType:o.encType||d,flushSync:o.flushSync})}else await r(o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:g,formMethod:o.method||h,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:i,flushSync:o.flushSync,viewTransition:o.viewTransition})},[n,r,e,i])}function aN(t,{relative:e}={}){let{basename:i}=E.useContext(Ti),n=E.useContext(en);rt(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),a={...Lo(t||".",{relative:e})},o=Zn();if(t==null){a.search=o.search;let c=new URLSearchParams(a.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(g=>g).forEach(g=>c.append("index",g));let p=c.toString();a.search=p?`?${p}`:""}}return(!t||t===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(a.pathname=a.pathname==="/"?i:xn([i,a.pathname])),oo(a)}function oN(t,{relative:e}={}){let i=E.useContext(k2);rt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=B2("useViewTransitionState"),r=Lo(t,{relative:e});if(!i.isTransitioning)return!1;let a=Gn(i.currentLocation.pathname,n)||i.currentLocation.pathname,o=Gn(i.nextLocation.pathname,n)||i.nextLocation.pathname;return Gc(r.pathname,o)!=null||Gc(r.pathname,a)!=null}var Pl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},uN={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},cN=class{#e=uN;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},fs=new cN;function hN(t){setTimeout(t,0)}var bs=typeof window>"u"||"Deno"in globalThis;function Kt(){}function fN(t,e){return typeof t=="function"?t(e):t}function pm(t){return typeof t=="number"&&t>=0&&t!==1/0}function z2(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Nr(t,e){return typeof t=="function"?t(e):t}function Hi(t,e){return typeof t=="function"?t(e):t}function I1(t,e){const{type:i="all",exact:n,fetchStatus:r,predicate:a,queryKey:o,stale:c}=t;if(o){if(n){if(e.queryHash!==Ng(o,e.options))return!1}else if(!uo(e.queryKey,o))return!1}if(i!=="all"){const h=e.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||r&&r!==e.state.fetchStatus||a&&!a(e))}function Q1(t,e){const{exact:i,status:n,predicate:r,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(i){if(vs(e.options.mutationKey)!==vs(a))return!1}else if(!uo(e.options.mutationKey,a))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Ng(t,e){return(e?.queryKeyHashFn||vs)(t)}function vs(t){return JSON.stringify(t,(e,i)=>mm(i)?Object.keys(i).sort().reduce((n,r)=>(n[r]=i[r],n),{}):i)}function uo(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(i=>uo(t[i],e[i])):!1}var dN=Object.prototype.hasOwnProperty;function _2(t,e,i=0){if(t===e)return t;if(i>500)return e;const n=G1(t)&&G1(e);if(!n&&!(mm(t)&&mm(e)))return e;const a=(n?t:Object.keys(t)).length,o=n?e:Object.keys(e),c=o.length,h=n?new Array(c):{};let d=0;for(let p=0;p<c;p++){const g=n?p:o[p],x=t[g],v=e[g];if(x===v){h[g]=x,(n?p<a:dN.call(t,g))&&d++;continue}if(x===null||v===null||typeof x!="object"||typeof v!="object"){h[g]=v;continue}const w=_2(x,v,i+1);h[g]=w,w===x&&d++}return a===c&&d===a?t:h}function Yc(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(t[i]!==e[i])return!1;return!0}function G1(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function mm(t){if(!Y1(t))return!1;const e=t.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!Y1(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Y1(t){return Object.prototype.toString.call(t)==="[object Object]"}function pN(t){return new Promise(e=>{fs.setTimeout(e,t)})}function gm(t,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(t,e):i.structuralSharing!==!1?_2(t,e):e}function mN(t,e,i=0){const n=[...t,e];return i&&n.length>i?n.slice(1):n}function gN(t,e,i=0){const n=[e,...t];return i&&n.length>i?n.slice(0,-1):n}var Rg=Symbol();function H2(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Rg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Dg(t,e){return typeof t=="function"?t(...e):!!t}function yN(t,e,i){let n=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),n||(n=!0,r.aborted?i():r.addEventListener("abort",i,{once:!0})),r)}),t}var xN=class extends Pl{#e;#t;#i;constructor(){super(),this.#i=t=>{if(!bs&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#i=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},jg=new xN;function ym(){let t,e;const i=new Promise((r,a)=>{t=r,e=a});i.status="pending",i.catch(()=>{});function n(r){Object.assign(i,r),delete i.resolve,delete i.reject}return i.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},i.reject=r=>{n({status:"rejected",reason:r}),e(r)},i}var bN=hN;function vN(){let t=[],e=0,i=c=>{c()},n=c=>{c()},r=bN;const a=c=>{e?t.push(c):r(()=>{i(c)})},o=()=>{const c=t;t=[],c.length&&r(()=>{n(()=>{c.forEach(h=>{i(h)})})})};return{batch:c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},batchCalls:c=>(...h)=>{a(()=>{c(...h)})},schedule:a,setNotifyFunction:c=>{i=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{r=c}}}var kt=vN(),SN=class extends Pl{#e=!0;#t;#i;constructor(){super(),this.#i=t=>{if(!bs&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#i=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(i=>{i(t)}))}isOnline(){return this.#e}},Kc=new SN;function wN(t){return Math.min(1e3*2**t,3e4)}function U2(t){return(t??"online")==="online"?Kc.isOnline():!0}var xm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function q2(t){let e=!1,i=0,n;const r=ym(),a=()=>r.status!=="pending",o=k=>{if(!a()){const C=new xm(k);x(C),t.onCancel?.(C)}},c=()=>{e=!0},h=()=>{e=!1},d=()=>jg.isFocused()&&(t.networkMode==="always"||Kc.isOnline())&&t.canRun(),p=()=>U2(t.networkMode)&&t.canRun(),g=k=>{a()||(n?.(),r.resolve(k))},x=k=>{a()||(n?.(),r.reject(k))},v=()=>new Promise(k=>{n=C=>{(a()||d())&&k(C)},t.onPause?.()}).then(()=>{n=void 0,a()||t.onContinue?.()}),w=()=>{if(a())return;let k;const C=i===0?t.initialPromise:void 0;try{k=C??t.fn()}catch(M){k=Promise.reject(M)}Promise.resolve(k).then(g).catch(M=>{if(a())return;const T=t.retry??(bs?0:3),j=t.retryDelay??wN,L=typeof j=="function"?j(i,M):j,D=T===!0||typeof T=="number"&&i<T||typeof T=="function"&&T(i,M);if(e||!D){x(M);return}i++,t.onFail?.(i,M),pN(L).then(()=>d()?void 0:v()).then(()=>{e?x(M):w()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(n?.(),r),cancelRetry:c,continueRetry:h,canStart:p,start:()=>(p()?w():v().then(w),r)}}var P2=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pm(this.gcTime)&&(this.#e=fs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(bs?1/0:300*1e3))}clearGcTimeout(){this.#e&&(fs.clearTimeout(this.#e),this.#e=void 0)}},kN=class extends P2{#e;#t;#i;#r;#n;#l;#a;constructor(t){super(),this.#a=!1,this.#l=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#i=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=W1(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#l,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=W1(this.options);e.data!==void 0&&(this.setState(K1(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(t,e){const i=gm(this.state.data,t,this.options);return this.#s({data:i,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),i}setState(t,e){this.#s({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Hi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Rg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Nr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!z2(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(h=>h.options.queryFn);c&&this.setOptions(c.options)}const i=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#a=!0,i.signal)})},r=()=>{const c=H2(this.options,e),d=(()=>{const p={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(p),p})();return this.#a=!1,this.options.persister?this.options.persister(c,d,this):c(d)},o=(()=>{const c={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return n(c),c})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#s({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=q2({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof xm&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),i.abort()},onFail:(c,h)=>{this.#s({type:"failed",failureCount:c,error:h})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const c=await this.#n.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#i.config.onSuccess?.(c,this),this.#i.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof xm){if(c.silent)return this.#n.promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw this.#s({type:"error",error:c}),this.#i.config.onError?.(c,this),this.#i.config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}#s(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...F2(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...K1(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?n:void 0,n;case"error":const r=t.error;return{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),kt.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:t})})}};function F2(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:U2(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function K1(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function W1(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,i=e!==void 0,n=i?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var CN=class extends Pl{constructor(t,e){super(),this.options=e,this.#e=t,this.#s=null,this.#a=ym(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#r=void 0;#n;#l;#a;#s;#m;#f;#d;#u;#c;#o;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),X1(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hi(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),e._defaulted&&!Yc(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const n=this.hasListeners();n&&Z1(this.#t,i,this.options,e)&&this.#h(),this.updateResult(),n&&(this.#t!==i||Hi(this.options.enabled,this.#t)!==Hi(e.enabled,this.#t)||Nr(this.options.staleTime,this.#t)!==Nr(e.staleTime,this.#t))&&this.#g();const r=this.#y();n&&(this.#t!==i||Hi(this.options.enabled,this.#t)!==Hi(e.enabled,this.#t)||r!==this.#o)&&this.#x(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),i=this.createResult(e,t);return MN(this,i)&&(this.#r=i,this.#l=this.options,this.#n=this.#t.state),i}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),e?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),i=this.#e.getQueryCache().build(this.#e,e);return i.fetch().then(()=>this.createResult(i,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#w();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Kt)),e}#g(){this.#v();const t=Nr(this.options.staleTime,this.#t);if(bs||this.#r.isStale||!pm(t))return;const i=z2(this.#r.dataUpdatedAt,t)+1;this.#u=fs.setTimeout(()=>{this.#r.isStale||this.updateResult()},i)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#x(t){this.#S(),this.#o=t,!(bs||Hi(this.options.enabled,this.#t)===!1||!pm(this.#o)||this.#o===0)&&(this.#c=fs.setInterval(()=>{(this.options.refetchIntervalInBackground||jg.isFocused())&&this.#h()},this.#o))}#b(){this.#g(),this.#x(this.#y())}#v(){this.#u&&(fs.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#c&&(fs.clearInterval(this.#c),this.#c=void 0)}createResult(t,e){const i=this.#t,n=this.options,r=this.#r,a=this.#n,o=this.#l,h=t!==i?t.state:this.#i,{state:d}=t;let p={...d},g=!1,x;if(e._optimisticResults){const Z=this.hasListeners(),J=!Z&&X1(t,e),ue=Z&&Z1(t,i,e,n);(J||ue)&&(p={...p,...F2(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:w,status:k}=p;x=p.data;let C=!1;if(e.placeholderData!==void 0&&x===void 0&&k==="pending"){let Z;r?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(Z=r.data,C=!0):Z=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,Z!==void 0&&(k="success",x=gm(r?.data,Z,e),g=!0)}if(e.select&&x!==void 0&&!C)if(r&&x===a?.data&&e.select===this.#m)x=this.#f;else try{this.#m=e.select,x=e.select(x),x=gm(r?.data,x,e),this.#f=x,this.#s=null}catch(Z){this.#s=Z}this.#s&&(v=this.#s,x=this.#f,w=Date.now(),k="error");const M=p.fetchStatus==="fetching",T=k==="pending",j=k==="error",L=T&&M,D=x!==void 0,H={status:k,fetchStatus:p.fetchStatus,isPending:T,isSuccess:k==="success",isError:j,isInitialLoading:L,isLoading:L,data:x,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:M,isRefetching:M&&!T,isLoadingError:j&&!D,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:j&&D,isStale:Lg(t,e),refetch:this.refetch,promise:this.#a,isEnabled:Hi(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Z=H.data!==void 0,J=H.status==="error"&&!Z,ue=ee=>{J?ee.reject(H.error):Z&&ee.resolve(H.data)},ae=()=>{const ee=this.#a=H.promise=ym();ue(ee)},F=this.#a;switch(F.status){case"pending":t.queryHash===i.queryHash&&ue(F);break;case"fulfilled":(J||H.data!==F.value)&&ae();break;case"rejected":(!J||H.error!==F.reason)&&ae();break}}return H}updateResult(){const t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#l=this.options,this.#n.data!==void 0&&(this.#d=this.#t),Yc(e,t))return;this.#r=e;const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!this.#p.size)return!0;const a=new Set(r??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#r).some(o=>{const c=o;return this.#r[c]!==t[c]&&a.has(c)})};this.#k({listeners:i()})}#w(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#i=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function AN(t,e){return Hi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function X1(t,e){return AN(t,e)||t.state.data!==void 0&&bm(t,e,e.refetchOnMount)}function bm(t,e,i){if(Hi(e.enabled,t)!==!1&&Nr(e.staleTime,t)!=="static"){const n=typeof i=="function"?i(t):i;return n==="always"||n!==!1&&Lg(t,e)}return!1}function Z1(t,e,i,n){return(t!==e||Hi(n.enabled,t)===!1)&&(!i.suspense||t.state.status!=="error")&&Lg(t,i)}function Lg(t,e){return Hi(e.enabled,t)!==!1&&t.isStaleByTime(Nr(e.staleTime,t))}function MN(t,e){return!Yc(t.getCurrentResult(),e)}function J1(t){return{onFetch:(e,i)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let p=!1;const g=w=>{yN(w,()=>e.signal,()=>p=!0)},x=H2(e.options,e.fetchOptions),v=async(w,k,C)=>{if(p)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:k,direction:C?"backward":"forward",meta:e.options.meta};return g(U),U})(),j=await x(T),{maxPages:L}=e.options,D=C?gN:mN;return{pages:D(w.pages,j,L),pageParams:D(w.pageParams,k,L)}};if(r&&a.length){const w=r==="backward",k=w?TN:$1,C={pages:a,pageParams:o},M=k(n,C);c=await v(C,M,w)}else{const w=t??a.length;do{const k=h===0?o[0]??n.initialPageParam:$1(n,c);if(h>0&&k==null)break;c=await v(c,k),h++}while(h<w)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i):e.fetchFn=d}}}function $1(t,{pages:e,pageParams:i}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,i[n],i):void 0}function TN(t,{pages:e,pageParams:i}){return e.length>0?t.getPreviousPageParam?.(e[0],e,i[0],i):void 0}var ON=class extends P2{#e;#t;#i;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#i=t.mutationCache,this.#t=[],this.state=t.state||V2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#i.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=q2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#n({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#i.canRun(this)});const n=this.state.status==="pending",r=!this.#r.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:r}),this.#i.config.onMutate&&await this.#i.config.onMutate(t,this,i);const o=await this.options.onMutate?.(t,i);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:r})}const a=await this.#r.start();return await this.#i.config.onSuccess?.(a,t,this.state.context,this,i),await this.options.onSuccess?.(a,t,this.state.context,i),await this.#i.config.onSettled?.(a,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(a,null,t,this.state.context,i),this.#n({type:"success",data:a}),a}catch(a){try{await this.#i.config.onError?.(a,t,this.state.context,this,i)}catch(o){Promise.reject(o)}try{await this.options.onError?.(a,t,this.state.context,i)}catch(o){Promise.reject(o)}try{await this.#i.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,i)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,a,t,this.state.context,i)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:a}),a}finally{this.#i.runNext(this)}}#n(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),kt.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(t)}),this.#i.notify({mutation:this,type:"updated",action:t})})}};function V2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var EN=class extends Pl{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#i=0}#e;#t;#i;build(t,e,i){const n=new ON({client:t,mutationCache:this,mutationId:++this.#i,options:t.defaultMutationOptions(e),state:i});return this.add(n),n}add(t){this.#e.add(t);const e=uc(t);if(typeof e=="string"){const i=this.#t.get(e);i?i.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=uc(t);if(typeof e=="string"){const i=this.#t.get(e);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=uc(t);if(typeof e=="string"){const n=this.#t.get(e)?.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=uc(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){kt.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(i=>Q1(e,i))}findAll(t={}){return this.getAll().filter(e=>Q1(t,e))}notify(t){kt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return kt.batch(()=>Promise.all(t.map(e=>e.continue().catch(Kt))))}};function uc(t){return t.options.scope?.id}var NN=class extends Pl{#e;#t=void 0;#i;#r;constructor(e,i){super(),this.#e=e,this.setOptions(i),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const i=this.options;this.options=this.#e.defaultMutationOptions(e),Yc(this.options,i)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),i?.mutationKey&&this.options.mutationKey&&vs(i.mutationKey)!==vs(this.options.mutationKey)?this.reset():this.#i?.state.status==="pending"&&this.#i.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#i?.removeObserver(this)}onMutationUpdate(e){this.#n(),this.#l(e)}getCurrentResult(){return this.#t}reset(){this.#i?.removeObserver(this),this.#i=void 0,this.#n(),this.#l()}mutate(e,i){return this.#r=i,this.#i?.removeObserver(this),this.#i=this.#e.getMutationCache().build(this.#e,this.options),this.#i.addObserver(this),this.#i.execute(e)}#n(){const e=this.#i?.state??V2();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#l(e){kt.batch(()=>{if(this.#r&&this.hasListeners()){const i=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,i,n,r)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(e.data,null,i,n,r)}catch(a){Promise.reject(a)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,i,n,r)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(void 0,e.error,i,n,r)}catch(a){Promise.reject(a)}}}this.listeners.forEach(i=>{i(this.#t)})})}},RN=class extends Pl{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,i){const n=e.queryKey,r=e.queryHash??Ng(n,e);let a=this.get(r);return a||(a=new kN({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(a)),a}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(i=>I1(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>I1(t,i)):e}notify(t){kt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},DN=class{#e;#t;#i;#r;#n;#l;#a;#s;constructor(t={}){this.#e=t.queryCache||new RN,this.#t=t.mutationCache||new EN,this.#i=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#l=0}mount(){this.#l++,this.#l===1&&(this.#a=jg.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Kc.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#l--,this.#l===0&&(this.#a?.(),this.#a=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),i=this.#e.build(this,e),n=i.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&i.isStaleByTime(Nr(e.staleTime,i))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),a=this.#e.get(n.queryHash)?.state.data,o=fN(e,a);if(o!==void 0)return this.#e.build(this,n).setData(o,{...i,manual:!0})}setQueriesData(t,e,i){return kt.batch(()=>this.#e.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;kt.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=this.#e;return kt.batch(()=>(i.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const i={revert:!0,...e},n=kt.batch(()=>this.#e.findAll(t).map(r=>r.cancel(i)));return Promise.all(n).then(Kt).catch(Kt)}invalidateQueries(t,e={}){return kt.batch(()=>(this.#e.findAll(t).forEach(i=>{i.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const i={...e,cancelRefetch:e.cancelRefetch??!0},n=kt.batch(()=>this.#e.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let a=r.fetch(void 0,i);return i.throwOnError||(a=a.catch(Kt)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Kt)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=this.#e.build(this,e);return i.isStaleByTime(Nr(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Kt).catch(Kt)}fetchInfiniteQuery(t){return t.behavior=J1(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Kt).catch(Kt)}ensureInfiniteQueryData(t){return t.behavior=J1(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Kc.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#i}setDefaultOptions(t){this.#i=t}setQueryDefaults(t,e){this.#r.set(vs(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],i={};return e.forEach(n=>{uo(t,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(t,e){this.#n.set(vs(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],i={};return e.forEach(n=>{uo(t,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#i.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Ng(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Rg&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#i.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},I2=E.createContext(void 0),pt=t=>{const e=E.useContext(I2);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},jN=({client:t,children:e})=>(E.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),b.jsx(I2.Provider,{value:t,children:e})),Q2=E.createContext(!1),LN=()=>E.useContext(Q2);Q2.Provider;function BN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var zN=E.createContext(BN()),_N=()=>E.useContext(zN),HN=(t,e,i)=>{const n=i?.state.error&&typeof t.throwOnError=="function"?Dg(t.throwOnError,[i.state.error,i]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},UN=t=>{E.useEffect(()=>{t.clearReset()},[t])},qN=({result:t,errorResetBoundary:e,throwOnError:i,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Dg(i,[t.error,n])),PN=t=>{if(t.suspense){const i=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>i(n(...r)):i(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},FN=(t,e)=>t.isLoading&&t.isFetching&&!e,VN=(t,e)=>t?.suspense&&e.isPending,ev=(t,e,i)=>e.fetchOptimistic(t).catch(()=>{i.clearReset()});function IN(t,e,i){const n=LN(),r=_N(),a=pt(),o=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const c=a.getQueryCache().get(o.queryHash);o._optimisticResults=n?"isRestoring":"optimistic",PN(o),HN(o,r,c),UN(r);const h=!a.getQueryCache().get(o.queryHash),[d]=E.useState(()=>new e(a,o)),p=d.getOptimisticResult(o),g=!n&&t.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(x=>{const v=g?d.subscribe(kt.batchCalls(x)):Kt;return d.updateResult(),v},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),E.useEffect(()=>{d.setOptions(o)},[o,d]),VN(o,p))throw ev(o,d,r);if(qN({result:p,errorResetBoundary:r,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw p.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,p),o.experimental_prefetchInRender&&!bs&&FN(p,n)&&(h?ev(o,d,r):c?.promise)?.catch(Kt).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?p:d.trackResult(p)}function jr(t,e){return IN(t,CN)}function Nt(t,e){const i=pt(),[n]=E.useState(()=>new NN(i,t));E.useEffect(()=>{n.setOptions(t)},[n,t]);const r=E.useSyncExternalStore(E.useCallback(o=>n.subscribe(kt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=E.useCallback((o,c)=>{n.mutate(o,c).catch(Kt)},[n]);if(r.error&&Dg(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const QN="/api";async function Pe(t,e){const i=await fetch(`${QN}${t}`,{headers:{"Content-Type":"application/json",...e?.headers},...e}),n=await i.json();if(!i.ok)throw new Error(n.error??`Request failed: ${i.status}`);return n.data}const Fe={health:()=>Pe("/health"),projects:{list:()=>Pe("/projects"),create:t=>Pe("/projects",{method:"POST",body:JSON.stringify({name:t})}),getActive:()=>Pe("/projects/active"),switchActive:t=>Pe("/projects/active",{method:"PUT",body:JSON.stringify({projectId:t})}),rename:(t,e)=>Pe(`/projects/${t}`,{method:"PUT",body:JSON.stringify({name:e})}),delete:t=>Pe(`/projects/${t}`,{method:"DELETE"})},specs:{list:()=>Pe("/specs"),upload:(t,e,i)=>Pe("/specs",{method:"POST",body:JSON.stringify({spec:t,name:e,upstreamUrl:i})}),uploadFromUrl:(t,e)=>Pe("/specs/url",{method:"POST",body:JSON.stringify({url:t,name:e})}),update:(t,e)=>Pe(`/specs/${t}`,{method:"PUT",body:JSON.stringify(e)}),toggle:t=>Pe(`/specs/${t}/toggle`,{method:"PUT"}),delete:t=>Pe(`/specs/${t}`,{method:"DELETE"}),reimport:(t,e)=>Pe(`/specs/${t}/reimport`,{method:"POST",body:e?JSON.stringify({spec:e}):"{}"})},endpoints:{list:()=>Pe("/endpoints"),update:(t,e)=>Pe(`/endpoints/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(e)}),bulkUpdate:t=>Pe("/endpoints/bulk",{method:"PUT",body:JSON.stringify(t)})},config:{get:()=>Pe("/config"),update:t=>Pe("/config",{method:"PUT",body:JSON.stringify(t)}),export:()=>Pe("/config/export"),import:t=>Pe("/config/import",{method:"POST",body:JSON.stringify(t)})},logs:{get:(t=100)=>Pe(`/logs?limit=${t}`),clear:()=>Pe("/logs",{method:"DELETE"})},proxy:{status:()=>Pe("/proxy/status"),start:()=>Pe("/proxy/start",{method:"POST"}),stop:()=>Pe("/proxy/stop",{method:"POST"})},presets:{list:()=>Pe("/presets"),create:t=>Pe("/presets",{method:"POST",body:JSON.stringify(t)}),delete:t=>Pe(`/presets/${encodeURIComponent(t)}`,{method:"DELETE"}),apply:t=>Pe(`/presets/${encodeURIComponent(t)}/apply`,{method:"POST"})}};function GN(){return jr({queryKey:["proxyStatus"],queryFn:Fe.proxy.status,refetchInterval:5e3})}function YN(){const t=pt();return Nt({mutationFn:Fe.proxy.start,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}function KN(){const t=pt();return Nt({mutationFn:Fe.proxy.stop,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}const WN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),G2=(...t)=>t.filter((e,i,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===i).join(" ").trim();var XN={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ZN=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...c},h)=>E.createElement("svg",{ref:h,...XN,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:G2("lucide",r),...c},[...o.map(([d,p])=>E.createElement(d,p)),...Array.isArray(a)?a:[a]]));const Te=(t,e)=>{const i=E.forwardRef(({className:n,...r},a)=>E.createElement(ZN,{ref:a,iconNode:e,className:G2(`lucide-${WN(t)}`,n),...r}));return i.displayName=`${t}`,i};const vm=Te("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const Sm=Te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Wc=Te("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const Xc=Te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Bo=Te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Y2=Te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const JN=Te("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const El=Te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const $N=Te("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const e3=Te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const wm=Te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const t3=Te("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const i3=Te("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);const n3=Te("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const r3=Te("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const K2=Te("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const Zc=Te("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const W2=Te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Nl=Te("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const s3=Te("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const l3=Te("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Jc=Te("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const a3=Te("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Bh=Te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const o3=Te("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);const u3=Te("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);const c3=Te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const h3=Te("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const f3=Te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const d3=Te("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const X2=Te("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const p3=Te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Z2=Te("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const m3=Te("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const co=Te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const g3=Te("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const J2=Te("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const y3=Te("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const x3=Te("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);const As=Te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Bg=Te("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function $2(t){var e,i,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=$2(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function b3(){for(var t,e,i=0,n="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=$2(t))&&(n&&(n+=" "),n+=e);return n}const zg="-",v3=t=>{const e=w3(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const c=o.split(zg);return c[0]===""&&c.length!==1&&c.shift(),ew(c,e)||S3(o)},getConflictingClassGroupIds:(o,c)=>{const h=i[o]||[];return c&&n[o]?[...h,...n[o]]:h}}},ew=(t,e)=>{if(t.length===0)return e.classGroupId;const i=t[0],n=e.nextPart.get(i),r=n?ew(t.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const a=t.join(zg);return e.validators.find(({validator:o})=>o(a))?.classGroupId},tv=/^\[(.+)\]$/,S3=t=>{if(tv.test(t)){const e=tv.exec(t)[1],i=e?.substring(0,e.indexOf(":"));if(i)return"arbitrary.."+i}},w3=t=>{const{theme:e,prefix:i}=t,n={nextPart:new Map,validators:[]};return C3(Object.entries(t.classGroups),i).forEach(([a,o])=>{km(o,n,a,e)}),n},km=(t,e,i,n)=>{t.forEach(r=>{if(typeof r=="string"){const a=r===""?e:iv(e,r);a.classGroupId=i;return}if(typeof r=="function"){if(k3(r)){km(r(n),e,i,n);return}e.validators.push({validator:r,classGroupId:i});return}Object.entries(r).forEach(([a,o])=>{km(o,iv(e,a),i,n)})})},iv=(t,e)=>{let i=t;return e.split(zg).forEach(n=>{i.nextPart.has(n)||i.nextPart.set(n,{nextPart:new Map,validators:[]}),i=i.nextPart.get(n)}),i},k3=t=>t.isThemeGetter,C3=(t,e)=>e?t.map(([i,n])=>{const r=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,c])=>[e+o,c])):a);return[i,r]}):t,A3=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=new Map,n=new Map;const r=(a,o)=>{i.set(a,o),e++,e>t&&(e=0,n=i,i=new Map)};return{get(a){let o=i.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return r(a,o),o},set(a,o){i.has(a)?i.set(a,o):r(a,o)}}},tw="!",M3=t=>{const{separator:e,experimentalParseClassName:i}=t,n=e.length===1,r=e[0],a=e.length,o=c=>{const h=[];let d=0,p=0,g;for(let C=0;C<c.length;C++){let M=c[C];if(d===0){if(M===r&&(n||c.slice(C,C+a)===e)){h.push(c.slice(p,C)),p=C+a;continue}if(M==="/"){g=C;continue}}M==="["?d++:M==="]"&&d--}const x=h.length===0?c:c.substring(p),v=x.startsWith(tw),w=v?x.substring(1):x,k=g&&g>p?g-p:void 0;return{modifiers:h,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:k}};return i?c=>i({className:c,parseClassName:o}):o},T3=t=>{if(t.length<=1)return t;const e=[];let i=[];return t.forEach(n=>{n[0]==="["?(e.push(...i.sort(),n),i=[]):i.push(n)}),e.push(...i.sort()),e},O3=t=>({cache:A3(t.cacheSize),parseClassName:M3(t),...v3(t)}),E3=/\s+/,N3=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:r}=e,a=[],o=t.trim().split(E3);let c="";for(let h=o.length-1;h>=0;h-=1){const d=o[h],{modifiers:p,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:v}=i(d);let w=!!v,k=n(w?x.substring(0,v):x);if(!k){if(!w){c=d+(c.length>0?" "+c:c);continue}if(k=n(x),!k){c=d+(c.length>0?" "+c:c);continue}w=!1}const C=T3(p).join(":"),M=g?C+tw:C,T=M+k;if(a.includes(T))continue;a.push(T);const j=r(k,w);for(let L=0;L<j.length;++L){const D=j[L];a.push(M+D)}c=d+(c.length>0?" "+c:c)}return c};function R3(){let t=0,e,i,n="";for(;t<arguments.length;)(e=arguments[t++])&&(i=iw(e))&&(n&&(n+=" "),n+=i);return n}const iw=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=iw(t[n]))&&(i&&(i+=" "),i+=e);return i};function D3(t,...e){let i,n,r,a=o;function o(h){const d=e.reduce((p,g)=>g(p),t());return i=O3(d),n=i.cache.get,r=i.cache.set,a=c,c(h)}function c(h){const d=n(h);if(d)return d;const p=N3(h,i);return r(h,p),p}return function(){return a(R3.apply(null,arguments))}}const tt=t=>{const e=i=>i[t]||[];return e.isThemeGetter=!0,e},nw=/^\[(?:([a-z-]+):)?(.+)\]$/i,j3=/^\d+\/\d+$/,L3=new Set(["px","full","screen"]),B3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,z3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,H3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,U3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fn=t=>Sl(t)||L3.has(t)||j3.test(t),kr=t=>Fl(t,"length",Y3),Sl=t=>!!t&&!Number.isNaN(Number(t)),Op=t=>Fl(t,"number",Sl),Fa=t=>!!t&&Number.isInteger(Number(t)),q3=t=>t.endsWith("%")&&Sl(t.slice(0,-1)),Me=t=>nw.test(t),Cr=t=>B3.test(t),P3=new Set(["length","size","percentage"]),F3=t=>Fl(t,P3,rw),V3=t=>Fl(t,"position",rw),I3=new Set(["image","url"]),Q3=t=>Fl(t,I3,W3),G3=t=>Fl(t,"",K3),Va=()=>!0,Fl=(t,e,i)=>{const n=nw.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):i(n[2]):!1},Y3=t=>z3.test(t)&&!_3.test(t),rw=()=>!1,K3=t=>H3.test(t),W3=t=>U3.test(t),X3=()=>{const t=tt("colors"),e=tt("spacing"),i=tt("blur"),n=tt("brightness"),r=tt("borderColor"),a=tt("borderRadius"),o=tt("borderSpacing"),c=tt("borderWidth"),h=tt("contrast"),d=tt("grayscale"),p=tt("hueRotate"),g=tt("invert"),x=tt("gap"),v=tt("gradientColorStops"),w=tt("gradientColorStopPositions"),k=tt("inset"),C=tt("margin"),M=tt("opacity"),T=tt("padding"),j=tt("saturate"),L=tt("scale"),D=tt("sepia"),U=tt("skew"),H=tt("space"),Z=tt("translate"),J=()=>["auto","contain","none"],ue=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",Me,e],F=()=>[Me,e],ee=()=>["",Fn,kr],fe=()=>["auto",Sl,Me],de=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],P=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Me],ye=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>[Sl,Me];return{cacheSize:500,separator:":",theme:{colors:[Va],spacing:[Fn,kr],blur:["none","",Cr,Me],brightness:N(),borderColor:[t],borderRadius:["none","","full",Cr,Me],borderSpacing:F(),borderWidth:ee(),contrast:N(),grayscale:ce(),hueRotate:N(),invert:ce(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[q3,kr],inset:ae(),margin:ae(),opacity:N(),padding:F(),saturate:N(),scale:N(),sepia:ce(),skew:N(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Me]}],container:["container"],columns:[{columns:[Cr]}],"break-after":[{"break-after":ye()}],"break-before":[{"break-before":ye()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...de(),Me]}],overflow:[{overflow:ue()}],"overflow-x":[{"overflow-x":ue()}],"overflow-y":[{"overflow-y":ue()}],overscroll:[{overscroll:J()}],"overscroll-x":[{"overscroll-x":J()}],"overscroll-y":[{"overscroll-y":J()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Fa,Me]}],basis:[{basis:ae()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Me]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",Fa,Me]}],"grid-cols":[{"grid-cols":[Va]}],"col-start-end":[{col:["auto",{span:["full",Fa,Me]},Me]}],"col-start":[{"col-start":fe()}],"col-end":[{"col-end":fe()}],"grid-rows":[{"grid-rows":[Va]}],"row-start-end":[{row:["auto",{span:[Fa,Me]},Me]}],"row-start":[{"row-start":fe()}],"row-end":[{"row-end":fe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Me]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Me]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Me,e]}],"min-w":[{"min-w":[Me,e,"min","max","fit"]}],"max-w":[{"max-w":[Me,e,"none","full","min","max","fit","prose",{screen:[Cr]},Cr]}],h:[{h:[Me,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Me,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Me,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Me,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cr,kr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Op]}],"font-family":[{font:[Va]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Me]}],"line-clamp":[{"line-clamp":["none",Sl,Op]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fn,Me]}],"list-image":[{"list-image":["none",Me]}],"list-style-type":[{list:["none","disc","decimal",Me]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[M]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...P(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fn,kr]}],"underline-offset":[{"underline-offset":["auto",Fn,Me]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[M]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...de(),V3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",F3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Q3]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[...P(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[M]}],"divide-style":[{divide:P()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...P()]}],"outline-offset":[{"outline-offset":[Fn,Me]}],"outline-w":[{outline:[Fn,kr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[Fn,kr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Cr,G3]}],"shadow-color":[{shadow:[Va]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[n]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Cr,Me]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[M]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Me]}],duration:[{duration:N()}],ease:[{ease:["linear","in","out","in-out",Me]}],delay:[{delay:N()}],animate:[{animate:["none","spin","ping","pulse","bounce",Me]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[Fa,Me]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Me]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fn,kr,Op]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Z3=D3(X3);function Se(...t){return Z3(b3(t))}function J3(){return jr({queryKey:["projects"],queryFn:Fe.projects.list})}function $3(){return jr({queryKey:["activeProject"],queryFn:Fe.projects.getActive,retry:!1})}function eR(){const t=pt();return Nt({mutationFn:e=>Fe.projects.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function tR(){const t=pt();return Nt({mutationFn:e=>Fe.projects.switchActive(e),onSuccess:()=>{t.invalidateQueries()}})}function iR(){const t=pt();return Nt({mutationFn:({id:e,name:i})=>Fe.projects.rename(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]}),t.invalidateQueries({queryKey:["activeProject"]})}})}function nR(){const t=pt();return Nt({mutationFn:e=>Fe.projects.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function rR(){const{data:t}=J3(),{data:e}=$3(),i=eR(),n=tR(),r=nR(),a=iR(),[o,c]=E.useState(!1),[h,d]=E.useState(!1),[p,g]=E.useState(""),[x,v]=E.useState(null),[w,k]=E.useState(""),C=E.useRef(null),M=(D,U)=>{v(D),k(U),d(!1)},T=D=>{w.trim()&&a.mutate({id:D,name:w.trim()},{onSuccess:()=>v(null)})},j=(D,U)=>{confirm(`Delete project "${U}"?`)&&r.mutate(D)};E.useEffect(()=>{function D(U){C.current&&!C.current.contains(U.target)&&(c(!1),d(!1),v(null))}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const L=()=>{p.trim()&&i.mutate(p.trim(),{onSuccess:()=>{g(""),d(!1)}})};return b.jsxs("div",{className:"relative",ref:C,children:[b.jsxs("button",{onClick:()=>c(!o),className:Se("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",o?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[b.jsx(s3,{className:"w-3.5 h-3.5 text-primary opacity-70"}),b.jsx("span",{className:"font-bold truncate max-w-[120px]",children:e?.name??"Select Project"}),b.jsx(Bo,{className:Se("w-3 h-3 text-muted-foreground transition-transform",o&&"rotate-180")})]}),o&&b.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[260px] animate-in fade-in zoom-in-95 duration-200",children:[b.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Switch Project"})}),b.jsx("div",{className:"max-h-[420px] overflow-y-auto px-1.5",children:t?.map(D=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:Se("group flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-all",D.id===e?.id?"bg-primary/10 text-primary font-bold shadow-sm":"text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"),children:[b.jsxs("button",{className:"flex-1 text-left truncate flex items-center gap-2",onClick:()=>{D.id!==e?.id&&(n.mutate(D.id),c(!1))},children:[b.jsx(r3,{className:"w-3.5 h-3.5 opacity-40 shrink-0"}),D.name]}),b.jsx("button",{onClick:U=>{U.stopPropagation(),x===D.id?v(null):M(D.id,D.name)},className:Se("p-1 rounded-md transition-all opacity-0 group-hover:opacity-100",x===D.id?"opacity-100 text-primary bg-primary/10":"text-muted-foreground hover:text-primary hover:bg-primary/10"),title:"Edit project",children:b.jsx(X2,{className:"w-3 h-3"})})]}),x===D.id&&b.jsxs("div",{className:"mx-2 p-3 rounded-xl bg-muted/40 border border-border/40 space-y-3 animate-in slide-in-from-top-2 duration-200 shadow-inner",children:[b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Name"}),b.jsxs("div",{className:"flex gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",value:w,onChange:U=>k(U.target.value),onKeyDown:U=>{U.key==="Enter"&&T(D.id),U.key==="Escape"&&v(null)},className:"flex-1 px-2.5 py-1.5 text-xs font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>T(D.id),disabled:!w.trim(),className:"p-1.5 bg-primary/10 text-primary rounded-lg hover:bg-primary hover:text-primary-foreground transition-all disabled:opacity-40","aria-label":"Confirm rename",children:b.jsx(Xc,{className:"w-3.5 h-3.5"})})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Project ID"}),b.jsx("p",{className:"px-1 text-[10px] font-mono text-muted-foreground/60 truncate",children:D.id})]}),b.jsxs("div",{className:"flex items-center justify-between pt-1",children:[b.jsxs("button",{onClick:()=>{v(null),j(D.id,D.name)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[9px] font-black uppercase tracking-widest text-destructive hover:bg-destructive/10 rounded-lg transition-all border border-transparent hover:border-destructive/20",children:[b.jsx(co,{className:"w-3 h-3"}),"Delete"]}),b.jsx("button",{onClick:()=>v(null),className:"px-3 py-1.5 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]})]},D.id))}),b.jsx("div",{className:"border-t border-border mt-1.5 pt-1.5 px-1.5",children:h?b.jsxs("div",{className:"px-1 py-1 flex gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:p,onChange:D=>g(D.target.value),onKeyDown:D=>{D.key==="Enter"&&L(),D.key==="Escape"&&d(!1)},className:"flex-1 px-2.5 py-1.5 text-xs rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:L,disabled:!p.trim(),className:"px-3 py-1.5 text-xs font-bold rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 shadow-sm",children:"Add"})]}):b.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-primary hover:bg-primary/5 rounded-lg transition-all font-bold",children:[b.jsx(Bh,{className:"w-3.5 h-3.5"}),"New Project"]})})]})]})}function sw(t){return typeof t>"u"||t===null}function sR(t){return typeof t=="object"&&t!==null}function lR(t){return Array.isArray(t)?t:sw(t)?[]:[t]}function aR(t,e){var i,n,r,a;if(e)for(a=Object.keys(e),i=0,n=a.length;i<n;i+=1)r=a[i],t[r]=e[r];return t}function oR(t,e){var i="",n;for(n=0;n<e;n+=1)i+=t;return i}function uR(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}var cR=sw,hR=sR,fR=lR,dR=oR,pR=uR,mR=aR,Ct={isNothing:cR,isObject:hR,toArray:fR,repeat:dR,isNegativeZero:pR,extend:mR};function lw(t,e){var i="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(i+=`
12
+
13
+ `+t.mark.snippet),n+" "+i):n}function ho(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=lw(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ho.prototype=Object.create(Error.prototype);ho.prototype.constructor=ho;ho.prototype.toString=function(e){return this.name+": "+lw(this,e)};var Xt=ho;function Ep(t,e,i,n,r){var a="",o="",c=Math.floor(r/2)-1;return n-e>c&&(a=" ... ",e=n-c+a.length),i-n>c&&(o=" ...",i=n+c-o.length),{str:a+t.slice(e,i).replace(/\t/g,"→")+o,pos:n-e+a.length}}function Np(t,e){return Ct.repeat(" ",e-t.length)+t}function gR(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var i=/\r?\n|\r|\0/g,n=[0],r=[],a,o=-1;a=i.exec(t.buffer);)r.push(a.index),n.push(a.index+a[0].length),t.position<=a.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var c="",h,d,p=Math.min(t.line+e.linesAfter,r.length).toString().length,g=e.maxLength-(e.indent+p+3);for(h=1;h<=e.linesBefore&&!(o-h<0);h++)d=Ep(t.buffer,n[o-h],r[o-h],t.position-(n[o]-n[o-h]),g),c=Ct.repeat(" ",e.indent)+Np((t.line-h+1).toString(),p)+" | "+d.str+`
14
+ `+c;for(d=Ep(t.buffer,n[o],r[o],t.position,g),c+=Ct.repeat(" ",e.indent)+Np((t.line+1).toString(),p)+" | "+d.str+`
15
+ `,c+=Ct.repeat("-",e.indent+p+3+d.pos)+`^
16
+ `,h=1;h<=e.linesAfter&&!(o+h>=r.length);h++)d=Ep(t.buffer,n[o+h],r[o+h],t.position-(n[o]-n[o+h]),g),c+=Ct.repeat(" ",e.indent)+Np((t.line+h+1).toString(),p)+" | "+d.str+`
17
+ `;return c.replace(/\n$/,"")}var yR=gR,xR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],bR=["scalar","sequence","mapping"];function vR(t){var e={};return t!==null&&Object.keys(t).forEach(function(i){t[i].forEach(function(n){e[String(n)]=i})}),e}function SR(t,e){if(e=e||{},Object.keys(e).forEach(function(i){if(xR.indexOf(i)===-1)throw new Xt('Unknown option "'+i+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(i){return i},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=vR(e.styleAliases||null),bR.indexOf(this.kind)===-1)throw new Xt('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}var Ht=SR;function nv(t,e){var i=[];return t[e].forEach(function(n){var r=i.length;i.forEach(function(a,o){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(r=o)}),i[r]=n}),i}function wR(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,i;function n(r){r.multi?(t.multi[r.kind].push(r),t.multi.fallback.push(r)):t[r.kind][r.tag]=t.fallback[r.tag]=r}for(e=0,i=arguments.length;e<i;e+=1)arguments[e].forEach(n);return t}function Cm(t){return this.extend(t)}Cm.prototype.extend=function(e){var i=[],n=[];if(e instanceof Ht)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(i=i.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new Xt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(a){if(!(a instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Xt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Xt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Cm.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=nv(r,"implicit"),r.compiledExplicit=nv(r,"explicit"),r.compiledTypeMap=wR(r.compiledImplicit,r.compiledExplicit),r};var aw=Cm,ow=new Ht("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),uw=new Ht("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),cw=new Ht("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),hw=new aw({explicit:[ow,uw,cw]});function kR(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function CR(){return null}function AR(t){return t===null}var fw=new Ht("tag:yaml.org,2002:null",{kind:"scalar",resolve:kR,construct:CR,predicate:AR,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function MR(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function TR(t){return t==="true"||t==="True"||t==="TRUE"}function OR(t){return Object.prototype.toString.call(t)==="[object Boolean]"}var dw=new Ht("tag:yaml.org,2002:bool",{kind:"scalar",resolve:MR,construct:TR,predicate:OR,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function ER(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function NR(t){return 48<=t&&t<=55}function RR(t){return 48<=t&&t<=57}function DR(t){if(t===null)return!1;var e=t.length,i=0,n=!1,r;if(!e)return!1;if(r=t[i],(r==="-"||r==="+")&&(r=t[++i]),r==="0"){if(i+1===e)return!0;if(r=t[++i],r==="b"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(r!=="0"&&r!=="1")return!1;n=!0}return n&&r!=="_"}if(r==="x"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(!ER(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}if(r==="o"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(!NR(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}}if(r==="_")return!1;for(;i<e;i++)if(r=t[i],r!=="_"){if(!RR(t.charCodeAt(i)))return!1;n=!0}return!(!n||r==="_")}function jR(t){var e=t,i=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(i=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return i*parseInt(e.slice(2),2);if(e[1]==="x")return i*parseInt(e.slice(2),16);if(e[1]==="o")return i*parseInt(e.slice(2),8)}return i*parseInt(e,10)}function LR(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Ct.isNegativeZero(t)}var pw=new Ht("tag:yaml.org,2002:int",{kind:"scalar",resolve:DR,construct:jR,predicate:LR,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),BR=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function zR(t){return!(t===null||!BR.test(t)||t[t.length-1]==="_")}function _R(t){var e,i;return e=t.replace(/_/g,"").toLowerCase(),i=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:i*parseFloat(e,10)}var HR=/^[-+]?[0-9]+e/;function UR(t,e){var i;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ct.isNegativeZero(t))return"-0.0";return i=t.toString(10),HR.test(i)?i.replace("e",".e"):i}function qR(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Ct.isNegativeZero(t))}var mw=new Ht("tag:yaml.org,2002:float",{kind:"scalar",resolve:zR,construct:_R,predicate:qR,represent:UR,defaultStyle:"lowercase"}),gw=hw.extend({implicit:[fw,dw,pw,mw]}),yw=gw,xw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),bw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function PR(t){return t===null?!1:xw.exec(t)!==null||bw.exec(t)!==null}function FR(t){var e,i,n,r,a,o,c,h=0,d=null,p,g,x;if(e=xw.exec(t),e===null&&(e=bw.exec(t)),e===null)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,r=+e[3],!e[4])return new Date(Date.UTC(i,n,r));if(a=+e[4],o=+e[5],c=+e[6],e[7]){for(h=e[7].slice(0,3);h.length<3;)h+="0";h=+h}return e[9]&&(p=+e[10],g=+(e[11]||0),d=(p*60+g)*6e4,e[9]==="-"&&(d=-d)),x=new Date(Date.UTC(i,n,r,a,o,c,h)),d&&x.setTime(x.getTime()-d),x}function VR(t){return t.toISOString()}var vw=new Ht("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:PR,construct:FR,instanceOf:Date,represent:VR});function IR(t){return t==="<<"||t===null}var Sw=new Ht("tag:yaml.org,2002:merge",{kind:"scalar",resolve:IR}),_g=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
18
+ \r`;function QR(t){if(t===null)return!1;var e,i,n=0,r=t.length,a=_g;for(i=0;i<r;i++)if(e=a.indexOf(t.charAt(i)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function GR(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,a=_g,o=0,c=[];for(e=0;e<r;e++)e%4===0&&e&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|a.indexOf(n.charAt(e));return i=r%4*6,i===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):i===18?(c.push(o>>10&255),c.push(o>>2&255)):i===12&&c.push(o>>4&255),new Uint8Array(c)}function YR(t){var e="",i=0,n,r,a=t.length,o=_g;for(n=0;n<a;n++)n%3===0&&n&&(e+=o[i>>18&63],e+=o[i>>12&63],e+=o[i>>6&63],e+=o[i&63]),i=(i<<8)+t[n];return r=a%3,r===0?(e+=o[i>>18&63],e+=o[i>>12&63],e+=o[i>>6&63],e+=o[i&63]):r===2?(e+=o[i>>10&63],e+=o[i>>4&63],e+=o[i<<2&63],e+=o[64]):r===1&&(e+=o[i>>2&63],e+=o[i<<4&63],e+=o[64],e+=o[64]),e}function KR(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var ww=new Ht("tag:yaml.org,2002:binary",{kind:"scalar",resolve:QR,construct:GR,predicate:KR,represent:YR}),WR=Object.prototype.hasOwnProperty,XR=Object.prototype.toString;function ZR(t){if(t===null)return!0;var e=[],i,n,r,a,o,c=t;for(i=0,n=c.length;i<n;i+=1){if(r=c[i],o=!1,XR.call(r)!=="[object Object]")return!1;for(a in r)if(WR.call(r,a))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(a)===-1)e.push(a);else return!1}return!0}function JR(t){return t!==null?t:[]}var kw=new Ht("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ZR,construct:JR}),$R=Object.prototype.toString;function eD(t){if(t===null)return!0;var e,i,n,r,a,o=t;for(a=new Array(o.length),e=0,i=o.length;e<i;e+=1){if(n=o[e],$R.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;a[e]=[r[0],n[r[0]]]}return!0}function tD(t){if(t===null)return[];var e,i,n,r,a,o=t;for(a=new Array(o.length),e=0,i=o.length;e<i;e+=1)n=o[e],r=Object.keys(n),a[e]=[r[0],n[r[0]]];return a}var Cw=new Ht("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:eD,construct:tD}),iD=Object.prototype.hasOwnProperty;function nD(t){if(t===null)return!0;var e,i=t;for(e in i)if(iD.call(i,e)&&i[e]!==null)return!1;return!0}function rD(t){return t!==null?t:{}}var Aw=new Ht("tag:yaml.org,2002:set",{kind:"mapping",resolve:nD,construct:rD}),Hg=yw.extend({implicit:[vw,Sw],explicit:[ww,kw,Cw,Aw]}),Lr=Object.prototype.hasOwnProperty,$c=1,Mw=2,Tw=3,eh=4,Rp=1,sD=2,rv=3,lD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,aD=/[\x85\u2028\u2029]/,oD=/[,\[\]\{\}]/,Ow=/^(?:!|!!|![a-z\-]+!)$/i,Ew=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function sv(t){return Object.prototype.toString.call(t)}function bn(t){return t===10||t===13}function gs(t){return t===9||t===32}function ui(t){return t===9||t===32||t===10||t===13}function ml(t){return t===44||t===91||t===93||t===123||t===125}function uD(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function cD(t){return t===120?2:t===117?4:t===85?8:0}function hD(t){return 48<=t&&t<=57?t-48:-1}function lv(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
19
+ `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}function fD(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function Nw(t,e,i){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[e]=i}var Rw=new Array(256),Dw=new Array(256);for(var hl=0;hl<256;hl++)Rw[hl]=lv(hl)?1:0,Dw[hl]=lv(hl);function dD(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Hg,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function jw(t,e){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=yR(i),new Xt(e,i)}function pe(t,e){throw jw(t,e)}function th(t,e){t.onWarning&&t.onWarning.call(null,jw(t,e))}var av={YAML:function(e,i,n){var r,a,o;e.version!==null&&pe(e,"duplication of %YAML directive"),n.length!==1&&pe(e,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&pe(e,"ill-formed argument of the YAML directive"),a=parseInt(r[1],10),o=parseInt(r[2],10),a!==1&&pe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&th(e,"unsupported YAML version of the document")},TAG:function(e,i,n){var r,a;n.length!==2&&pe(e,"TAG directive accepts exactly two arguments"),r=n[0],a=n[1],Ow.test(r)||pe(e,"ill-formed tag handle (first argument) of the TAG directive"),Lr.call(e.tagMap,r)&&pe(e,'there is a previously declared suffix for "'+r+'" tag handle'),Ew.test(a)||pe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{pe(e,"tag prefix is malformed: "+a)}e.tagMap[r]=a}};function Rr(t,e,i,n){var r,a,o,c;if(e<i){if(c=t.input.slice(e,i),n)for(r=0,a=c.length;r<a;r+=1)o=c.charCodeAt(r),o===9||32<=o&&o<=1114111||pe(t,"expected valid JSON character");else lD.test(c)&&pe(t,"the stream contains non-printable characters");t.result+=c}}function ov(t,e,i,n){var r,a,o,c;for(Ct.isObject(i)||pe(t,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),o=0,c=r.length;o<c;o+=1)a=r[o],Lr.call(e,a)||(Nw(e,a,i[a]),n[a]=!0)}function gl(t,e,i,n,r,a,o,c,h){var d,p;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),d=0,p=r.length;d<p;d+=1)Array.isArray(r[d])&&pe(t,"nested arrays are not supported inside keys"),typeof r=="object"&&sv(r[d])==="[object Object]"&&(r[d]="[object Object]");if(typeof r=="object"&&sv(r)==="[object Object]"&&(r="[object Object]"),r=String(r),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(d=0,p=a.length;d<p;d+=1)ov(t,e,a[d],i);else ov(t,e,a,i);else!t.json&&!Lr.call(i,r)&&Lr.call(e,r)&&(t.line=o||t.line,t.lineStart=c||t.lineStart,t.position=h||t.position,pe(t,"duplicated mapping key")),Nw(e,r,a),delete i[r];return e}function Ug(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):pe(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function bt(t,e,i){for(var n=0,r=t.input.charCodeAt(t.position);r!==0;){for(;gs(r);)r===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),r=t.input.charCodeAt(++t.position);if(e&&r===35)do r=t.input.charCodeAt(++t.position);while(r!==10&&r!==13&&r!==0);if(bn(r))for(Ug(t),r=t.input.charCodeAt(t.position),n++,t.lineIndent=0;r===32;)t.lineIndent++,r=t.input.charCodeAt(++t.position);else break}return i!==-1&&n!==0&&t.lineIndent<i&&th(t,"deficient indentation"),n}function zh(t){var e=t.position,i;return i=t.input.charCodeAt(e),!!((i===45||i===46)&&i===t.input.charCodeAt(e+1)&&i===t.input.charCodeAt(e+2)&&(e+=3,i=t.input.charCodeAt(e),i===0||ui(i)))}function qg(t,e){e===1?t.result+=" ":e>1&&(t.result+=Ct.repeat(`
20
+ `,e-1))}function pD(t,e,i){var n,r,a,o,c,h,d,p,g=t.kind,x=t.result,v;if(v=t.input.charCodeAt(t.position),ui(v)||ml(v)||v===35||v===38||v===42||v===33||v===124||v===62||v===39||v===34||v===37||v===64||v===96||(v===63||v===45)&&(r=t.input.charCodeAt(t.position+1),ui(r)||i&&ml(r)))return!1;for(t.kind="scalar",t.result="",a=o=t.position,c=!1;v!==0;){if(v===58){if(r=t.input.charCodeAt(t.position+1),ui(r)||i&&ml(r))break}else if(v===35){if(n=t.input.charCodeAt(t.position-1),ui(n))break}else{if(t.position===t.lineStart&&zh(t)||i&&ml(v))break;if(bn(v))if(h=t.line,d=t.lineStart,p=t.lineIndent,bt(t,!1,-1),t.lineIndent>=e){c=!0,v=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=h,t.lineStart=d,t.lineIndent=p;break}}c&&(Rr(t,a,o,!1),qg(t,t.line-h),a=o=t.position,c=!1),gs(v)||(o=t.position+1),v=t.input.charCodeAt(++t.position)}return Rr(t,a,o,!1),t.result?!0:(t.kind=g,t.result=x,!1)}function mD(t,e){var i,n,r;if(i=t.input.charCodeAt(t.position),i!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=r=t.position;(i=t.input.charCodeAt(t.position))!==0;)if(i===39)if(Rr(t,n,t.position,!0),i=t.input.charCodeAt(++t.position),i===39)n=t.position,t.position++,r=t.position;else return!0;else bn(i)?(Rr(t,n,r,!0),qg(t,bt(t,!1,e)),n=r=t.position):t.position===t.lineStart&&zh(t)?pe(t,"unexpected end of the document within a single quoted scalar"):(t.position++,r=t.position);pe(t,"unexpected end of the stream within a single quoted scalar")}function gD(t,e){var i,n,r,a,o,c;if(c=t.input.charCodeAt(t.position),c!==34)return!1;for(t.kind="scalar",t.result="",t.position++,i=n=t.position;(c=t.input.charCodeAt(t.position))!==0;){if(c===34)return Rr(t,i,t.position,!0),t.position++,!0;if(c===92){if(Rr(t,i,t.position,!0),c=t.input.charCodeAt(++t.position),bn(c))bt(t,!1,e);else if(c<256&&Rw[c])t.result+=Dw[c],t.position++;else if((o=cD(c))>0){for(r=o,a=0;r>0;r--)c=t.input.charCodeAt(++t.position),(o=uD(c))>=0?a=(a<<4)+o:pe(t,"expected hexadecimal character");t.result+=fD(a),t.position++}else pe(t,"unknown escape sequence");i=n=t.position}else bn(c)?(Rr(t,i,n,!0),qg(t,bt(t,!1,e)),i=n=t.position):t.position===t.lineStart&&zh(t)?pe(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}pe(t,"unexpected end of the stream within a double quoted scalar")}function yD(t,e){var i=!0,n,r,a,o=t.tag,c,h=t.anchor,d,p,g,x,v,w=Object.create(null),k,C,M,T;if(T=t.input.charCodeAt(t.position),T===91)p=93,v=!1,c=[];else if(T===123)p=125,v=!0,c={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=c),T=t.input.charCodeAt(++t.position);T!==0;){if(bt(t,!0,e),T=t.input.charCodeAt(t.position),T===p)return t.position++,t.tag=o,t.anchor=h,t.kind=v?"mapping":"sequence",t.result=c,!0;i?T===44&&pe(t,"expected the node content, but found ','"):pe(t,"missed comma between flow collection entries"),C=k=M=null,g=x=!1,T===63&&(d=t.input.charCodeAt(t.position+1),ui(d)&&(g=x=!0,t.position++,bt(t,!0,e))),n=t.line,r=t.lineStart,a=t.position,Rl(t,e,$c,!1,!0),C=t.tag,k=t.result,bt(t,!0,e),T=t.input.charCodeAt(t.position),(x||t.line===n)&&T===58&&(g=!0,T=t.input.charCodeAt(++t.position),bt(t,!0,e),Rl(t,e,$c,!1,!0),M=t.result),v?gl(t,c,w,C,k,M,n,r,a):g?c.push(gl(t,null,w,C,k,M,n,r,a)):c.push(k),bt(t,!0,e),T=t.input.charCodeAt(t.position),T===44?(i=!0,T=t.input.charCodeAt(++t.position)):i=!1}pe(t,"unexpected end of the stream within a flow collection")}function xD(t,e){var i,n,r=Rp,a=!1,o=!1,c=e,h=0,d=!1,p,g;if(g=t.input.charCodeAt(t.position),g===124)n=!1;else if(g===62)n=!0;else return!1;for(t.kind="scalar",t.result="";g!==0;)if(g=t.input.charCodeAt(++t.position),g===43||g===45)Rp===r?r=g===43?rv:sD:pe(t,"repeat of a chomping mode identifier");else if((p=hD(g))>=0)p===0?pe(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?pe(t,"repeat of an indentation width identifier"):(c=e+p-1,o=!0);else break;if(gs(g)){do g=t.input.charCodeAt(++t.position);while(gs(g));if(g===35)do g=t.input.charCodeAt(++t.position);while(!bn(g)&&g!==0)}for(;g!==0;){for(Ug(t),t.lineIndent=0,g=t.input.charCodeAt(t.position);(!o||t.lineIndent<c)&&g===32;)t.lineIndent++,g=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>c&&(c=t.lineIndent),bn(g)){h++;continue}if(t.lineIndent<c){r===rv?t.result+=Ct.repeat(`
21
+ `,a?1+h:h):r===Rp&&a&&(t.result+=`
22
+ `);break}for(n?gs(g)?(d=!0,t.result+=Ct.repeat(`
23
+ `,a?1+h:h)):d?(d=!1,t.result+=Ct.repeat(`
24
+ `,h+1)):h===0?a&&(t.result+=" "):t.result+=Ct.repeat(`
25
+ `,h):t.result+=Ct.repeat(`
26
+ `,a?1+h:h),a=!0,o=!0,h=0,i=t.position;!bn(g)&&g!==0;)g=t.input.charCodeAt(++t.position);Rr(t,i,t.position,!1)}return!0}function uv(t,e){var i,n=t.tag,r=t.anchor,a=[],o,c=!1,h;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),h=t.input.charCodeAt(t.position);h!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,pe(t,"tab characters must not be used in indentation")),!(h!==45||(o=t.input.charCodeAt(t.position+1),!ui(o))));){if(c=!0,t.position++,bt(t,!0,-1)&&t.lineIndent<=e){a.push(null),h=t.input.charCodeAt(t.position);continue}if(i=t.line,Rl(t,e,Tw,!1,!0),a.push(t.result),bt(t,!0,-1),h=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&h!==0)pe(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return c?(t.tag=n,t.anchor=r,t.kind="sequence",t.result=a,!0):!1}function bD(t,e,i){var n,r,a,o,c,h,d=t.tag,p=t.anchor,g={},x=Object.create(null),v=null,w=null,k=null,C=!1,M=!1,T;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=g),T=t.input.charCodeAt(t.position);T!==0;){if(!C&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,pe(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),a=t.line,(T===63||T===58)&&ui(n))T===63?(C&&(gl(t,g,x,v,w,null,o,c,h),v=w=k=null),M=!0,C=!0,r=!0):C?(C=!1,r=!0):pe(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,T=n;else{if(o=t.line,c=t.lineStart,h=t.position,!Rl(t,i,Mw,!1,!0))break;if(t.line===a){for(T=t.input.charCodeAt(t.position);gs(T);)T=t.input.charCodeAt(++t.position);if(T===58)T=t.input.charCodeAt(++t.position),ui(T)||pe(t,"a whitespace character is expected after the key-value separator within a block mapping"),C&&(gl(t,g,x,v,w,null,o,c,h),v=w=k=null),M=!0,C=!1,r=!1,v=t.tag,w=t.result;else if(M)pe(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=d,t.anchor=p,!0}else if(M)pe(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=d,t.anchor=p,!0}if((t.line===a||t.lineIndent>e)&&(C&&(o=t.line,c=t.lineStart,h=t.position),Rl(t,e,eh,!0,r)&&(C?w=t.result:k=t.result),C||(gl(t,g,x,v,w,k,o,c,h),v=w=k=null),bt(t,!0,-1),T=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&T!==0)pe(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return C&&gl(t,g,x,v,w,null,o,c,h),M&&(t.tag=d,t.anchor=p,t.kind="mapping",t.result=g),M}function vD(t){var e,i=!1,n=!1,r,a,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&pe(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(i=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,r="!!",o=t.input.charCodeAt(++t.position)):r="!",e=t.position,i){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(a=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):pe(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ui(o);)o===33&&(n?pe(t,"tag suffix cannot contain exclamation marks"):(r=t.input.slice(e-1,t.position+1),Ow.test(r)||pe(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);a=t.input.slice(e,t.position),oD.test(a)&&pe(t,"tag suffix cannot contain flow indicator characters")}a&&!Ew.test(a)&&pe(t,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{pe(t,"tag name is malformed: "+a)}return i?t.tag=a:Lr.call(t.tagMap,r)?t.tag=t.tagMap[r]+a:r==="!"?t.tag="!"+a:r==="!!"?t.tag="tag:yaml.org,2002:"+a:pe(t,'undeclared tag handle "'+r+'"'),!0}function SD(t){var e,i;if(i=t.input.charCodeAt(t.position),i!==38)return!1;for(t.anchor!==null&&pe(t,"duplication of an anchor property"),i=t.input.charCodeAt(++t.position),e=t.position;i!==0&&!ui(i)&&!ml(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&pe(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function wD(t){var e,i,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!ui(n)&&!ml(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&pe(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),Lr.call(t.anchorMap,i)||pe(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],bt(t,!0,-1),!0}function Rl(t,e,i,n,r){var a,o,c,h=1,d=!1,p=!1,g,x,v,w,k,C;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=o=c=eh===i||Tw===i,n&&bt(t,!0,-1)&&(d=!0,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)),h===1)for(;vD(t)||SD(t);)bt(t,!0,-1)?(d=!0,c=a,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)):c=!1;if(c&&(c=d||r),(h===1||eh===i)&&($c===i||Mw===i?k=e:k=e+1,C=t.position-t.lineStart,h===1?c&&(uv(t,C)||bD(t,C,k))||yD(t,k)?p=!0:(o&&xD(t,k)||mD(t,k)||gD(t,k)?p=!0:wD(t)?(p=!0,(t.tag!==null||t.anchor!==null)&&pe(t,"alias node should not have any properties")):pD(t,k,$c===i)&&(p=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):h===0&&(p=c&&uv(t,C))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&pe(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),g=0,x=t.implicitTypes.length;g<x;g+=1)if(w=t.implicitTypes[g],w.resolve(t.result)){t.result=w.construct(t.result),t.tag=w.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Lr.call(t.typeMap[t.kind||"fallback"],t.tag))w=t.typeMap[t.kind||"fallback"][t.tag];else for(w=null,v=t.typeMap.multi[t.kind||"fallback"],g=0,x=v.length;g<x;g+=1)if(t.tag.slice(0,v[g].tag.length)===v[g].tag){w=v[g];break}w||pe(t,"unknown tag !<"+t.tag+">"),t.result!==null&&w.kind!==t.kind&&pe(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+w.kind+'", not "'+t.kind+'"'),w.resolve(t.result,t.tag)?(t.result=w.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):pe(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||p}function kD(t){var e=t.position,i,n,r,a=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(bt(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(a=!0,o=t.input.charCodeAt(++t.position),i=t.position;o!==0&&!ui(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(i,t.position),r=[],n.length<1&&pe(t,"directive name must not be less than one character in length");o!==0;){for(;gs(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!bn(o));break}if(bn(o))break;for(i=t.position;o!==0&&!ui(o);)o=t.input.charCodeAt(++t.position);r.push(t.input.slice(i,t.position))}o!==0&&Ug(t),Lr.call(av,n)?av[n](t,n,r):th(t,'unknown document directive "'+n+'"')}if(bt(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,bt(t,!0,-1)):a&&pe(t,"directives end mark is expected"),Rl(t,t.lineIndent-1,eh,!1,!0),bt(t,!0,-1),t.checkLineBreaks&&aD.test(t.input.slice(e,t.position))&&th(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&zh(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,bt(t,!0,-1));return}if(t.position<t.length-1)pe(t,"end of the stream or a document separator is expected");else return}function Lw(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
27
+ `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var i=new dD(t,e),n=t.indexOf("\0");for(n!==-1&&(i.position=n,pe(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)kD(i);return i.documents}function CD(t,e,i){e!==null&&typeof e=="object"&&typeof i>"u"&&(i=e,e=null);var n=Lw(t,i);if(typeof e!="function")return n;for(var r=0,a=n.length;r<a;r+=1)e(n[r])}function AD(t,e){var i=Lw(t,e);if(i.length!==0){if(i.length===1)return i[0];throw new Xt("expected a single document in the stream, but found more")}}var MD=CD,TD=AD,Bw={loadAll:MD,load:TD},zw=Object.prototype.toString,_w=Object.prototype.hasOwnProperty,Pg=65279,OD=9,fo=10,ED=13,ND=32,RD=33,DD=34,Am=35,jD=37,LD=38,BD=39,zD=42,Hw=44,_D=45,ih=58,HD=61,UD=62,qD=63,PD=64,Uw=91,qw=93,FD=96,Pw=123,VD=124,Fw=125,Vt={};Vt[0]="\\0";Vt[7]="\\a";Vt[8]="\\b";Vt[9]="\\t";Vt[10]="\\n";Vt[11]="\\v";Vt[12]="\\f";Vt[13]="\\r";Vt[27]="\\e";Vt[34]='\\"';Vt[92]="\\\\";Vt[133]="\\N";Vt[160]="\\_";Vt[8232]="\\L";Vt[8233]="\\P";var ID=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],QD=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function GD(t,e){var i,n,r,a,o,c,h;if(e===null)return{};for(i={},n=Object.keys(e),r=0,a=n.length;r<a;r+=1)o=n[r],c=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),h=t.compiledTypeMap.fallback[o],h&&_w.call(h.styleAliases,c)&&(c=h.styleAliases[c]),i[o]=c;return i}function YD(t){var e,i,n;if(e=t.toString(16).toUpperCase(),t<=255)i="x",n=2;else if(t<=65535)i="u",n=4;else if(t<=4294967295)i="U",n=8;else throw new Xt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+Ct.repeat("0",n-e.length)+e}var KD=1,po=2;function WD(t){this.schema=t.schema||Hg,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Ct.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=GD(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?po:KD,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function cv(t,e){for(var i=Ct.repeat(" ",e),n=0,r=-1,a="",o,c=t.length;n<c;)r=t.indexOf(`
28
+ `,n),r===-1?(o=t.slice(n),n=c):(o=t.slice(n,r+1),n=r+1),o.length&&o!==`
29
+ `&&(a+=i),a+=o;return a}function Mm(t,e){return`
30
+ `+Ct.repeat(" ",t.indent*e)}function XD(t,e){var i,n,r;for(i=0,n=t.implicitTypes.length;i<n;i+=1)if(r=t.implicitTypes[i],r.resolve(e))return!0;return!1}function nh(t){return t===ND||t===OD}function mo(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Pg||65536<=t&&t<=1114111}function hv(t){return mo(t)&&t!==Pg&&t!==ED&&t!==fo}function fv(t,e,i){var n=hv(t),r=n&&!nh(t);return(i?n:n&&t!==Hw&&t!==Uw&&t!==qw&&t!==Pw&&t!==Fw)&&t!==Am&&!(e===ih&&!r)||hv(e)&&!nh(e)&&t===Am||e===ih&&r}function ZD(t){return mo(t)&&t!==Pg&&!nh(t)&&t!==_D&&t!==qD&&t!==ih&&t!==Hw&&t!==Uw&&t!==qw&&t!==Pw&&t!==Fw&&t!==Am&&t!==LD&&t!==zD&&t!==RD&&t!==VD&&t!==HD&&t!==UD&&t!==BD&&t!==DD&&t!==jD&&t!==PD&&t!==FD}function JD(t){return!nh(t)&&t!==ih}function Wa(t,e){var i=t.charCodeAt(e),n;return i>=55296&&i<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(i-55296)*1024+n-56320+65536:i}function Vw(t){var e=/^\n* /;return e.test(t)}var Iw=1,Tm=2,Qw=3,Gw=4,fl=5;function $D(t,e,i,n,r,a,o,c){var h,d=0,p=null,g=!1,x=!1,v=n!==-1,w=-1,k=ZD(Wa(t,0))&&JD(Wa(t,t.length-1));if(e||o)for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Wa(t,h),!mo(d))return fl;k=k&&fv(d,p,c),p=d}else{for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Wa(t,h),d===fo)g=!0,v&&(x=x||h-w-1>n&&t[w+1]!==" ",w=h);else if(!mo(d))return fl;k=k&&fv(d,p,c),p=d}x=x||v&&h-w-1>n&&t[w+1]!==" "}return!g&&!x?k&&!o&&!r(t)?Iw:a===po?fl:Tm:i>9&&Vw(t)?fl:o?a===po?fl:Tm:x?Gw:Qw}function e5(t,e,i,n,r){t.dump=(function(){if(e.length===0)return t.quotingType===po?'""':"''";if(!t.noCompatMode&&(ID.indexOf(e)!==-1||QD.test(e)))return t.quotingType===po?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,i),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=n||t.flowLevel>-1&&i>=t.flowLevel;function h(d){return XD(t,d)}switch($D(e,c,t.indent,o,h,t.quotingType,t.forceQuotes&&!n,r)){case Iw:return e;case Tm:return"'"+e.replace(/'/g,"''")+"'";case Qw:return"|"+dv(e,t.indent)+pv(cv(e,a));case Gw:return">"+dv(e,t.indent)+pv(cv(t5(e,o),a));case fl:return'"'+i5(e)+'"';default:throw new Xt("impossible error: invalid scalar style")}})()}function dv(t,e){var i=Vw(t)?String(e):"",n=t[t.length-1]===`
31
+ `,r=n&&(t[t.length-2]===`
32
+ `||t===`
33
+ `),a=r?"+":n?"":"-";return i+a+`
34
+ `}function pv(t){return t[t.length-1]===`
35
+ `?t.slice(0,-1):t}function t5(t,e){for(var i=/(\n+)([^\n]*)/g,n=(function(){var d=t.indexOf(`
36
+ `);return d=d!==-1?d:t.length,i.lastIndex=d,mv(t.slice(0,d),e)})(),r=t[0]===`
37
+ `||t[0]===" ",a,o;o=i.exec(t);){var c=o[1],h=o[2];a=h[0]===" ",n+=c+(!r&&!a&&h!==""?`
38
+ `:"")+mv(h,e),r=a}return n}function mv(t,e){if(t===""||t[0]===" ")return t;for(var i=/ [^ ]/g,n,r=0,a,o=0,c=0,h="";n=i.exec(t);)c=n.index,c-r>e&&(a=o>r?o:c,h+=`
39
+ `+t.slice(r,a),r=a+1),o=c;return h+=`
40
+ `,t.length-r>e&&o>r?h+=t.slice(r,o)+`
41
+ `+t.slice(o+1):h+=t.slice(r),h.slice(1)}function i5(t){for(var e="",i=0,n,r=0;r<t.length;i>=65536?r+=2:r++)i=Wa(t,r),n=Vt[i],!n&&mo(i)?(e+=t[r],i>=65536&&(e+=t[r+1])):e+=n||YD(i);return e}function n5(t,e,i){var n="",r=t.tag,a,o,c;for(a=0,o=i.length;a<o;a+=1)c=i[a],t.replacer&&(c=t.replacer.call(i,String(a),c)),(Yn(t,e,c,!1,!1)||typeof c>"u"&&Yn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=r,t.dump="["+n+"]"}function gv(t,e,i,n){var r="",a=t.tag,o,c,h;for(o=0,c=i.length;o<c;o+=1)h=i[o],t.replacer&&(h=t.replacer.call(i,String(o),h)),(Yn(t,e+1,h,!0,!0,!1,!0)||typeof h>"u"&&Yn(t,e+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=Mm(t,e)),t.dump&&fo===t.dump.charCodeAt(0)?r+="-":r+="- ",r+=t.dump);t.tag=a,t.dump=r||"[]"}function r5(t,e,i){var n="",r=t.tag,a=Object.keys(i),o,c,h,d,p;for(o=0,c=a.length;o<c;o+=1)p="",n!==""&&(p+=", "),t.condenseFlow&&(p+='"'),h=a[o],d=i[h],t.replacer&&(d=t.replacer.call(i,h,d)),Yn(t,e,h,!1,!1)&&(t.dump.length>1024&&(p+="? "),p+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Yn(t,e,d,!1,!1)&&(p+=t.dump,n+=p));t.tag=r,t.dump="{"+n+"}"}function s5(t,e,i,n){var r="",a=t.tag,o=Object.keys(i),c,h,d,p,g,x;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new Xt("sortKeys must be a boolean or a function");for(c=0,h=o.length;c<h;c+=1)x="",(!n||r!=="")&&(x+=Mm(t,e)),d=o[c],p=i[d],t.replacer&&(p=t.replacer.call(i,d,p)),Yn(t,e+1,d,!0,!0,!0)&&(g=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,g&&(t.dump&&fo===t.dump.charCodeAt(0)?x+="?":x+="? "),x+=t.dump,g&&(x+=Mm(t,e)),Yn(t,e+1,p,!0,g)&&(t.dump&&fo===t.dump.charCodeAt(0)?x+=":":x+=": ",x+=t.dump,r+=x));t.tag=a,t.dump=r||"{}"}function yv(t,e,i){var n,r,a,o,c,h;for(r=i?t.explicitTypes:t.implicitTypes,a=0,o=r.length;a<o;a+=1)if(c=r[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(i?c.multi&&c.representName?t.tag=c.representName(e):t.tag=c.tag:t.tag="?",c.represent){if(h=t.styleMap[c.tag]||c.defaultStyle,zw.call(c.represent)==="[object Function]")n=c.represent(e,h);else if(_w.call(c.represent,h))n=c.represent[h](e,h);else throw new Xt("!<"+c.tag+'> tag resolver accepts not "'+h+'" style');t.dump=n}return!0}return!1}function Yn(t,e,i,n,r,a,o){t.tag=null,t.dump=i,yv(t,i,!1)||yv(t,i,!0);var c=zw.call(t.dump),h=n,d;n&&(n=t.flowLevel<0||t.flowLevel>e);var p=c==="[object Object]"||c==="[object Array]",g,x;if(p&&(g=t.duplicates.indexOf(i),x=g!==-1),(t.tag!==null&&t.tag!=="?"||x||t.indent!==2&&e>0)&&(r=!1),x&&t.usedDuplicates[g])t.dump="*ref_"+g;else{if(p&&x&&!t.usedDuplicates[g]&&(t.usedDuplicates[g]=!0),c==="[object Object]")n&&Object.keys(t.dump).length!==0?(s5(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(r5(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?gv(t,e-1,t.dump,r):gv(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(n5(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object String]")t.tag!=="?"&&e5(t,t.dump,e,a,h);else{if(c==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new Xt("unacceptable kind of an object to dump "+c)}t.tag!==null&&t.tag!=="?"&&(d=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",t.dump=d+" "+t.dump)}return!0}function l5(t,e){var i=[],n=[],r,a;for(Om(t,i,n),r=0,a=n.length;r<a;r+=1)e.duplicates.push(i[n[r]]);e.usedDuplicates=new Array(a)}function Om(t,e,i){var n,r,a;if(t!==null&&typeof t=="object")if(r=e.indexOf(t),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(e.push(t),Array.isArray(t))for(r=0,a=t.length;r<a;r+=1)Om(t[r],e,i);else for(n=Object.keys(t),r=0,a=n.length;r<a;r+=1)Om(t[n[r]],e,i)}function a5(t,e){e=e||{};var i=new WD(e);i.noRefs||l5(t,i);var n=t;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Yn(i,0,n,!0,!0)?i.dump+`
42
+ `:""}var o5=a5,u5={dump:o5};function Fg(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var c5=Ht,h5=aw,f5=hw,d5=gw,p5=yw,m5=Hg,g5=Bw.load,y5=Bw.loadAll,x5=u5.dump,b5=Xt,v5={binary:ww,float:mw,map:cw,null:fw,pairs:Cw,set:Aw,timestamp:vw,bool:dw,int:pw,merge:Sw,omap:kw,seq:uw,str:ow},S5=Fg("safeLoad","load"),w5=Fg("safeLoadAll","loadAll"),k5=Fg("safeDump","dump"),xv={Type:c5,Schema:h5,FAILSAFE_SCHEMA:f5,JSON_SCHEMA:d5,CORE_SCHEMA:p5,DEFAULT_SCHEMA:m5,load:g5,loadAll:y5,dump:x5,YAMLException:b5,types:v5,safeLoad:S5,safeLoadAll:w5,safeDump:k5};function _h(){return jr({queryKey:["specs"],queryFn:Fe.specs.list})}function C5(){const t=pt();return Nt({mutationFn:({spec:e,name:i,upstreamUrl:n})=>Fe.specs.upload(e,i,n),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function A5(){const t=pt();return Nt({mutationFn:({url:e,name:i})=>Fe.specs.uploadFromUrl(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function Yw(){const t=pt();return Nt({mutationFn:({specId:e,data:i})=>Fe.specs.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function M5(){const t=pt();return Nt({mutationFn:e=>Fe.specs.toggle(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function T5(){const t=pt();return Nt({mutationFn:({specId:e,spec:i})=>Fe.specs.reimport(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function O5(){const t=pt();return Nt({mutationFn:e=>Fe.specs.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function E5(){const{data:t}=_h(),e=M5(),i=O5(),n=C5(),r=A5(),a=Yw(),o=T5(),[c,h]=E.useState(!1),[d,p]=E.useState(!1),[g,x]=E.useState(null),[v,w]=E.useState("url"),[k,C]=E.useState(""),[M,T]=E.useState(""),[j,L]=E.useState(""),D=E.useRef(null);E.useEffect(()=>{function F(ee){D.current&&!D.current.contains(ee.target)&&(h(!1),p(!1),x(null))}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);const U=E.useCallback(async F=>{if(!k.trim())return alert("Enter a spec name");try{const ee=await F.text(),de=/\.ya?ml$/i.test(F.name)?xv.load(ee):JSON.parse(ee);n.mutate({spec:de,name:k.trim()},{onSuccess:()=>{C(""),p(!1),h(!1)}})}catch{alert("Invalid file")}},[n,k]),H=()=>{!M.trim()||!k.trim()||r.mutate({url:M.trim(),name:k.trim()},{onSuccess:()=>{T(""),C(""),p(!1),h(!1)}})},Z=F=>{if(F.metadata.sourceUrl)o.mutate({specId:F.id});else{const ee=document.createElement("input");ee.type="file",ee.accept=".json,.yaml,.yml",ee.onchange=async fe=>{const de=fe.target.files?.[0];if(de)try{const P=await de.text(),ne=/\.ya?ml$/i.test(de.name)?xv.load(P):JSON.parse(P);o.mutate({specId:F.id,spec:ne})}catch{alert("Invalid file")}},ee.click()}},J=F=>{a.mutate({specId:F,data:{upstreamUrl:j.trim()}},{onSuccess:()=>x(null)})},ue=t?.filter(F=>F.active)??[],ae=ue.length===1?ue[0].name:ue.length>1?`${ue.length} Specs`:"Select Spec";return b.jsxs("div",{className:"relative",ref:D,children:[b.jsxs("button",{onClick:()=>h(!c),className:Se("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",c?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[b.jsx(Wc,{className:"w-3.5 h-3.5 text-mode-mock opacity-70"}),b.jsx("span",{className:"font-bold truncate max-w-[150px]",children:ae}),b.jsx(Bo,{className:Se("w-3 h-3 text-muted-foreground transition-transform",c&&"rotate-180")})]}),c&&b.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[340px] animate-in fade-in zoom-in-95 duration-200",children:[b.jsxs("div",{className:"px-3 py-1 mb-1 border-b border-border/40 flex items-center justify-between",children:[b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"API Specifications"}),b.jsx("button",{onClick:()=>{p(!d),x(null),C(""),T("")},className:"p-1 hover:bg-primary/10 text-primary rounded-md transition-all",children:d?b.jsx(As,{className:"w-3.5 h-3.5"}):b.jsx(Bh,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"max-h-[450px] overflow-y-auto px-1.5 py-1 ",children:d?b.jsxs("div",{className:"p-3 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Spec Identifier"}),b.jsx("input",{autoFocus:!0,type:"text",placeholder:"e.g. staging-api",value:k,onChange:F=>C(F.target.value),className:"w-full px-3 py-2 text-xs font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),b.jsxs("div",{className:"flex p-0.5 bg-muted rounded-lg border border-border/40",children:[b.jsxs("button",{onClick:()=>w("url"),className:Se("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",v==="url"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[b.jsx(K2,{className:"w-3 h-3"})," URL"]}),b.jsxs("button",{onClick:()=>w("file"),className:Se("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",v==="file"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[b.jsx(J2,{className:"w-3 h-3"})," File"]})]}),v==="url"?b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"relative group",children:[b.jsx(l3,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),b.jsx("input",{type:"url",placeholder:"https://api.example.com/spec.json",value:M,onChange:F=>T(F.target.value),className:"w-full pl-9 pr-3 py-2 text-xs font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),b.jsxs("button",{onClick:H,disabled:!M.trim()||!k.trim()||r.isPending,className:"w-full py-2 bg-primary text-primary-foreground text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-primary/90 transition-all flex items-center justify-center gap-2",children:[r.isPending?b.jsx(Jc,{className:"w-3.5 h-3.5 animate-spin"}):b.jsx(Xc,{className:"w-3.5 h-3.5"}),"Import from URL"]})]}):b.jsxs("label",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed border-border/60 rounded-xl hover:border-primary/40 hover:bg-primary/5 transition-all cursor-pointer group",children:[b.jsx(i3,{className:"w-8 h-8 text-muted-foreground/40 group-hover:text-primary transition-colors mb-2"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground group-hover:text-primary",children:"Click to select file"}),b.jsx("input",{type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:F=>{const ee=F.target.files?.[0];ee&&U(ee)}})]})]}):b.jsxs("div",{className:"space-y-1",children:[t?.length===0&&b.jsxs("div",{className:"py-10 text-center px-6 space-y-2",children:[b.jsx(Wc,{className:"w-8 h-8 mx-auto text-muted-foreground opacity-20"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground/60 leading-tight",children:"No specifications yet. Import one to start intercepting."})]}),t?.map(F=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:Se("group flex items-center gap-3 px-3 py-2.5 text-sm rounded-lg transition-all border border-transparent cursor-pointer relative overflow-hidden",F.active?"bg-primary/10 border-primary/20 shadow-sm ring-1 ring-primary/5":"text-muted-foreground/60 hover:bg-accent/40"),onClick:()=>e.mutate(F.id),children:[b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:Se("font-black truncate text-xs uppercase tracking-tight",F.active?"text-foreground":"text-muted-foreground"),children:F.name}),F.active&&b.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--color-primary),0.5)]"})]}),b.jsxs("p",{className:"text-[10px] font-bold opacity-40 truncate leading-none mt-1",children:[F.metadata.title," (v",F.metadata.version,")"]})]}),b.jsxs("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[b.jsx("button",{onClick:ee=>{ee.stopPropagation(),x(g===F.id?null:F.id),L(F.upstreamUrl)},className:"p-1.5 text-muted-foreground hover:text-primary rounded-md hover:bg-primary/10 transition-all",title:"Configure",children:b.jsx(X2,{className:"w-3.5 h-3.5"})}),b.jsx("button",{onClick:ee=>{ee.stopPropagation(),confirm(`Delete spec "${F.name}"?`)&&i.mutate(F.id)},className:"p-1.5 text-muted-foreground hover:text-destructive rounded-md hover:bg-destructive/10 transition-all",title:"Delete",children:b.jsx(co,{className:"w-3.5 h-3.5"})})]})]}),g===F.id&&b.jsxs("div",{className:"mx-2 p-3 rounded-xl bg-muted/40 border border-border/40 space-y-3 animate-in slide-in-from-top-2 duration-200 shadow-inner",children:[b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Upstream URL"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx("input",{autoFocus:!0,type:"url",value:j,onChange:ee=>L(ee.target.value),className:"flex-1 px-3 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>J(F.id),className:"p-1.5 bg-primary/10 text-primary rounded-lg hover:bg-primary hover:text-primary-foreground transition-all",children:b.jsx(Xc,{className:"w-4 h-4"})})]})]}),b.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[b.jsxs("button",{onClick:()=>Z(F),disabled:o.isPending,className:"flex-1 flex items-center justify-center gap-2 py-1.5 bg-muted border border-border/60 text-[9px] font-black uppercase tracking-widest rounded-lg hover:bg-accent transition-all",children:[o.isPending?b.jsx(Jc,{className:"w-3 h-3 animate-spin"}):b.jsx(c3,{className:"w-3 h-3"}),"Reimport"]}),b.jsx("button",{onClick:()=>x(null),className:"px-3 py-1.5 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]})]},F.id))]})}),b.jsx("div",{className:"border-t border-border mt-1.5 pt-2 px-3 pb-1",children:b.jsxs("div",{className:"flex items-center justify-between text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.2em]",children:[b.jsxs("span",{children:["Total: ",t?.length??0]}),b.jsxs("span",{className:"text-primary/60",children:[ue.length," Active"]})]})})]})]})}const Kw=E.createContext(void 0);function N5(){const t=E.useContext(Kw);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Ww="/assets/logo-full-DJtzE5xc.png",R5="#181717",D5=E.forwardRef(function({title:e="GitHub",color:i="currentColor",size:n=24,...r},a){return i==="default"&&(i=R5),b.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,fill:i,viewBox:"0 0 24 24",ref:a,...r,children:[b.jsx("title",{children:e}),b.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})});function j5({open:t,onClose:e}){const i=pt(),{data:n}=jr({queryKey:["config"],queryFn:Fe.config.get}),{data:r}=jr({queryKey:["health"],queryFn:Fe.health}),[a,o]=E.useState("config"),[c,h]=E.useState(4e3);E.useEffect(()=>{n&&h(n.proxyPort)},[n]);const d=Nt({mutationFn:()=>Fe.config.update({proxyPort:c}),onSuccess:()=>{i.invalidateQueries({queryKey:["config"]}),e()}}),p=async()=>{const x=await Fe.config.export(),v=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),w=URL.createObjectURL(v),k=document.createElement("a");k.href=w,k.download=`interceptr-config-${new Date().toISOString().slice(0,10)}.json`,k.click(),URL.revokeObjectURL(w)},g=async x=>{const v=await x.text(),w=JSON.parse(v);await Fe.config.import(w),i.invalidateQueries()};return t?b.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[b.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md",onClick:e}),b.jsxs("div",{className:"relative w-full max-w-xl bg-card border border-border/60 shadow-2xl rounded-3xl overflow-hidden flex flex-col max-h-[90vh]",children:[b.jsxs("div",{className:"px-6 py-4 border-b border-border/40 bg-muted flex items-center justify-between shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(d3,{className:"w-4 h-4 text-primary"}),b.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-foreground/80",children:"System Control"})]}),b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:b.jsx(As,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"flex border-b border-border/20 bg-muted/30 shrink-0 px-4",children:[b.jsx("button",{onClick:()=>o("config"),className:Se("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",a==="config"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Configuration"}),b.jsx("button",{onClick:()=>o("about"),className:Se("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",a==="about"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"About"})]}),b.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:a==="config"?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(K2,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Network Environment"})]}),b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex-1 space-y-1",children:[b.jsx("p",{className:"text-xs font-black text-foreground uppercase tracking-tight leading-none mb-1",children:"Proxy Port"}),b.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-medium",children:"Internal server interface listener port."})]}),b.jsx("input",{type:"number",value:c,onChange:x=>h(Number(x.target.value)),className:"w-32 px-4 py-2 text-sm font-mono font-black rounded-xl border border-border/60 bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner text-right"})]})]}),b.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx($N,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Data Sovereignty"})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm group",children:[b.jsx(e3,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Backup"]}),b.jsxs("label",{className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm cursor-pointer group",children:[b.jsx(J2,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Restore",b.jsx("input",{type:"file",accept:".json",className:"hidden",onChange:x=>{const v=x.target.files?.[0];v&&g(v)}})]})]})]})]}):b.jsxs("div",{className:"flex flex-col items-center text-center space-y-8 py-4",children:[b.jsx("div",{className:"max-w-[300px] p-4",children:b.jsx("img",{src:Ww,alt:"Interceptr Full Logo",className:"w-full h-auto object-contain"})}),b.jsxs("div",{className:"space-y-2",children:[b.jsx("h3",{className:"text-xl font-black tracking-tighter uppercase",children:"Interceptr"}),b.jsxs("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest",children:["Version ",r?.version??"—"]})]}),b.jsx("div",{className:"max-w-md",children:b.jsx("p",{className:"text-sm font-medium text-muted-foreground leading-relaxed",children:"A professional-grade HTTP interception proxy and mocking tool designed specifically for modern engineering workflows."})}),b.jsxs("div",{className:"w-full grid grid-cols-1 gap-3 pt-4",children:[b.jsxs("a",{href:"https://github.com/pckhib/interceptr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:b.jsx(D5,{className:"w-4 h-4"})}),b.jsxs("div",{className:"text-left",children:[b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"GitHub Repository"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Contribute or report issues."})]})]}),b.jsx(wm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]}),b.jsxs("a",{href:"https://github.com/pckhib",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:b.jsx(W2,{className:"w-4 h-4 text-primary"})}),b.jsxs("div",{className:"text-left",children:[b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"Developer"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Patrick Hieber"})]})]}),b.jsx(wm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]})]}),b.jsx("p",{className:"text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.3em] pt-4",children:"API Simulation Made Simple."})]})}),b.jsx("div",{className:"p-4 border-t border-border/40 bg-muted flex justify-end gap-3 px-6 shrink-0",children:a==="config"?b.jsxs(b.Fragment,{children:[b.jsx("button",{onClick:e,className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors duration-75",children:"Cancel"}),b.jsx("button",{onClick:()=>d.mutate(),className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-md active:scale-95",children:"Persist Settings"})]}):b.jsx("button",{onClick:e,className:"px-8 py-2.5 text-[10px] font-black uppercase tracking-widest bg-foreground text-background rounded-xl hover:opacity-90 transition-all shadow-md active:scale-95",children:"Close"})})]})]}):null}function L5(){const{theme:t,toggleTheme:e}=N5(),{data:i}=GN(),n=YN(),r=KN(),[a,o]=E.useState(!1),c=i?.running??!1,h=n.isPending||r.isPending;return b.jsxs(b.Fragment,{children:[b.jsxs("header",{className:"h-14 border-b-2 border-border/60 bg-card header-gradient flex items-center justify-between px-4 shrink-0 z-50 relative",children:[b.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-white/5"}),b.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[b.jsx("div",{className:"flex items-center group cursor-pointer h-8",children:b.jsx("img",{src:Ww,alt:"Interceptr",className:"h-7 w-auto object-contain transition-transform duration-75 group-hover:scale-105"})}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 hidden sm:block"}),b.jsx(rR,{}),b.jsx(E5,{})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs("div",{className:Se("hidden md:flex items-center gap-2 px-3 py-1.5 rounded-full border text-[10px] font-black uppercase tracking-widest transition-all duration-300",c?"bg-success/10 border-success/30 text-success shadow-[0_0_10px_-2px_rgba(34,197,94,0.3)]":"bg-muted border-border text-muted-foreground/60"),children:[b.jsx("div",{className:Se("w-2 h-2 rounded-full",c?"bg-success animate-pulse":"bg-muted-foreground/20")}),b.jsx("span",{children:c?`:${i?.port}`:"Offline"})]}),b.jsxs("button",{onClick:()=>c?r.mutate():n.mutate(),disabled:h,className:Se("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all shadow-sm border",c?"bg-destructive/10 border-destructive/20 text-destructive hover:bg-destructive hover:text-destructive-foreground":"bg-primary border-primary/20 text-primary-foreground hover:bg-primary/90",h&&"opacity-50 cursor-not-allowed"),children:[b.jsx(o3,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden lg:inline",children:c?"Stop":"Start"})]}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1"}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Toggle theme",children:t==="dark"?b.jsx(m3,{className:"w-4 h-4"}):b.jsx(a3,{className:"w-4 h-4"})}),b.jsx("button",{onClick:()=>o(!0),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Settings",children:b.jsx(p3,{className:"w-4 h-4"})})]})]})]}),b.jsx(j5,{open:a,onClose:()=>o(!1)})]})}function B5(){const[t,e]=E.useState(()=>typeof window<"u"&&localStorage.getItem("theme")||"dark");E.useEffect(()=>{const n=window.document.documentElement;n.classList.remove("light","dark"),n.classList.add(t),localStorage.setItem("theme",t)},[t]);const i=()=>e(n=>n==="light"?"dark":"light");return b.jsx(Kw.Provider,{value:{theme:t,toggleTheme:i},children:b.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background text-foreground",children:[b.jsx(L5,{}),b.jsx("main",{className:"flex-1 overflow-hidden relative",children:b.jsx(TE,{})})]})})}function Xw(){return jr({queryKey:["endpoints"],queryFn:Fe.endpoints.list})}function z5(){const t=pt();return Nt({mutationFn:({id:e,config:i})=>Fe.endpoints.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}function Zw(){const t=pt();return Nt({mutationFn:e=>Fe.endpoints.bulkUpdate(e),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const _5={GET:"text-emerald-400 bg-emerald-400/10 border-emerald-400/30 shadow-[0_0_10px_-3px_rgba(52,211,153,0.3)]",POST:"text-blue-400 bg-blue-400/10 border-blue-400/30 shadow-[0_0_10px_-3px_rgba(96,165,250,0.3)]",PUT:"text-amber-400 bg-amber-400/10 border-amber-400/30 shadow-[0_0_10px_-3px_rgba(251,191,36,0.3)]",PATCH:"text-orange-400 bg-orange-400/10 border-orange-400/30 shadow-[0_0_10px_-3px_rgba(251,146,60,0.3)]",DELETE:"text-rose-400 bg-rose-400/10 border-rose-400/30 shadow-[0_0_10px_-3px_rgba(251,113,133,0.3)]",HEAD:"text-purple-400 bg-purple-400/10 border-purple-400/30 shadow-[0_0_10px_-3px_rgba(192,132,252,0.3)]",OPTIONS:"text-slate-400 bg-slate-400/10 border-slate-400/30"};function Vg({method:t}){return b.jsx("span",{className:Se("inline-flex items-center justify-center px-1.5 py-0.5 text-[10px] font-black rounded-[4px] border uppercase tracking-widest w-[52px] shrink-0 font-mono transition-all",_5[t]??"text-muted-foreground bg-muted/20 border-border"),children:t})}const H5=[{value:"passthrough",label:"Pass",icon:Sm,activeClass:"bg-mode-passthrough/20 text-mode-passthrough border-mode-passthrough/30 shadow-[0_0_8px_-2px_rgba(var(--mode-passthrough),0.3)]"},{value:"delay",label:"Delay",icon:El,activeClass:"bg-mode-delay/20 text-mode-delay border-mode-delay/30 shadow-[0_0_8px_-2px_rgba(var(--mode-delay),0.3)]"},{value:"mock",label:"Mock",icon:t3,activeClass:"bg-mode-mock/20 text-mode-mock border-mode-mock/30 shadow-[0_0_8px_-2px_rgba(var(--mode-mock),0.3)]"}];function U5({value:t,onChange:e}){return b.jsx("div",{className:"inline-flex rounded-lg border border-border/60 bg-muted/30 p-1 shadow-inner backdrop-blur-sm",children:H5.map(({value:i,label:n,icon:r,activeClass:a})=>b.jsxs("button",{onClick:()=>e(i),className:Se("flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-widest rounded-md transition-all duration-200 border border-transparent",t===i?Se("font-bold",a):"text-muted-foreground/60 hover:text-foreground hover:bg-white/5"),children:[b.jsx(r,{className:Se("w-3.5 h-3.5",t===i?"animate-in zoom-in-75 duration-300":"opacity-50")}),b.jsx("span",{className:"hidden sm:inline",children:n})]},i))})}function q5({delay:t,onChange:e}){const[i,n]=E.useState(t.ms),[r,a]=E.useState(t.jitterMs??0);E.useEffect(()=>{n(t.ms),a(t.jitterMs??0)},[t.ms,t.jitterMs]);const o=()=>{e({ms:i,jitterMs:r||void 0})};return b.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 max-w-2xl py-2",children:[b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[b.jsx(El,{className:"w-3.5 h-3.5 text-mode-delay"}),"Base Delay"]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"number",value:i,onChange:c=>n(Number(c.target.value)),onBlur:o,className:"w-20 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay focus:border-mode-delay outline-none text-right"}),b.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),b.jsx("input",{type:"range",min:0,max:1e4,step:50,value:i,onChange:c=>n(Number(c.target.value)),onMouseUp:o,className:"w-full accent-mode-delay h-4 bg-transparent cursor-pointer"}),b.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[b.jsx("span",{children:"0ms"}),b.jsx("span",{children:"5,000ms"}),b.jsx("span",{children:"10,000ms"})]})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[b.jsx(Bg,{className:"w-3.5 h-3.5 text-mode-delay/60"}),"Jitter (±)"]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"number",value:r,onChange:c=>a(Number(c.target.value)),onBlur:o,className:"w-16 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay/40 focus:border-mode-delay/40 outline-none text-right"}),b.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),b.jsx("input",{type:"range",min:0,max:2e3,step:10,value:r,onChange:c=>a(Number(c.target.value)),onMouseUp:o,className:"w-full accent-mode-delay/60 h-4 bg-transparent cursor-pointer"}),b.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[b.jsx("span",{children:"0ms"}),b.jsx("span",{children:"1,000ms"}),b.jsx("span",{children:"2,000ms"})]})]})]})}function Em(){return Em=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Em.apply(null,arguments)}function P5(t,e){if(t==null)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;i[n]=t[n]}return i}let Nm=[],Jw=[];(()=>{let t="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,i=0;e<t.length;e++)(e%2?Jw:Nm).push(i=i+t[e])})();function F5(t){if(t<768)return!1;for(let e=0,i=Nm.length;;){let n=e+i>>1;if(t<Nm[n])i=n;else if(t>=Jw[n])e=n+1;else return!0;if(e==i)return!1}}function bv(t){return t>=127462&&t<=127487}const vv=8205;function V5(t,e,i=!0,n=!0){return(i?$w:I5)(t,e,n)}function $w(t,e,i){if(e==t.length)return e;e&&ek(t.charCodeAt(e))&&tk(t.charCodeAt(e-1))&&e--;let n=Dp(t,e);for(e+=Sv(n);e<t.length;){let r=Dp(t,e);if(n==vv||r==vv||i&&F5(r))e+=Sv(r),n=r;else if(bv(r)){let a=0,o=e-2;for(;o>=0&&bv(Dp(t,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function I5(t,e,i){for(;e>0;){let n=$w(t,e-2,i);if(n<e)return n;e--}return 0}function Dp(t,e){let i=t.charCodeAt(e);if(!tk(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return ek(n)?(i-55296<<10)+(n-56320)+65536:i}function ek(t){return t>=56320&&t<57344}function tk(t){return t>=55296&&t<56320}function Sv(t){return t<65536?1:2}class Ue{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,i,n){[e,i]=Dl(this,e,i);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(i,this.length,r,1),fn.from(r,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Dl(this,e,i);let n=[];return this.decompose(e,i,n,0),fn.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new eo(this),a=new eo(e);for(let o=i,c=i;;){if(r.next(o),a.next(o),o=0,r.lineBreak!=a.lineBreak||r.done!=a.done||r.value!=a.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new eo(this,e)}iterRange(e,i=this.length){return new ik(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new nk(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Ue.empty:e.length<=32?new ft(e):fn.from(ft.split(e,[]))}}class ft extends Ue{constructor(e,i=Q5(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,r){for(let a=0;;a++){let o=this.text[a],c=r+o.length;if((i?n:c)>=e)return new G5(r,c,n,o);r=c+1,n++}}decompose(e,i,n,r){let a=e<=0&&i>=this.length?this:new ft(wv(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),c=_c(a.text,o.text.slice(),0,a.length);if(c.length<=32)n.push(new ft(c,o.length+a.length));else{let h=c.length>>1;n.push(new ft(c.slice(0,h)),new ft(c.slice(h)))}}else n.push(a)}replace(e,i,n){if(!(n instanceof ft))return super.replace(e,i,n);[e,i]=Dl(this,e,i);let r=_c(this.text,_c(n.text,wv(this.text,0,e)),i),a=this.length+n.length-(i-e);return r.length<=32?new ft(r,a):fn.from(ft.split(r,[]),a)}sliceString(e,i=this.length,n=`
43
+ `){[e,i]=Dl(this,e,i);let r="";for(let a=0,o=0;a<=i&&o<this.text.length;o++){let c=this.text[o],h=a+c.length;a>e&&o&&(r+=n),e<h&&i>a&&(r+=c.slice(Math.max(0,e-a),i-a)),a=h+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let a of e)n.push(a),r+=a.length+1,n.length==32&&(i.push(new ft(n,r)),n=[],r=-1);return r>-1&&i.push(new ft(n,r)),i}}class fn extends Ue{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let a=0;;a++){let o=this.children[a],c=r+o.length,h=n+o.lines-1;if((i?h:c)>=e)return o.lineInner(e,i,n,r);r=c+1,n=h+1}}decompose(e,i,n,r){for(let a=0,o=0;o<=i&&a<this.children.length;a++){let c=this.children[a],h=o+c.length;if(e<=h&&i>=o){let d=r&((o<=e?1:0)|(h>=i?2:0));o>=e&&h<=i&&!d?n.push(c):c.decompose(e-o,i-o,n,d)}o=h+1}}replace(e,i,n){if([e,i]=Dl(this,e,i),n.lines<this.lines)for(let r=0,a=0;r<this.children.length;r++){let o=this.children[r],c=a+o.length;if(e>=a&&i<=c){let h=o.replace(e-a,i-a,n),d=this.lines-o.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[r]=h,new fn(p,this.length-(i-e)+n.length)}return super.replace(a,c,h)}a=c+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
44
+ `){[e,i]=Dl(this,e,i);let r="";for(let a=0,o=0;a<this.children.length&&o<=i;a++){let c=this.children[a],h=o+c.length;o>e&&a&&(r+=n),e<h&&i>o&&(r+=c.sliceString(e-o,i-o,n)),o=h+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof fn))return 0;let n=0,[r,a,o,c]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,a+=i){if(r==o||a==c)return n;let h=this.children[r],d=e.children[a];if(h!=d)return n+h.scanIdentical(d,i);n+=h.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let v of e)n+=v.lines;if(n<32){let v=[];for(let w of e)w.flatten(v);return new ft(v,i)}let r=Math.max(32,n>>5),a=r<<1,o=r>>1,c=[],h=0,d=-1,p=[];function g(v){let w;if(v.lines>a&&v instanceof fn)for(let k of v.children)g(k);else v.lines>o&&(h>o||!h)?(x(),c.push(v)):v instanceof ft&&h&&(w=p[p.length-1])instanceof ft&&v.lines+w.lines<=32?(h+=v.lines,d+=v.length+1,p[p.length-1]=new ft(w.text.concat(v.text),w.length+1+v.length)):(h+v.lines>r&&x(),h+=v.lines,d+=v.length+1,p.push(v))}function x(){h!=0&&(c.push(p.length==1?p[0]:fn.from(p,d)),d=-1,h=p.length=0)}for(let v of e)g(v);return x(),c.length==1?c[0]:new fn(c,i)}}Ue.empty=new ft([""],0);function Q5(t){let e=-1;for(let i of t)e+=i.length+1;return e}function _c(t,e,i=0,n=1e9){for(let r=0,a=0,o=!0;a<t.length&&r<=n;a++){let c=t[a],h=r+c.length;h>=i&&(h>n&&(c=c.slice(0,n-r)),r<i&&(c=c.slice(i-r)),o?(e[e.length-1]+=c,o=!1):e.push(c)),r=h+1}return e}function wv(t,e,i){return _c(t,[""],e,i)}class eo{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof ft?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],a=this.offsets[n],o=a>>1,c=r instanceof ft?r.text.length:r.children.length;if(o==(i>0?c:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
45
+ `,this;e--}else if(r instanceof ft){let h=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,h.length>Math.max(0,e))return this.value=e==0?h:i>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=r.children[o+(i<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof ft?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class ik{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new eo(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class nk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ue.prototype[Symbol.iterator]=function(){return this.iter()},eo.prototype[Symbol.iterator]=ik.prototype[Symbol.iterator]=nk.prototype[Symbol.iterator]=function(){return this});class G5{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}}function Dl(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Et(t,e,i=!0,n=!0){return V5(t,e,i,n)}function Y5(t){return t>=56320&&t<57344}function K5(t){return t>=55296&&t<56320}function li(t,e){let i=t.charCodeAt(e);if(!K5(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Y5(n)?(i-55296<<10)+(n-56320)+65536:i}function Ig(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function dn(t){return t<65536?1:2}const Rm=/\r\n?|\n/;var Zt=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Zt||(Zt={}));class vn{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let a=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,a),r+=a):r+=o,n+=a}}iterChangedRanges(e,i=!1){Dm(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new vn(e)}composeDesc(e){return this.empty?e:e.empty?this:rk(this,e)}mapDesc(e,i=!1){return e.empty?this:jm(this,e,i)}mapPos(e,i=-1,n=Zt.Simple){let r=0,a=0;for(let o=0;o<this.sections.length;){let c=this.sections[o++],h=this.sections[o++],d=r+c;if(h<0){if(d>e)return a+(e-r);a+=c}else{if(n!=Zt.Simple&&d>=e&&(n==Zt.TrackDel&&r<e&&d>e||n==Zt.TrackBefore&&r<e||n==Zt.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!c)return e==r||i<0?a:a+h;a+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return a}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let a=this.sections[n++],o=this.sections[n++],c=r+a;if(o>=0&&r<=i&&c>=e)return r<e&&c>i?"cover":!0;r=c}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new vn(e)}static create(e){return new vn(e)}}class wt extends vn{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Dm(this,(i,n,r,a,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return jm(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,a=0;r<i.length;r+=2){let o=i[r],c=i[r+1];if(c>=0){i[r]=c,i[r+1]=o;let h=r>>1;for(;n.length<h;)n.push(Ue.empty);n.push(o?e.slice(a,a+o):Ue.empty)}a+=o}return new wt(i,n)}compose(e){return this.empty?e:e.empty?this:rk(this,e,!0)}map(e,i=!1){return e.empty?this:jm(this,e,i,!0)}iterChanges(e,i=!1){Dm(this,e,i)}get desc(){return vn.create(this.sections)}filter(e){let i=[],n=[],r=[],a=new go(this);e:for(let o=0,c=0;;){let h=o==e.length?1e9:e[o++];for(;c<h||c==h&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,h-c);Pt(r,p,-1);let g=a.ins==-1?-1:a.off==0?a.ins:0;Pt(i,p,g),g>0&&Or(n,i,a.text),a.forward(p),c+=p}let d=e[o++];for(;c<d;){if(a.done)break e;let p=Math.min(a.len,d-c);Pt(i,p,-1),Pt(r,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),c+=p}}return{changes:new wt(i,n),filtered:vn.create(r)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],r=this.sections[i+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let r=[],a=[],o=0,c=null;function h(p=!1){if(!p&&!r.length)return;o<i&&Pt(r,i-o,-1);let g=new wt(r,a);c=c?c.compose(g.map(c)):g,r=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof wt){if(p.length!=i)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${i})`);h(),c=c?c.compose(p.map(c)):p}else{let{from:g,to:x=g,insert:v}=p;if(g>x||g<0||x>i)throw new RangeError(`Invalid change range ${g} to ${x} (in doc of length ${i})`);let w=v?typeof v=="string"?Ue.of(v.split(n||Rm)):v:Ue.empty,k=w.length;if(g==x&&k==0)return;g<o&&h(),g>o&&Pt(r,g-o,-1),Pt(r,x-g,k),Or(a,r,w),o=x}}return d(e),h(!c),c}static empty(e){return new wt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;r<e.length;r++){let a=e[r];if(typeof a=="number")i.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,c)=>c&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)i.push(a[0],0);else{for(;n.length<r;)n.push(Ue.empty);n[r]=Ue.of(a.slice(1)),i.push(a[0],n[r].length)}}}return new wt(i,n)}static createSet(e,i){return new wt(e,i)}}function Pt(t,e,i,n=!1){if(e==0&&i<=0)return;let r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:r>=0&&e==0&&t[r]==0?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function Or(t,e,i){if(i.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<n;)t.push(Ue.empty);t.push(i)}}function Dm(t,e,i){let n=t.inserted;for(let r=0,a=0,o=0;o<t.sections.length;){let c=t.sections[o++],h=t.sections[o++];if(h<0)r+=c,a+=c;else{let d=r,p=a,g=Ue.empty;for(;d+=c,p+=h,h&&n&&(g=g.append(n[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)c=t.sections[o++],h=t.sections[o++];e(r,d,a,p,g),r=d,a=p}}}function jm(t,e,i,n=!1){let r=[],a=n?[]:null,o=new go(t),c=new go(e);for(let h=-1;;){if(o.done&&c.len||c.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&c.ins==-1){let d=Math.min(o.len,c.len);Pt(r,d,-1),o.forward(d),c.forward(d)}else if(c.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(c.len<o.len||c.len==o.len&&!i))){let d=c.len;for(Pt(r,c.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&h<o.i&&o.len<=p&&(Pt(r,0,o.ins),a&&Or(a,r,o.text),h=o.i),o.forward(p),d-=p}c.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(c.ins==-1){let g=Math.min(p,c.len);d+=g,p-=g,c.forward(g)}else if(c.ins==0&&c.len<p)p-=c.len,c.next();else break;Pt(r,d,h<o.i?o.ins:0),a&&h<o.i&&Or(a,r,o.text),h=o.i,o.forward(o.len-p)}else{if(o.done&&c.done)return a?wt.createSet(r,a):vn.create(r);throw new Error("Mismatched change set lengths")}}}function rk(t,e,i=!1){let n=[],r=i?[]:null,a=new go(t),o=new go(e);for(let c=!1;;){if(a.done&&o.done)return r?wt.createSet(n,r):vn.create(n);if(a.ins==0)Pt(n,a.len,0,c),a.next();else if(o.len==0&&!o.done)Pt(n,0,o.ins,c),r&&Or(r,n,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let h=Math.min(a.len2,o.len),d=n.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;Pt(n,h,p,c),r&&p&&Or(r,n,o.text)}else o.ins==-1?(Pt(n,a.off?0:a.len,h,c),r&&Or(r,n,a.textBit(h))):(Pt(n,a.off?0:a.len,o.off?0:o.ins,c),r&&!o.off&&Or(r,n,o.text));c=(a.ins>h||o.ins>=0&&o.len>h)&&(c||n.length>d),a.forward2(h),o.forward(h)}}}}class go{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,i=this.i-2>>1;return i>=e.length?Ue.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?Ue.empty:i[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ds{constructor(e,i,n){this.from=e,this.to=i,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new ds(n,r,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return W.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return W.range(this.anchor,n)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!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 W.range(e.anchor,e.head)}static create(e,i,n){return new ds(e,i,n)}}class W{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:W.create(this.ranges.map(n=>n.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new W([this.main],0)}addRange(e,i=!0){return W.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,W.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new W(e.ranges.map(i=>ds.fromJSON(i)),e.main)}static single(e,i=e){return new W([W.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let a=e[r];if(a.empty?a.from<=n:a.from<n)return W.normalized(e.slice(),i);n=a.to}return new W(e,i)}static cursor(e,i=0,n,r){return ds.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,i,n,r){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return i<e?ds.create(i,e,48|a):ds.create(e,i,(i>e?8:0)|a)}static normalized(e,i=0){let n=e[i];e.sort((r,a)=>r.from-a.from),i=e.indexOf(n);for(let r=1;r<e.length;r++){let a=e[r],o=e[r-1];if(a.empty?a.from<=o.to:a.from<o.to){let c=o.from,h=Math.max(a.to,o.to);r<=i&&i--,e.splice(--r,2,a.anchor>a.head?W.range(h,c):W.range(c,h))}}return new W(e,i)}}function sk(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let Qg=0;class le{constructor(e,i,n,r,a){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=r,this.id=Qg++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new le(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:Gg),!!e.static,e.enables)}of(e){return new Hc([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hc(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hc(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Gg(t,e){return t==e||t.length==e.length&&t.every((i,n)=>i===e[n])}class Hc{constructor(e,i,n,r){this.dependencies=e,this.facet=i,this.type=n,this.value=r,this.id=Qg++}dynamicSlot(e){var i;let n=this.value,r=this.facet.compareInput,a=this.id,o=e[a]>>1,c=this.type==2,h=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?h=!0:g=="selection"?d=!0:(((i=e[g.id])!==null&&i!==void 0?i:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[o]=n(g),1},update(g,x){if(h&&x.docChanged||d&&(x.docChanged||x.selection)||Lm(g,p)){let v=n(g);if(c?!kv(v,g.values[o],r):!r(v,g.values[o]))return g.values[o]=v,1}return 0},reconfigure:(g,x)=>{let v,w=x.config.address[a];if(w!=null){let k=sh(x,w);if(this.dependencies.every(C=>C instanceof le?x.facet(C)===g.facet(C):C instanceof It?x.field(C,!1)==g.field(C,!1):!0)||(c?kv(v=n(g),k,r):r(v=n(g),k)))return g.values[o]=k,0}else v=n(g);return g.values[o]=v,1}}}}function kv(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}function Lm(t,e){let i=!1;for(let n of e)to(t,n)&1&&(i=!0);return i}function W5(t,e,i){let n=i.map(h=>t[h.id]),r=i.map(h=>h.type),a=n.filter(h=>!(h&1)),o=t[e.id]>>1;function c(h){let d=[];for(let p=0;p<n.length;p++){let g=sh(h,n[p]);if(r[p]==2)for(let x of g)d.push(x);else d.push(g)}return e.combine(d)}return{create(h){for(let d of n)to(h,d);return h.values[o]=c(h),1},update(h,d){if(!Lm(h,a))return 0;let p=c(h);return e.compare(p,h.values[o])?0:(h.values[o]=p,1)},reconfigure(h,d){let p=Lm(h,n),g=d.config.facets[e.id],x=d.facet(e);if(g&&!p&&Gg(i,g))return h.values[o]=x,0;let v=c(h);return e.compare(v,x)?(h.values[o]=x,0):(h.values[o]=v,1)}}}const cc=le.define({static:!0});class It{constructor(e,i,n,r,a){this.id=e,this.createF=i,this.updateF=n,this.compareF=r,this.spec=a,this.provides=void 0}static define(e){let i=new It(Qg++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(cc).find(n=>n.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,r)=>{let a=n.values[i],o=this.updateF(a,r);return this.compareF(a,o)?0:(n.values[i]=o,1)},reconfigure:(n,r)=>{let a=n.facet(cc),o=r.facet(cc),c;return(c=a.find(h=>h.field==this))&&c!=o.find(h=>h.field==this)?(n.values[i]=c.create(n),1):r.config.address[this.id]!=null?(n.values[i]=r.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,cc.of({field:this,create:e})]}get extension(){return this}}const cs={lowest:4,low:3,default:2,high:1,highest:0};function Ia(t){return e=>new lk(e,t)}const Ms={highest:Ia(cs.highest),high:Ia(cs.high),default:Ia(cs.default),low:Ia(cs.low),lowest:Ia(cs.lowest)};class lk{constructor(e,i){this.inner=e,this.prec=i}}class Hh{of(e){return new Bm(this,e)}reconfigure(e){return Hh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bm{constructor(e,i){this.compartment=e,this.inner=i}}class rh{constructor(e,i,n,r,a,o){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=r,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let r=[],a=Object.create(null),o=new Map;for(let x of X5(e,i,o))x instanceof It?r.push(x):(a[x.facet.id]||(a[x.facet.id]=[])).push(x);let c=Object.create(null),h=[],d=[];for(let x of r)c[x.id]=d.length<<1,d.push(v=>x.slot(v));let p=n?.config.facets;for(let x in a){let v=a[x],w=v[0].facet,k=p&&p[x]||[];if(v.every(C=>C.type==0))if(c[w.id]=h.length<<1|1,Gg(k,v))h.push(n.facet(w));else{let C=w.combine(v.map(M=>M.value));h.push(n&&w.compare(C,n.facet(w))?n.facet(w):C)}else{for(let C of v)C.type==0?(c[C.id]=h.length<<1|1,h.push(C.value)):(c[C.id]=d.length<<1,d.push(M=>C.dynamicSlot(M)));c[w.id]=d.length<<1,d.push(C=>W5(C,w,v))}}let g=d.map(x=>x(c));return new rh(e,o,g,c,h,a)}}function X5(t,e,i){let n=[[],[],[],[],[]],r=new Map;function a(o,c){let h=r.get(o);if(h!=null){if(h<=c)return;let d=n[h].indexOf(o);d>-1&&n[h].splice(d,1),o instanceof Bm&&i.delete(o.compartment)}if(r.set(o,c),Array.isArray(o))for(let d of o)a(d,c);else if(o instanceof Bm){if(i.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;i.set(o.compartment,d),a(d,c)}else if(o instanceof lk)a(o.inner,o.prec);else if(o instanceof It)n[c].push(o),o.provides&&a(o.provides,c);else if(o instanceof Hc)n[c].push(o),o.facet.extensions&&a(o.facet.extensions,cs.default);else{let d=o.extension;if(!d)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,c)}}return a(t,cs.default),n.reduce((o,c)=>o.concat(c))}function to(t,e){if(e&1)return 2;let i=e>>1,n=t.status[i];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function sh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const ak=le.define(),zm=le.define({combine:t=>t.some(e=>e),static:!0}),ok=le.define({combine:t=>t.length?t[0]:void 0,static:!0}),uk=le.define(),ck=le.define(),hk=le.define(),fk=le.define({combine:t=>t.length?t[0]:!1});class Sn{constructor(e,i){this.type=e,this.value=i}static define(){return new Z5}}class Z5{of(e){return new Sn(this,e)}}class J5{constructor(e){this.map=e}of(e){return new we(this,e)}}class we{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new we(this.type,i)}is(e){return this.type==e}static define(e={}){return new J5(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let a=r.map(i);a&&n.push(a)}return n}}we.reconfigure=we.define();we.appendConfig=we.define();class At{constructor(e,i,n,r,a,o){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,n&&sk(n,i.newLength),a.some(c=>c.type==At.time)||(this.annotations=a.concat(At.time.of(Date.now())))}static create(e,i,n,r,a,o){return new At(e,i,n,r,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 i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(At.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}At.time=Sn.define();At.userEvent=Sn.define();At.addToHistory=Sn.define();At.remote=Sn.define();function $5(t,e){let i=[];for(let n=0,r=0;;){let a,o;if(n<t.length&&(r==e.length||e[r]>=t[n]))a=t[n++],o=t[n++];else if(r<e.length)a=e[r++],o=e[r++];else return i;!i.length||i[i.length-1]<a?i.push(a,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function dk(t,e,i){var n;let r,a,o;return i?(r=e.changes,a=wt.empty(e.changes.length),o=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(a):(n=t.selection)===null||n===void 0?void 0:n.map(r),effects:we.mapEffects(t.effects,r).concat(we.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function _m(t,e,i){let n=e.selection,r=wl(e.annotations);return e.userEvent&&(r=r.concat(At.userEvent.of(e.userEvent))),{changes:e.changes instanceof wt?e.changes:wt.of(e.changes||[],i,t.facet(ok)),selection:n&&(n instanceof W?n:W.single(n.anchor,n.head)),effects:wl(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function pk(t,e,i){let n=_m(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(i=!1);let o=!!e[a].sequential;n=dk(n,_m(t,e[a],o?n.changes.newLength:t.doc.length),o)}let r=At.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return t4(i?e4(r):r)}function e4(t){let e=t.startState,i=!0;for(let r of e.facet(uk)){let a=r(t);if(a===!1){i=!1;break}Array.isArray(a)&&(i=i===!0?a:$5(i,a))}if(i!==!0){let r,a;if(i===!1)a=t.changes.invertedDesc,r=wt.empty(e.doc.length);else{let o=t.changes.filter(i);r=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}t=At.create(e,r,t.selection&&t.selection.map(a),we.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let n=e.facet(ck);for(let r=n.length-1;r>=0;r--){let a=n[r](t);a instanceof At?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof At?t=a[0]:t=pk(e,wl(a),!1)}return t}function t4(t){let e=t.startState,i=e.facet(hk),n=t;for(let r=i.length-1;r>=0;r--){let a=i[r](t);a&&Object.keys(a).length&&(n=dk(n,_m(e,a,t.changes.newLength),!0))}return n==t?t:At.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const i4=[];function wl(t){return t==null?i4:Array.isArray(t)?t:[t]}var nt=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(nt||(nt={}));const n4=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Hm;try{Hm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function r4(t){if(Hm)return Hm.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||n4.test(i)))return!0}return!1}function s4(t){return e=>{if(!/\S/.test(e))return nt.Space;if(r4(e))return nt.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return nt.Word;return nt.Other}}class Be{constructor(e,i,n,r,a,o){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)to(this,c<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return to(this,n),sh(this,n)}update(...e){return pk(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let c of e.effects)c.is(Hh.reconfigure)?(i&&(r=new Map,i.compartments.forEach((h,d)=>r.set(d,h)),i=null),r.set(c.value.compartment,c.value.extension)):c.is(we.reconfigure)?(i=null,n=c.value):c.is(we.appendConfig)&&(i=null,n=wl(n).concat(c.value));let a;i?a=e.startState.values.slice():(i=rh.resolve(n,r,this),a=new Be(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let o=e.startState.facet(zm)?e.newSelection:e.newSelection.asSingle();new Be(i,e.newDoc,o,a,(c,h)=>h.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:W.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),r=this.changes(n.changes),a=[n.range],o=wl(n.effects);for(let c=1;c<i.ranges.length;c++){let h=e(i.ranges[c]),d=this.changes(h.changes),p=d.map(r);for(let x=0;x<c;x++)a[x]=a[x].map(p);let g=r.mapDesc(d,!0);a.push(h.range.map(g)),r=r.compose(p),o=we.mapEffects(o,p).concat(we.mapEffects(wl(h.effects),g))}return{changes:r,selection:W.create(a,i.mainIndex),effects:o}}changes(e=[]){return e instanceof wt?e:wt.of(e,this.doc.length,this.facet(Be.lineSeparator))}toText(e){return Ue.of(e.split(this.facet(Be.lineSeparator)||Rm))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(to(this,i),sh(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof It&&this.config.address[r.id]!=null&&(i[n]=r.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(e,a)){let o=n[a],c=e[a];r.push(o.init(h=>o.spec.fromJSON(c,h)))}}return Be.create({doc:e.doc,selection:W.fromJSON(e.selection),extensions:i.extensions?r.concat([i.extensions]):r})}static create(e={}){let i=rh.resolve(e.extensions||[],new Map),n=e.doc instanceof Ue?e.doc:Ue.of((e.doc||"").split(i.staticFacet(Be.lineSeparator)||Rm)),r=e.selection?e.selection instanceof W?e.selection:W.single(e.selection.anchor,e.selection.head):W.single(0);return sk(r,n.length),i.staticFacet(zm)||(r=r.asSingle()),new Be(i,n,r,i.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Be.tabSize)}get lineBreak(){return this.facet(Be.lineSeparator)||`
46
+ `}get readOnly(){return this.facet(fk)}phrase(e,...i){for(let n of this.facet(Be.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let a=+(r||1);return!a||a>i.length?n:i[a-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let a of this.facet(ak))for(let o of a(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return s4(i.length?i[0]:"")}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-n,c=e-n;for(;o>0;){let h=Et(i,o,!1);if(a(i.slice(h,o))!=nt.Word)break;o=h}for(;c<r;){let h=Et(i,c);if(a(i.slice(c,h))!=nt.Word)break;c=h}return o==c?null:W.range(o+n,c+n)}}Be.allowMultipleSelections=zm;Be.tabSize=le.define({combine:t=>t.length?t[0]:4});Be.lineSeparator=ok;Be.readOnly=fk;Be.phrases=le.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});Be.languageData=ak;Be.changeFilter=uk;Be.transactionFilter=ck;Be.transactionExtender=hk;Hh.reconfigure=we.define();function wn(t,e,i={}){let n={};for(let r of t)for(let a of Object.keys(r)){let o=r[a],c=n[a];if(c===void 0)n[a]=o;else if(!(c===o||o===void 0))if(Object.hasOwnProperty.call(i,a))n[a]=i[a](c,o);else throw new Error("Config merge conflict for field "+a)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Br{eq(e){return this==e}range(e,i=e){return Um.create(e,i,this)}}Br.prototype.startSide=Br.prototype.endSide=0;Br.prototype.point=!1;Br.prototype.mapMode=Zt.TrackDel;function Yg(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Um=class mk{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new mk(e,i,n)}};function qm(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Kg{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let a=n?this.to:this.from;for(let o=r,c=a.length;;){if(o==c)return o;let h=o+c>>1,d=a[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-i;if(h==o)return d>=0?o:c;d>=0?c=h:o=h+1}}between(e,i,n,r){for(let a=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,a);a<o;a++)if(r(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,i){let n=[],r=[],a=[],o=-1,c=-1;for(let h=0;h<this.value.length;h++){let d=this.value[h],p=this.from[h]+e,g=this.to[h]+e,x,v;if(p==g){let w=i.mapPos(p,d.startSide,d.mapMode);if(w==null||(x=v=w,d.startSide!=d.endSide&&(v=i.mapPos(p,d.endSide),v<x)))continue}else if(x=i.mapPos(p,d.startSide),v=i.mapPos(g,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&&(c=Math.max(c,v-x)),n.push(d),r.push(x-o),a.push(v-o))}return{mapped:n.length?new Kg(r,a,n,c):null,pos:o}}}class Re{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new Re(e,i,n,r)}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 i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:a=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(qm)),this.isEmpty)return i.length?Re.of(i):this;let c=new gk(this,null,-1).goto(0),h=0,d=[],p=new Kn;for(;c.value||h<i.length;)if(h<i.length&&(c.from-i[h].from||c.startSide-i[h].value.startSide)>=0){let g=i[h++];p.addInner(g.from,g.to,g.value)||d.push(g)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(h==i.length||this.chunkEnd(c.chunkIndex)<i[h].from)&&(!o||r>this.chunkEnd(c.chunkIndex)||a<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!o||r>c.to||a<c.from||o(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(Um.create(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Re.empty:this.nextLayer.update({add:d,filter:o,filterFrom:r,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let c=this.chunkPos[o],h=this.chunk[o],d=e.touchesRange(c,c+h.length);if(d===!1)r=Math.max(r,h.maxPoint),i.push(h),n.push(e.mapPos(c));else if(d===!0){let{mapped:p,pos:g}=h.map(c,e);p&&(r=Math.max(r,p.maxPoint),i.push(p),n.push(g))}}let a=this.nextLayer.map(e);return i.length==0?a:new Re(n,i,a||Re.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let a=this.chunkPos[r],o=this.chunk[r];if(i>=a&&e<=a+o.length&&o.between(a,e-a,i-a,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return yo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return yo.from(e).goto(i)}static compare(e,i,n,r,a=-1){let o=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=a),c=i.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=a),h=Cv(o,c,n),d=new Qa(o,h,a),p=new Qa(c,h,a);n.iterGaps((g,x,v)=>Av(d,g,p,x,v,r)),n.empty&&n.length==0&&Av(d,0,p,0,0,r)}static eq(e,i,n=0,r){r==null&&(r=999999999);let a=e.filter(p=>!p.isEmpty&&i.indexOf(p)<0),o=i.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let c=Cv(a,o),h=new Qa(a,c,0).goto(n),d=new Qa(o,c,0).goto(n);for(;;){if(h.to!=d.to||!Pm(h.active,d.active)||h.point&&(!d.point||!Yg(h.point,d.point)))return!1;if(h.to>r)return!0;h.next(),d.next()}}static spans(e,i,n,r,a=-1){let o=new Qa(e,null,a).goto(i),c=i,h=o.openStart;for(;;){let d=Math.min(o.to,n);if(o.point){let p=o.activeForPoint(o.to),g=o.pointFrom<i?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,h);r.point(c,d,o.point,p,g,o.pointRank),h=Math.min(o.openEnd(d),p.length)}else d>c&&(r.span(c,d,o.active,h),h=o.openEnd(d));if(o.to>n)return h+(o.point&&o.to>n?1:0);c=o.to,o.next()}}static of(e,i=!1){let n=new Kn;for(let r of e instanceof Um?[e]:i?l4(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Re.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Re.empty;r=r.nextLayer)i=new Re(r.chunkPos,r.chunk,i,Math.max(r.maxPoint,i.maxPoint));return i}}Re.empty=new Re([],[],null,-1);function l4(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(qm(e,n)>0)return t.slice().sort(qm);e=n}return t}Re.empty.nextLayer=Re.empty;class Kn{finishChunk(e){this.chunks.push(new Kg(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,i,n){this.addInner(e,i,n)||(this.nextLayer||(this.nextLayer=new Kn)).add(e,i,n)}addInner(e,i,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=i,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let n=i.value.length-1;return this.last=i.value[n],this.lastFrom=i.from[n]+e,this.lastTo=i.to[n]+e,!0}finish(){return this.finishInner(Re.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=Re.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function Cv(t,e,i){let n=new Map;for(let a of t)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&n.set(a.chunk[o],a.chunkPos[o]);let r=new Set;for(let a of e)for(let o=0;o<a.chunk.length;o++){let c=n.get(a.chunk[o]);c!=null&&(i?i.mapPos(c):c)==a.chunkPos[o]&&!i?.touchesRange(c,c+a.chunk[o].length)&&r.add(a.chunk[o])}return r}class gk{constructor(e,i,n,r=0){this.layer=e,this.skip=i,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!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],i=this.layer.chunk[this.chunkIndex],n=e+i.from[this.rangeIndex];if(this.from=n,this.to=e+i.to[this.rangeIndex],this.value=i.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 yo{constructor(e){this.heap=e}static from(e,i=null,n=-1){let r=[];for(let a=0;a<e.length;a++)for(let o=e[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new gk(o,i,n,a));return r.length==1?r[0]:new yo(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let n of this.heap)n.goto(e,i);for(let n=this.heap.length>>1;n>=0;n--)jp(this.heap,n);return this.next(),this}forward(e,i){for(let n of this.heap)n.forward(e,i);for(let n=this.heap.length>>1;n>=0;n--)jp(this.heap,n);(this.to-e||this.value.endSide-i)<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(),jp(this.heap,0)}}}function jp(t,e){for(let i=t[e];;){let n=(e<<1)+1;if(n>=t.length)break;let r=t[n];if(n+1<t.length&&r.compare(t[n+1])>=0&&(r=t[n+1],n++),i.compare(r)<0)break;t[n]=i,t[e]=r,e=n}}class Qa{constructor(e,i,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=yo.from(e,i,n)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){hc(this.active,e),hc(this.activeTo,e),hc(this.activeRank,e),this.minActive=Mv(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:r,rank:a}=this.cursor;for(;i<this.activeRank.length&&(a-this.activeRank[i]||r-this.activeTo[i])>0;)i++;fc(this.active,i,n),fc(this.activeTo,i,r),fc(this.activeRank,i,a),e&&fc(e,i,this.cursor.from),this.minActive=Mv(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&hc(n,r)}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(n),this.cursor.next();else if(i&&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(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&i.push(this.active[n]);return i.reverse()}openEnd(e){let i=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)i++;return i}}function Av(t,e,i,n,r,a){t.goto(e),i.goto(n);let o=n+r,c=n,h=n-e,d=!!a.boundChange;for(let p=!1;;){let g=t.to+h-i.to,x=g||t.endSide-i.endSide,v=x<0?t.to+h:i.to,w=Math.min(v,o);if(t.point||i.point?(t.point&&i.point&&Yg(t.point,i.point)&&Pm(t.activeForPoint(t.to),i.activeForPoint(i.to))||a.comparePoint(c,w,t.point,i.point),p=!1):(p&&a.boundChange(c),w>c&&!Pm(t.active,i.active)&&a.compareRange(c,w,t.active,i.active),d&&w<o&&(g||t.openEnd(v)!=i.openEnd(v))&&(p=!0)),v>o)break;c=v,x<=0&&t.next(),x>=0&&i.next()}}function Pm(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!Yg(t[i],e[i]))return!1;return!0}function hc(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function fc(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function Mv(t,e){let i=-1,n=1e9;for(let r=0;r<e.length;r++)(e[r]-n||t[r].endSide-t[i].endSide)<0&&(i=r,n=e[r]);return i}function Vl(t,e,i=t.length){let n=0;for(let r=0;r<i&&r<t.length;)t.charCodeAt(r)==9?(n+=e-n%e,r++):(n++,r=Et(t,r));return n}function Fm(t,e,i,n){for(let r=0,a=0;;){if(a>=e)return r;if(r==t.length)break;a+=t.charCodeAt(r)==9?i-a%i:1,r=Et(t,r)}return n===!0?-1:t.length}const Vm="ͼ",Tv=typeof Symbol>"u"?"__"+Vm:Symbol.for(Vm),Im=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ov=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zr{constructor(e,i){this.rules=[];let{finish:n}=i||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,c,h,d){let p=[],g=/^@(\w+)\b/.exec(o[0]),x=g&&g[1]=="keyframes";if(g&&c==null)return h.push(o[0]+";");for(let v in c){let w=c[v];if(/&/.test(v))a(v.split(/,\s*/).map(k=>o.map(C=>k.replace(/&/,C))).reduce((k,C)=>k.concat(C)),w,h);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");a(r(v),w,p,x)}else w!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+w+";")}(p.length||x)&&h.push((n&&!g&&!d?o.map(n):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in e)a(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
47
+ `)}static newName(){let e=Ov[Tv]||1;return Ov[Tv]=e+1,Vm+e.toString(36)}static mount(e,i,n){let r=e[Im],a=n&&n.nonce;r?a&&r.setNonce(a):r=new a4(e,a),r.mount(Array.isArray(i)?i:[i],e)}}let Ev=new Map;class a4{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let a=Ev.get(n);if(a)return e[Im]=a;this.sheet=new r.CSSStyleSheet,Ev.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Im]=this}mount(e,i){let n=this.sheet,r=0,a=0;for(let o=0;o<e.length;o++){let c=e[o],h=this.modules.indexOf(c);if(h<a&&h>-1&&(this.modules.splice(h,1),a--,h=-1),h==-1){if(this.modules.splice(a++,0,c),n)for(let d=0;d<c.rules.length;d++)n.insertRule(c.rules[d],r++)}else{for(;a<h;)r+=this.modules[a++].rules.length;r+=c.rules.length,a++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let h=0;h<this.modules.length;h++)o+=this.modules[h].getRules()+`
48
+ `;this.styleTag.textContent=o;let c=i.head||i;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var _r={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:"'"},xo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o4=typeof navigator<"u"&&/Mac/.test(navigator.platform),u4=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _t=0;_t<10;_t++)_r[48+_t]=_r[96+_t]=String(_t);for(var _t=1;_t<=24;_t++)_r[_t+111]="F"+_t;for(var _t=65;_t<=90;_t++)_r[_t]=String.fromCharCode(_t+32),xo[_t]=String.fromCharCode(_t);for(var Lp in _r)xo.hasOwnProperty(Lp)||(xo[Lp]=_r[Lp]);function c4(t){var e=o4&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||u4&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?xo:_r)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Ke(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)yk(t,arguments[e]);return t}function yk(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)yk(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}let Wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Qm=typeof document<"u"?document:{documentElement:{style:{}}};const Gm=/Edge\/(\d+)/.exec(Wt.userAgent),xk=/MSIE \d/.test(Wt.userAgent),Ym=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wt.userAgent),Uh=!!(xk||Ym||Gm),Nv=!Uh&&/gecko\/(\d+)/i.test(Wt.userAgent),Bp=!Uh&&/Chrome\/(\d+)/.exec(Wt.userAgent),h4="webkitFontSmoothing"in Qm.documentElement.style,Km=!Uh&&/Apple Computer/.test(Wt.vendor),Rv=Km&&(/Mobile\/\w+/.test(Wt.userAgent)||Wt.maxTouchPoints>2);var se={mac:Rv||/Mac/.test(Wt.platform),windows:/Win/.test(Wt.platform),linux:/Linux|X11/.test(Wt.platform),ie:Uh,ie_version:xk?Qm.documentMode||6:Ym?+Ym[1]:Gm?+Gm[1]:0,gecko:Nv,gecko_version:Nv?+(/Firefox\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,chrome:!!Bp,chrome_version:Bp?+Bp[1]:0,ios:Rv,android:/Android\b/.test(Wt.userAgent),webkit_version:h4?+(/\bAppleWebKit\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,safari:Km,safari_version:Km?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Wt.userAgent)||[0,0])[1]:0,tabSize:Qm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Wg(t,e){for(let i in t)i=="class"&&e.class?e.class+=" "+t.class:i=="style"&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}const lh=Object.create(null);function Xg(t,e,i){if(t==e)return!0;t||(t=lh),e||(e=lh);let n=Object.keys(t),r=Object.keys(e);if(n.length-0!=r.length-0)return!1;for(let a of n)if(a!=i&&(r.indexOf(a)==-1||t[a]!==e[a]))return!1;return!0}function f4(t,e){for(let i=t.attributes.length-1;i>=0;i--){let n=t.attributes[i].name;e[n]==null&&t.removeAttribute(n)}for(let i in e){let n=e[i];i=="style"?t.style.cssText=n:t.getAttribute(i)!=n&&t.setAttribute(i,n)}}function Dv(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,r=="style"?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,r=="style"?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function d4(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i];e[n.name]=n.value}return e}class kn{eq(e){return!1}updateDOM(e,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,i,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ut=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(Ut||(Ut={}));class ge extends Br{constructor(e,i,n,r){super(),this.startSide=e,this.endSide=i,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new zo(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return i+=n&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new Ss(e,i,i,n,e.widget||null,!1)}static replace(e){let i=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:a,end:o}=bk(e,i);n=(a?i?-3e8:-1:5e8)-1,r=(o?i?2e8:1:-6e8)+1}return new Ss(e,n,r,i,e.widget||null,!0)}static line(e){return new _o(e)}static set(e,i=!1){return Re.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ge.none=Re.empty;class zo extends ge{constructor(e){let{start:i,end:n}=bk(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Wg(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||lh}eq(e){return this==e||e instanceof zo&&this.tagName==e.tagName&&Xg(this.attrs,e.attrs)}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}zo.prototype.point=!1;class _o extends ge{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _o&&this.spec.class==e.spec.class&&Xg(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}_o.prototype.mapMode=Zt.TrackBefore;_o.prototype.point=!0;class Ss extends ge{constructor(e,i,n,r,a,o){super(i,n,a,e),this.block=r,this.isReplace=o,this.mapMode=r?i<=0?Zt.TrackBefore:Zt.TrackAfter:Zt.TrackDel}get type(){return this.startSide!=this.endSide?Ut.WidgetRange:this.startSide<=0?Ut.WidgetBefore:Ut.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ss&&p4(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}Ss.prototype.point=!0;function bk(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return i==null&&(i=t.inclusive),n==null&&(n=t.inclusive),{start:i??e,end:n??e}}function p4(t,e){return t==e||!!(t&&e&&t.compare(e))}function kl(t,e,i,n=0){let r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}class bo extends Br{constructor(e,i){super(),this.tagName=e,this.attributes=i}eq(e){return e==this||e instanceof bo&&this.tagName==e.tagName&&Xg(this.attributes,e.attributes)}static create(e){return new bo(e.tagName,e.attributes||lh)}static set(e,i=!1){return Re.of(e,i)}}bo.prototype.startSide=bo.prototype.endSide=-1;function vo(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Wm(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function io(t,e){if(!e.anchorNode)return!1;try{return Wm(t,e.anchorNode)}catch{return!1}}function no(t){return t.nodeType==3?wo(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ro(t,e,i,n){return i?jv(t,e,i,n,-1)||jv(t,e,i,n,1):!1}function Hr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function ah(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function jv(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:Wn(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=Hr(t)+(r<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?Wn(t):0}else return!1}}function Wn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function So(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function m4(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function vk(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function g4(t,e,i,n,r,a,o,c){let h=t.ownerDocument,d=h.defaultView||window;for(let p=t,g=!1;p&&!g;)if(p.nodeType==1){let x,v=p==h.body,w=1,k=1;if(v)x=m4(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(g=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let T=p.getBoundingClientRect();({scaleX:w,scaleY:k}=vk(p,T)),x={left:T.left,right:T.left+p.clientWidth*w,top:T.top,bottom:T.top+p.clientHeight*k}}let C=0,M=0;if(r=="nearest")e.top<x.top?(M=e.top-(x.top+o),i>0&&e.bottom>x.bottom+M&&(M=e.bottom-x.bottom+o)):e.bottom>x.bottom&&(M=e.bottom-x.bottom+o,i<0&&e.top-M<x.top&&(M=e.top-(x.top+o)));else{let T=e.bottom-e.top,j=x.bottom-x.top;M=(r=="center"&&T<=j?e.top+T/2-j/2:r=="start"||r=="center"&&i<0?e.top-o:e.bottom-j+o)-x.top}if(n=="nearest"?e.left<x.left?(C=e.left-(x.left+a),i>0&&e.right>x.right+C&&(C=e.right-x.right+a)):e.right>x.right&&(C=e.right-x.right+a,i<0&&e.left<x.left+C&&(C=e.left-(x.left+a))):C=(n=="center"?e.left+(e.right-e.left)/2-(x.right-x.left)/2:n=="start"==c?e.left-a:e.right-(x.right-x.left)+a)-x.left,C||M)if(v)d.scrollBy(C,M);else{let T=0,j=0;if(M){let L=p.scrollTop;p.scrollTop+=M/k,j=(p.scrollTop-L)*k}if(C){let L=p.scrollLeft;p.scrollLeft+=C/w,T=(p.scrollLeft-L)*w}e={left:e.left-T,top:e.top-j,right:e.right-T,bottom:e.bottom-j},T&&Math.abs(T-C)<1&&(n="nearest"),j&&Math.abs(j-M)<1&&(r="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 y4(t){let e=t.ownerDocument,i,n;for(let r=t.parentNode;r&&!(r==e.body||i&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:n}}class x4{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:i,focusNode:n}=e;this.set(i,Math.min(e.anchorOffset,i?Wn(i):0),n,Math.min(e.focusOffset,n?Wn(n):0))}set(e,i,n,r){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=r}}let us=null;se.safari&&se.safari_version>=26&&(us=!1);function Sk(t){if(t.setActive)return t.setActive();if(us)return t.focus(us);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(us==null?{get preventScroll(){return us={preventScroll:!0},!0}}:void 0),!us){us=!1;for(let i=0;i<e.length;){let n=e[i++],r=e[i++],a=e[i++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let Lv;function wo(t,e,i=e){let n=Lv||(Lv=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function Cl(t,e,i,n){let r={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let a=new KeyboardEvent("keydown",r);a.synthetic=!0,t.dispatchEvent(a);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,t.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function b4(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function v4(t,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Wn(i));;)if(n){if(i.nodeType!=1)return!1;let r=i.childNodes[n-1];r.contentEditable=="false"?n--:(i=r,n=Wn(i))}else{if(i==t)return!0;n=Hr(i),i=i.parentNode}}function wk(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function kk(t,e){for(let i=t,n=e;;){if(i.nodeType==3&&n>0)return{node:i,offset:n};if(i.nodeType==1&&n>0){if(i.contentEditable=="false")return null;i=i.childNodes[n-1],n=Wn(i)}else if(i.parentNode&&!ah(i))n=Hr(i),i=i.parentNode;else return null}}function Ck(t,e){for(let i=t,n=e;;){if(i.nodeType==3&&n<i.nodeValue.length)return{node:i,offset:n};if(i.nodeType==1&&n<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[n],n=0}else if(i.parentNode&&!ah(i))n=Hr(i)+1,i=i.parentNode;else return null}}class Xi{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new Xi(e.parentNode,Hr(e),i)}static after(e,i){return new Xi(e.parentNode,Hr(e)+1,i)}}var Ze=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Ze||(Ze={}));const ws=Ze.LTR,Zg=Ze.RTL;function Ak(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const S4=Ak("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),w4=Ak("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Xm=Object.create(null),on=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Xm[e]=i,Xm[i]=-e}function Mk(t){return t<=247?S4[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?w4[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const k4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class mn{get dir(){return this.level%2?Zg:ws}constructor(e,i,n){this.from=e,this.to=i,this.level=n}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,n,r){let a=-1;for(let o=0;o<e.length;o++){let c=e[o];if(c.from<=i&&c.to>=i){if(c.level==n)return o;(a<0||(r!=0?r<0?c.from<i:c.to>i:e[a].level>c.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function Tk(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],r=e[i];if(n.from!=r.from||n.to!=r.to||n.direction!=r.direction||!Tk(n.inner,r.inner))return!1}return!0}const Xe=[];function C4(t,e,i,n,r){for(let a=0;a<=n.length;a++){let o=a?n[a-1].to:e,c=a<n.length?n[a].from:i,h=a?256:r;for(let d=o,p=h,g=h;d<c;d++){let x=Mk(t.charCodeAt(d));x==512?x=p:x==8&&g==4&&(x=16),Xe[d]=x==4?2:x,x&7&&(g=x),p=x}for(let d=o,p=h,g=h;d<c;d++){let x=Xe[d];if(x==128)d<c-1&&p==Xe[d+1]&&p&24?x=Xe[d]=p:Xe[d]=256;else if(x==64){let v=d+1;for(;v<c&&Xe[v]==64;)v++;let w=d&&p==8||v<i&&Xe[v]==8?g==1?1:8:256;for(let k=d;k<v;k++)Xe[k]=w;d=v-1}else x==8&&g==1&&(Xe[d]=1);p=x,x&7&&(g=x)}}}function A4(t,e,i,n,r){let a=r==1?2:1;for(let o=0,c=0,h=0;o<=n.length;o++){let d=o?n[o-1].to:e,p=o<n.length?n[o].from:i;for(let g=d,x,v,w;g<p;g++)if(v=Xm[x=t.charCodeAt(g)])if(v<0){for(let k=c-3;k>=0;k-=3)if(on[k+1]==-v){let C=on[k+2],M=C&2?r:C&4?C&1?a:r:0;M&&(Xe[g]=Xe[on[k]]=M),c=k;break}}else{if(on.length==189)break;on[c++]=g,on[c++]=x,on[c++]=h}else if((w=Xe[g])==2||w==1){let k=w==r;h=k?0:1;for(let C=c-3;C>=0;C-=3){let M=on[C+2];if(M&2)break;if(k)on[C+2]|=2;else{if(M&4)break;on[C+2]|=4}}}}}function M4(t,e,i,n){for(let r=0,a=n;r<=i.length;r++){let o=r?i[r-1].to:t,c=r<i.length?i[r].from:e;for(let h=o;h<c;){let d=Xe[h];if(d==256){let p=h+1;for(;;)if(p==c){if(r==i.length)break;p=i[r++].to,c=r<i.length?i[r].from:e}else if(Xe[p]==256)p++;else break;let g=a==1,x=(p<e?Xe[p]:n)==1,v=g==x?g?1:2:n;for(let w=p,k=r,C=k?i[k-1].to:t;w>h;)w==C&&(w=i[--k].from,C=k?i[k-1].to:t),Xe[--w]=v;h=p}else a=d,h++}}}function Zm(t,e,i,n,r,a,o){let c=n%2?2:1;if(n%2==r%2)for(let h=e,d=0;h<i;){let p=!0,g=!1;if(d==a.length||h<a[d].from){let k=Xe[h];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d<a.length&&w==a[d].from){if(g)break e;let k=a[d];if(!p)for(let C=k.to,M=d+1;;){if(C==i)break e;if(M<a.length&&a[M].from==C)C=a[M++].to;else{if(Xe[C]==c)break e;break}}if(d++,x)x.push(k);else{k.from>h&&o.push(new mn(h,k.from,v));let C=k.direction==ws!=!(v%2);Jm(t,C?n+1:n,r,k.inner,k.from,k.to,o),h=k.to}w=k.to}else{if(w==i||(p?Xe[w]!=c:Xe[w]==c))break;w++}x?Zm(t,h,w,n+1,r,x,o):h<w&&o.push(new mn(h,w,v)),h=w}else for(let h=i,d=a.length;h>e;){let p=!0,g=!1;if(!d||h>a[d-1].to){let k=Xe[h-1];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d&&w==a[d-1].to){if(g)break e;let k=a[--d];if(!p)for(let C=k.from,M=d;;){if(C==e)break e;if(M&&a[M-1].to==C)C=a[--M].from;else{if(Xe[C-1]==c)break e;break}}if(x)x.push(k);else{k.to<h&&o.push(new mn(k.to,h,v));let C=k.direction==ws!=!(v%2);Jm(t,C?n+1:n,r,k.inner,k.from,k.to,o),h=k.from}w=k.from}else{if(w==e||(p?Xe[w-1]!=c:Xe[w-1]==c))break;w--}x?Zm(t,w,h,n+1,r,x,o):w<h&&o.push(new mn(w,h,v)),h=w}}function Jm(t,e,i,n,r,a,o){let c=e%2?2:1;C4(t,r,a,n,c),A4(t,r,a,n,c),M4(r,a,n,c),Zm(t,r,a,e,i,n,o)}function T4(t,e,i){if(!t)return[new mn(0,0,e==Zg?1:0)];if(e==ws&&!i.length&&!k4.test(t))return Ok(t.length);if(i.length)for(;t.length>Xe.length;)Xe[Xe.length]=256;let n=[],r=e==ws?0:1;return Jm(t,r,r,i,0,t.length,n),n}function Ok(t){return[new mn(0,t,0)]}let Ek="";function O4(t,e,i,n,r){var a;let o=n.head-t.from,c=mn.find(e,o,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),h=e[c],d=h.side(r,i);if(o==d){let x=c+=r?1:-1;if(x<0||x>=e.length)return null;h=e[c=x],o=h.side(!r,i),d=h.side(r,i)}let p=Et(t.text,o,h.forward(r,i));(p<h.from||p>h.to)&&(p=d),Ek=t.text.slice(Math.min(o,p),Math.max(o,p));let g=c==(r?e.length-1:0)?null:e[c+(r?1:-1)];return g&&p==d&&g.level+(r?0:1)<h.level?W.cursor(g.side(!r,i)+t.from,g.forward(r,i)?1:-1,g.level):W.cursor(p+t.from,h.forward(r,i)?-1:1,h.level)}function E4(t,e,i){for(let n=e;n<i;n++){let r=Mk(t.charCodeAt(n));if(r==1)return ws;if(r==2||r==4)return Zg}return ws}const Nk=le.define(),Rk=le.define(),Dk=le.define(),jk=le.define(),$m=le.define(),Lk=le.define(),Bk=le.define(),Jg=le.define(),$g=le.define(),zk=le.define({combine:t=>t.some(e=>e)}),_k=le.define({combine:t=>t.some(e=>e)}),Hk=le.define();class Al{constructor(e,i="nearest",n="nearest",r=5,a=5,o=!1){this.range=e,this.y=i,this.x=n,this.yMargin=r,this.xMargin=a,this.isSnapshot=o}map(e){return e.empty?this:new Al(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 Al(W.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const dc=we.define({map:(t,e)=>t.map(e)}),Uk=we.define();function ci(t,e,i){let n=t.facet(jk);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const In=le.define({combine:t=>t.length?t[0]:!0});let N4=0;const yl=le.define({combine(t){return t.filter((e,i)=>{for(let n=0;n<i;n++)if(t[n].plugin==e.plugin)return!1;return!0})}});class ot{constructor(e,i,n,r,a){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(yl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(yl.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:r,provide:a,decorations:o}=i||{};return new ot(N4++,e,n,r,c=>{let h=[];return o&&h.push(qh.of(d=>{let p=d.plugin(c);return p?o(p):ge.none})),a&&h.push(a(c)),h})}static fromClass(e,i){return ot.define((n,r)=>new e(n,r),i)}}class zp{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 i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(n){if(ci(i.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(i){ci(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(n){ci(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const qk=le.define(),e0=le.define(),qh=le.define(),Pk=le.define(),t0=le.define(),Ho=le.define(),Fk=le.define();function Bv(t,e){let i=t.state.facet(Fk);if(!i.length)return i;let n=i.map(a=>a instanceof Function?a(t):a),r=[];return Re.spans(n,e.from,e.to,{point(){},span(a,o,c,h){let d=a-e.from,p=o-e.from,g=r;for(let x=c.length-1;x>=0;x--,h--){let v=c[x].spec.bidiIsolate,w;if(v==null&&(v=E4(e.text,d,p)),h>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=p,g=w.inner;else{let k={from:d,to:p,direction:v,inner:[]};g.push(k),g=k.inner}}}}),r}const Vk=le.define();function i0(t){let e=0,i=0,n=0,r=0;for(let a of t.state.facet(Vk)){let o=a(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(i=Math.max(i,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:i,top:n,bottom:r}}const Xa=le.define();class qi{constructor(e,i,n,r){this.fromA=e,this.toA=i,this.fromB=n,this.toB=r}join(e){return new qi(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 i=e.length,n=this;for(;i>0;i--){let r=e[i-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(i-1,1)}}return e.splice(i,0,n),e}static extendWithRanges(e,i){if(i.length==0)return e;let n=[];for(let r=0,a=0,o=0;;){let c=r<e.length?e[r].fromB:1e9,h=a<i.length?i[a]:1e9,d=Math.min(c,h);if(d==1e9)break;let p=d+o,g=d,x=p;for(;;)if(a<i.length&&i[a]<=g){let v=i[a+1];a+=2,g=Math.max(g,v);for(let w=r;w<e.length&&e[w].fromB<=g;w++)o=e[w].toA-e[w].toB;x=Math.max(x,v+o)}else if(r<e.length&&e[r].fromB<=g){let v=e[r++];g=Math.max(g,v.toB),x=Math.max(x,v.toA),o=v.toA-v.toB}else break;n.push(new qi(p,x,d,g))}return n}}class oh{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=wt.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let r=[];this.changes.iterChangedRanges((a,o,c,h)=>r.push(new qi(a,o,c,h))),this.changedRanges=r}static create(e,i,n){return new oh(e,i,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const R4=[];class vt{constructor(e,i,n=0){this.dom=e,this.length=i,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return R4}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 i=this.domAttrs;i&&f4(this.dom,i)}}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,i=this.posAtStart){let n=i;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,i){return null}domPosFor(e,i){let n=Hr(this.dom),r=this.length?e>0:i>0;return new Xi(this.parent.dom,n+(r?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 Fh)return e;return null}static get(e){return e.cmTile}}class Ph extends vt{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 i=this.dom,n=null,r,a=e?.node==i?e:null,o=0;for(let c of this.children){if(c.sync(e),o+=c.length+c.breakAfter,r=n?n.nextSibling:i.firstChild,a&&r!=c.dom&&(a.written=!0),c.dom.parentNode==i)for(;r&&r!=c.dom;)r=zv(r);else i.insertBefore(c.dom,r);n=c.dom}for(r=n?n.nextSibling:i.firstChild,a&&r&&(a.written=!0);r;)r=zv(r);this.length=o}}function zv(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Fh extends Ph{constructor(e,i){super(i),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 i=vt.get(e);if(i&&this.owns(i))return i;e=e.parentNode}}blockTiles(e){for(let i=[],n=this,r=0,a=0;;)if(r==n.children.length){if(!i.length)return;n=n.parent,n.breakAfter&&a++,r=i.pop()}else{let o=n.children[r++];if(o instanceof Qn)i.push(r),n=o,r=0;else{let c=a+o.length,h=e(o,a);if(h!==void 0)return h;a=c+o.breakAfter}}}resolveBlock(e,i){let n,r=-1,a,o=-1;if(this.blockTiles((c,h)=>{let d=h+c.length;if(e>=h&&e<=d){if(c.isWidget()&&i>=-1&&i<=1){if(c.flags&32)return!0;c.flags&16&&(n=void 0)}(h<e||e==d&&(i<-1?c.length:c.covers(1)))&&(!n||!c.isWidget()&&n.isWidget())&&(n=c,r=e-h),(d>e||e==h&&(i>1?c.length:c.covers(-1)))&&(!a||!c.isWidget()&&a.isWidget())&&(a=c,o=e-h)}}),!n&&!a)throw new Error("No tile at position "+e);return n&&i<0||!a?{tile:n,offset:r}:{tile:a,offset:o}}}class Qn extends Ph{constructor(e,i){super(e),this.wrapper=i}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,i){let n=new Qn(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class jl extends Ph{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,n){let r=new jl(i||document.createElement("div"),e);return(!i||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,i,n){let r=null,a=-1,o=null,c=-1;function h(p,g){for(let x=0,v=0;x<p.children.length&&v<=g;x++){let w=p.children[x],k=v+w.length;k>=g&&(w.isComposite()?h(w,g-v):(!o||o.isHidden&&(i>0||n&&j4(o,w)))&&(k>g||w.flags&32)?(o=w,c=g-v):(v<g||w.flags&16&&!w.isHidden)&&(r=w,a=g-v)),v=k}}h(this,e);let d=(i<0?r:o)||r||o;return d?{tile:d,offset:d==r?a:c}:null}coordsIn(e,i){let n=this.resolveInline(e,i,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),i):D4(this)}domIn(e,i){let n=this.resolveInline(e,i);if(n){let{tile:r,offset:a}=n;if(this.dom.contains(r.dom))return r.isText()?new Xi(r.dom,Math.min(r.dom.nodeValue.length,a)):r.domPosFor(a,r.flags&16?1:r.flags&32?-1:i);let o=n.tile.parent,c=!1;for(let h of o.children){if(c)return new Xi(h.dom,0);h==n.tile&&(c=!0)}}return new Xi(this.dom,0)}}function D4(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=no(e);return i[i.length-1]||null}function j4(t,e){let i=t.coordsIn(0,1),n=e.coordsIn(0,1);return i&&n&&n.top<i.bottom}class oi extends Ph{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let n=new oi(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class ps extends vt{constructor(e,i){super(e,i.length),this.text=i}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,i){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,a=e,o=0;e==0&&i<0||e==n&&i>=0?se.chrome||se.gecko||(e?(r--,o=1):a<n&&(a++,o=-1)):i<0?r--:a<n&&a++;let c=wo(this.dom,r,a).getClientRects();if(!c.length)return null;let h=c[(o?o<0:i>=0)?0:c.length-1];return se.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(c,d=>d.width)||h),o?So(h,o<0):h||null}static of(e,i){let n=new ps(i||document.createTextNode(e),e);return i||(n.flags|=2),n}}class ks extends vt{constructor(e,i,n,r){super(e,i,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,i){return this.coordsInWidget(e,i,!1)}coordsInWidget(e,i,n){let r=this.widget.coordsAt(this.dom,e,i);if(r)return r;if(n)return So(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=c?a.length-1:0;o=a[h],!(e>0?h==0:h==a.length-1||o.top<o.bottom);h+=c?-1:1);return So(o,!c)}}get overrideDOMText(){if(!this.length)return Ue.empty;let{root:e}=this;if(!e)return Ue.empty;let i=this.posAtStart;return e.view.state.doc.slice(i,i+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,n,r,a){return a||(a=e.toDOM(i),e.editable||(a.contentEditable="false")),new ks(a,n,e,r)}}class uh extends vt{constructor(e){let i=document.createElement("img");i.className="cm-widgetBuffer",i.setAttribute("aria-hidden","true"),super(i,0,e)}get isHidden(){return!0}get overrideDOMText(){return Ue.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class L4{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,n){let{tile:r,index:a,beforeBreak:o,parents:c}=this;for(;e||i>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(a==r.children.length){if(!e&&!c.length)break;n&&n.leave(r),o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++}else{let h=r.children[a],d=h.breakAfter;(i>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(o=!!d,a++,e-=h.length):(c.push({tile:r,index:a}),r=h,a=0,n&&h.isComposite()&&n.enter(h))}else if(a==r.length)o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++;else if(e){let h=Math.min(e,r.length-a);n&&n.skip(r,a,a+h),e-=h,a+=h}else break;return this.tile=r,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class B4{constructor(e,i,n,r){this.from=e,this.to=i,this.wrapper=n,this.rank=r}}class z4{constructor(e,i,n){this.cache=e,this.root=i,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,i,n,r){var a;this.flushBuffer();let o=this.ensureMarks(i,n),c=o.lastChild;if(c&&c.isText()&&!(c.flags&8)&&c.length+e.length<512){this.cache.reused.set(c,2);let h=o.children[o.children.length-1]=new ps(c.dom,c.text+e);h.parent=o}else o.append(r||ps.of(e,(a=this.cache.find(ps))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,i){let n=this.curLine;n.dom!=i.line.dom&&(n.setDOM(this.cache.reused.has(i.line)?_p(i.line.dom):i.line.dom),this.cache.reused.set(i.line,2));let r=n;for(let c=i.marks.length-1;c>=0;c--){let h=i.marks[c],d=r.lastChild;if(d instanceof oi&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(_p(h.dom)),r=d;else{if(this.cache.reused.get(h)){let g=vt.get(h.dom);g&&g.setDOM(_p(h.dom))}let p=oi.of(h.mark,h.dom);r.append(p),r=p}this.cache.reused.set(h,2)}let a=vt.get(e.text);a&&this.cache.reused.set(a,2);let o=new ps(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,i,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let a=this.ensureMarks(i,n);!r&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,i,n){this.flushBuffer(),this.ensureMarks(i,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let i=this.afterWidget||this.lastBlock;i.length+=e,this.pos+=e}addLineStart(e,i){var n;e||(e=Ik);let r=jl.start(e,i||((n=this.cache.find(jl))===null||n===void 0?void 0:n.dom),!!i);this.getBlockPos().append(this.lastBlock=this.curLine=r)}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,i){var n;let r=this.curLine;for(let a=e.length-1;a>=0;a--){let o=e[a],c;if(i>0&&(c=r.lastChild)&&c instanceof oi&&c.mark.eq(o))r=c,i--;else{let h=oi.of(o,(n=this.cache.find(oi,d=>d.mark.eq(o)))===null||n===void 0?void 0:n.dom);r.append(h),r=h,i=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!_v(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(se.ios&&_v(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Hp,0,32)||new ks(Hp.toDOM(),0,Hp,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 i=new B4(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-i.rank||this.wrappers[n-1].to-i.to)<0;)n--;this.wrappers.splice(n,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let i=this.root;for(let n of this.wrappers){let r=i.lastChild;if(n.from<this.pos&&r instanceof Qn&&r.wrapper.eq(n.wrapper))i=r;else{let a=Qn.of(n.wrapper,(e=this.cache.find(Qn,o=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);i.append(a),i=a}}return i}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let i=2|(e<0?16:32),n=this.cache.find(uh,void 0,1);return n&&(n.flags=i),n||new uh(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class _4{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:r,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=r;let c=this.textOff=Math.min(e,r.length);return a?null:r.slice(0,c)}let i=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,i);return this.textOff=i,n}}const ch=[ks,jl,ps,oi,uh,Qn,Fh];for(let t=0;t<ch.length;t++)ch[t].bucket=t;class H4{constructor(e){this.view=e,this.buckets=ch.map(()=>[]),this.index=ch.map(()=>0),this.reused=new Map}add(e){let i=e.constructor.bucket,n=this.buckets[i];n.length<6?n.push(e):n[this.index[i]=(this.index[i]+1)%6]=e}find(e,i,n=2){let r=e.bucket,a=this.buckets[r],o=this.index[r];for(let c=a.length-1;c>=0;c--){let h=(c+o)%a.length,d=a[h];if((!i||i(d))&&!this.reused.has(d))return a.splice(h,1),h<o&&this.index[r]--,this.reused.set(d,n),d}return null}findWidget(e,i,n){let r=this.buckets[0];if(r.length)for(let a=0,o=0;;a++){if(a==r.length){if(o)return null;o=1,a=0}let c=r[a];if(!this.reused.has(c)&&(o==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return r.splice(a,1),a<this.index[0]&&this.index[0]--,c.widget==e&&c.length==i&&(c.flags&497)==n?(this.reused.set(c,1),c):(this.reused.set(c,2),new ks(c.dom,i,e,c.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,i=2){if(!this.reused.has(e))return this.reused.set(e,i),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class U4{constructor(e,i,n,r,a){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new H4(e),this.text=new _4(e.state.doc),this.builder=new z4(this.cache,new Fh(e,e.contentDOM),Re.iter(n)),this.cache.reused.set(i,2),this.old=new L4(i),this.reuseWalker={skip:(o,c,h)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,i){let n=i&&this.getCompositionContext(i.text);for(let r=0,a=0,o=0;;){let c=o<e.length?e[o++]:null,h=c?c.fromA:this.old.root.length;if(h>r){let d=h-r;this.preserve(d,!o,!c),r=h,a+=d}if(!c)break;i&&c.fromA<=i.range.fromA&&c.toA>=i.range.toA?(this.forward(c.fromA,i.range.fromA,i.range.fromA<i.range.toA?1:-1),this.emit(a,i.range.fromB),this.cache.clear(),this.builder.addComposition(i,n),this.text.skip(i.range.toB-i.range.fromB),this.forward(i.range.fromA,c.toA),this.emit(i.range.toB,c.toB)):(this.forward(c.fromA,c.toA),this.emit(a,c.toB)),a=c.toB,r=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,n){let r=F4(this.old),a=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,c,h)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(h-c);else{let d=h>0||c<o.length?ks.of(o.widget,this.view,h-c,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,r,a),a=r.length)}else if(o.isText())this.builder.ensureLine(null),!c&&h==o.length?this.builder.addText(o.text,r,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(c,h),r,a)),a=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof uh)this.cache.add(o);else if(o instanceof oi)this.builder.ensureLine(null),this.builder.addMark(o,r,a),this.cache.reused.set(o,1),a=r.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 oi&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=a=0):o instanceof oi&&(r.shift(),a=Math.min(a,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let n=null,r=this.builder,a=0,o=Re.spans(this.decorations,e,i,{point:(c,h,d,p,g,x)=>{if(d instanceof Ss){if(this.disallowBlockEffectsFor[x]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,g>p.length)r.continueWidget(h-c);else{let v=d.widget||(d.block?Ll.block:Ll.inline),w=q4(d),k=this.cache.findWidget(v,h-c,w)||ks.of(v,this.view,h-c,w);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(k)):(r.ensureLine(n),r.addInlineWidget(k,p,g))}n=null}else n=P4(n,d);h>c&&this.text.skip(h-c)},span:(c,h,d,p)=>{for(let g=c;g<h;){let x=this.text.next(Math.min(512,h-g));x==null?(r.addLineStartIfNotCovered(n),r.addBreak(),g++):(r.ensureLine(n),r.addText(x,d,g==c?p:d.length),g+=x.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=o>a,this.openMarks=o}forward(e,i,n=1){i-e<=10?this.old.advance(i-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(i-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let i=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let a=vt.get(r);if(r==this.view.contentDOM)break;a instanceof oi?i.push(a):a?.isLine()?n=a:a instanceof Qn||(r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new jl(r,Ik):n||i.push(oi.of(new zo({tagName:r.nodeName.toLowerCase(),attributes:d4(r)}),r)))}return{line:n,marks:i}}}function _v(t,e){let i=n=>{for(let r of n.children)if((e?r.isText():r.length)||i(r))return!0;return!1};return i(t)}function q4(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Ik={class:"cm-line"};function P4(t,e){let i=e.spec.attributes,n=e.spec.class;return!i&&!n||(t||(t={class:"cm-line"}),i&&Wg(i,t),n&&(t.class+=" "+n)),t}function F4(t){let e=[];for(let i=t.parents.length;i>1;i--){let n=i==t.parents.length?t.tile:t.parents[i].tile;n instanceof oi&&e.push(n.mark)}return e}function _p(t){let e=vt.get(t);return e&&e.setDOM(t.cloneNode()),t}class Ll extends kn{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}}Ll.inline=new Ll("span");Ll.block=new Ll("div");const Hp=new class extends kn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Hv{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ge.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Fh(e,e.contentDOM),this.updateInner([new qi(0,0,0,e.state.doc.length)],null)}update(e){var i;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:p,toA:g})=>g<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?r=this.domChanged.newSel.head:!Z4(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let a=r>-1?I4(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;n=new qi(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(se.ie||se.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,c=this.blockWrappers;this.updateDeco();let h=Y4(o,this.decorations,e.changes);h.length&&(n=qi.extendWithRanges(n,h));let d=W4(c,this.blockWrappers,e.changes);return d.length&&(n=qi.extendWithRanges(n,d)),a&&!n.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(i||e.length){let o=this.tile,c=new U4(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,i),eg(o,c.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=se.chrome||se.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof Up&&r.push(a.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let n of i.effects)n.is(Uk)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,a=r==n,o=!a&&!(this.view.state.facet(In)||n.tabIndex>-1)&&io(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(a||i||o))return;let c=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,d,p;if(h.empty?p=d=this.inlineDOMNearPos(h.anchor,h.assoc||1):(p=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),d=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),se.gecko&&h.empty&&!this.hasComposition&&V4(d)){let x=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(x,d.node.childNodes[d.offset]||null)),d=p=new Xi(x,0),c=!0}let g=this.view.observer.selectionRange;(c||!g.focusNode||(!ro(d.node,d.offset,g.anchorNode,g.anchorOffset)||!ro(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,h))&&(this.view.observer.ignore(()=>{se.android&&se.chrome&&n.contains(g.focusNode)&&X4(g.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let x=vo(this.view.root);if(x)if(h.empty){if(se.gecko){let v=Q4(d.node,d.offset);if(v&&v!=3){let w=(v==1?kk:Ck)(d.node,d.offset);w&&(d=new Xi(w.node,w.offset))}}x.collapse(d.node,d.offset),h.bidiLevel!=null&&x.caretBidiLevel!==void 0&&(x.caretBidiLevel=h.bidiLevel)}else if(x.extend){x.collapse(d.node,d.offset);try{x.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();h.anchor>h.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==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Xi(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new Xi(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&ro(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,n=vo(e.root),{anchorNode:r,anchorOffset:a}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let o=this.lineAt(i.head,i.assoc);if(!o)return;let c=o.posAtStart;if(i.head==c||i.head==c+o.length)return;let h=this.coordsAt(i.head,-1),d=this.coordsAt(i.head,1);if(!h||!d||h.bottom>d.top)return;let p=this.domAtPos(i.head+i.assoc,i.assoc);n.collapse(p.node,p.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=i.from&&n.collapse(r,a)}posFromDOM(e,i){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let a;if(e==n.dom)a=n.dom.childNodes[i];else{let o=Wn(e)==0?0:i==0?-1:1;for(;;){let c=e.parentNode;if(c==n.dom)break;o==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?o=-1:o=1),e=c}o<0?a=e:a=e.nextSibling}if(a==n.dom.firstChild)return r;for(;a&&!vt.get(a);)a=a.nextSibling;if(!a)return r+n.length;for(let o=0,c=r;;o++){let h=n.children[o];if(h.dom==a)return c;c+=h.length+h.breakAfter}}else return n.isText()?e==n.dom?r+i:r+(i?n.length:0):r}domAtPos(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.domPosFor(e,i):n.domIn(r,i)}inlineDOMNearPos(e,i){let n,r=-1,a=!1,o,c=-1,h=!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 g=p+d.length;if(p<=e&&(n=d,r=e-p,a=g<e),g>=e&&!o&&(o=d,c=e-p,h=p>e),p>e&&o)return!0}}),!n&&!o?this.domAtPos(e,i):(a&&o?n=null:h&&n&&(o=null),n&&i<0||!o?n.domIn(r,i):o.domIn(c,i))}coordsAt(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.widget instanceof Up?null:n.coordsInWidget(r,i,!0):n.coordsIn(r,i)}lineAt(e,i){let{tile:n}=this.tile.resolveBlock(e,i);return n.isLine()?n:null}coordsForChar(e){let{tile:i,offset:n}=this.tile.resolveBlock(e,1);if(!i.isLine())return null;function r(a,o){if(a.isComposite())for(let c of a.children){if(c.length>=o){let h=r(c,o);if(h)return h}if(o-=c.length,o<0)break}else if(a.isText()&&o<a.length){let c=Et(a.text,o);if(c==o)return null;let h=wo(a.dom,o,c).getClientRects();for(let d=0;d<h.length;d++){let p=h[d];if(d==h.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(i,n)}measureVisibleLineHeights(e){let i=[],{from:n,to:r}=e,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==Ze.LTR,d=0,p=(g,x,v)=>{for(let w=0;w<g.children.length&&!(x>r);w++){let k=g.children[w],C=x+k.length,M=k.dom.getBoundingClientRect(),{height:T}=M;if(v&&!w&&(d+=M.top-v.top),k instanceof Qn)C>n&&p(k,x,M);else if(x>=n&&(d>0&&i.push(-d),i.push(T+d),d=0,o)){let j=k.dom.lastChild,L=j?no(j):[];if(L.length){let D=L[L.length-1],U=h?D.right-M.left:M.right-D.left;U>c&&(c=U,this.minWidth=a,this.minWidthFrom=x,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-M.bottom),x=C+k.breakAfter}};return p(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?Ze.RTL:Ze.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let c=0,h;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=no(d.dom);if(p.length!=1)return;c+=p[0].width,h=p[0].height}if(c)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:c/o.length,textHeight:h}}});if(e)return e;let i=document.createElement("div"),n,r,a;return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let o=no(i.firstChild)[0];n=i.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,a=o&&o.height?o.height:n,i.remove()}),{lineHeight:n,charWidth:r,textHeight:a}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,r=0;;r++){let a=r==i.viewports.length?null:i.viewports[r],o=a?a.from-1:this.view.state.doc.length;if(o>n){let c=(i.lineBlockAt(o).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(ge.replace({widget:new Up(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!a)break;n=a.to+1}return ge.set(e)}updateDeco(){let e=1,i=this.view.state.facet(qh).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),n=!1,r=this.view.state.facet(t0).map((a,o)=>{let c=typeof a=="function";return c&&(n=!0),c?a(this.view):a});for(r.length&&(this.dynamicDecorationMap[e++]=n,i.push(Re.join(r))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Pk).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(Hk))try{if(d(this.view,e.range,e))return!0}catch(p){ci(this.view.state,p,"scroll handler")}let{range:i}=e,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),r;if(!n)return;!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let a=i0(this.view),o={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:c,offsetHeight:h}=this.view.scrollDOM;if(g4(this.view.scrollDOM,o,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==Ze.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(i.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let i=n=>n.isWidget()||n.children.some(i);return i(this.tile.resolveBlock(e,1).tile)}destroy(){eg(this.tile)}}function eg(t,e){let i=e?.get(t);if(i!=1){i==null&&t.destroy();for(let n of t.children)eg(n,e)}}function V4(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Qk(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=kk(i.focusNode,i.focusOffset),r=Ck(i.focusNode,i.focusOffset),a=n||r;if(r&&n&&r.node!=n.node){let c=vt.get(r.node);if(!c||c.isText()&&c.text!=r.node.nodeValue)a=r;else if(t.docView.lastCompositionAfterCursor){let h=vt.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(a=r)}}if(t.docView.lastCompositionAfterCursor=a!=n,!a)return null;let o=e-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function I4(t,e,i){let n=Qk(t,i);if(!n)return null;let{node:r,from:a,to:o}=n,c=r.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(n.from,n.to)!=c)return null;let h=e.invertedDesc;return{range:new qi(h.mapPos(a),h.mapPos(o),a,o),text:r}}function Q4(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let G4=class{constructor(){this.changes=[]}compareRange(e,i){kl(e,i,this.changes)}comparePoint(e,i){kl(e,i,this.changes)}boundChange(e){kl(e,e,this.changes)}};function Y4(t,e,i){let n=new G4;return Re.compare(t,e,i,n),n.changes}class K4{constructor(){this.changes=[]}compareRange(e,i){kl(e,i,this.changes)}comparePoint(){}boundChange(e){kl(e,e,this.changes)}}function W4(t,e,i){let n=new K4;return Re.compare(t,e,i,n),n.changes}function X4(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function Z4(t,e){let i=!1;return e&&t.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(i=!0)}),i}class Up extends kn{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 J4(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),a=e-r.from;if(r.length==0)return W.cursor(e);a==0?i=1:a==r.length&&(i=-1);let o=a,c=a;i<0?o=Et(r.text,a,!1):c=Et(r.text,a);let h=n(r.text.slice(o,c));for(;o>0;){let d=Et(r.text,o,!1);if(n(r.text.slice(d,o))!=h)break;o=d}for(;c<r.length;){let d=Et(r.text,c);if(n(r.text.slice(c,d))!=h)break;c=d}return W.range(o+r.from,c+r.from)}function $4(t,e,i,n,r){let a=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,h=Math.floor((r-i.top-(t.defaultLineHeight-c)*.5)/c);a+=h*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+Fm(o,a,t.state.tabSize)}function tg(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let a of n.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!r||a.type==Ut.Text&&(r.type!=a.type||(i<0?a.from<e:a.to>e)))&&(r=a)}}return r||n}return n}function ej(t,e,i,n){let r=tg(t,e.head,e.assoc||-1),a=!n||r.type!=Ut.Text||!(t.lineWrapping||r.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(a){let o=t.dom.getBoundingClientRect(),c=t.textDirectionAt(r.from),h=t.posAtCoords({x:i==(c==Ze.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(h!=null)return W.cursor(h,i?-1:1)}return W.cursor(i?r.to:r.from,i?-1:1)}function Uv(t,e,i,n){let r=t.state.doc.lineAt(e.head),a=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let c=e,h=null;;){let d=O4(r,a,o,c,i),p=Ek;if(!d){if(r.number==(i?t.state.doc.lines:1))return c;p=`
49
+ `,r=t.state.doc.line(r.number+(i?1:-1)),a=t.bidiSpans(r),d=t.visualLineSide(r,!i)}if(h){if(!h(p))return c}else{if(!n)return d;h=n(p)}c=d}}function tj(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return a=>{let o=n(a);return r==nt.Space&&(r=o),r==o}}function ij(t,e,i,n){let r=e.head,a=i?1:-1;if(r==(i?t.state.doc.length:0))return W.cursor(r,e.assoc);let o=e.goalColumn,c,h=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(r,(e.empty?e.assoc:0)||(i?1:-1)),p=t.documentTop;if(d)o==null&&(o=d.left-h.left),c=a<0?d.top:d.bottom;else{let w=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-w.from))),c=(a<0?w.top:w.bottom)+p}let g=h.left+o,x=n??t.viewState.heightOracle.textHeight>>1,v=ig(t,{x:g,y:c+x*a},!1,a);return W.cursor(v.pos,v.assoc,void 0,o)}function so(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(a,o,c)=>{if(e>a&&e<o){let h=n||i||(e-a<o-e?-1:1);e=h<0?a:o,n=h}});if(!n)return e}}function Gk(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],a=null;if(r.empty){let o=so(t,r.from,0);o!=r.from&&(a=W.cursor(o,-1))}else{let o=so(t,r.from,-1),c=so(t,r.to,1);(o!=r.from||c!=r.to)&&(a=W.range(r.from==r.anchor?o:c,r.from==r.head?o:c))}a&&(i||(i=e.ranges.slice()),i[n]=a)}return i?W.create(i,e.mainIndex):e}function qp(t,e,i){let n=so(t.state.facet(Ho).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:W.cursor(n,n<i.from?1:-1)}class pn{constructor(e,i){this.pos=e,this.assoc=i}}function ig(t,e,i,n){let r=t.contentDOM.getBoundingClientRect(),a=r.top+t.viewState.paddingTop,{x:o,y:c}=e,h=c-a,d;for(;;){if(h<0)return new pn(0,1);if(h>t.viewState.docHeight)return new pn(t.state.doc.length,-1);if(d=t.elementAtHeight(h),n==null)break;if(d.type==Ut.Text){if(n<0?d.to<t.viewport.from:d.from>t.viewport.to)break;let x=t.docView.coordsAt(n<0?d.from:d.to,n>0?-1:1);if(x&&(n<0?x.top<=h+a:x.bottom>=h+a))break}let g=t.viewState.heightOracle.textHeight/2;h=n>0?d.bottom+g:d.top-g}if(t.viewport.from>=d.to||t.viewport.to<=d.from){if(i)return null;if(d.type==Ut.Text){let g=$4(t,r,d,o,c);return new pn(g,g==d.from?1:-1)}}if(d.type!=Ut.Text)return h<(d.top+d.bottom)/2?new pn(d.from,1):new pn(d.to,-1);let p=t.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=t.docView.lineAt(d.from,-2)),new nj(t,o,c,t.textDirectionAt(d.from)).scanTile(p,d.from)}class nj{constructor(e,i,n,r){this.view=e,this.x=i,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,i){let{line:n,spans:r}=this.bidiSpansAt(e);return r[mn.find(r,e-n.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:n,spans:r}=this.bidiSpansAt(e);return r[mn.find(r,e-n.from,-1,i)].dir}bidiIn(e,i){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<i)}scan(e,i){let n=0,r=e.length-1,a=new Set,o=this.bidiIn(e[0],e[r]),c,h,d=-1,p=1e9,g;e:for(;n<r;){let v=r-n,w=n+r>>1;t:if(a.has(w)){let C=n+Math.floor(Math.random()*v);for(let M=0;M<v;M++){if(!a.has(C)){w=C;break t}C++,C==r&&(C=n)}break e}a.add(w);let k=i(w);if(k)for(let C=0;C<k.length;C++){let M=k[C],T=0;if(M.bottom<this.y)(!c||c.bottom<M.bottom)&&(c=M),T=1;else if(M.top>this.y)(!h||h.top>M.top)&&(h=M),T=-1;else{let j=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,L=Math.abs(j);L<p&&(d=w,p=L,g=M),j&&(T=j<0==(this.baseDir==Ze.LTR)?-1:1)}T==-1&&(!o||this.baseDirAt(e[w],1))?r=w:T==1&&(!o||this.baseDirAt(e[w+1],-1))&&(n=w+1)}}if(!g){let v=c&&(!h||this.y-c.bottom<h.top-this.y)?c:h;return this.y=(v.top+v.bottom)/2,this.scan(e,i)}let x=(o?this.dirAt(e[d],1):this.baseDir)==Ze.LTR;return{i:d,after:this.x>(g.left+g.right)/2==x}}scanText(e,i){let n=[];for(let a=0;a<e.length;a=Et(e.text,a))n.push(i+a);n.push(i+e.length);let r=this.scan(n,a=>{let o=n[a]-i,c=n[a+1]-i;return wo(e.dom,o,c).getClientRects()});return r.after?new pn(n[r.i+1],-1):new pn(n[r.i],1)}scanTile(e,i){if(!e.length)return new pn(i,1);if(e.children.length==1){let c=e.children[0];if(c.isText())return this.scanText(c,i);if(c.isComposite())return this.scanTile(c,i)}let n=[i];for(let c=0,h=i;c<e.children.length;c++)n.push(h+=e.children[c].length);let r=this.scan(n,c=>{let h=e.children[c];return h.flags&48?null:(h.dom.nodeType==1?h.dom:wo(h.dom,0,h.length)).getClientRects()}),a=e.children[r.i],o=n[r.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):r.after?new pn(n[r.i+1],-1):new pn(o,1)}}const Za="￿";class rj{constructor(e,i){this.points=e,this.view=i,this.text="",this.lineSeparator=i.state.facet(Be.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Za}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let a=this.text.length;this.readNode(r);let o=vt.get(r),c=r.nextSibling;if(c==i){o?.breakAfter&&!c&&n!=this.view.contentDOM&&this.lineBreak();break}let h=vt.get(c);(o&&h?o.breakAfter:(o?o.breakAfter:ah(r))||ah(c)&&(r.nodeName!="BR"||o?.isWidget())&&this.text.length>a)&&!lj(c,i)&&this.lineBreak(),r=c}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,c;if(this.lineSeparator?(a=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(c=r.exec(i))&&(a=c.index,o=c[0].length),this.append(i.slice(n,a<0?i.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);n=a+o}}readNode(e){let i=vt.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(sj(e,n.node,n.offset)?i:0))}}function sj(t,e,i){for(;;){if(!e||i<Wn(e))return!1;if(e==t)return!0;i=Hr(e)+1,e=e.parentNode}}function lj(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=vt.get(t);if(!n?.isWidget())return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r?.length)return!1}return!0}class qv{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class aj{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=Yk(e.docView.tile,i,n,0))){let c=a||o?[]:uj(e),h=new rj(c,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=cj(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!Wm(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!Wm(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),p=e.viewport;if((se.ios||se.chrome)&&e.state.selection.main.empty&&h!=d&&(p.from>0||p.to<e.state.doc.length)){let g=Math.min(h,d),x=Math.max(h,d),v=p.from-g,w=p.to-x;(v==0||v==1||g==0)&&(w==0||w==-1||x==e.state.doc.length)&&(h=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(W.range(d,h)):this.newSel=W.single(d,h)}}}function Yk(t,e,i,n){if(t.isComposite()){let r=-1,a=-1,o=-1,c=-1;for(let h=0,d=n,p=n;h<t.children.length;h++){let g=t.children[h],x=d+g.length;if(d<e&&x>i)return Yk(g,e,i,d);if(x>=e&&r==-1&&(r=h,a=d),d>i&&g.dom.parentNode==t.dom){o=h,c=p;break}p=x,d=x+g.breakAfter}return{from:a,to:c<0?n+t.length:c,startDOM:(r?t.children[r-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Kk(t,e){let i,{newSel:n}=e,r=t.state.selection.main,a=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:c}=e.bounds,h=r.from,d=null;(a===8||se.android&&e.text.length<c-o)&&(h=r.to,d="end");let p=Wk(t.state.doc.sliceString(o,c,Za),e.text,h-o,d);p&&(se.chrome&&a==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==Za+Za&&p.toB--,i={from:o+p.from,to:o+p.toA,insert:Ue.of(e.text.slice(p.from,p.toB).split(Za))})}else n&&(!t.hasFocus&&t.state.facet(In)||hh(n,r))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!r.empty&&n&&n.main.empty?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(se.mac||se.android)&&i&&i.from==i.to&&i.from==r.head-1&&/^\. ?$/.test(i.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(n&&i.insert.length==2&&(n=W.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:Ue.of([i.insert.toString().replace("."," ")])}):i&&i.from>=r.from&&i.to<=r.to&&(i.from!=r.from||i.to!=r.to)&&r.to-r.from-(i.to-i.from)<=4?i={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,r.to))}:t.state.doc.lineAt(r.from).to<r.to&&t.docView.lineHasWidget(r.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:r.from,to:r.to,insert:t.state.toText(t.inputState.insertingText)}:se.chrome&&i&&i.from==i.to&&i.from==r.head&&i.insert.toString()==`
50
+ `&&t.lineWrapping&&(n&&(n=W.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:Ue.of([" "])}),i)return n0(t,i,n,a);if(n&&!hh(n,r)){let o=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=Gk(t.state.facet(Ho).map(h=>h(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:c}),!0}else return!1}function n0(t,e,i,n=-1){if(se.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(se.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Cl(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Cl(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Cl(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,c=()=>o||(o=oj(t,e,i));return t.state.facet(Lk).some(h=>h(t,e.from,e.to,a,c))||t.dispatch(c()),!0}function oj(t,e,i){let n,r=t.state,a=r.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let h=e.from<a.from?-1:1,d=h<0?a.from:a.to,p=so(r.facet(Ho).map(g=>g(t)),d,h);e.from==p&&(o=p)}if(o>-1)n={changes:e,selection:W.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&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let h=a.from<e.from?r.sliceDoc(a.from,e.from):"",d=a.to>e.to?r.sliceDoc(e.to,a.to):"";n=r.replaceSelection(t.state.toText(h+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let h=r.changes(e),d=i&&i.main.to<=h.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let p=t.state.sliceDoc(e.from,e.to),g,x=i&&Qk(t,i.main.head);if(x){let w=e.insert.length-(e.to-e.from);g={from:x.from,to:x.to-w}}else g=t.state.doc.lineAt(a.head);let v=a.to-e.to;n=r.changeByRange(w=>{if(w.from==a.from&&w.to==a.to)return{changes:h,range:d||w.map(h)};let k=w.to-v,C=k-p.length;if(t.state.sliceDoc(C,k)!=p||k>=g.from&&C<=g.to)return{range:w};let M=r.changes({from:C,to:k,insert:e.insert}),T=w.to-a.to;return{changes:M,range:d?W.range(Math.max(0,d.anchor+T),Math.max(0,d.head+T)):w.map(M)}})}else n={changes:h,selection:d&&r.selection.replaceRange(d)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:c,scrollIntoView:!0})}function Wk(t,e,i,n){let r=Math.min(t.length,e.length),a=0;for(;a<r&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==r&&t.length==e.length)return null;let o=t.length,c=e.length;for(;o>0&&c>0&&t.charCodeAt(o-1)==e.charCodeAt(c-1);)o--,c--;if(n=="end"){let h=Math.max(0,a-Math.min(o,c));i-=o+h-a}if(o<a&&t.length<e.length){let h=i<=a&&i>=o?a-i:0;a-=h,c=a+(c-o),o=a}else if(c<a){let h=i<=a&&i>=c?a-i:0;a-=h,o=a+(o-c),c=a}return{from:a,toA:o,toB:c}}function uj(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a}=t.observer.selectionRange;return i&&(e.push(new qv(i,n)),(r!=i||a!=n)&&e.push(new qv(r,a))),e}function cj(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?W.single(i+e,n+e):null}function hh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class hj{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,se.safari&&e.contentDOM.addEventListener("input",()=>null),se.gecko&&Mj(e.contentDOM.ownerDocument)}handleEvent(e){!bj(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,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=fj(e),n=this.handlers,r=this.view.contentDOM;for(let a in i)if(a!="scroll"){let o=!i[a].handlers.length,c=n[a];c&&o!=!c.handlers.length&&(r.removeEventListener(a,this.handleEvent),c=null),c||r.addEventListener(a,this.handleEvent,{passive:o})}for(let a in n)a!="scroll"&&!i[a]&&r.removeEventListener(a,this.handleEvent);this.handlers=i}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&&Zk.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),se.android&&se.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return se.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=Xk.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||dj.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Cl(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:se.safari&&!se.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 Pv(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(r){ci(i.state,r)}}}function fj(t){let e=Object.create(null);function i(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let r=n.spec,a=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(a)for(let c in a){let h=a[c];h&&i(c).handlers.push(Pv(n.value,h))}if(o)for(let c in o){let h=o[c];h&&i(c).observers.push(Pv(n.value,h))}}for(let n in $i)i(n).handlers.push($i[n]);for(let n in Ii)i(n).observers.push(Ii[n]);return e}const Xk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],dj="dthko",Zk=[16,17,18,20,91,92,224,225],pc=6;function mc(t){return Math.max(0,t)*.7+8}function pj(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class mj{constructor(e,i,n,r){this.view=e,this.startEvent=i,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=y4(e.contentDOM),this.atoms=e.state.facet(Ho).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=i.shiftKey,this.multiple=e.state.facet(Be.allowMultipleSelections)&&gj(e,i),this.dragging=xj(e,i)&&eC(i)==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&&pj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=0,a=0,o=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:c}=this.scrollParents.y.getBoundingClientRect());let h=i0(this.view);e.clientX-h.left<=r+pc?i=-mc(r-e.clientX):e.clientX+h.right>=o-pc&&(i=mc(e.clientX-o)),e.clientY-h.top<=a+pc?n=-mc(a-e.clientY):e.clientY+h.bottom>=c-pc&&(n=mc(e.clientY-c)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:i}=this,n=Gk(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function gj(t,e){let i=t.state.facet(Nk);return i.length?i[0](e):se.mac?e.metaKey:e.ctrlKey}function yj(t,e){let i=t.state.facet(Rk);return i.length?i[0](e):se.mac?!e.altKey:!e.ctrlKey}function xj(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=vo(t.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let a=0;a<r.length;a++){let o=r[a];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function bj(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,n;i!=t.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(n=vt.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const $i=Object.create(null),Ii=Object.create(null),Jk=se.ie&&se.ie_version<15||se.ios&&se.webkit_version<604;function vj(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),$k(t,i.value)},50)}function Vh(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function $k(t,e){e=Vh(t.state,Jg,e);let{state:i}=t,n,r=1,a=i.toText(e),o=a.lines==i.selection.ranges.length;if(ng!=null&&i.selection.ranges.every(h=>h.empty)&&ng==a.toString()){let h=-1;n=i.changeByRange(d=>{let p=i.doc.lineAt(d.from);if(p.from==h)return{range:d};h=p.from;let g=i.toText((o?a.line(r++).text:e)+i.lineBreak);return{changes:{from:p.from,insert:g},range:W.cursor(d.from+g.length)}})}else o?n=i.changeByRange(h=>{let d=a.line(r++);return{changes:{from:h.from,to:h.to,insert:d.text},range:W.cursor(h.from+d.length)}}):n=i.replaceSelection(a);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ii.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};$i.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ii.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ii.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};$i.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(Dk))if(i=n(t,e),i)break;if(!i&&e.button==0&&(i=wj(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new mj(t,e,i,n)),n&&t.observer.ignore(()=>{Sk(t.contentDOM);let a=t.root.activeElement;a&&!a.contains(t.contentDOM)&&a.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Fv(t,e,i,n){if(n==1)return W.cursor(e,i);if(n==2)return J4(t.state,e,i);{let r=t.docView.lineAt(e,i),a=t.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:a.from,c=r?r.posAtEnd:a.to;return c<t.state.doc.length&&c==a.to&&c++,W.range(o,c)}}const Sj=se.ie&&se.ie_version<=11;let Vv=null,Iv=0,Qv=0;function eC(t){if(!Sj)return t.detail;let e=Vv,i=Qv;return Vv=t,Qv=Date.now(),Iv=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Iv+1)%3:1}function wj(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=eC(e),r=t.state.selection;return{update(a){a.docChanged&&(i.pos=a.changes.mapPos(i.pos),r=r.map(a.changes))},get(a,o,c){let h=t.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=Fv(t,h.pos,h.assoc,n);if(i.pos!=h.pos&&!o){let g=Fv(t,i.pos,i.assoc,n),x=Math.min(g.from,p.from),v=Math.max(g.to,p.to);p=x<p.from?W.range(x,v):W.range(v,x)}return o?r.replaceRange(r.main.extend(p.from,p.to)):c&&n==1&&r.ranges.length>1&&(d=kj(r,h.pos))?d:c?r.addRange(p):W.create([p])}}}function kj(t,e){for(let i=0;i<t.ranges.length;i++){let{from:n,to:r}=t.ranges[i];if(n<=e&&r>=e)return W.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}$i.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let r=t.docView.tile.nearest(e.target);if(r&&r.isWidget()){let a=r.posAtStart,o=a+r.length;(a>=i.to||o<=i.from)&&(i=W.range(a,o))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Vh(t.state,$g,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};$i.dragend=t=>(t.inputState.draggedContent=null,!1);function Gv(t,e,i,n){if(i=Vh(t.state,Jg,i),!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=t.inputState,o=n&&a&&yj(t,e)?{from:a.from,to:a.to}:null,c={from:r,insert:i},h=t.state.changes(o?[o,c]:c);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}$i.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,a=()=>{++r==i.length&&Gv(t,e,n.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<i.length;o++){let c=new FileReader;c.onerror=a,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[o]=c.result),a()},c.readAsText(i[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Gv(t,e,n,!0),!0}return!1};$i.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Jk?null:e.clipboardData;return i?($k(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(vj(t),!1)};function Cj(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}function Aj(t){let e=[],i=[],n=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),i.push(r));if(!e.length){let r=-1;for(let{from:a}of t.selection.ranges){let o=t.doc.lineAt(a);o.number>r&&(e.push(o.text),i.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),r=o.number}n=!0}return{text:Vh(t,$g,e.join(t.lineBreak)),ranges:i,linewise:n}}let ng=null;$i.copy=$i.cut=(t,e)=>{if(!io(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:r}=Aj(t.state);if(!i&&!r)return!1;ng=r?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let a=Jk?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",i),!0):(Cj(t,i),!1)};const tC=Sn.define();function iC(t,e){let i=[];for(let n of t.facet(Bk)){let r=n(t,e);r&&i.push(r)}return i.length?t.update({effects:i,annotations:tC.of(!0)}):null}function nC(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=iC(t.state,e);i?t.dispatch(i):t.update([])}},10)}Ii.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),nC(t)};Ii.blur=t=>{t.observer.clearSelectionRange(),nC(t)};Ii.compositionstart=Ii.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ii.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,se.chrome&&se.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ii.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};$i.beforeinput=(t,e)=>{var i,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let a=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),o=e.getTargetRanges();if(a&&o.length){let c=o[0],h=t.posAtDOM(c.startContainer,c.startOffset),d=t.posAtDOM(c.endContainer,c.endOffset);return n0(t,{from:h,to:d,insert:t.state.toText(a)},null),!0}}let r;if(se.chrome&&se.android&&(r=Xk.find(a=>a.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return se.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),se.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ii.compositionend(t,e),20),!1};const Yv=new Set;function Mj(t){Yv.has(t)||(Yv.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Kv=["pre-wrap","normal","pre-line","break-spaces"];let Bl=!1;function Wv(){Bl=!1}class Tj{constructor(e){this.lineWrapping=e,this.doc=Ue.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let n=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((i-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Kv.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(i=!0,this.heightSamples[Math.floor(r*10)]=!0)}return i}refresh(e,i,n,r,a,o){let c=Kv.indexOf(e)>-1,h=Math.abs(i-this.lineHeight)>.3||this.lineWrapping!=c||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=c,this.lineHeight=i,this.charWidth=n,this.textHeight=r,this.lineLength=a,h){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 h}}class Oj{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class Wi{constructor(e,i,n,r,a){this.from=e,this.length=i,this.top=n,this.height=r,this._content=a}get type(){return typeof this._content=="number"?Ut.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 Ss?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Wi(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var Je=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(Je||(Je={}));const Uc=.001;class Jt{constructor(e,i,n=2){this.length=e,this.height=i,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Uc&&(Bl=!0),this.height=e)}replace(e,i,n){return Jt.of(n)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,n,r){let a=this,o=n.doc;for(let c=r.length-1;c>=0;c--){let{fromA:h,toA:d,fromB:p,toB:g}=r[c],x=a.lineAt(h,Je.ByPosNoHeight,n.setDoc(i),0,0),v=x.to>=d?x:a.lineAt(d,Je.ByPosNoHeight,n,0,0);for(g+=v.to-d,d=v.to;c>0&&x.from<=r[c-1].toA;)h=r[c-1].fromA,p=r[c-1].fromB,c--,h<x.from&&(x=a.lineAt(h,Je.ByPosNoHeight,n,0,0));p+=x.from-h,h=x.from;let w=r0.build(n.setDoc(o),e,p,g);a=fh(a,a.replace(h,d,w))}return a.updateHeight(n,0)}static empty(){return new Ai(0,0,0)}static of(e){if(e.length==1)return e[0];let i=0,n=e.length,r=0,a=0;for(;;)if(i==n)if(r>a*2){let c=e[i-1];c.break?e.splice(--i,1,c.left,null,c.right):e.splice(--i,1,c.left,c.right),n+=1+c.break,r-=c.size}else if(a>r*2){let c=e[n];c.break?e.splice(n,1,c.left,null,c.right):e.splice(n,1,c.left,c.right),n+=2+c.break,a-=c.size}else break;else if(r<a){let c=e[i++];c&&(r+=c.size)}else{let c=e[--n];c&&(a+=c.size)}let o=0;return e[i-1]==null?(o=1,i--):e[i]==null&&(o=1,n++),new Nj(Jt.of(e.slice(0,i)),o,Jt.of(e.slice(n)))}}function fh(t,e){return t==e?t:(t.constructor!=e.constructor&&(Bl=!0),e)}Jt.prototype.size=1;const Ej=ge.replace({});class rC extends Jt{constructor(e,i,n){super(e,i),this.deco=n,this.spaceAbove=0}mainBlock(e,i){return new Wi(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,i,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Wi(r,0,n,this.spaceAbove,Ej):this.mainBlock(n,r)}lineAt(e,i,n,r,a){let o=this.mainBlock(r,a);return this.spaceAbove?this.blockAt(0,n,r,a).join(o):o}forEachLine(e,i,n,r,a,o){e<=a+this.length&&i>=a&&o(this.lineAt(0,Je.ByPos,n,r,a))}setMeasuredHeight(e){let i=e.heights[e.index++];i<0?(this.spaceAbove=-i,i=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(i)}updateHeight(e,i=0,n=!1,r){return r&&r.from<=i&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ai extends rC{constructor(e,i,n){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,i){return new Wi(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,i,n){let r=n[0];return n.length==1&&(r instanceof Ai||r instanceof zt&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof zt?r=new Ai(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Jt.of(n)}updateHeight(e,i=0,n=!1,r){return r&&r.from<=i&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class zt extends Jt{constructor(e){super(e,0)}heightMetrics(e,i){let n=e.doc.lineAt(i).number,r=e.doc.lineAt(i+this.length).number,a=r-n+1,o,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*a);o=h/a,this.length>a+1&&(c=(this.height-h)/(this.length-a-1))}else o=this.height/a;return{firstLine:n,lastLine:r,perLine:o,perChar:c}}blockAt(e,i,n,r){let{firstLine:a,lastLine:o,perLine:c,perChar:h}=this.heightMetrics(i,r);if(i.lineWrapping){let d=r+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),p=i.doc.lineAt(d),g=c+p.length*h,x=Math.max(n,e-g/2);return new Wi(p.from,p.length,x,g,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((e-n)/c))),{from:p,length:g}=i.doc.line(a+d);return new Wi(p,g,n+c*d,c,0)}}lineAt(e,i,n,r,a){if(i==Je.ByHeight)return this.blockAt(e,n,r,a);if(i==Je.ByPosNoHeight){let{from:v,to:w}=n.doc.lineAt(e);return new Wi(v,w-v,0,0,0)}let{firstLine:o,perLine:c,perChar:h}=this.heightMetrics(n,a),d=n.doc.lineAt(e),p=c+d.length*h,g=d.number-o,x=r+c*g+h*(d.from-a-g);return new Wi(d.from,d.length,Math.max(r,Math.min(x,r+this.height-p)),p,0)}forEachLine(e,i,n,r,a,o){e=Math.max(e,a),i=Math.min(i,a+this.length);let{firstLine:c,perLine:h,perChar:d}=this.heightMetrics(n,a);for(let p=e,g=r;p<=i;){let x=n.doc.lineAt(p);if(p==e){let w=x.number-c;g+=h*w+d*(e-a-w)}let v=h+d*x.length;o(new Wi(x.from,x.length,g,v,0)),g+=v,p=x.to+1}}replace(e,i,n){let r=this.length-i;if(r>0){let a=n[n.length-1];a instanceof zt?n[n.length-1]=new zt(a.length+r):n.push(null,new zt(r-1))}if(e>0){let a=n[0];a instanceof zt?n[0]=new zt(e+a.length):n.unshift(new zt(e-1),null)}return Jt.of(n)}decomposeLeft(e,i){i.push(new zt(e-1),null)}decomposeRight(e,i){i.push(null,new zt(this.length-e-1))}updateHeight(e,i=0,n=!1,r){let a=i+this.length;if(r&&r.from<=i+this.length&&r.more){let o=[],c=Math.max(i,r.from),h=-1;for(r.from>i&&o.push(new zt(r.from-i-1).updateHeight(e,i));c<=a&&r.more;){let p=e.doc.lineAt(c).length;o.length&&o.push(null);let g=r.heights[r.index++],x=0;g<0&&(x=-g,g=r.heights[r.index++]),h==-1?h=g:Math.abs(g-h)>=Uc&&(h=-2);let v=new Ai(p,g,x);v.outdated=!1,o.push(v),c+=p+1}c<=a&&o.push(null,new zt(a-c).updateHeight(e,c));let d=Jt.of(o);return(h<0||Math.abs(d.height-this.height)>=Uc||Math.abs(h-this.heightMetrics(e,i).perLine)>=Uc)&&(Bl=!0),fh(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Nj extends Jt{constructor(e,i,n){super(e.length+i+n.length,e.height+n.height,i|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,i,n,r){let a=n+this.left.height;return e<a?this.left.blockAt(e,i,n,r):this.right.blockAt(e,i,a,r+this.left.length+this.break)}lineAt(e,i,n,r,a){let o=r+this.left.height,c=a+this.left.length+this.break,h=i==Je.ByHeight?e<o:e<c,d=h?this.left.lineAt(e,i,n,r,a):this.right.lineAt(e,i,n,o,c);if(this.break||(h?d.to<c:d.from>c))return d;let p=i==Je.ByPosNoHeight?Je.ByPosNoHeight:Je.ByPos;return h?d.join(this.right.lineAt(c,p,n,o,c)):this.left.lineAt(c,p,n,r,a).join(d)}forEachLine(e,i,n,r,a,o){let c=r+this.left.height,h=a+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,i,n,r,a,o),i>=h&&this.right.forEachLine(e,i,n,c,h,o);else{let d=this.lineAt(h,Je.ByPos,n,r,a);e<d.from&&this.left.forEachLine(e,d.from-1,n,r,a,o),d.to>=e&&d.from<=i&&o(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,c,h,o)}}replace(e,i,n){let r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(e,i,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,i-r,n));let a=[];e>0&&this.decomposeLeft(e,a);let o=a.length;for(let c of n)a.push(c);if(e>0&&Xv(a,o-1),i<this.length){let c=a.length;this.decomposeRight(i,a),Xv(a,c)}return Jt.of(a)}decomposeLeft(e,i){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(n++,e>=n&&i.push(null)),e>n&&this.right.decomposeLeft(e-n,i)}decomposeRight(e,i){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,i);e<n&&this.left.decomposeRight(e,i),this.break&&e<r&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?Jt.of(this.break?[e,null,i]:[e,i]):(this.left=fh(this.left,e),this.right=fh(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,n=!1,r){let{left:a,right:o}=this,c=i+a.length+this.break,h=null;return r&&r.from<=i+a.length&&r.more?h=a=a.updateHeight(e,i,n,r):a.updateHeight(e,i,n),r&&r.from<=c+o.length&&r.more?h=o=o.updateHeight(e,c,n,r):o.updateHeight(e,c,n),h?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 Xv(t,e){let i,n;t[e]==null&&(i=t[e-1])instanceof zt&&(n=t[e+1])instanceof zt&&t.splice(e-1,3,new zt(i.length+1+n.length))}const Rj=5;class r0{constructor(e,i){this.pos=e,this.oracle=i,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,i){if(this.lineStart>-1){let n=Math.min(i,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ai?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ai(n-this.pos,-1,0)),this.writtenTo=n,i>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,n){if(e<i||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=i-e;n.block?this.addBlock(new rC(o,r,n)):(o||a||r>=Rj)&&this.addLineDeco(r,a,o)}else i>e&&this.span(e,i);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:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,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 Ai(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let n=new zt(i-e);return this.oracle.doc.lineAt(e).to==i&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ai)return e;let i=new Ai(0,-1,0);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=i,this.writtenTo=this.pos=this.pos+n}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof Ai)&&!this.isCovered?this.nodes.push(new Ai(0,-1,0)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let r of this.nodes)r instanceof Ai&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,i,n,r){let a=new r0(n,e);return Re.spans(i,n,r,a,0),a.finish(n)}}function Dj(t,e,i){let n=new jj;return Re.compare(t,e,i,n,0),n.changes}class jj{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,r){(e<i||n&&n.heightRelevant||r&&r.heightRelevant)&&kl(e,i,this.changes,5)}}function Lj(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,r=n.defaultView||window,a=Math.max(0,i.left),o=Math.min(r.innerWidth,i.right),c=Math.max(0,i.top),h=Math.min(r.innerHeight,i.bottom);for(let d=t.parentNode;d&&d!=n.body;)if(d.nodeType==1){let p=d,g=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&g.overflow!="visible"){let x=p.getBoundingClientRect();a=Math.max(a,x.left),o=Math.min(o,x.right),c=Math.max(c,x.top),h=Math.min(d==t.parentNode?r.innerHeight:h,x.bottom)}d=g.position=="absolute"||g.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-i.left,right:Math.max(a,o)-i.left,top:c-(i.top+e),bottom:Math.max(c,h)-(i.top+e)}}function Bj(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function zj(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Pp{constructor(e,i,n,r){this.from=e,this.to=i,this.size=n,this.displaySize=r}static same(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=i[n];if(r.from!=a.from||r.to!=a.to||r.size!=a.size)return!1}return!0}draw(e,i){return ge.replace({widget:new _j(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class _j extends kn{constructor(e,i){super(),this.size=e,this.vertical=i}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 Zv{constructor(e){this.state=e,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.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Jv,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ze.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(e0).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Tj(i),this.stateDeco=$v(e),this.heightMap=Jt.empty().applyChanges(this.stateDeco,Ue.empty,this.heightOracle.setDoc(e.doc),[new qi(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ge.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let n=0;n<=1;n++){let r=n?i.head:i.anchor;if(!e.some(({from:a,to:o})=>r>=a&&r<=o)){let{from:a,to:o}=this.lineBlockAt(r);e.push(new gc(a,o))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Jv:new s0(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(Ja(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=$v(this.state);let r=e.changedRanges,a=qi.extendWithRanges(r,Dj(n,this.stateDeco,e?e.changes:wt.empty(this.state.doc.length))),o=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Wv(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||Bl)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let h=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<h.from||i.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,i));let d=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_k)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ze.RTL:Ze.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",c=i.getBoundingClientRect(),h=o||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let d=0,p=0;if(c.width&&c.height){let{scaleX:L,scaleY:D}=vk(i,c);(L>.005&&Math.abs(this.scaleX-L)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=L,this.scaleY=D,d|=16,o=h=!0)}let g=(parseInt(n.paddingTop)||0)*this.scaleY,x=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=x)&&(this.paddingTop=g,this.paddingBottom=x,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=wk(e.scrollDOM);let w=(this.printing?zj:Lj)(i,this.paddingTop),k=w.top-this.pixelViewport.top,C=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let M=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(M!=this.inView&&(this.inView=M,M&&(h=!0)),!this.inView&&!this.scrollTarget&&!Bj(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),h){let L=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(L)&&(o=!0),o||r.lineWrapping&&Math.abs(T-this.contentDOMWidth)>r.charWidth){let{lineHeight:D,charWidth:U,textHeight:H}=e.docView.measureTextSize();o=D>0&&r.refresh(a,D,U,H,Math.max(5,T/U),L),o&&(e.docView.minWidth=0,d|=16)}k>0&&C>0?p=Math.max(k,C):k<0&&C<0&&(p=Math.min(k,C)),Wv();for(let D of this.viewports){let U=D.from==this.viewport.from?L:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?Jt.empty().applyChanges(this.stateDeco,Ue.empty,this.heightOracle,[new qi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Oj(D.from,U))}Bl&&(d|=2)}let j=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return j&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||j)&&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,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:c}=this,h=new gc(r.lineAt(o-n*1e3,Je.ByHeight,a,0,0).from,r.lineAt(c+(1-n)*1e3,Je.ByHeight,a,0,0).to);if(i){let{head:d}=i.range;if(d<h.from||d>h.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=r.lineAt(d,Je.ByPos,a,0,0),x;i.y=="center"?x=(g.top+g.bottom)/2-p/2:i.y=="start"||i.y=="nearest"&&d<h.from?x=g.top:x=g.bottom-p,h=new gc(r.lineAt(x-1e3/2,Je.ByHeight,a,0,0).from,r.lineAt(x+p+1e3/2,Je.ByHeight,a,0,0).to)}}return h}mapViewport(e,i){let n=i.mapPos(e.from,-1),r=i.mapPos(e.to,1);return new gc(this.heightMap.lineAt(n,Je.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Je.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(i,Je.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:c}=this;return(e==0||r<=o-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||a>=c+Math.max(10,Math.min(n,250)))&&r>o-2*1e3&&a<c+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let n=[];for(let r of e)i.touchesRange(r.from,r.to)||n.push(new Pp(i.mapPos(r.from),i.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,i){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,a=r>>1,o=r<<1;if(this.defaultTextDirection!=Ze.LTR&&!n)return[];let c=[],h=(p,g,x,v)=>{if(g-p<a)return;let w=this.state.selection.main,k=[w.from];w.empty||k.push(w.to);for(let M of k)if(M>p&&M<g){h(p,M-10,x,v),h(M+10,g,x,v);return}let C=Uj(e,M=>M.from>=x.from&&M.to<=x.to&&Math.abs(M.from-p)<a&&Math.abs(M.to-g)<a&&!k.some(T=>M.from<T&&M.to>T));if(!C){if(g<x.to&&i&&n&&i.visibleRanges.some(j=>j.from<=g&&j.to>=g)){let j=i.moveToLineBoundary(W.cursor(g),!1,!0).head;j>p&&(g=j)}let M=this.gapSize(x,p,g,v),T=n||M<2e6?M:2e6;C=new Pp(p,g,M,T)}c.push(C)},d=p=>{if(p.length<o||p.type!=Ut.Text)return;let g=Hj(p.from,p.to,this.stateDeco);if(g.total<o)return;let x=this.scrollTarget?this.scrollTarget.range.head:null,v,w;if(n){let k=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,M;if(x!=null){let T=xc(g,x),j=((this.visibleBottom-this.visibleTop)/2+k)/p.height;C=T-j,M=T+j}else C=(this.visibleTop-p.top-k)/p.height,M=(this.visibleBottom-p.top+k)/p.height;v=yc(g,C),w=yc(g,M)}else{let k=g.total*this.heightOracle.charWidth,C=r*this.heightOracle.charWidth,M=0;if(k>2e6)for(let U of e)U.from>=p.from&&U.from<p.to&&U.size!=U.displaySize&&U.from*this.heightOracle.charWidth+M<this.pixelViewport.left&&(M=U.size-U.displaySize);let T=this.pixelViewport.left+M,j=this.pixelViewport.right+M,L,D;if(x!=null){let U=xc(g,x),H=((j-T)/2+C)/k;L=U-H,D=U+H}else L=(T-C)/k,D=(j+C)/k;v=yc(g,L),w=yc(g,D)}v>p.from&&h(p.from,v,p,g),w<p.to&&h(w,p.to,p,g)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return c}gapSize(e,i,n,r){let a=xc(r,n)-xc(r,i);return this.heightOracle.lineWrapping?e.height*a:r.total*this.heightOracle.charWidth*a}updateLineGaps(e){Pp.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ge.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let n=[];Re.spans(i,this.viewport.from,this.viewport.to,{span(a,o){n.push({from:a,to:o})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let a=0;a<n.length&&!(r&8);a++){let o=this.visibleRanges[a],c=n[a];(o.from!=c.from||o.to!=c.to)&&(r|=4,e&&e.mapPos(o.from,-1)==c.from&&e.mapPos(o.to,1)==c.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||Ja(this.heightMap.lineAt(e,Je.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(i=>i.top<=e&&i.bottom>=e)||Ja(this.heightMap.lineAt(this.scaler.fromDOM(e),Je.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return Ja(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 gc{constructor(e,i){this.from=e,this.to=i}}function Hj(t,e,i){let n=[],r=t,a=0;return Re.spans(i,t,e,{span(){},point(o,c){o>r&&(n.push({from:r,to:o}),a+=o-r),r=c}},20),r<e&&(n.push({from:r,to:e}),a+=e-r),{total:a,ranges:n}}function yc({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let r=0;;r++){let{from:a,to:o}=e[r],c=o-a;if(n<=c)return a+n;n-=c}}function xc(t,e){let i=0;for(let{from:n,to:r}of t.ranges){if(e<=r){i+=e-n;break}i+=r-n}return i/t.total}function Uj(t,e){for(let i of t)if(e(i))return i}const Jv={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function $v(t){let e=t.facet(qh).filter(n=>typeof n!="function"),i=t.facet(t0).filter(n=>typeof n!="function");return i.length&&e.push(Re.join(i)),e}class s0{constructor(e,i,n){let r=0,a=0,o=0;this.viewports=n.map(({from:c,to:h})=>{let d=i.lineAt(c,Je.ByPos,e,0,0).top,p=i.lineAt(h,Je.ByPos,e,0,0).bottom;return r+=p-d,{from:c,to:h,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(i.height-r);for(let c of this.viewports)c.domTop=o+(c.top-a)*this.scale,o=c.domBottom=c.domTop+(c.bottom-c.top),a=c.bottom}toDOM(e){for(let i=0,n=0,r=0;;i++){let a=i<this.viewports.length?this.viewports[i]:null;if(!a||e<a.top)return r+(e-n)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);n=a.bottom,r=a.domBottom}}fromDOM(e){for(let i=0,n=0,r=0;;i++){let a=i<this.viewports.length?this.viewports[i]:null;if(!a||e<a.domTop)return n+(e-r)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);n=a.bottom,r=a.domBottom}}eq(e){return e instanceof s0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,n)=>i.from==e.viewports[n].from&&i.to==e.viewports[n].to):!1}}function Ja(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Wi(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(r=>Ja(r,e)):t._content)}const bc=le.define({combine:t=>t.join(" ")}),rg=le.define({combine:t=>t.indexOf(!0)>-1}),sg=zr.newName(),sC=zr.newName(),lC=zr.newName(),aC={"&light":"."+sC,"&dark":"."+lC};function lg(t,e,i){return new zr(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return t;if(!i||!i[r])throw new RangeError(`Unsupported selector: ${r}`);return i[r]}):t+" "+n}})}const qj=lg("."+sg,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-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"}},aC),Pj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Fp=se.ie&&se.ie_version<=11;class Fj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new x4,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(i=>{for(let n of i)this.queue.push(n);(se.ie&&se.ie_version<=11||se.ios&&e.composing)&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&se.android&&e.constructor.EDIT_CONTEXT!==!1&&!(se.chrome&&se.chrome_version<126)&&(this.editContext=new Ij(e),e.state.facet(In)&&(e.contentDOM.editContext=this.editContext.editContext)),Fp&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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 i;((i=this.view.docView)===null||i===void 0?void 0:i.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(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.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(i=>{i.length>0&&i[i.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((i,n)=>i!=e[n]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(In)?n.root.activeElement!=this.dom:!io(this.dom,r))return;let a=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(se.ie&&se.ie_version<=11||se.android&&se.chrome)&&!n.state.selection.main.empty&&r.focusNode&&ro(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=vo(e.root);if(!i)return!1;let n=se.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Vj(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let r=io(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&v4(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let n=this.dom;n;)if(n.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=i)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Pj),Fp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Fp&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var n;if(!this.delayedAndroidKey){let r=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&Cl(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,n=-1,r=!1;for(let a of e){let o=this.readMutation(a);o&&(o.typeOver&&(r=!0),i==-1?{from:i,to:n}=o:(i=Math.min(o.from,i),n=Math.max(o.to,n)))}return{from:i,to:n,typeOver:r}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),r=this.selectionChanged&&io(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new aj(this.view,e,i,n);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 i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,r=Kk(this.view,i);return this.view.state==n&&(i.domChanged||i.newSel&&!hh(this.view.state.selection,i.newSel.main))&&this.view.update([]),r}readMutation(e){let i=this.view.docView.tile.nearest(e.target);if(!i||i.isWidget())return null;if(i.markDirty(e.type=="attributes"),e.type=="childList"){let n=eS(i,e.previousSibling||e.target.previousSibling,-1),r=eS(i,e.nextSibling||e.target.nextSibling,1);return{from:n?i.posAfter(n):i.posAtStart,to:r?i.posBefore(r):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.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(In)!=e.state.facet(In)&&(e.view.contentDOM.editContext=e.state.facet(In)?this.editContext.editContext:null))}destroy(){var e,i,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.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 eS(t,e,i){for(;e;){let n=vt.get(e);if(n&&n.parent==t)return n;let r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}function tS(t,e){let i=e.startContainer,n=e.startOffset,r=e.endContainer,a=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return ro(o.node,o.offset,r,a)&&([i,n,r,a]=[r,a,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a}}function Vj(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return tS(t,r)}let i=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),i=r.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),i?tS(t,i):null}class Ij{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:a,head:o}=r,c=this.toEditorPos(n.updateRangeStart),h=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:c,drifted:!1});let d=h-c>n.text.length;c==this.from&&a<this.from?c=a:h==this.to&&a>this.to&&(h=a);let p=Wk(e.state.sliceDoc(c,h),n.text,(d?r.from:r.to)-c,d?"end":null);if(!p){let x=W.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));hh(x,r)||e.dispatch({selection:x,userEvent:"select"});return}let g={from:p.from+c,to:p.toA+c,insert:Ue.of(n.text.slice(p.from,p.toB).split(`
51
+ `))};if((se.mac||se.android)&&g.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:c,to:h,insert:Ue.of([n.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let x=this.to-this.from+(g.to-g.from+g.insert.length);n0(e,g,W.single(this.toEditorPos(n.selectionStart,x),this.toEditorPos(n.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],a=null;for(let o=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);o<c;o++){let h=e.coordsForChar(o);a=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||a||new DOMRect,r.push(a)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let a of n.getTextFormats()){let o=a.underlineStyle,c=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(c)){let h=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;r.push(ge.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:Uk.of(ge.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=vo(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((a,o,c,h,d)=>{if(n)return;let p=d.length-(o-a);if(r&&o>=r.to)if(r.from==a&&r.to==o&&r.insert.eq(d)){r=this.pendingContextChange=null,i+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(a+=i,o+=i,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){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}i+=p}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.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||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+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 i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ie{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 i;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:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(a=>n(a,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||b4(e.parent)||document,this.viewState=new Zv(e.state||Be.create(e)),e.scrollTo&&e.scrollTo.is(dc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(yl).map(r=>new zp(r));for(let r of this.plugins)r.update(this);this.observer=new Fj(this),this.inputState=new hj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Hv(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let i=e.length==1&&e[0]instanceof At?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,n=!1,r,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,c=0,h=null;e.some(x=>x.annotation(tC))?(this.inputState.notifiedFocused=o,c=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,h=iC(a,o),h||(c=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(Be.phrases)!=this.state.facet(Be.phrases))return this.setState(a);r=oh.create(this,a,e),r.flags|=c;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(g&&(g=g.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;g=new Al(v.empty?v:W.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(dc)&&(g=v.value.clip(this.state))}this.viewState.update(r,g),this.bidiCache=dh.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),i=this.docView.update(r),this.state.facet(Xa)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(bc)!=r.state.facet(bc)&&(this.viewState.mustMeasureContent=!0),(i||n||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!r.empty)for(let x of this.state.facet($m))try{x(r)}catch(v){ci(this.state,v,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!Kk(this,p)&&d.force&&Cl(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 i=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Zv(e),this.plugins=e.facet(yl).map(n=>new zp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Hv(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(yl),n=e.state.facet(yl);if(i!=n){let r=[];for(let a of n){let o=i.indexOf(a);if(o<0)r.push(new zp(a));else{let c=this.plugins[o];c.mustUpdate=e,r.push(c)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);i!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(n){ci(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(o<0)if(wk(n))a=-1,o=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(r);a=v.from,o=v.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];h&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(w){return ci(this.state,w),iS}}),g=oh.create(this,this.state,[]),x=!1;g.flags|=h,i?i.flags|=h:i=g,this.updateState=2,g.empty||(this.updatePlugins(g),this.inputState.update(g),this.updateAttrs(),x=this.docView.update(g),x&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=iS)try{let w=d[v];w.write&&w.write(p[v],this)}catch(w){ci(this.state,w)}if(x&&this.docView.updateSelection(!0),!g.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;if(w>1||w<-1){r=r+w,n.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let c of this.state.facet($m))c(i)}get themeClasses(){return sg+" "+(this.state.facet(rg)?lC:sC)+" "+this.state.facet(bc)}updateAttrs(){let e=nS(this,qk,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(In)?"true":"false",class:"cm-content",style:`${se.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),nS(this,e0,i);let n=this.observer.ignore(()=>{let r=Dv(this.contentDOM,this.contentAttrs,i),a=Dv(this.dom,this.editorAttrs,e);return r||a});return this.editorAttrs=e,this.contentAttrs=i,n}showAnnouncements(e){let i=!0;for(let n of e)for(let r of n.effects)if(r.is(ie.announce)){i&&(this.announceDOM.textContent=""),i=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Xa);let e=this.state.facet(ie.cspNonce);zr.mount(this.root,this.styleModules.concat(qj).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 i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(n=>n.plugin==e)||null),i&&i.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,i,n){return qp(this,e,Uv(this,e,i,n))}moveByGroup(e,i){return qp(this,e,Uv(this,e,i,n=>tj(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),a=n[i?n.length-1:0];return W.cursor(a.side(i,r)+e.from,a.forward(!i,r)?1:-1)}moveToLineBoundary(e,i,n=!0){return ej(this,e,i,n)}moveVertically(e,i,n){return qp(this,e,ij(this,e,i,n))}domAtPos(e,i=1){return this.docView.domAtPos(e,i)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){this.readMeasured();let n=ig(this,e,i);return n&&n.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),ig(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let n=this.docView.coordsAt(e,i);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),a=this.bidiSpans(r),o=a[mn.find(a,e-r.from,-1,i)];return So(n,o.dir==Ze.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(zk)||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>Qj)return Ok(e.length);let i=this.textDirectionAt(e.from),n;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==i&&(a.fresh||Tk(a.isolates,n=Bv(this,e))))return a.order;n||(n=Bv(this,e));let r=T4(e.text,i,n);return this.bidiCache.push(new dh(e.from,e.to,i,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||se.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Sk(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,i={}){return dc.of(new Al(typeof e=="number"?W.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return dc.of(new Al(W.cursor(n.from),"start","start",n.top-e,i,!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 ot.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ot.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=zr.newName(),r=[bc.of(n),Xa.of(lg(`.${n}`,e))];return i&&i.dark&&r.push(rg.of(!0)),r}static baseTheme(e){return Ms.lowest(Xa.of(lg("."+sg,e,aC)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),r=n&&vt.get(n)||vt.get(e);return((i=r?.root)===null||i===void 0?void 0:i.view)||null}}ie.styleModule=Xa;ie.inputHandler=Lk;ie.clipboardInputFilter=Jg;ie.clipboardOutputFilter=$g;ie.scrollHandler=Hk;ie.focusChangeEffect=Bk;ie.perLineTextDirection=zk;ie.exceptionSink=jk;ie.updateListener=$m;ie.editable=In;ie.mouseSelectionStyle=Dk;ie.dragMovesSelection=Rk;ie.clickAddsSelectionRange=Nk;ie.decorations=qh;ie.blockWrappers=Pk;ie.outerDecorations=t0;ie.atomicRanges=Ho;ie.bidiIsolatedRanges=Fk;ie.scrollMargins=Vk;ie.darkTheme=rg;ie.cspNonce=le.define({combine:t=>t.length?t[0]:""});ie.contentAttributes=e0;ie.editorAttributes=qk;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=we.define();const Qj=4096,iS={};class dh{constructor(e,i,n,r,a,o){this.from=e,this.to=i,this.dir=n,this.isolates=r,this.fresh=a,this.order=o}static update(e,i){if(i.empty&&!e.some(a=>a.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Ze.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let o=e[a];o.dir==r&&!i.touchesRange(o.from,o.to)&&n.push(new dh(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function nS(t,e,i){for(let n=t.state.facet(e),r=n.length-1;r>=0;r--){let a=n[r],o=typeof a=="function"?a(t):a;o&&Wg(o,i)}return i}const Gj=se.mac?"mac":se.windows?"win":se.linux?"linux":"key";function Yj(t,e){const i=t.split(/-(?!$)/);let n=i[i.length-1];n=="Space"&&(n=" ");let r,a,o,c;for(let h=0;h<i.length-1;++h){const d=i[h];if(/^(cmd|meta|m)$/i.test(d))c=!0;else if(/^a(lt)?$/i.test(d))r=!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"?c=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),a&&(n="Ctrl-"+n),c&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function vc(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Kj=Ms.default(ie.domEventHandlers({keydown(t,e){return uC(oC(e.state),t,e,"editor")}})),Ih=le.define({enables:Kj}),rS=new WeakMap;function oC(t){let e=t.facet(Ih),i=rS.get(e);return i||rS.set(e,i=Zj(e.reduce((n,r)=>n.concat(r),[]))),i}function Wj(t,e,i){return uC(oC(t.state),e,t,i)}let Tr=null;const Xj=4e3;function Zj(t,e=Gj){let i=Object.create(null),n=Object.create(null),r=(o,c)=>{let h=n[o];if(h==null)n[o]=c;else if(h!=c)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,c,h,d,p)=>{var g,x;let v=i[o]||(i[o]=Object.create(null)),w=c.split(/ (?!$)/).map(M=>Yj(M,e));for(let M=1;M<w.length;M++){let T=w.slice(0,M).join(" ");r(T,!0),v[T]||(v[T]={preventDefault:!0,stopPropagation:!1,run:[j=>{let L=Tr={view:j,prefix:T,scope:o};return setTimeout(()=>{Tr==L&&(Tr=null)},Xj),!0}]})}let k=w.join(" ");r(k,!1);let C=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(g=v._any)===null||g===void 0?void 0:g.run)===null||x===void 0?void 0:x.slice())||[]});h&&C.run.push(h),d&&(C.preventDefault=!0),p&&(C.stopPropagation=!0)};for(let o of t){let c=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of c){let p=i[d]||(i[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=o;for(let x in p)p[x].run.push(v=>g(v,ag))}let h=o[e]||o.key;if(h)for(let d of c)a(d,h,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+h,o.shift,o.preventDefault,o.stopPropagation)}return i}let ag=null;function uC(t,e,i,n){ag=e;let r=c4(e),a=li(r,0),o=dn(a)==r.length&&r!=" ",c="",h=!1,d=!1,p=!1;Tr&&Tr.view==i&&Tr.scope==n&&(c=Tr.prefix+" ",Zk.indexOf(e.keyCode)<0&&(d=!0,Tr=null));let g=new Set,x=C=>{if(C){for(let M of C.run)if(!g.has(M)&&(g.add(M),M(i)))return C.stopPropagation&&(p=!0),!0;C.preventDefault&&(C.stopPropagation&&(p=!0),d=!0)}return!1},v=t[n],w,k;return v&&(x(v[c+vc(r,e,!o)])?h=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(se.windows&&e.ctrlKey&&e.altKey)&&!(se.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=_r[e.keyCode])&&w!=r?(x(v[c+vc(w,e,!0)])||e.shiftKey&&(k=xo[e.keyCode])!=r&&k!=w&&x(v[c+vc(k,e,!1)]))&&(h=!0):o&&e.shiftKey&&x(v[c+vc(r,e,!0)])&&(h=!0),!h&&x(v._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),ag=null,h}class Uo{constructor(e,i,n,r,a){this.className=e,this.left=i,this.top=n,this.width=r,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.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,i,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let a=cC(e);return[new Uo(i,r.left-a.left,r.top-a.top,null,r.bottom-r.top)]}else return Jj(e,i,n)}}function cC(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ze.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function sS(t,e,i,n){let r=t.coordsAtPos(e,i*2);if(!r)return n;let a=t.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,c=t.posAtCoords({x:a.left+1,y:o}),h=t.posAtCoords({x:a.right-1,y:o});return c==null||h==null?n:{from:Math.max(n.from,Math.min(c,h)),to:Math.min(n.to,Math.max(c,h))}}function Jj(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),a=t.textDirection==Ze.LTR,o=t.contentDOM,c=o.getBoundingClientRect(),h=cC(t),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),g=c.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),x=c.right-(p?parseInt(p.paddingRight):0),v=tg(t,n,1),w=tg(t,r,-1),k=v.type==Ut.Text?v:null,C=w.type==Ut.Text?w:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=sS(t,n,1,k)),C&&(t.lineWrapping||w.widgetLineBreaks)&&(C=sS(t,r,-1,C)),k&&C&&k.from==C.from&&k.to==C.to)return T(j(i.from,i.to,k));{let D=k?j(i.from,null,k):L(v,!1),U=C?j(null,i.to,C):L(w,!0),H=[];return(k||v).to<(C||w).from-(k&&C?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2<U.top?H.push(M(g,D.bottom,x,U.top)):D.bottom<U.top&&t.elementAtHeight((D.bottom+U.top)/2).type==Ut.Text&&(D.bottom=U.top=(D.bottom+U.top)/2),T(D).concat(H).concat(T(U))}function M(D,U,H,Z){return new Uo(e,D-h.left,U-h.top,Math.max(0,H-D),Z-U)}function T({top:D,bottom:U,horizontal:H}){let Z=[];for(let J=0;J<H.length;J+=2)Z.push(M(H[J],D,H[J+1],U));return Z}function j(D,U,H){let Z=1e9,J=-1e9,ue=[];function ae(fe,de,P,X,ne){let ce=t.coordsAtPos(fe,fe==H.to?-2:2),ye=t.coordsAtPos(P,P==H.from?2:-2);!ce||!ye||(Z=Math.min(ce.top,ye.top,Z),J=Math.max(ce.bottom,ye.bottom,J),ne==Ze.LTR?ue.push(a&&de?g:ce.left,a&&X?x:ye.right):ue.push(!a&&X?g:ye.left,!a&&de?x:ce.right))}let F=D??H.from,ee=U??H.to;for(let fe of t.visibleRanges)if(fe.to>F&&fe.from<ee)for(let de=Math.max(fe.from,F),P=Math.min(fe.to,ee);;){let X=t.state.doc.lineAt(de);for(let ne of t.bidiSpans(X)){let ce=ne.from+X.from,ye=ne.to+X.from;if(ce>=P)break;ye>de&&ae(Math.max(ce,de),D==null&&ce<=F,Math.min(ye,P),U==null&&ye>=ee,ne.dir)}if(de=X.to+1,de>=P)break}return ue.length==0&&ae(F,D==null,ee,U==null,t.textDirection),{top:Z,bottom:J,horizontal:ue}}function L(D,U){let H=c.top+(U?D.top:D.bottom);return{top:H,bottom:H,horizontal:[]}}}function $j(t,e){return t.constructor==e.constructor&&t.eq(e)}class eL{constructor(e,i){this.view=e,this.layer=i,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"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,e)}update(e){e.startState.facet(qc)!=e.state.facet(qc)&&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 i=0,n=e.facet(qc);for(;i<n.length&&n[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:i}=this.view;(e!=this.scaleX||i!=this.scaleY)&&(this.scaleX=e,this.scaleY=i,this.dom.style.transform=`scale(${1/e}, ${1/i})`)}draw(e){if(e.length!=this.drawn.length||e.some((i,n)=>!$j(i,this.drawn[n]))){let i=this.dom.firstChild,n=0;for(let r of e)r.update&&i&&r.constructor&&this.drawn[n].constructor&&r.update(i,this.drawn[n])?(i=i.nextSibling,n++):this.dom.insertBefore(r.draw(),i);for(;i;){let r=i.nextSibling;i.remove(),i=r}this.drawn=e,se.safari&&se.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const qc=le.define();function hC(t){return[ot.define(e=>new eL(e,t)),qc.of(t)]}const ko=le.define({combine(t){return wn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function tL(t={}){return[ko.of(t),iL,nL,rL,_k.of(!0)]}function fC(t){return t.startState.facet(ko)!=t.state.facet(ko)}const iL=hC({above:!0,markers(t){let{state:e}=t,i=e.facet(ko),n=[];for(let r of e.selection.ranges){let a=r==e.selection.main;if(r.empty||i.drawRangeCursor){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=r.empty?r:W.cursor(r.head,r.head>r.anchor?-1:1);for(let h of Uo.forRange(t,o,c))n.push(h)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let i=fC(t);return i&&lS(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){lS(e.state,t)},class:"cm-cursorLayer"});function lS(t,e){e.style.animationDuration=t.facet(ko).cursorBlinkRate+"ms"}const nL=hC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Uo.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||fC(t)},class:"cm-selectionLayer"}),rL=Ms.highest(ie.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"}}}})),dC=we.define({map(t,e){return t==null?null:e.mapPos(t)}}),$a=It.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,n)=>n.is(dC)?n.value:i,t)}}),sL=ot.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field($a);i==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"),(t.startState.field($a)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field($a),i=e!=null&&t.coordsAtPos(e);if(!i)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:i.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field($a)!=t&&this.view.dispatch({effects:dC.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function lL(){return[$a,sL]}function aS(t,e,i,n,r){e.lastIndex=0;for(let a=t.iterRange(i,n),o=i,c;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;c=e.exec(a.value);)r(o+c.index,c)}function aL(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:a}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),a=Math.min(t.state.doc.lineAt(a).to,a+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=a:n.push({from:r,to:a});return n}class oL{constructor(e){const{regexp:i,decoration:n,decorate:r,boundary:a,maxLength:o=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=(c,h,d,p)=>r(p,d,d+c[0].length,c,h);else if(typeof n=="function")this.addMatch=(c,h,d,p)=>{let g=n(c,h,d);g&&p(d,d+c[0].length,g)};else if(n)this.addMatch=(c,h,d,p)=>p(d,d+c[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(e){let i=new Kn,n=i.add.bind(i);for(let{from:r,to:a}of aL(e,this.maxLength))aS(e.state.doc,this.regexp,r,a,(o,c)=>this.addMatch(c,e,o,n));return i.finish()}updateDeco(e,i){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((a,o,c,h)=>{h>=e.view.viewport.from&&c<=e.view.viewport.to&&(n=Math.min(c,n),r=Math.max(h,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,i.map(e.changes),n,r):i}updateRange(e,i,n,r){for(let a of e.visibleRanges){let o=Math.max(a.from,n),c=Math.min(a.to,r);if(c>=o){let h=e.state.doc.lineAt(o),d=h.to<c?e.state.doc.lineAt(c):h,p=Math.max(a.from,h.from),g=Math.min(a.to,d.to);if(this.boundary){for(;o>h.from;o--)if(this.boundary.test(h.text[o-1-h.from])){p=o;break}for(;c<d.to;c++)if(this.boundary.test(d.text[c-d.from])){g=c;break}}let x=[],v,w=(k,C,M)=>x.push(M.range(k,C));if(h==d)for(this.regexp.lastIndex=p-h.from;(v=this.regexp.exec(h.text))&&v.index<g-h.from;)this.addMatch(v,e,v.index+h.from,w);else aS(e.state.doc,this.regexp,p,g,(k,C)=>this.addMatch(C,e,k,w));i=i.update({filterFrom:p,filterTo:g,filter:(k,C)=>k<p||C>g,add:x})}}return i}}const og=/x/.unicode!=null?"gu":"g",uL=new RegExp(`[\0-\b
52
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,og),cL={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 Vp=null;function hL(){var t;if(Vp==null&&typeof document<"u"&&document.body){let e=document.body.style;Vp=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Vp||!1}const Pc=le.define({combine(t){let e=wn(t,{render:null,specialChars:uL,addSpecialChars:null});return(e.replaceTabs=!hL())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,og)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,og)),e}});function fL(t={}){return[Pc.of(t),dL()]}let oS=null;function dL(){return oS||(oS=ot.fromClass(class{constructor(t){this.view=t,this.decorations=ge.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Pc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new oL({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,a=li(e[0],0);if(a==9){let o=r.lineAt(n),c=i.state.tabSize,h=Vl(o.text,c,n-o.from);return ge.replace({widget:new yL((c-h%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ge.replace({widget:new gL(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Pc);t.startState.facet(Pc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const pL="•";function mL(t){return t>=32?pL:t==10?"␤":String.fromCharCode(9216+t)}class gL extends kn{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=mL(this.code),n=e.state.phrase("Control character")+" "+(cL[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let a=document.createElement("span");return a.textContent=i,a.title=n,a.setAttribute("aria-label",n),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class yL extends kn{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 xL(){return vL}const bL=ge.line({class:"cm-activeLine"}),vL=ot.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(bL.range(r.from)),e=r.from)}return ge.set(i)}},{decorations:t=>t.decorations});class SL extends kn{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?no(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=So(i[0],n.direction!="rtl"),a=parseInt(n.lineHeight);return r.bottom-r.top>a*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+a}:r}ignoreEvent(){return!1}}function wL(t){let e=ot.fromClass(class{constructor(i){this.view=i,this.placeholder=t?ge.set([ge.widget({widget:new SL(t),side:1}).range(0)]):ge.none}get decorations(){return this.view.state.doc.length?ge.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,ie.contentAttributes.of({"aria-placeholder":t})]:e}const ug=2e3;function kL(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),a=[];if(e.off>ug||i.off>ug||e.col<0||i.col<0){let o=Math.min(e.off,i.off),c=Math.max(e.off,i.off);for(let h=n;h<=r;h++){let d=t.doc.line(h);d.length<=c&&a.push(W.range(d.from+o,d.to+c))}}else{let o=Math.min(e.col,i.col),c=Math.max(e.col,i.col);for(let h=n;h<=r;h++){let d=t.doc.line(h),p=Fm(d.text,o,t.tabSize,!0);if(p<0)a.push(W.cursor(d.to));else{let g=Fm(d.text,c,t.tabSize);a.push(W.range(d.from+p,d.from+g))}}}return a}function CL(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function uS(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,a=r>ug?-1:r==n.length?CL(t,e.clientX):Vl(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:a,off:r}}function AL(t,e){let i=uS(t,e),n=t.state.selection;return i?{update(r){if(r.docChanged){let a=r.changes.mapPos(r.startState.doc.line(i.line).from),o=r.state.doc.lineAt(a);i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},n=n.map(r.changes)}},get(r,a,o){let c=uS(t,r);if(!c)return n;let h=kL(t.state,i,c);return h.length?o?W.create(h.concat(n.ranges)):W.create(h):n}}:null}function ML(t){let e=(i=>i.altKey&&i.button==0);return ie.mouseSelectionStyle.of((i,n)=>e(n)?AL(i,n):null)}const TL={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},OL={style:"cursor: crosshair"};function EL(t={}){let[e,i]=TL[t.key||"Alt"],n=ot.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||i(r))},keyup(r){(r.keyCode==e||!i(r))&&this.set(!1)},mousemove(r){this.set(i(r))}}});return[n,ie.contentAttributes.of(r=>{var a;return!((a=r.plugin(n))===null||a===void 0)&&a.isDown?OL:null})]}const Sc="-10000px";class pC{constructor(e,i,n,r){this.facet=i,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(i),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=n(o,a))}update(e,i){var n;let r=e.state.facet(this.facet),a=r.filter(h=>h);if(r===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let o=[],c=i?[]:null;for(let h=0;h<a.length;h++){let d=a[h],p=-1;if(d){for(let g=0;g<this.tooltips.length;g++){let x=this.tooltips[g];x&&x.create==d.create&&(p=g)}if(p<0)o[h]=this.createTooltipView(d,h?o[h-1]:null),c&&(c[h]=!!d.above);else{let g=o[h]=this.tooltipViews[p];c&&(c[h]=i[p]),g.update&&g.update(e)}}}for(let h of this.tooltipViews)o.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return i&&(c.forEach((h,d)=>i[d]=h),i.length=c.length),this.input=r,this.tooltips=a,this.tooltipViews=o,!0}}function NL(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Ip=le.define({combine:t=>{var e,i,n;return{position:se.ios?"absolute":((e=t.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((i=t.find(r=>r.parent))===null||i===void 0?void 0:i.parent)||null,tooltipSpace:((n=t.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||NL}}}),cS=new WeakMap,l0=ot.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Ip);this.position=e.position,this.parent=e.parent,this.classes=t.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 pC(t,a0,(i,n)=>this.createTooltip(i,n),i=>{this.resizeObserver&&this.resizeObserver.unobserve(i.dom),i.dom.remove()}),this.above=this.manager.tooltips.map(i=>!!i.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Ip);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),n=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",i.dom.appendChild(r)}return i.dom.style.position=this.position,i.dom.style.top=Sc,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(t=n.destroy)===null||t===void 0||t.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(i=this.intersectionObserver)===null||i===void 0||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(se.safari){let o=a.getBoundingClientRect();i=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else i=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(i||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(t=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),r=i0(this.view);return{visible:{left:n.left+r.left,top:n.top+r.top,right:n.right-r.right,bottom:n.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let c=this.manager.tooltipViews[o];return c.getCoords?c.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(Ip).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:i,space:n,scaleX:r,scaleY:a}=t,o=[];for(let c=0;c<this.manager.tooltips.length;c++){let h=this.manager.tooltips[c],d=this.manager.tooltipViews[c],{dom:p}=d,g=t.pos[c],x=t.size[c];if(!g||h.clip!==!1&&(g.bottom<=Math.max(i.top,n.top)||g.top>=Math.min(i.bottom,n.bottom)||g.right<Math.max(i.left,n.left)-.1||g.left>Math.min(i.right,n.right)+.1)){p.style.top=Sc;continue}let v=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,k=x.right-x.left,C=(e=cS.get(d))!==null&&e!==void 0?e:x.bottom-x.top,M=d.offset||DL,T=this.view.textDirection==Ze.LTR,j=x.width>n.right-n.left?T?n.left:n.right-x.width:T?Math.max(n.left,Math.min(g.left-(v?14:0)+M.x,n.right-k)):Math.min(Math.max(n.left,g.left-k+(v?14:0)-M.x),n.right-k),L=this.above[c];!h.strictSide&&(L?g.top-C-w-M.y<n.top:g.bottom+C+w+M.y>n.bottom)&&L==n.bottom-g.bottom>g.top-n.top&&(L=this.above[c]=!L);let D=(L?g.top-n.top:n.bottom-g.bottom)-w;if(D<C&&d.resize!==!1){if(D<this.view.defaultLineHeight){p.style.top=Sc;continue}cS.set(d,C),p.style.height=(C=D)/a+"px"}else p.style.height&&(p.style.height="");let U=L?g.top-C-w-M.y:g.bottom+w+M.y,H=j+k;if(d.overlap!==!0)for(let Z of o)Z.left<H&&Z.right>j&&Z.top<U+C&&Z.bottom>U&&(U=L?Z.top-C-2-w:Z.bottom+w+2);if(this.position=="absolute"?(p.style.top=(U-t.parent.top)/a+"px",hS(p,(j-t.parent.left)/r)):(p.style.top=U/a+"px",hS(p,j/r)),v){let Z=g.left+(T?M.x:-M.x)-(j+14-7);v.style.left=Z/r+"px"}d.overlap!==!0&&o.push({left:j,top:U,right:H,bottom:U+C}),p.classList.toggle("cm-tooltip-above",L),p.classList.toggle("cm-tooltip-below",!L),d.positioned&&d.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=Sc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function hS(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const RL=ie.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"}}}),DL={x:0,y:0},a0=le.define({enables:[l0,RL]}),ph=le.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])});class Qh{static create(e){return new Qh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new pC(e,ph,(i,n)=>this.createHostedView(i,n),i=>i.dom.remove())}createHostedView(e,i){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,i?i.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let i of this.manager.tooltipViews)i.mount&&i.mount(e);this.mounted=!0}positioned(e){for(let i of this.manager.tooltipViews)i.positioned&&i.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let i of this.manager.tooltipViews)(e=i.destroy)===null||e===void 0||e.call(i)}passProp(e){let i;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(i===void 0)i=r;else if(i!==r)return}}return i}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 jL=a0.compute([ph],t=>{let e=t.facet(ph);return e.length===0?null:{pos:Math.min(...e.map(i=>i.pos)),end:Math.max(...e.map(i=>{var n;return(n=i.end)!==null&&n!==void 0?n:i.pos})),create:Qh.create,above:e[0].above,arrow:e.some(i=>i.arrow)}});class LL{constructor(e,i,n,r,a){this.view=e,this.source=i,this.field=n,this.setHover=r,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){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:i}=this,n=e.docView.tile.nearest(i.target);if(!n)return;let r,a=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(i),r==null)return;let c=e.coordsAtPos(r);if(!c||i.y<c.top||i.y>c.bottom||i.x<c.left-e.defaultCharacterWidth||i.x>c.right+e.defaultCharacterWidth)return;let h=e.bidiSpans(e.state.doc.lineAt(r)).find(p=>p.from<=r&&p.to>=r),d=h&&h.dir==Ze.RTL?-1:1;a=i.x<c.left?-d:d}let o=this.source(e,r,a);if(o?.then){let c=this.pending={pos:r};o.then(h=>{this.pending==c&&(this.pending=null,h&&!(Array.isArray(h)&&!h.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(h)?h:[h])}))},h=>ci(e.state,h,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(l0),i=e?e.manager.tooltips.findIndex(n=>n.create==Qh.create):-1;return i>-1?e.manager.tooltipViews[i]:null}mousemove(e){var i,n;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:r,tooltip:a}=this;if(r.length&&a&&!BL(a.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,c=(n=(i=r[0])===null||i===void 0?void 0:i.end)!==null&&n!==void 0?n:o;(o==c?this.view.posAtCoords(this.lastMove)!=o:!zL(this.view,o,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:i}=this;if(i.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let i=n=>{e.removeEventListener("mouseleave",i),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",i)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const wc=4;function BL(t,e){let{left:i,right:n,top:r,bottom:a}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let c=o.getBoundingClientRect();r=Math.min(c.top,r),a=Math.max(c.bottom,a)}return e.clientX>=i-wc&&e.clientX<=n+wc&&e.clientY>=r-wc&&e.clientY<=a+wc}function zL(t,e,i,n,r,a){let o=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>n||o.right<n||o.top>r||Math.min(o.bottom,c)<r)return!1;let h=t.posAtCoords({x:n,y:r},!1);return h>=e&&h<=i}function _L(t,e={}){let i=we.define(),n=It.define({create(){return[]},update(r,a){if(r.length&&(e.hideOnChange&&(a.docChanged||a.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(a,o))),a.docChanged)){let o=[];for(let c of r){let h=a.changes.mapPos(c.pos,-1,Zt.TrackDel);if(h!=null){let d=Object.assign(Object.create(null),c);d.pos=h,d.end!=null&&(d.end=a.changes.mapPos(d.end)),o.push(d)}}r=o}for(let o of a.effects)o.is(i)&&(r=o.value),o.is(HL)&&(r=[]);return r},provide:r=>ph.from(r)});return{active:n,extension:[n,ot.define(r=>new LL(r,t,n,i,e.hoverTime||300)),jL]}}function mC(t,e){let i=t.plugin(l0);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const HL=we.define(),fS=le.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function o0(t,e){let i=t.plugin(gC),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const gC=ot.fromClass(class{constructor(t){this.input=t.state.facet(Co),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(fS);this.top=new kc(t,!0,e.topContainer),this.bottom=new kc(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(i=>i.top)),this.bottom.sync(this.panels.filter(i=>!i.top));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(fS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new kc(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new kc(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Co);if(i!=this.input){let n=i.filter(h=>h),r=[],a=[],o=[],c=[];for(let h of n){let d=this.specs.indexOf(h),p;d<0?(p=h(t.view),c.push(p)):(p=this.panels[d],p.update&&p.update(t)),r.push(p),(p.top?a:o).push(p)}this.specs=n,this.panels=r,this.top.sync(a),this.bottom.sync(o);for(let h of c)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ie.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class kc{constructor(e,i,n){this.view=e,this.top=i,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let i of this.panels)i.destroy&&e.indexOf(i)<0&&i.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 i=this.container||this.view.dom;i.insertBefore(this.dom,this.top?i.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=dS(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=dS(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 dS(t){let e=t.nextSibling;return t.remove(),e}const Co=le.define({enables:gC});function UL(t,e){let i,n=new Promise(o=>i=o),r=o=>qL(o,e,i);t.state.field(Qp,!1)?t.dispatch({effects:yC.of(r)}):t.dispatch({effects:we.appendConfig.of(Qp.init(()=>[r]))});let a=xC.of(r);return{close:a,result:n.then(o=>((t.win.queueMicrotask||(h=>t.win.setTimeout(h,10)))(()=>{t.state.field(Qp).indexOf(r)>-1&&t.dispatch({effects:a})}),o))}}const Qp=It.define({create(){return[]},update(t,e){for(let i of e.effects)i.is(yC)?t=[i.value].concat(t):i.is(xC)&&(t=t.filter(n=>n!=i.value));return t},provide:t=>Co.computeN([t],e=>e.field(t))}),yC=we.define(),xC=we.define();function qL(t,e,i){let n=e.content?e.content(t,()=>o(null)):null;if(!n){if(n=Ke("form"),e.input){let c=Ke("input",e.input);/^(text|password|number|email|tel|url)$/.test(c.type)&&c.classList.add("cm-textfield"),c.name||(c.name="input"),n.appendChild(Ke("label",(e.label||"")+": ",c))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(Ke("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let c=0;c<r.length;c++){let h=r[c];h.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(h))}),h.addEventListener("submit",d=>{d.preventDefault(),o(h)})}let a=Ke("div",n,Ke("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(a.className=e.class),a.classList.add("cm-dialog");function o(c){a.contains(a.ownerDocument.activeElement)&&t.focus(),i(c)}return{dom:a,top:e.top,mount:()=>{if(e.focus){let c;typeof e.focus=="string"?c=n.querySelector(e.focus):c=n.querySelector("input")||n.querySelector("button"),c&&"select"in c?c.select():c&&"focus"in c&&c.focus()}}}}class Xn extends Br{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Xn.prototype.elementClass="";Xn.prototype.toDOM=void 0;Xn.prototype.mapMode=Zt.TrackBefore;Xn.prototype.startSide=Xn.prototype.endSide=-1;Xn.prototype.point=!0;const Fc=le.define(),PL=le.define(),FL={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Re.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},lo=le.define();function VL(t){return[bC(),lo.of({...FL,...t})]}const pS=le.define({combine:t=>t.some(e=>e)});function bC(t){return[IL]}const IL=ot.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.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=t.state.facet(lo).map(e=>new gS(t,e)),this.fixed=!t.state.facet(pS);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),t.scrollDOM.insertBefore(this.dom,t.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(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<(i.to-i.from)*.8)}if(t.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(pS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=Re.iter(this.view.state.facet(Fc),this.view.viewport.from),n=[],r=this.gutters.map(a=>new QL(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(a.type)){let o=!0;for(let c of a.type)if(c.type==Ut.Text&&o){cg(i,n,c.from);for(let h of r)h.line(this.view,c,n);o=!1}else if(c.widget)for(let h of r)h.widget(this.view,c)}else if(a.type==Ut.Text){cg(i,n,a.from);for(let o of r)o.line(this.view,a,n)}else if(a.widget)for(let o of r)o.widget(this.view,a);for(let a of r)a.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(lo),i=t.state.facet(lo),n=t.docChanged||t.heightChanged||t.viewportChanged||!Re.eq(t.startState.facet(Fc),t.state.facet(Fc),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let r of this.gutters)r.update(t)&&(n=!0);else{n=!0;let r=[];for(let a of i){let o=e.indexOf(a);o<0?r.push(new gS(this.view,a)):(this.gutters[o].update(t),r.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),r.indexOf(a)<0&&a.destroy();for(let a of r)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>ie.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||i.gutters.length==0||!i.fixed)return null;let n=i.dom.offsetWidth*e.scaleX,r=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ze.LTR?{left:n,right:r}:{right:n,left:r}})});function mS(t){return Array.isArray(t)?t:[t]}function cg(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class QL{constructor(e,i,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Re.iter(e.markers,i.from)}addElement(e,i,n){let{gutter:r}=this,a=(i.top-this.height)/e.scaleY,o=i.height/e.scaleY;if(this.i==r.elements.length){let c=new vC(e,o,a,n);r.elements.push(c),r.dom.appendChild(c.dom)}else r.elements[this.i].update(e,o,a,n);this.height=i.bottom,this.i++}line(e,i,n){let r=[];cg(this.cursor,r,i.from),n.length&&(r=r.concat(n));let a=this.gutter.config.lineMarker(e,i,r);a&&r.unshift(a);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,i,r)}widget(e,i){let n=this.gutter.config.widgetMarker(e,i.widget,i),r=n?[n]:null;for(let a of e.state.facet(PL)){let o=a(e,i.widget,i);o&&(r||(r=[])).push(o)}r&&this.addElement(e,i,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}}class gS{constructor(e,i){this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in i.domEventHandlers)this.dom.addEventListener(n,r=>{let a=r.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let h=a.getBoundingClientRect();o=(h.top+h.bottom)/2}else o=r.clientY;let c=e.lineBlockAtHeight(o-e.documentTop);i.domEventHandlers[n](e,c,r)&&r.preventDefault()});this.markers=mS(i.markers(e)),i.initialSpacer&&(this.spacer=new vC(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let i=this.markers;if(this.markers=mS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!Re.eq(this.markers,i,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class vC{constructor(e,i,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,n,r)}update(e,i,n,r){this.height!=i&&(this.height=i,this.dom.style.height=i+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),GL(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,i){let n="cm-gutterElement",r=this.dom.firstChild;for(let a=0,o=0;;){let c=o,h=a<i.length?i[a++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let g=o;g<this.markers.length;g++)if(this.markers[g].compare(h)){c=g,d=!0;break}}else c=this.markers.length;for(;o<c;){let p=this.markers[o++];if(p.toDOM){p.destroy(r);let g=r.nextSibling;r.remove(),r=g}}if(!h)break;h.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(h.toDOM(e),r)),d&&o++}this.dom.className=n,this.markers=i}destroy(){this.setMarkers(null,[])}}function GL(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}const YL=le.define(),KL=le.define(),xl=le.define({combine(t){return wn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let n=Object.assign({},e);for(let r in i){let a=n[r],o=i[r];n[r]=a?(c,h,d)=>a(c,h,d)||o(c,h,d):o}return n}})}});class Gp extends Xn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Yp(t,e){return t.state.facet(xl).formatNumber(e,t.state)}const WL=lo.compute([xl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(YL)},lineMarker(e,i,n){return n.some(r=>r.toDOM)?null:new Gp(Yp(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,n)=>{for(let r of e.state.facet(KL)){let a=r(e,i,n);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(xl)!=e.state.facet(xl),initialSpacer(e){return new Gp(Yp(e,yS(e.state.doc.lines)))},updateSpacer(e,i){let n=Yp(i.view,yS(i.view.state.doc.lines));return n==e.number?e:new Gp(n)},domEventHandlers:t.facet(xl).domEventHandlers,side:"before"}));function XL(t={}){return[xl.of(t),bC(),WL]}function yS(t){let e=9;for(;e<t;)e=e*10+9;return e}const ZL=new class extends Xn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},JL=Fc.compute(["selection"],t=>{let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.head).from;r>i&&(i=r,e.push(ZL.range(r)))}return Re.of(e)});function $L(){return JL}const SC=1024;let e6=0;class Kp{constructor(e,i){this.from=e,this.to=i}}class Oe{constructor(e={}){this.id=e6++,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=fi.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}Oe.closedBy=new Oe({deserialize:t=>t.split(" ")});Oe.openedBy=new Oe({deserialize:t=>t.split(" ")});Oe.group=new Oe({deserialize:t=>t.split(" ")});Oe.isolate=new Oe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Oe.contextHash=new Oe({perNode:!0});Oe.lookAhead=new Oe({perNode:!0});Oe.mounted=new Oe({perNode:!0});class ao{constructor(e,i,n,r=!1){this.tree=e,this.overlay=i,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Oe.mounted.id]}}const t6=Object.create(null);class fi{constructor(e,i,n,r=0){this.name=e,this.props=i,this.id=n,this.flags=r}static define(e){let i=e.props&&e.props.length?Object.create(null):t6,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new fi(e.name||"",i,e.id,n);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(r)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[a[0].id]=a[1]}}return r}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 i=this.prop(Oe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let n in e)for(let r of n.split(" "))i[r]=e[n];return n=>{for(let r=n.prop(Oe.group),a=-1;a<(r?r.length:0);a++){let o=i[a<0?n.name:r[a]];if(o)return o}}}}fi.none=new fi("",Object.create(null),0,8);class u0{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let n of this.types){let r=null;for(let a of e){let o=a(n);if(o){r||(r=Object.assign({},n.props));let c=o[1],h=o[0];h.combine&&h.id in r&&(c=h.combine(r[h.id],c)),r[h.id]=c}}i.push(r?new fi(n.name,r,n.id,n.flags):n)}return new u0(i)}}const Cc=new WeakMap,xS=new WeakMap;var at;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(at||(at={}));class dt{constructor(e,i,n,r,a){if(this.type=e,this.children=i,this.positions=n,this.length=r,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,c]of a)this.props[typeof o=="number"?o:o.id]=c}}toString(){let e=ao.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let n of this.children){let r=n.toString();r&&(i&&(i+=","),i+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new fg(this.topNode,e)}cursorAt(e,i=0,n=0){let r=Cc.get(this)||this.topNode,a=new fg(r);return a.moveTo(e,i),Cc.set(this,a._tree),a}get topNode(){return new Vi(this,0,0,null)}resolve(e,i=0){let n=Ao(Cc.get(this)||this.topNode,e,i,!1);return Cc.set(this,n),n}resolveInner(e,i=0){let n=Ao(xS.get(this)||this.topNode,e,i,!0);return xS.set(this,n),n}resolveStack(e,i=0){return r6(this,e,i)}iterate(e){let{enter:i,leave:n,from:r=0,to:a=this.length}=e,o=e.mode||0,c=(o&at.IncludeAnonymous)>0;for(let h=this.cursor(o|at.IncludeAnonymous);;){let d=!1;if(h.from<=a&&h.to>=r&&(!c&&h.type.isAnonymous||i(h)!==!1)){if(h.firstChild())continue;d=!0}for(;d&&n&&(c||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:f0(fi.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,r)=>new dt(this.type,i,n,r,this.propValues),e.makeTree||((i,n,r)=>new dt(fi.none,i,n,r)))}static build(e){return s6(e)}}dt.empty=new dt(fi.none,[],[],0);class c0{constructor(e,i){this.buffer=e,this.index=i}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 c0(this.buffer,this.index)}}class Ur{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return fi.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],n=this.buffer[e+3],r=this.set.types[i],a=r.name;if(/\W/.test(a)&&!r.isError&&(a=JSON.stringify(a)),e+=4,n==e)return a;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return a+"("+o.join(",")+")"}findChild(e,i,n,r,a){let{buffer:o}=this,c=-1;for(let h=e;h!=i&&!(wC(a,r,o[h+1],o[h+2])&&(c=h,n>0));h=o[h+3]);return c}slice(e,i,n){let r=this.buffer,a=new Uint16Array(i-e),o=0;for(let c=e,h=0;c<i;){a[h++]=r[c++],a[h++]=r[c++]-n;let d=a[h++]=r[c++]-n;a[h++]=r[c++]-e,o=Math.max(o,d)}return new Ur(a,o,this.set)}}function wC(t,e,i,n){switch(t){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function Ao(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let o=!n&&t instanceof Vi&&t.index<0?null:t.parent;if(!o)return t;t=o}let a=n?0:at.IgnoreOverlays;if(n)for(let o=t,c=o.parent;c;o=c,c=o.parent)o instanceof Vi&&o.index<0&&((r=c.enter(e,i,a))===null||r===void 0?void 0:r.from)!=o.from&&(t=c);for(;;){let o=t.enter(e,i,a);if(!o)return t;t=o}}class kC{cursor(e=0){return new fg(this,e)}getChild(e,i=null,n=null){let r=bS(this,e,i,n);return r.length?r[0]:null}getChildren(e,i=null,n=null){return bS(this,e,i,n)}resolve(e,i=0){return Ao(this,e,i,!1)}resolveInner(e,i=0){return Ao(this,e,i,!0)}matchContext(e){return hg(this.parent,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),n=this;for(;i;){let r=i.lastChild;if(!r||r.to!=i.to)break;r.type.isError&&r.from==r.to?(n=i,i=r.prevSibling):i=r}return n}get node(){return this}get next(){return this.parent}}class Vi extends kC{constructor(e,i,n,r){super(),this._tree=e,this.from=i,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,n,r,a=0){for(let o=this;;){for(let{children:c,positions:h}=o._tree,d=i>0?c.length:-1;e!=d;e+=i){let p=c[e],g=h[e]+o.from,x;if(!(!(a&at.EnterBracketed&&p instanceof dt&&(x=ao.get(p))&&!x.overlay&&x.bracketed&&n>=g&&n<=g+p.length)&&!wC(r,n,g,g+p.length))){if(p instanceof Ur){if(a&at.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,i,n-g,r);if(v>-1)return new Er(new i6(o,p,e,g),null,v)}else if(a&at.IncludeAnonymous||!p.type.isAnonymous||h0(p)){let v;if(!(a&at.IgnoreMounts)&&(v=ao.get(p))&&!v.overlay)return new Vi(v.tree,g,e,o);let w=new Vi(p,g,e,o);return a&at.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?p.children.length-1:0,i,n,r,a)}}}if(a&at.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+i:e=i<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,i,n=0){let r;if(!(n&at.IgnoreOverlays)&&(r=ao.get(this._tree))&&r.overlay){let a=e-this.from,o=n&at.EnterBracketed&&r.bracketed;for(let{from:c,to:h}of r.overlay)if((i>0||o?c<=a:c<a)&&(i<0||o?h>=a:h>a))return new Vi(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function bS(t,e,i,n){let r=t.cursor(),a=[];if(!r.firstChild())return a;if(i!=null){for(let o=!1;!o;)if(o=r.type.is(i),!r.nextSibling())return a}for(;;){if(n!=null&&r.type.is(n))return a;if(r.type.is(e)&&a.push(r.node),!r.nextSibling())return n==null?a:[]}}function hg(t,e,i=e.length-1){for(let n=t;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class i6{constructor(e,i,n,r){this.parent=e,this.buffer=i,this.index=n,this.start=r}}class Er extends kC{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,i,n){super(),this.context=e,this._parent=i,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,i,n){let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.context.start,n);return a<0?null:new Er(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,i,n=0){if(n&at.ExcludeBuffers)return null;let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return a<0?null:new Er(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,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Er(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new Er(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:n}=this.context,r=this.index+4,a=n.buffer[this.index+3];if(a>r){let o=n.buffer[this.index+1];e.push(n.slice(r,a,o)),i.push(0)}return new dt(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function CC(t){if(!t.length)return null;let e=0,i=t[0];for(let a=1;a<t.length;a++){let o=t[a];(o.from>i.from||o.to<i.to)&&(i=o,e=a)}let n=i instanceof Vi&&i.index<0?null:i.parent,r=t.slice();return n?r[e]=n:r.splice(e,1),new n6(r,i)}class n6{constructor(e,i){this.heads=e,this.node=i}get next(){return CC(this.heads)}}function r6(t,e,i){let n=t.resolveInner(e,i),r=null;for(let a=n instanceof Vi?n:n.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(r||(r=[n])).push(o.resolve(e,i)),a=o}else{let o=ao.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let c=new Vi(o.tree,o.overlay[0].from+a.from,-1,a);(r||(r=[n])).push(Ao(c,e,i,!1))}}return r?CC(r):n}class fg{get name(){return this.type.name}constructor(e,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~at.EnterBracketed,e instanceof Vi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=i||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Vi?(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,i,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,n,this.mode));let{buffer:r}=this.buffer,a=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.buffer.start,n);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,i,n=this.mode){return this.buffer?n&at.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&at.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&at.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:i}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else{let r=i.buffer[this.index+3];if(r<(n<0?i.buffer.length:i.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(r.buffer.buffer[a+3]<this.index)return!1;({index:i,parent:n}=r)}else({index:i,_parent:n}=this._tree);for(;n;{index:i,_parent:n}=n)if(i>-1)for(let a=i+e,o=e<0?-1:n._tree.children.length;a!=o;a+=e){let c=n._tree.children[a];if(this.mode&at.IncludeAnonymous||c instanceof Ur||!c.type.isAnonymous||h0(c))return!1}return!0}move(e,i){if(i&&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,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,a=this.stack.length;a>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;i=o,n=a+1;break e}r=this.stack[--a]}for(let r=n;r<this.stack.length;r++)i=new Er(this.buffer,i,this.stack[r]);return this.bufferNode=new Er(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&i&&i(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return hg(this.node.parent,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let r=e.length-1,a=this.stack.length-1;r>=0;a--){if(a<0)return hg(this._tree,e,r);let o=n[i.buffer[this.stack[a]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function h0(t){return t.children.some(e=>e instanceof Ur||!e.type.isAnonymous||h0(e))}function s6(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=SC,reused:a=[],minRepeatType:o=n.types.length}=t,c=Array.isArray(i)?new c0(i,i.length):i,h=n.types,d=0,p=0;function g(D,U,H,Z,J,ue){let{id:ae,start:F,end:ee,size:fe}=c,de=p,P=d;if(fe<0)if(c.next(),fe==-1){let N=a[ae];H.push(N),Z.push(F-D);return}else if(fe==-3){d=ae;return}else if(fe==-4){p=ae;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let X=h[ae],ne,ce,ye=F-D;if(ee-F<=r&&(ce=C(c.pos-U,J))){let N=new Uint16Array(ce.size-ce.skip),Q=c.pos-ce.size,$=N.length;for(;c.pos>Q;)$=M(ce.start,N,$);ne=new Ur(N,ee-ce.start,n),ye=ce.start-D}else{let N=c.pos-fe;c.next();let Q=[],$=[],re=ae>=o?ae:-1,be=0,ke=ee;for(;c.pos>N;)re>=0&&c.id==re&&c.size>=0?(c.end<=ke-r&&(w(Q,$,F,be,c.end,ke,re,de,P),be=Q.length,ke=c.end),c.next()):ue>2500?x(F,N,Q,$):g(F,N,Q,$,re,ue+1);if(re>=0&&be>0&&be<Q.length&&w(Q,$,F,be,F,ke,re,de,P),Q.reverse(),$.reverse(),re>-1&&be>0){let ze=v(X,P);ne=f0(X,Q,$,0,Q.length,0,ee-F,ze,ze)}else ne=k(X,Q,$,ee-F,de-ee,P)}H.push(ne),Z.push(ye)}function x(D,U,H,Z){let J=[],ue=0,ae=-1;for(;c.pos>U;){let{id:F,start:ee,end:fe,size:de}=c;if(de>4)c.next();else{if(ae>-1&&ee<ae)break;ae<0&&(ae=fe-r),J.push(F,ee,fe),ue++,c.next()}}if(ue){let F=new Uint16Array(ue*4),ee=J[J.length-2];for(let fe=J.length-3,de=0;fe>=0;fe-=3)F[de++]=J[fe],F[de++]=J[fe+1]-ee,F[de++]=J[fe+2]-ee,F[de++]=de;H.push(new Ur(F,J[2]-ee,n)),Z.push(ee-D)}}function v(D,U){return(H,Z,J)=>{let ue=0,ae=H.length-1,F,ee;if(ae>=0&&(F=H[ae])instanceof dt){if(!ae&&F.type==D&&F.length==J)return F;(ee=F.prop(Oe.lookAhead))&&(ue=Z[ae]+F.length+ee)}return k(D,H,Z,J,ue,U)}}function w(D,U,H,Z,J,ue,ae,F,ee){let fe=[],de=[];for(;D.length>Z;)fe.push(D.pop()),de.push(U.pop()+H-J);D.push(k(n.types[ae],fe,de,ue-J,F-ue,ee)),U.push(J-H)}function k(D,U,H,Z,J,ue,ae){if(ue){let F=[Oe.contextHash,ue];ae=ae?[F].concat(ae):[F]}if(J>25){let F=[Oe.lookAhead,J];ae=ae?[F].concat(ae):[F]}return new dt(D,U,H,Z,ae)}function C(D,U){let H=c.fork(),Z=0,J=0,ue=0,ae=H.end-r,F={size:0,start:0,skip:0};e:for(let ee=H.pos-D;H.pos>ee;){let fe=H.size;if(H.id==U&&fe>=0){F.size=Z,F.start=J,F.skip=ue,ue+=4,Z+=4,H.next();continue}let de=H.pos-fe;if(fe<0||de<ee||H.start<ae)break;let P=H.id>=o?4:0,X=H.start;for(H.next();H.pos>de;){if(H.size<0)if(H.size==-3||H.size==-4)P+=4;else break e;else H.id>=o&&(P+=4);H.next()}J=X,Z+=fe,ue+=P}return(U<0||Z==D)&&(F.size=Z,F.start=J,F.skip=ue),F.size>4?F:void 0}function M(D,U,H){let{id:Z,start:J,end:ue,size:ae}=c;if(c.next(),ae>=0&&Z<o){let F=H;if(ae>4){let ee=c.pos-(ae-4);for(;c.pos>ee;)H=M(D,U,H)}U[--H]=F,U[--H]=ue-D,U[--H]=J-D,U[--H]=Z}else ae==-3?d=Z:ae==-4&&(p=Z);return H}let T=[],j=[];for(;c.pos>0;)g(t.start||0,t.bufferStart||0,T,j,-1,0);let L=(e=t.length)!==null&&e!==void 0?e:T.length?j[0]+T[0].length:0;return new dt(h[t.topID],T.reverse(),j.reverse(),L)}const vS=new WeakMap;function Vc(t,e){if(!t.isAnonymous||e instanceof Ur||e.type!=t)return 1;let i=vS.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof dt)){i=1;break}i+=Vc(t,n)}vS.set(e,i)}return i}function f0(t,e,i,n,r,a,o,c,h){let d=0;for(let w=n;w<r;w++)d+=Vc(t,e[w]);let p=Math.ceil(d*1.5/8),g=[],x=[];function v(w,k,C,M,T){for(let j=C;j<M;){let L=j,D=k[j],U=Vc(t,w[j]);for(j++;j<M;j++){let H=Vc(t,w[j]);if(U+H>=p)break;U+=H}if(j==L+1){if(U>p){let H=w[L];v(H.children,H.positions,0,H.children.length,k[L]+T);continue}g.push(w[L])}else{let H=k[j-1]+w[j-1].length-D;g.push(f0(t,w,k,L,j,D,H,null,h))}x.push(D+T-a)}}return v(e,i,n,r,0),(c||h)(g,x,o)}class ys{constructor(e,i,n,r,a=!1,o=!1){this.from=e,this.to=i,this.tree=n,this.offset=r,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,i=[],n=!1){let r=[new ys(0,e.length,e,0,!1,n)];for(let a of i)a.to>e.length&&r.push(a);return r}static applyChanges(e,i,n=128){if(!i.length)return e;let r=[],a=1,o=e.length?e[0]:null;for(let c=0,h=0,d=0;;c++){let p=c<i.length?i[c]:null,g=p?p.fromA:1e9;if(g-h>=n)for(;o&&o.from<g;){let x=o;if(h>=x.from||g<=x.to||d){let v=Math.max(x.from,h)-d,w=Math.min(x.to,g)-d;x=v>=w?null:new ys(v,w,x.tree,x.offset+d,c>0,!!p)}if(x&&r.push(x),o.to>g)break;o=a<e.length?e[a++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return r}}class AC{startParse(e,i,n){return typeof e=="string"&&(e=new l6(e)),n=n?n.length?n.map(r=>new Kp(r.from,r.to)):[new Kp(0,0)]:[new Kp(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let r=this.startParse(e,i,n);for(;;){let a=r.advance();if(a)return a}}}class l6{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new Oe({perNode:!0});let a6=0;class Ui{constructor(e,i,n,r){this.name=e,this.set=i,this.base=n,this.modified=r,this.id=a6++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let n=typeof e=="string"?e:"?";if(e instanceof Ui&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let r=new Ui(n,[],null,[]);if(r.set.push(r),i)for(let a of i.set)r.set.push(a);return r}static defineModifier(e){let i=new mh(e);return n=>n.modified.indexOf(i)>-1?n:mh.get(n.base||n,n.modified.concat(i).sort((r,a)=>r.id-a.id))}}let o6=0;class mh{constructor(e){this.name=e,this.instances=[],this.id=o6++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(c=>c.base==e&&u6(i,c.modified));if(n)return n;let r=[],a=new Ui(e.name,r,e,i);for(let c of i)c.instances.push(a);let o=c6(i);for(let c of e.set)if(!c.modified.length)for(let h of o)r.push(mh.get(c,h));return a}}function u6(t,e){return t.length==e.length&&t.every((i,n)=>i==e[n])}function c6(t){let e=[[]];for(let i=0;i<t.length;i++)for(let n=0,r=e.length;n<r;n++)e.push(e[n].concat(t[i]));return e.sort((i,n)=>n.length-i.length)}function MC(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let r of i.split(" "))if(r){let a=[],o=2,c=r;for(let g=0;;){if(c=="..."&&g>0&&g+3==r.length){o=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+r);if(a.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),g+=x[0].length,g==r.length)break;let v=r[g++];if(g==r.length&&v=="!"){o=0;break}if(v!="/")throw new RangeError("Invalid path: "+r);c=r.slice(g)}let h=a.length-1,d=a[h];if(!d)throw new RangeError("Invalid path: "+r);let p=new Mo(n,o,h>0?a.slice(0,h):null);e[d]=p.sort(e[d])}}return TC.add(e)}const TC=new Oe({combine(t,e){let i,n,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),i&&i.mode==r.mode&&!r.context&&!i.context)continue;let a=new Mo(r.tags,r.mode,r.context);i?i.next=a:n=a,i=a}return n}});class Mo{constructor(e,i,n,r){this.tags=e,this.mode=i,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Mo.empty=new Mo([],2,null);function OC(t,e){let i=Object.create(null);for(let a of t)if(!Array.isArray(a.tag))i[a.tag.id]=a.class;else for(let o of a.tag)i[o.id]=a.class;let{scope:n,all:r=null}=e||{};return{style:a=>{let o=r;for(let c of a)for(let h of c.set){let d=i[h.id];if(d){o=o?o+" "+d:d;break}}return o},scope:n}}function h6(t,e){let i=null;for(let n of t){let r=n.style(e);r&&(i=i?i+" "+r:r)}return i}function f6(t,e,i,n=0,r=t.length){let a=new d6(n,Array.isArray(e)?e:[e],i);a.highlightRange(t.cursor(),n,r,"",a.highlighters),a.flush(r)}class d6{constructor(e,i,n){this.at=e,this.highlighters=i,this.span=n,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,n,r,a){let{type:o,from:c,to:h}=e;if(c>=n||h<=i)return;o.isTop&&(a=this.highlighters.filter(v=>!v.scope||v.scope(o)));let d=r,p=p6(e)||Mo.empty,g=h6(a,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(r+=(r?" ":"")+g)),this.startSpan(Math.max(i,c),d),p.opaque)return;let x=e.tree&&e.tree.prop(Oe.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),w=this.highlighters.filter(C=>!C.scope||C.scope(x.tree.type)),k=e.firstChild();for(let C=0,M=c;;C++){let T=C<x.overlay.length?x.overlay[C]:null,j=T?T.from+c:h,L=Math.max(i,M),D=Math.min(n,j);if(L<D&&k)for(;e.from<D&&(this.highlightRange(e,L,D,r,a),this.startSpan(Math.min(D,e.to),d),!(e.to>=j||!e.nextSibling())););if(!T||j>n)break;M=T.to+c,M>i&&(this.highlightRange(v.cursor(),Math.max(i,T.from+c),Math.min(n,M),"",w),this.startSpan(Math.min(n,M),d))}k&&e.parent()}else if(e.firstChild()){x&&(r="");do if(!(e.to<=i)){if(e.from>=n)break;this.highlightRange(e,i,n,r,a),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function p6(t){let e=t.type.prop(TC);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const te=Ui.define,Ac=te(),Ar=te(),SS=te(Ar),wS=te(Ar),Mr=te(),Mc=te(Mr),Wp=te(Mr),hn=te(),os=te(hn),un=te(),cn=te(),dg=te(),Ga=te(dg),Tc=te(),I={comment:Ac,lineComment:te(Ac),blockComment:te(Ac),docComment:te(Ac),name:Ar,variableName:te(Ar),typeName:SS,tagName:te(SS),propertyName:wS,attributeName:te(wS),className:te(Ar),labelName:te(Ar),namespace:te(Ar),macroName:te(Ar),literal:Mr,string:Mc,docString:te(Mc),character:te(Mc),attributeValue:te(Mc),number:Wp,integer:te(Wp),float:te(Wp),bool:te(Mr),regexp:te(Mr),escape:te(Mr),color:te(Mr),url:te(Mr),keyword:un,self:te(un),null:te(un),atom:te(un),unit:te(un),modifier:te(un),operatorKeyword:te(un),controlKeyword:te(un),definitionKeyword:te(un),moduleKeyword:te(un),operator:cn,derefOperator:te(cn),arithmeticOperator:te(cn),logicOperator:te(cn),bitwiseOperator:te(cn),compareOperator:te(cn),updateOperator:te(cn),definitionOperator:te(cn),typeOperator:te(cn),controlOperator:te(cn),punctuation:dg,separator:te(dg),bracket:Ga,angleBracket:te(Ga),squareBracket:te(Ga),paren:te(Ga),brace:te(Ga),content:hn,heading:os,heading1:te(os),heading2:te(os),heading3:te(os),heading4:te(os),heading5:te(os),heading6:te(os),contentSeparator:te(hn),list:te(hn),quote:te(hn),emphasis:te(hn),strong:te(hn),link:te(hn),monospace:te(hn),strikethrough:te(hn),inserted:te(),deleted:te(),changed:te(),invalid:te(),meta:Tc,documentMeta:te(Tc),annotation:te(Tc),processingInstruction:te(Tc),definition:Ui.defineModifier("definition"),constant:Ui.defineModifier("constant"),function:Ui.defineModifier("function"),standard:Ui.defineModifier("standard"),local:Ui.defineModifier("local"),special:Ui.defineModifier("special")};for(let t in I){let e=I[t];e instanceof Ui&&(e.name=t)}OC([{tag:I.link,class:"tok-link"},{tag:I.heading,class:"tok-heading"},{tag:I.emphasis,class:"tok-emphasis"},{tag:I.strong,class:"tok-strong"},{tag:I.keyword,class:"tok-keyword"},{tag:I.atom,class:"tok-atom"},{tag:I.bool,class:"tok-bool"},{tag:I.url,class:"tok-url"},{tag:I.labelName,class:"tok-labelName"},{tag:I.inserted,class:"tok-inserted"},{tag:I.deleted,class:"tok-deleted"},{tag:I.literal,class:"tok-literal"},{tag:I.string,class:"tok-string"},{tag:I.number,class:"tok-number"},{tag:[I.regexp,I.escape,I.special(I.string)],class:"tok-string2"},{tag:I.variableName,class:"tok-variableName"},{tag:I.local(I.variableName),class:"tok-variableName tok-local"},{tag:I.definition(I.variableName),class:"tok-variableName tok-definition"},{tag:I.special(I.variableName),class:"tok-variableName2"},{tag:I.definition(I.propertyName),class:"tok-propertyName tok-definition"},{tag:I.typeName,class:"tok-typeName"},{tag:I.namespace,class:"tok-namespace"},{tag:I.className,class:"tok-className"},{tag:I.macroName,class:"tok-macroName"},{tag:I.propertyName,class:"tok-propertyName"},{tag:I.operator,class:"tok-operator"},{tag:I.comment,class:"tok-comment"},{tag:I.meta,class:"tok-meta"},{tag:I.invalid,class:"tok-invalid"},{tag:I.punctuation,class:"tok-punctuation"}]);var Xp;const bl=new Oe;function m6(t){return le.define({combine:t?e=>e.concat(t):void 0})}const g6=new Oe;class Zi{constructor(e,i,n=[],r=""){this.data=e,this.name=r,Be.prototype.hasOwnProperty("tree")||Object.defineProperty(Be.prototype,"tree",{get(){return Ft(this)}}),this.parser=i,this.extension=[qr.of(this),Be.languageData.of((a,o,c)=>{let h=kS(a,o,c),d=h.type.prop(bl);if(!d)return[];let p=a.facet(d),g=h.type.prop(g6);if(g){let x=h.resolve(o-h.from,c);for(let v of g)if(v.test(x,a)){let w=a.facet(v.facet);return v.type=="replace"?w:w.concat(p)}}return p})].concat(n)}isActiveAt(e,i,n=-1){return kS(e,i,n).type.prop(bl)==this.data}findRegions(e){let i=e.facet(qr);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let n=[],r=(a,o)=>{if(a.prop(bl)==this.data){n.push({from:o,to:o+a.length});return}let c=a.prop(Oe.mounted);if(c){if(c.tree.prop(bl)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+o,to:h.to+o});else n.push({from:o,to:o+a.length});return}else if(c.overlay){let h=n.length;if(r(c.tree,c.overlay[0].from+o),n.length>h)return}}for(let h=0;h<a.children.length;h++){let d=a.children[h];d instanceof dt&&r(d,a.positions[h]+o)}};return r(Ft(e),0),n}get allowsNesting(){return!0}}Zi.setState=we.define();function kS(t,e,i){let n=t.facet(qr),r=Ft(t).topNode;if(!n||n.allowsNesting)for(let a=r;a;a=a.enter(e,i,at.ExcludeBuffers|at.EnterBracketed))a.type.isTop&&(r=a);return r}class gh extends Zi{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=m6(e.languageData);return new gh(i,e.parser.configure({props:[bl.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new gh(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ft(t){let e=t.field(Zi.state,!1);return e?e.tree:dt.empty}class y6{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,i){let n=this.cursorPos-this.string.length;return e<n||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-n,i-n)}}let Ya=null;class yh{constructor(e,i,n=[],r,a,o,c,h){this.parser=e,this.state=i,this.fragments=n,this.tree=r,this.treeLen=a,this.viewport=o,this.skipped=c,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new yh(e,i,[],dt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new y6(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=dt.empty&&this.isDone(i??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(ys.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(ys.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Ya;Ya=this;try{return e()}finally{Ya=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=CS(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:r,treeLen:a,viewport:o,skipped:c}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((d,p,g,x)=>h.push({fromA:d,toA:p,fromB:g,toB:x})),n=ys.applyChanges(n,h),r=dt.empty,a=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){c=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);p<g&&c.push({from:p,to:g})}}}return new yh(this.parser,i,n,r,a,o,c,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:a}=this.skipped[n];r<e.to&&a>e.from&&(this.fragments=CS(this.fragments,r,a),this.skipped.splice(n--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends AC{createParse(i,n,r){let a=r[0].from,o=r[r.length-1].to;return{parsedPos:a,advance(){let h=Ya;if(h){for(let d of r)h.tempSkipped.push(d);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new dt(fi.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Ya}}function CS(t,e,i){return ys.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class zl{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new zl(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=yh.create(e.facet(qr).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new zl(n)}}Zi.state=It.define({create:zl.init,update(t,e){for(let i of e.effects)if(i.is(Zi.setState))return i.value;return e.startState.facet(qr)!=e.state.facet(qr)?zl.init(e.state):t.apply(e)}});let EC=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(EC=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Zp=typeof navigator<"u"&&(!((Xp=navigator.scheduling)===null||Xp===void 0)&&Xp.isInputPending)?()=>navigator.scheduling.isInputPending():null,x6=ot.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 i=this.view.state.field(Zi.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(Zi.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=EC(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,a=n.field(Zi.state);if(a.tree==a.context.tree&&a.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Zp?Math.max(25,e.timeRemaining()-5):1e9),c=a.context.treeLen<r&&n.doc.length>r+1e3,h=a.context.work(()=>Zp&&Zp()||Date.now()>o,r+(c?0:1e5));this.chunkBudget-=Date.now()-i,(h||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new zl(a.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>ci(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),qr=le.define({combine(t){return t.length?t[0]:null},enables:t=>[Zi.state,x6,ie.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class b6{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const v6=le.define(),Gh=le.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function xh(t){let e=t.facet(Gh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function To(t,e){let i="",n=t.tabSize,r=t.facet(Gh)[0];if(r==" "){for(;e>=n;)i+=" ",e-=n;r=" "}for(let a=0;a<e;a++)i+=r;return i}function d0(t,e){t instanceof Be&&(t=new Yh(t));for(let n of t.state.facet(v6)){let r=n(t,e);if(r!==void 0)return r}let i=Ft(t.state);return i.length>=e?S6(t,i,e):null}class Yh{constructor(e,i={}){this.state=e,this.options=i,this.unit=xh(e)}lineAt(e,i=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:a}=this.options;return r!=null&&r>=n.from&&r<=n.to?a&&r==e?{text:"",from:e}:(i<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,i=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,i);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,i=1){let{text:n,from:r}=this.lineAt(e,i),a=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(a+=o-this.countColumn(n,n.search(/\S|$/))),a}countColumn(e,i=e.length){return Vl(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:n,from:r}=this.lineAt(e,i),a=this.options.overrideIndentation;if(a){let o=a(r);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const NC=new Oe;function S6(t,e,i){let n=e.resolveStack(i),r=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(r!=n.node){let a=[];for(let o=r;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)n={node:a[o],next:n}}return RC(n,t,i)}function RC(t,e,i){for(let n=t;n;n=n.next){let r=k6(n.node);if(r)return r(p0.create(e,i,n))}return 0}function w6(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function k6(t){let e=t.type.prop(NC);if(e)return e;let i=t.firstChild,n;if(i&&(n=i.type.prop(Oe.closedBy))){let r=t.lastChild,a=r&&n.indexOf(r.name)>-1;return o=>T6(o,!0,1,void 0,a&&!w6(o)?r.from:void 0)}return t.parent==null?C6:null}function C6(){return 0}class p0 extends Yh{constructor(e,i,n){super(e.state,e.options),this.base=e,this.pos=i,this.context=n}get node(){return this.context.node}static create(e,i,n){return new p0(e,i,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let i=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(i.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(A6(n,e))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}continue(){return RC(this.context.next,this.base,this.pos)}}function A6(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function M6(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,a=t.state.doc.lineAt(i.from),o=r==null||r<=a.from?a.to:Math.min(a.to,r);for(let c=i.to;;){let h=e.childAfter(c);if(!h||h==n)return null;if(!h.type.isSkipped){if(h.from>=o)return null;let d=/^ */.exec(a.text.slice(i.to-a.from))[0].length;return{from:i.from,to:i.to+d}}c=h.to}}function T6(t,e,i,n,r){let a=t.textAfter,o=a.match(/^\s*/)[0].length,c=n&&a.slice(o,o+n.length)==n||r==t.pos+o,h=M6(t);return h?c?t.column(h.from):t.column(h.to):t.baseIndent+(c?0:t.unit*i)}function AS({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const O6=200;function E6(){return Be.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,r=i.lineAt(n);if(n>r.from+O6)return t;let a=i.sliceString(r.from,n);if(!e.some(d=>d.test(a)))return t;let{state:o}=t,c=-1,h=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==c)continue;c=p.from;let g=d0(o,p.from);if(g==null)continue;let x=/^\s*/.exec(p.text)[0],v=To(o,g);x!=v&&h.push({from:p.from,to:p.from+x.length,insert:v})}return h.length?[t,{changes:h,sequential:!0}]:t})}const N6=le.define(),DC=new Oe;function R6(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function D6(t,e,i){let n=Ft(t);if(n.length<i)return null;let r=n.resolveStack(i,1),a=null;for(let o=r;o;o=o.next){let c=o.node;if(c.to<=i||c.from>i)continue;if(a&&c.from<e)break;let h=c.type.prop(DC);if(h&&(c.to<n.length-50||n.length==t.doc.length||!j6(c))){let d=h(c,t);d&&d.from<=i&&d.from>=e&&d.to>i&&(a=d)}}return a}function j6(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function bh(t,e,i){for(let n of t.facet(N6)){let r=n(t,e,i);if(r)return r}return D6(t,e,i)}function jC(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const Kh=we.define({map:jC}),qo=we.define({map:jC});function LC(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(n=>n.from<=i&&n.to>=i)||e.push(t.lineBlockAt(i));return e}const Cs=It.define({create(){return ge.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,n)=>t=MS(t,i,n)),t=t.map(e.changes);for(let i of e.effects)if(i.is(Kh)&&!L6(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(_C),r=n?ge.replace({widget:new P6(n(e.state,i.value))}):TS;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(qo)&&(t=t.update({filter:(n,r)=>i.value.from!=n||i.value.to!=r,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=MS(t,e.selection.main.head)),t},provide:t=>ie.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(n,r)=>{i.push(n,r)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i<t.length;){let n=t[i++],r=t[i++];if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(TS.range(n,r))}return ge.set(e,!0)}});function MS(t,e,i=e){let n=!1;return t.between(e,i,(r,a)=>{r<i&&a>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(r,a)=>r>=i||a<=e}):t}function vh(t,e,i){var n;let r=null;return(n=t.field(Cs,!1))===null||n===void 0||n.between(e,i,(a,o)=>{(!r||r.from>a)&&(r={from:a,to:o})}),r}function L6(t,e,i){let n=!1;return t.between(e,e,(r,a)=>{r==e&&a==i&&(n=!0)}),n}function BC(t,e){return t.field(Cs,!1)?e:e.concat(we.appendConfig.of(HC()))}const B6=t=>{for(let e of LC(t)){let i=bh(t.state,e.from,e.to);if(i)return t.dispatch({effects:BC(t.state,[Kh.of(i),zC(t,i)])}),!0}return!1},z6=t=>{if(!t.state.field(Cs,!1))return!1;let e=[];for(let i of LC(t)){let n=vh(t.state,i.from,i.to);n&&e.push(qo.of(n),zC(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function zC(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return ie.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${r}.`)}const _6=t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let r=t.lineBlockAt(n),a=bh(e,r.from,r.to);a&&i.push(Kh.of(a)),n=(a?t.lineBlockAt(a.to):r).to+1}return i.length&&t.dispatch({effects:BC(t.state,i)}),!!i.length},H6=t=>{let e=t.state.field(Cs,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(n,r)=>{i.push(qo.of({from:n,to:r}))}),t.dispatch({effects:i}),!0},U6=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:B6},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:z6},{key:"Ctrl-Alt-[",run:_6},{key:"Ctrl-Alt-]",run:H6}],q6={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},_C=le.define({combine(t){return wn(t,q6)}});function HC(t){return[Cs,I6]}function UC(t,e){let{state:i}=t,n=i.facet(_C),r=o=>{let c=t.lineBlockAt(t.posAtDOM(o.target)),h=vh(t.state,c.from,c.to);h&&t.dispatch({effects:qo.of(h)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",i.phrase("folded code")),a.title=i.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=r,a}const TS=ge.replace({widget:new class extends kn{toDOM(t){return UC(t,null)}}});class P6 extends kn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return UC(e,this.value)}}const F6={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Jp extends Xn{constructor(e,i){super(),this.config=e,this.open=i}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=e.state.phrase(this.open?"Fold line":"Unfold line"),i}}function V6(t={}){let e={...F6,...t},i=new Jp(e,!0),n=new Jp(e,!1),r=ot.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(qr)!=o.state.facet(qr)||o.startState.field(Cs,!1)!=o.state.field(Cs,!1)||Ft(o.startState)!=Ft(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let c=new Kn;for(let h of o.viewportLineBlocks){let d=vh(o.state,h.from,h.to)?n:bh(o.state,h.from,h.to)?i:null;d&&c.add(h.from,h.from,d)}return c.finish()}}),{domEventHandlers:a}=e;return[r,VL({class:"cm-foldGutter",markers(o){var c;return((c=o.plugin(r))===null||c===void 0?void 0:c.markers)||Re.empty},initialSpacer(){return new Jp(e,!1)},domEventHandlers:{...a,click:(o,c,h)=>{if(a.click&&a.click(o,c,h))return!0;let d=vh(o.state,c.from,c.to);if(d)return o.dispatch({effects:qo.of(d)}),!0;let p=bh(o.state,c.from,c.to);return p?(o.dispatch({effects:Kh.of(p)}),!0):!1}}}),HC()]}const I6=ie.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 Po{constructor(e,i){this.specs=e;let n;function r(c){let h=zr.newName();return(n||(n=Object.create(null)))["."+h]=c,h}const a=typeof i.all=="string"?i.all:i.all?r(i.all):void 0,o=i.scope;this.scope=o instanceof Zi?c=>c.prop(bl)==o.data:o?c=>c==o:void 0,this.style=OC(e.map(c=>({tag:c.tag,class:c.class||r(Object.assign({},c,{tag:null}))})),{all:a}).style,this.module=n?new zr(n):null,this.themeType=i.themeType}static define(e,i){return new Po(e,i||{})}}const pg=le.define(),qC=le.define({combine(t){return t.length?[t[0]]:null}});function $p(t){let e=t.facet(pg);return e.length?e:t.facet(qC)}function PC(t,e){let i=[G6],n;return t instanceof Po&&(t.module&&i.push(ie.styleModule.of(t.module)),n=t.themeType),e?.fallback?i.push(qC.of(t)):n?i.push(pg.computeN([ie.darkTheme],r=>r.facet(ie.darkTheme)==(n=="dark")?[t]:[])):i.push(pg.of(t)),i}class Q6{constructor(e){this.markCache=Object.create(null),this.tree=Ft(e.state),this.decorations=this.buildDeco(e,$p(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Ft(e.state),n=$p(e.state),r=n!=$p(e.startState),{viewport:a}=e.view,o=e.changes.mapPos(this.decoratedTo,1);i.length<a.to&&!r&&i.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(i!=this.tree||e.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=a.to)}buildDeco(e,i){if(!i||!this.tree.length)return ge.none;let n=new Kn;for(let{from:r,to:a}of e.visibleRanges)f6(this.tree,i,(o,c,h)=>{n.add(o,c,this.markCache[h]||(this.markCache[h]=ge.mark({class:h})))},r,a);return n.finish()}}const G6=Ms.high(ot.fromClass(Q6,{decorations:t=>t.decorations})),Y6=Po.define([{tag:I.meta,color:"#404740"},{tag:I.link,textDecoration:"underline"},{tag:I.heading,textDecoration:"underline",fontWeight:"bold"},{tag:I.emphasis,fontStyle:"italic"},{tag:I.strong,fontWeight:"bold"},{tag:I.strikethrough,textDecoration:"line-through"},{tag:I.keyword,color:"#708"},{tag:[I.atom,I.bool,I.url,I.contentSeparator,I.labelName],color:"#219"},{tag:[I.literal,I.inserted],color:"#164"},{tag:[I.string,I.deleted],color:"#a11"},{tag:[I.regexp,I.escape,I.special(I.string)],color:"#e40"},{tag:I.definition(I.variableName),color:"#00f"},{tag:I.local(I.variableName),color:"#30a"},{tag:[I.typeName,I.namespace],color:"#085"},{tag:I.className,color:"#167"},{tag:[I.special(I.variableName),I.macroName],color:"#256"},{tag:I.definition(I.propertyName),color:"#00c"},{tag:I.comment,color:"#940"},{tag:I.invalid,color:"#f00"}]),K6=ie.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),FC=1e4,VC="()[]{}",IC=le.define({combine(t){return wn(t,{afterCursor:!0,brackets:VC,maxScanDistance:FC,renderMatch:Z6})}}),W6=ge.mark({class:"cm-matchingBracket"}),X6=ge.mark({class:"cm-nonmatchingBracket"});function Z6(t){let e=[],i=t.matched?W6:X6;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}function OS(t){let e=[],i=t.facet(IC);for(let n of t.selection.ranges){if(!n.empty)continue;let r=gn(t,n.head,-1,i)||n.head>0&&gn(t,n.head-1,1,i)||i.afterCursor&&(gn(t,n.head,1,i)||n.head<t.doc.length&&gn(t,n.head+1,-1,i));r&&(e=e.concat(i.renderMatch(r,t)))}return ge.set(e,!0)}const J6=ot.fromClass(class{constructor(t){this.paused=!1,this.decorations=OS(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=OS(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),$6=[J6,K6];function eB(t={}){return[IC.of(t),$6]}const tB=new Oe;function mg(t,e,i){let n=t.prop(e<0?Oe.openedBy:Oe.closedBy);if(n)return n;if(t.name.length==1){let r=i.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[i[r+e]]}return null}function gg(t){let e=t.type.prop(tB);return e?e(t.node):t}function gn(t,e,i,n={}){let r=n.maxScanDistance||FC,a=n.brackets||VC,o=Ft(t),c=o.resolveInner(e,i);for(let h=c;h;h=h.parent){let d=mg(h.type,i,a);if(d&&h.from<h.to){let p=gg(h);if(p&&(i>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return iB(t,e,i,h,p,d,a)}}return nB(t,e,i,o,c.type,r,a)}function iB(t,e,i,n,r,a,o){let c=n.parent,h={from:r.from,to:r.to},d=0,p=c?.cursor();if(p&&(i<0?p.childBefore(n.from):p.childAfter(n.to)))do if(i<0?p.to<=n.from:p.from>=n.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let g=gg(p);return{start:h,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(mg(p.type,i,o))d++;else if(mg(p.type,-i,o)){if(d==0){let g=gg(p);return{start:h,end:g&&g.from<g.to?{from:g.from,to:g.to}:void 0,matched:!1}}d--}}while(i<0?p.prevSibling():p.nextSibling());return{start:h,matched:!1}}function nB(t,e,i,n,r,a,o){let c=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=o.indexOf(c);if(h<0||h%2==0!=i>0)return null;let d={from:i<0?e-1:e,to:i>0?e+1:e},p=t.doc.iterRange(e,i>0?t.doc.length:0),g=0;for(let x=0;!p.next().done&&x<=a;){let v=p.value;i<0&&(x+=v.length);let w=e+x*i;for(let k=i>0?0:v.length-1,C=i>0?v.length:-1;k!=C;k+=i){let M=o.indexOf(v[k]);if(!(M<0||n.resolveInner(w+k,1).type!=r))if(M%2==0==i>0)g++;else{if(g==1)return{start:d,end:{from:w+k,to:w+k+1},matched:M>>1==h>>1};g--}}i>0&&(x+=v.length)}return p.done?{start:d,matched:!1}:null}const rB=Object.create(null),ES=[fi.none],NS=[],RS=Object.create(null),sB=Object.create(null);for(let[t,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"]])sB[t]=lB(rB,e);function em(t,e){NS.indexOf(t)>-1||(NS.push(t),console.warn(e))}function lB(t,e){let i=[];for(let c of e.split(" ")){let h=[];for(let d of c.split(".")){let p=t[d]||I[d];p?typeof p=="function"?h.length?h=h.map(p):em(d,`Modifier ${d} used at start of tag`):h.length?em(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:em(d,`Unknown highlighting tag ${d}`)}for(let d of h)i.push(d)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(c=>c.id),a=RS[r];if(a)return a.id;let o=RS[r]=fi.define({id:ES.length,name:n,props:[MC({[n]:i})]});return ES.push(o),o.id}Ze.RTL,Ze.LTR;const aB=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=g0(t.state,i.from);return n.line?oB(t):n.block?cB(t):!1};function m0(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}const oB=m0(dB,0),uB=m0(QC,0),cB=m0((t,e)=>QC(t,e,fB(e)),0);function g0(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const Ka=50;function hB(t,{open:e,close:i},n,r){let a=t.sliceDoc(n-Ka,n),o=t.sliceDoc(r,r+Ka),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(o)[0].length,d=a.length-c;if(a.slice(d-e.length,d)==e&&o.slice(h,h+i.length)==i)return{open:{pos:n-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};let p,g;r-n<=2*Ka?p=g=t.sliceDoc(n,r):(p=t.sliceDoc(n,n+Ka),g=t.sliceDoc(r-Ka,r));let x=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-i.length;return p.slice(x,x+e.length)==e&&g.slice(w,w+i.length)==i?{open:{pos:n+x+e.length,margin:/\s/.test(p.charAt(x+e.length))?1:0},close:{pos:r-v-i.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function fB(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let a=e.length-1;a>=0&&e[a].to>n.from?e[a].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function QC(t,e,i=e.selection.ranges){let n=i.map(a=>g0(e,a.from).block);if(!n.every(a=>a))return null;let r=i.map((a,o)=>hB(e,n[o],a.from,a.to));if(t!=2&&!r.every(a=>a))return{changes:e.changes(i.map((a,o)=>r[o]?[]:[{from:a.from,insert:n[o].open+" "},{from:a.to,insert:" "+n[o].close}]))};if(t!=1&&r.some(a=>a)){let a=[];for(let o=0,c;o<r.length;o++)if(c=r[o]){let h=n[o],{open:d,close:p}=c;a.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:a}}return null}function dB(t,e,i=e.selection.ranges){let n=[],r=-1;e:for(let{from:a,to:o}of i){let c=n.length,h=1e9,d;for(let p=a;p<=o;){let g=e.doc.lineAt(p);if(d==null&&(d=g0(e,g.from).line,!d))continue e;if(g.from>r&&(a==o||o>g.from)){r=g.from;let x=/^\s*/.exec(g.text)[0].length,v=x==g.length,w=g.text.slice(x,x+d.length)==d?x:-1;x<g.text.length&&x<h&&(h=x),n.push({line:g,comment:w,token:d,indent:x,empty:v,single:!1})}p=g.to+1}if(h<1e9)for(let p=c;p<n.length;p++)n[p].indent<n[p].line.text.length&&(n[p].indent=h);n.length==c+1&&(n[c].single=!0)}if(t!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:c,token:h,indent:d,empty:p,single:g}of n)(g||!p)&&a.push({from:c.from+d,insert:h+" "});let o=e.changes(a);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:c,token:h}of n)if(c>=0){let d=o.from+c,p=d+h.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const yg=Sn.define(),pB=Sn.define(),mB=le.define(),GC=le.define({combine(t){return wn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(n,r)=>e(n,r)||i(n,r)})}}),YC=It.define({create(){return yn.empty},update(t,e){let i=e.state.facet(GC),n=e.annotation(yg);if(n){let h=hi.fromTransaction(e,n.selection),d=n.side,p=d==0?t.undone:t.done;return h?p=Sh(p,p.length,i.minDepth,h):p=XC(p,e.startState.selection),new yn(d==0?n.rest:p,d==0?p:n.rest)}let r=e.annotation(pB);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(At.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let a=hi.fromTransaction(e),o=e.annotation(At.time),c=e.annotation(At.userEvent);return a?t=t.addChanges(a,o,c,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,c,i.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new yn(t.done.map(hi.fromJSON),t.undone.map(hi.fromJSON))}});function gB(t={}){return[YC,GC.of(t),ie.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?KC:e.inputType=="historyRedo"?xg:null;return n?(e.preventDefault(),n(i)):!1}})]}function Wh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(YC,!1);if(!r)return!1;let a=r.pop(t,i,e);return a?(n(a),!0):!1}}const KC=Wh(0,!1),xg=Wh(1,!1),yB=Wh(0,!0),xB=Wh(1,!0);class hi{constructor(e,i,n,r,a){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=a}setSelAfter(e){return new hi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new hi(e.changes&&wt.fromJSON(e.changes),[],e.mapped&&vn.fromJSON(e.mapped),e.startSelection&&W.fromJSON(e.startSelection),e.selectionsAfter.map(W.fromJSON))}static fromTransaction(e,i){let n=Pi;for(let r of e.startState.facet(mB)){let a=r(e);a.length&&(n=n.concat(a))}return!n.length&&e.changes.empty?null:new hi(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,Pi)}static selection(e){return new hi(void 0,Pi,void 0,void 0,e)}}function Sh(t,e,i,n){let r=e+1>i+20?e-i-1:0,a=t.slice(r,e);return a.push(n),a}function bB(t,e){let i=[],n=!1;return t.iterChangedRanges((r,a)=>i.push(r,a)),e.iterChangedRanges((r,a,o,c)=>{for(let h=0;h<i.length;){let d=i[h++],p=i[h++];c>=d&&o<=p&&(n=!0)}}),n}function vB(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function WC(t,e){return t.length?e.length?t.concat(e):t:e}const Pi=[],SB=200;function XC(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-SB));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Sh(t,t.length-1,1e9,i.setSelAfter(n)))}else return[hi.selection([e])]}function wB(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function tm(t,e){if(!t.length)return t;let i=t.length,n=Pi;for(;i;){let r=kB(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let a=t.slice(0,i);return a[i-1]=r,a}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[hi.selection(n)]:Pi}function kB(t,e,i){let n=WC(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Pi,i);if(!t.changes)return hi.selection(n);let r=t.changes.map(e),a=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(a):a;return new hi(r,we.mapEffects(t.effects,e),o,t.startSelection.map(a),n)}const CB=/^(input\.type|delete)($|\.)/;class yn{constructor(e,i,n=0,r=void 0){this.done=e,this.undone=i,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new yn(this.done,this.undone):this}addChanges(e,i,n,r,a){let o=this.done,c=o[o.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||CB.test(n))&&(!c.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(a,bB(c.changes,e.changes))||n=="input.type.compose")?o=Sh(o,o.length-1,r.minDepth,new hi(e.changes.compose(c.changes),WC(we.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,Pi)):o=Sh(o,o.length,r.minDepth,e),new yn(o,Pi,i,n)}addSelection(e,i,n,r){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Pi;return a.length>0&&i-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&vB(a[a.length-1],e)?this:new yn(XC(this.done,e),this.undone,i,n)}addMapping(e){return new yn(tm(this.done,e),tm(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,i,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let a=r[r.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):i.selection);if(n&&a.selectionsAfter.length)return i.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:yg.of({side:e,rest:wB(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let c=r.length==1?Pi:r.slice(0,r.length-1);return a.mapped&&(c=tm(c,a.mapped)),i.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:yg.of({side:e,rest:c,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}yn.empty=new yn(Pi,Pi);const AB=[{key:"Mod-z",run:KC,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:xg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:xg,preventDefault:!0},{key:"Mod-u",run:yB,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xB,preventDefault:!0}];function Il(t,e){return W.create(t.ranges.map(e),t.mainIndex)}function tn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function nn({state:t,dispatch:e},i){let n=Il(t.selection,i);return n.eq(t.selection,!0)?!1:(e(tn(t,n)),!0)}function Xh(t,e){return W.cursor(e?t.to:t.from)}function ZC(t,e){return nn(t,i=>i.empty?t.moveByChar(i,e):Xh(i,e))}function Qt(t){return t.textDirectionAt(t.state.selection.main.head)==Ze.LTR}const JC=t=>ZC(t,!Qt(t)),$C=t=>ZC(t,Qt(t));function eA(t,e){return nn(t,i=>i.empty?t.moveByGroup(i,e):Xh(i,e))}const MB=t=>eA(t,!Qt(t)),TB=t=>eA(t,Qt(t));function OB(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Zh(t,e,i){let n=Ft(t).resolveInner(e.head),r=i?Oe.closedBy:Oe.openedBy;for(let h=e.head;;){let d=i?n.childAfter(h):n.childBefore(h);if(!d)break;OB(t,d,r)?n=d:h=i?d.to:d.from}let a=n.type.prop(r),o,c;return a&&(o=i?gn(t,n.from,1):gn(t,n.to,-1))&&o.matched?c=i?o.end.to:o.end.from:c=i?n.to:n.from,W.cursor(c,i?-1:1)}const EB=t=>nn(t,e=>Zh(t.state,e,!Qt(t))),NB=t=>nn(t,e=>Zh(t.state,e,Qt(t)));function tA(t,e){return nn(t,i=>{if(!i.empty)return Xh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}const iA=t=>tA(t,!1),nA=t=>tA(t,!0);function rA(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,n=0,r;if(e){for(let a of t.state.facet(ie.scrollMargins)){let o=a(t);o?.top&&(i=Math.max(o?.top,i)),o?.bottom&&(n=Math.max(o?.bottom,n))}r=t.scrollDOM.clientHeight-i-n}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function sA(t,e){let i=rA(t),{state:n}=t,r=Il(n.selection,o=>o.empty?t.moveVertically(o,e,i.height):Xh(o,e));if(r.eq(n.selection))return!1;let a;if(i.selfScroll){let o=t.coordsAtPos(n.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),h=c.top+i.marginTop,d=c.bottom-i.marginBottom;o&&o.top>h&&o.bottom<d&&(a=ie.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-h}))}return t.dispatch(tn(n,r),{effects:a}),!0}const DS=t=>sA(t,!1),bg=t=>sA(t,!0);function Fr(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let a=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&e.head!=n.from+a&&(r=W.cursor(n.from+a))}return r}const RB=t=>nn(t,e=>Fr(t,e,!0)),DB=t=>nn(t,e=>Fr(t,e,!1)),jB=t=>nn(t,e=>Fr(t,e,!Qt(t))),LB=t=>nn(t,e=>Fr(t,e,Qt(t))),BB=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).from,1)),zB=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).to,-1));function _B(t,e,i){let n=!1,r=Il(t.selection,a=>{let o=gn(t,a.head,-1)||gn(t,a.head,1)||a.head>0&&gn(t,a.head-1,1)||a.head<t.doc.length&&gn(t,a.head+1,-1);if(!o||!o.end)return a;n=!0;let c=o.start.from==a.head?o.end.to:o.end.from;return W.cursor(c)});return n?(e(tn(t,r)),!0):!1}const HB=({state:t,dispatch:e})=>_B(t,e);function Qi(t,e){let i=Il(t.state.selection,n=>{let r=e(n);return W.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(tn(t.state,i)),!0)}function lA(t,e){return Qi(t,i=>t.moveByChar(i,e))}const aA=t=>lA(t,!Qt(t)),oA=t=>lA(t,Qt(t));function uA(t,e){return Qi(t,i=>t.moveByGroup(i,e))}const UB=t=>uA(t,!Qt(t)),qB=t=>uA(t,Qt(t)),PB=t=>Qi(t,e=>Zh(t.state,e,!Qt(t))),FB=t=>Qi(t,e=>Zh(t.state,e,Qt(t)));function cA(t,e){return Qi(t,i=>t.moveVertically(i,e))}const hA=t=>cA(t,!1),fA=t=>cA(t,!0);function dA(t,e){return Qi(t,i=>t.moveVertically(i,e,rA(t).height))}const jS=t=>dA(t,!1),LS=t=>dA(t,!0),VB=t=>Qi(t,e=>Fr(t,e,!0)),IB=t=>Qi(t,e=>Fr(t,e,!1)),QB=t=>Qi(t,e=>Fr(t,e,!Qt(t))),GB=t=>Qi(t,e=>Fr(t,e,Qt(t))),YB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).from)),KB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).to)),BS=({state:t,dispatch:e})=>(e(tn(t,{anchor:0})),!0),zS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.doc.length})),!0),_S=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:0})),!0),HS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),WB=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),XB=({state:t,dispatch:e})=>{let i=Jh(t).map(({from:n,to:r})=>W.range(n,Math.min(r+1,t.doc.length)));return e(t.update({selection:W.create(i),userEvent:"select"})),!0},ZB=({state:t,dispatch:e})=>{let i=Il(t.selection,n=>{let r=Ft(t),a=r.resolveStack(n.from,1);if(n.empty){let o=r.resolveStack(n.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:c}=o;if((c.from<n.from&&c.to>=n.to||c.to>n.to&&c.from<=n.from)&&o.next)return W.range(c.to,c.from)}return n});return i.eq(t.selection)?!1:(e(tn(t,i)),!0)};function pA(t,e){let{state:i}=t,n=i.selection,r=i.selection.ranges.slice();for(let a of i.selection.ranges){let o=i.doc.lineAt(a.head);if(e?o.to<t.state.doc.length:o.from>0)for(let c=a;;){let h=t.moveVertically(c,e);if(h.head<o.from||h.head>o.to){r.some(d=>d.head==h.head)||r.push(h);break}else{if(h.head==c.head)break;c=h}}}return r.length==n.ranges.length?!1:(t.dispatch(tn(i,W.create(r,r.length-1))),!0)}const JB=t=>pA(t,!1),$B=t=>pA(t,!0),e8=({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=W.create([i.main]):i.main.empty||(n=W.create([W.cursor(i.main.head)])),n?(e(tn(t,n)),!0):!1};function Fo(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(a=>{let{from:o,to:c}=a;if(o==c){let h=e(a);h<o?(i="delete.backward",h=Oc(t,h,!1)):h>o&&(i="delete.forward",h=Oc(t,h,!0)),o=Math.min(o,h),c=Math.max(c,h)}else o=Oc(t,o,!1),c=Oc(t,c,!0);return o==c?{range:a}:{changes:{from:o,to:c},range:W.cursor(o,o<a.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?ie.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Oc(t,e,i){if(t instanceof ie)for(let n of t.state.facet(ie.atomicRanges).map(r=>r(t)))n.between(e,e,(r,a)=>{r<e&&a>e&&(e=i?a:r)});return e}const mA=(t,e,i)=>Fo(t,n=>{let r=n.from,{state:a}=t,o=a.doc.lineAt(r),c,h;if(i&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(c=o.text.slice(0,r-o.from))){if(c[c.length-1]==" ")return r-1;let d=Vl(c,a.tabSize),p=d%xh(a)||xh(a);for(let g=0;g<p&&c[c.length-1-g]==" ";g++)r--;h=r}else h=Et(o.text,r-o.from,e,e)+o.from,h==r&&o.number!=(e?a.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(h-o.from,r-o.from))&&(h=Et(o.text,h-o.from,!1,!1)+o.from);return h}),vg=t=>mA(t,!1,!0),gA=t=>mA(t,!0,!1),yA=(t,e)=>Fo(t,i=>{let n=i.head,{state:r}=t,a=r.doc.lineAt(n),o=r.charCategorizer(n);for(let c=null;;){if(n==(e?a.to:a.from)){n==i.head&&a.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=Et(a.text,n-a.from,e)+a.from,d=a.text.slice(Math.min(n,h)-a.from,Math.max(n,h)-a.from),p=o(d);if(c!=null&&p!=c)break;(d!=" "||n!=i.head)&&(c=p),n=h}return n}),xA=t=>yA(t,!1),t8=t=>yA(t,!0),i8=t=>Fo(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),n8=t=>Fo(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),r8=t=>Fo(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),s8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ue.of(["",""])},range:W.cursor(n.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},l8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let r=n.from,a=t.doc.lineAt(r),o=r==a.from?r-1:Et(a.text,r-a.from,!1)+a.from,c=r==a.to?r+1:Et(a.text,r-a.from,!0)+a.from;return{changes:{from:o,to:c,insert:t.doc.slice(r,c).append(t.doc.slice(o,r))},range:W.cursor(c)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Jh(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),a=t.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=t.doc.lineAt(n.to-1)),i>=r.number){let o=e[e.length-1];o.to=a.to,o.ranges.push(n)}else e.push({from:r.from,to:a.to,ranges:[n]});i=a.number+1}return e}function bA(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let a of Jh(t)){if(i?a.to==t.doc.length:a.from==0)continue;let o=t.doc.lineAt(i?a.to+1:a.from-1),c=o.length+1;if(i){n.push({from:a.to,to:o.to},{from:a.from,insert:o.text+t.lineBreak});for(let h of a.ranges)r.push(W.range(Math.min(t.doc.length,h.anchor+c),Math.min(t.doc.length,h.head+c)))}else{n.push({from:o.from,to:a.from},{from:a.to,insert:t.lineBreak+o.text});for(let h of a.ranges)r.push(W.range(h.anchor-c,h.head-c))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:W.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const a8=({state:t,dispatch:e})=>bA(t,e,!1),o8=({state:t,dispatch:e})=>bA(t,e,!0);function vA(t,e,i){if(t.readOnly)return!1;let n=[];for(let a of Jh(t))i?n.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):n.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)});let r=t.changes(n);return e(t.update({changes:r,selection:t.selection.map(r,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const u8=({state:t,dispatch:e})=>vA(t,e,!1),c8=({state:t,dispatch:e})=>vA(t,e,!0),h8=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Jh(e).map(({from:r,to:a})=>(r>0?r--:a<e.doc.length&&a++,{from:r,to:a}))),n=Il(e.selection,r=>{let a;if(t.lineWrapping){let o=t.lineBlockAt(r.head),c=t.coordsAtPos(r.head,r.assoc||1);c&&(a=o.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,a)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function f8(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=Ft(t).resolveInner(e),n=i.childBefore(e),r=i.childAfter(e),a;return n&&r&&n.to<=e&&r.from>=e&&(a=n.type.prop(Oe.closedBy))&&a.indexOf(r.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const US=SA(!1),d8=SA(!0);function SA(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:a,to:o}=r,c=e.doc.lineAt(a),h=!t&&a==o&&f8(e,a);t&&(a=o=(o<=c.to?c:e.doc.lineAt(o)).to);let d=new Yh(e,{simulateBreak:a,simulateDoubleBreak:!!h}),p=d0(d,a);for(p==null&&(p=Vl(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));o<c.to&&/\s/.test(c.text[o-c.from]);)o++;h?{from:a,to:o}=h:a>c.from&&a<c.from+100&&!/\S/.test(c.text.slice(0,a))&&(a=c.from);let g=["",To(e,p)];return h&&g.push(To(e,d.lineIndent(c.from,-1))),{changes:{from:a,to:o,insert:Ue.of(g)},range:W.cursor(a+1+g[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function y0(t,e){let i=-1;return t.changeByRange(n=>{let r=[];for(let o=n.from;o<=n.to;){let c=t.doc.lineAt(o);c.number>i&&(n.empty||n.to>c.from)&&(e(c,r,n),i=c.number),o=c.to+1}let a=t.changes(r);return{changes:r,range:W.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const p8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Yh(t,{overrideIndentation:a=>{let o=i[a];return o??-1}}),r=y0(t,(a,o,c)=>{let h=d0(n,a.from);if(h==null)return;/\S/.test(a.text)||(h=0);let d=/^\s*/.exec(a.text)[0],p=To(t,h);(d!=p||c.from<a.from+d.length)&&(i[a.from]=h,o.push({from:a.from,to:a.from+d.length,insert:p}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},wA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(y0(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Gh)})}),{userEvent:"input.indent"})),!0),kA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(y0(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let a=Vl(r,t.tabSize),o=0,c=To(t,Math.max(0,a-xh(t)));for(;o<r.length&&o<c.length&&r.charCodeAt(o)==c.charCodeAt(o);)o++;n.push({from:i.from+o,to:i.from+r.length,insert:c.slice(o)})}),{userEvent:"delete.dedent"})),!0),m8=t=>(t.setTabFocusMode(),!0),g8=[{key:"Ctrl-b",run:JC,shift:aA,preventDefault:!0},{key:"Ctrl-f",run:$C,shift:oA},{key:"Ctrl-p",run:iA,shift:hA},{key:"Ctrl-n",run:nA,shift:fA},{key:"Ctrl-a",run:BB,shift:YB},{key:"Ctrl-e",run:zB,shift:KB},{key:"Ctrl-d",run:gA},{key:"Ctrl-h",run:vg},{key:"Ctrl-k",run:i8},{key:"Ctrl-Alt-h",run:xA},{key:"Ctrl-o",run:s8},{key:"Ctrl-t",run:l8},{key:"Ctrl-v",run:bg}],y8=[{key:"ArrowLeft",run:JC,shift:aA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:MB,shift:UB,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:jB,shift:QB,preventDefault:!0},{key:"ArrowRight",run:$C,shift:oA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:TB,shift:qB,preventDefault:!0},{mac:"Cmd-ArrowRight",run:LB,shift:GB,preventDefault:!0},{key:"ArrowUp",run:iA,shift:hA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:BS,shift:_S},{mac:"Ctrl-ArrowUp",run:DS,shift:jS},{key:"ArrowDown",run:nA,shift:fA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:zS,shift:HS},{mac:"Ctrl-ArrowDown",run:bg,shift:LS},{key:"PageUp",run:DS,shift:jS},{key:"PageDown",run:bg,shift:LS},{key:"Home",run:DB,shift:IB,preventDefault:!0},{key:"Mod-Home",run:BS,shift:_S},{key:"End",run:RB,shift:VB,preventDefault:!0},{key:"Mod-End",run:zS,shift:HS},{key:"Enter",run:US,shift:US},{key:"Mod-a",run:WB},{key:"Backspace",run:vg,shift:vg,preventDefault:!0},{key:"Delete",run:gA,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:xA,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:t8,preventDefault:!0},{mac:"Mod-Backspace",run:n8,preventDefault:!0},{mac:"Mod-Delete",run:r8,preventDefault:!0}].concat(g8.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),x8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:EB,shift:PB},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:NB,shift:FB},{key:"Alt-ArrowUp",run:a8},{key:"Shift-Alt-ArrowUp",run:u8},{key:"Alt-ArrowDown",run:o8},{key:"Shift-Alt-ArrowDown",run:c8},{key:"Mod-Alt-ArrowUp",run:JB},{key:"Mod-Alt-ArrowDown",run:$B},{key:"Escape",run:e8},{key:"Mod-Enter",run:d8},{key:"Alt-l",mac:"Ctrl-l",run:XB},{key:"Mod-i",run:ZB,preventDefault:!0},{key:"Mod-[",run:kA},{key:"Mod-]",run:wA},{key:"Mod-Alt-\\",run:p8},{key:"Shift-Mod-k",run:h8},{key:"Shift-Mod-\\",run:HB},{key:"Mod-/",run:aB},{key:"Alt-A",run:uB},{key:"Ctrl-m",mac:"Shift-Alt-m",run:m8}].concat(y8),b8={key:"Tab",run:wA,shift:kA},qS=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class _l{constructor(e,i,n=0,r=e.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=a?c=>a(qS(c)):qS,this.query=this.normalize(i)}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 li(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 i=Ig(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=dn(e);let r=this.normalize(i);if(r.length)for(let a=0,o=n;;a++){let c=r.charCodeAt(a),h=this.match(c,o,this.bufferPos+this.bufferStart);if(a==r.length-1){if(h)return this.value=h,this;break}o==n&&a<i.length&&i.charCodeAt(a)==c&&o++}}}match(e,i,n){let r=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],c=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[a+1],to:n}:(this.matches[a]++,c=!0)),c||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:i,to:n}:this.matches.push(1,i)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(_l.prototype[Symbol.iterator]=function(){return this});const CA={from:-1,to:-1,match:/.*/.exec("")},x0="gm"+(/x/.unicode==null?"":"u");class AA{constructor(e,i,n,r=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=CA,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new MA(e,i,n,r,a);this.re=new RegExp(i,x0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=wh(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let n=this.curLineStart+i.index,r=n+i[0].length;if(this.matchPos=wh(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},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 im=new WeakMap;class Ml{constructor(e,i){this.from=e,this.text=i}get to(){return this.from+this.text.length}static get(e,i,n){let r=im.get(e);if(!r||r.from>=n||r.to<=i){let c=new Ml(i,e.sliceString(i,n));return im.set(e,c),c}if(r.from==i&&r.to==n)return r;let{text:a,from:o}=r;return o>i&&(a=e.sliceString(i,o)+a,o=i),r.to<n&&(a+=e.sliceString(r.to,n)),im.set(e,new Ml(o,a)),new Ml(i,a.slice(i-o,n-o))}}class MA{constructor(e,i,n,r,a){this.text=e,this.to=a,this.done=!1,this.value=CA,this.matchPos=wh(e,r),this.re=new RegExp(i,x0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=Ml.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let n=this.flat.from+i.index,r=n+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this.matchPos=wh(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ml.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(AA.prototype[Symbol.iterator]=MA.prototype[Symbol.iterator]=function(){return this});function v8(t){try{return new RegExp(t,x0),!0}catch{return!1}}function wh(t,e){if(e>=t.length)return e;let i=t.lineAt(e),n;for(;e<i.to&&(n=i.text.charCodeAt(e-i.from))>=56320&&n<57344;)e++;return e}const S8=t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:r}=UL(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return r.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){t.dispatch({effects:n});return}let c=e.doc.lineAt(e.selection.main.head),[,h,d,p,g]=o,x=p?+p.slice(1):0,v=d?+d:c.number;if(d&&g){let C=v/100;h&&(C=C*(h=="-"?-1:1)+c.number/e.doc.lines),v=Math.round(e.doc.lines*C)}else d&&h&&(v=v*(h=="-"?-1:1)+c.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,v))),k=W.cursor(w.from+Math.max(0,Math.min(x,w.length)));t.dispatch({effects:[n,ie.scrollIntoView(k.from,{y:"center"})],selection:k})}),!0},w8={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},k8=le.define({combine(t){return wn(t,w8,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function C8(t){return[E8,O8]}const A8=ge.mark({class:"cm-selectionMatch"}),M8=ge.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function PS(t,e,i,n){return(i==0||t(e.sliceDoc(i-1,i))!=nt.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=nt.Word)}function T8(t,e,i,n){return t(e.sliceDoc(i,i+1))==nt.Word&&t(e.sliceDoc(n-1,n))==nt.Word}const O8=ot.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(k8),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ge.none;let r=n.main,a,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ge.none;let h=i.wordAt(r.head);if(!h)return ge.none;o=i.charCategorizer(r.head),a=i.sliceDoc(h.from,h.to)}else{let h=r.to-r.from;if(h<e.minSelectionLength||h>200)return ge.none;if(e.wholeWords){if(a=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!(PS(o,i,r.from,r.to)&&T8(o,i,r.from,r.to)))return ge.none}else if(a=i.sliceDoc(r.from,r.to),!a)return ge.none}let c=[];for(let h of t.visibleRanges){let d=new _l(i.doc,a,h.from,h.to);for(;!d.next().done;){let{from:p,to:g}=d.value;if((!o||PS(o,i,p,g))&&(r.empty&&p<=r.from&&g>=r.to?c.push(M8.range(p,g)):(p>=r.to||g<=r.from)&&c.push(A8.range(p,g)),c.length>e.maxMatches))return ge.none}}return ge.set(c)}},{decorations:t=>t.decorations}),E8=ie.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),N8=({state:t,dispatch:e})=>{let{selection:i}=t,n=W.create(i.ranges.map(r=>t.wordAt(r.head)||W.cursor(r.head)),i.mainIndex);return n.eq(i)?!1:(e(t.update({selection:n})),!0)};function R8(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),a=r&&r.from==i.from&&r.to==i.to;for(let o=!1,c=new _l(t.doc,e,n[n.length-1].to);;)if(c.next(),c.done){if(o)return null;c=new _l(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(h=>h.from==c.value.from))continue;if(a){let h=t.wordAt(c.value.from);if(!h||h.from!=c.value.from||h.to!=c.value.to)continue}return c.value}}const D8=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(a=>a.from===a.to))return N8({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let r=R8(t,n);return r?(e(t.update({selection:t.selection.addRange(W.range(r.from,r.to),!1),effects:ie.scrollIntoView(r.to)})),!0):!1},Ql=le.define({combine(t){return wn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new G8(e),scrollToMatch:e=>ie.scrollIntoView(e)})}});class TA{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||v8(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,(i,n)=>n=="n"?`
53
+ `:n=="r"?"\r":n=="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 H8(this):new B8(this)}getCursor(e,i=0,n){let r=e.doc?e:Be.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?pl(this,r,i,n):dl(this,r,i,n)}}class OA{constructor(e){this.spec=e}}function j8(t,e,i){return(n,r,a,o)=>{if(i&&!i(n,r,a,o))return!1;let c=n>=o&&r<=o+a.length?a.slice(n-o,r-o):e.doc.sliceString(n,r);return t(c,e,n,r)}}function dl(t,e,i,n){let r;return t.wholeWord&&(r=L8(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(r=j8(t.test,e,r)),new _l(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:a=>a.toLowerCase(),r)}function L8(t,e){return(i,n,r,a)=>((a>i||a+r.length<n)&&(a=Math.max(0,i-2),r=t.sliceString(a,Math.min(t.length,n+2))),(e(kh(r,i-a))!=nt.Word||e(Ch(r,i-a))!=nt.Word)&&(e(Ch(r,n-a))!=nt.Word||e(kh(r,n-a))!=nt.Word))}class B8 extends OA{constructor(e){super(e)}nextMatch(e,i,n){let r=dl(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let a=Math.min(e.doc.length,i+this.spec.unquoted.length);r=dl(this.spec,e,0,a).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let a=Math.max(i,r-1e4-this.spec.unquoted.length),o=dl(this.spec,e,a,r),c=null;for(;!o.nextOverlapping().done;)c=o.value;if(c)return c;if(a==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=dl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let a=dl(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}function z8(t,e,i){return(n,r,a)=>(!i||i(n,r,a))&&t(a[0],e,n,r)}function pl(t,e,i,n){let r;return t.wholeWord&&(r=_8(e.charCategorizer(e.selection.main.head))),t.test&&(r=z8(t.test,e,r)),new AA(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:r},i,n)}function kh(t,e){return t.slice(Et(t,e,!1),e)}function Ch(t,e){return t.slice(e,Et(t,e))}function _8(t){return(e,i,n)=>!n[0].length||(t(kh(n.input,n.index))!=nt.Word||t(Ch(n.input,n.index))!=nt.Word)&&(t(Ch(n.input,n.index+n[0].length))!=nt.Word||t(kh(n.input,n.index+n[0].length))!=nt.Word)}class H8 extends OA{nextMatch(e,i,n){let r=pl(this.spec,e,n,e.doc.length).next();return r.done&&(r=pl(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let a=Math.max(i,n-r*1e4),o=pl(this.spec,e,a,n),c=null;for(;!o.next().done;)c=o.value;if(c&&(a==i||c.from>a+10))return c;if(a==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(i,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let a=+n.slice(0,r);if(a>0&&a<e.match.length)return e.match[a]+n.slice(r)}return i})}matchAll(e,i){let n=pl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let a=pl(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}const Oo=we.define(),b0=we.define(),Dr=It.define({create(t){return new nm(Sg(t).create(),null)},update(t,e){for(let i of e.effects)i.is(Oo)?t=new nm(i.value.create(),t.panel):i.is(b0)&&(t=new nm(t.query,i.value?v0:null));return t},provide:t=>Co.from(t,e=>e.panel)});class nm{constructor(e,i){this.query=e,this.panel=i}}const U8=ge.mark({class:"cm-searchMatch"}),q8=ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),P8=ot.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Dr))}update(t){let e=t.state.field(Dr);(e!=t.startState.field(Dr)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ge.none;let{view:i}=this,n=new Kn;for(let r=0,a=i.visibleRanges,o=a.length;r<o;r++){let{from:c,to:h}=a[r];for(;r<o-1&&h>a[r+1].from-500;)h=a[++r].to;t.highlight(i.state,c,h,(d,p)=>{let g=i.state.selection.ranges.some(x=>x.from==d&&x.to==p);n.add(d,p,g?q8:U8)})}return n.finish()}},{decorations:t=>t.decorations});function Vo(t){return e=>{let i=e.state.field(Dr,!1);return i&&i.query.spec.valid?t(e,i):RA(e)}}const Ah=Vo((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=W.single(n.from,n.to),a=t.state.facet(Ql);return t.dispatch({selection:r,effects:[S0(t,n),a.scrollToMatch(r.main,t)],userEvent:"select.search"}),NA(t),!0}),Mh=Vo((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let a=W.single(r.from,r.to),o=t.state.facet(Ql);return t.dispatch({selection:a,effects:[S0(t,r),o.scrollToMatch(a.main,t)],userEvent:"select.search"}),NA(t),!0}),F8=Vo((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:W.create(i.map(n=>W.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),V8=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,a=[],o=0;for(let c=new _l(t.doc,t.sliceDoc(n,r));!c.next().done;){if(a.length>1e3)return!1;c.value.from==n&&(o=a.length),a.push(W.range(c.value.from,c.value.to))}return e(t.update({selection:W.create(a,o),userEvent:"select.search.matches"})),!0},FS=Vo((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let a=e.nextMatch(i,n,n);if(!a)return!1;let o=a,c=[],h,d,p=[];o.from==n&&o.to==r&&(d=i.toText(e.getReplacement(o)),c.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(i,o.from,o.to),p.push(ie.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+".")));let g=t.state.changes(c);return o&&(h=W.single(o.from,o.to).map(g),p.push(S0(t,o)),p.push(i.facet(Ql).scrollToMatch(h.main,t))),t.dispatch({changes:g,selection:h,effects:p,userEvent:"input.replace"}),!0}),I8=Vo((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(r=>{let{from:a,to:o}=r;return{from:a,to:o,insert:e.getReplacement(r)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:ie.announce.of(n),userEvent:"input.replace.all"}),!0});function v0(t){return t.state.facet(Ql).createPanel(t)}function Sg(t,e){var i,n,r,a,o;let c=t.selection.main,h=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!h)return e;let d=t.facet(Ql);return new TA({search:((i=e?.literal)!==null&&i!==void 0?i:d.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:d.literal,regexp:(a=e?.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function EA(t){let e=o0(t,v0);return e&&e.dom.querySelector("[main-field]")}function NA(t){let e=EA(t);e&&e==t.root.activeElement&&e.select()}const RA=t=>{let e=t.state.field(Dr,!1);if(e&&e.panel){let i=EA(t);if(i&&i!=t.root.activeElement){let n=Sg(t.state,e.query.spec);n.valid&&t.dispatch({effects:Oo.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[b0.of(!0),e?Oo.of(Sg(t.state,e.query.spec)):we.appendConfig.of(K8)]});return!0},DA=t=>{let e=t.state.field(Dr,!1);if(!e||!e.panel)return!1;let i=o0(t,v0);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:b0.of(!1)}),!0},Q8=[{key:"Mod-f",run:RA,scope:"editor search-panel"},{key:"F3",run:Ah,shift:Mh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ah,shift:Mh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:DA,scope:"editor search-panel"},{key:"Mod-Shift-l",run:V8},{key:"Mod-Alt-g",run:S8},{key:"Mod-d",run:D8,preventDefault:!0}];class G8{constructor(e){this.view=e;let i=this.query=e.state.field(Dr).query.spec;this.commit=this.commit.bind(this),this.searchField=Ke("input",{value:i.search,placeholder:ki(e,"Find"),"aria-label":ki(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ke("input",{value:i.replace,placeholder:ki(e,"Replace"),"aria-label":ki(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ke("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=Ke("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=Ke("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function n(r,a,o){return Ke("button",{class:"cm-button",name:r,onclick:a,type:"button"},o)}this.dom=Ke("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>Ah(e),[ki(e,"next")]),n("prev",()=>Mh(e),[ki(e,"previous")]),n("select",()=>F8(e),[ki(e,"all")]),Ke("label",null,[this.caseField,ki(e,"match case")]),Ke("label",null,[this.reField,ki(e,"regexp")]),Ke("label",null,[this.wordField,ki(e,"by word")]),...e.state.readOnly?[]:[Ke("br"),this.replaceField,n("replace",()=>FS(e),[ki(e,"replace")]),n("replaceAll",()=>I8(e),[ki(e,"replace all")])],Ke("button",{name:"close",onclick:()=>DA(e),"aria-label":ki(e,"close"),type:"button"},["×"])])}commit(){let e=new TA({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:Oo.of(e)}))}keydown(e){Wj(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Mh:Ah)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),FS(this.view))}update(e){for(let i of e.transactions)for(let n of i.effects)n.is(Oo)&&!n.value.eq(this.query)&&this.setQuery(n.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(Ql).top}}function ki(t,e){return t.state.phrase(e)}const Ec=30,Nc=/[\s\.,:;?!]/;function S0(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,a=Math.max(n.from,e-Ec),o=Math.min(r,i+Ec),c=t.state.sliceDoc(a,o);if(a!=n.from){for(let h=0;h<Ec;h++)if(!Nc.test(c[h+1])&&Nc.test(c[h])){c=c.slice(h);break}}if(o!=r){for(let h=c.length-1;h>c.length-Ec;h--)if(!Nc.test(c[h-1])&&Nc.test(c[h])){c=c.slice(0,h);break}}return ie.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${n.number}.`)}const Y8=ie.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"}}),K8=[Dr,Ms.low(P8),Y8];class jA{constructor(e,i,n,r){this.state=e,this.pos=i,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let i=Ft(this.state).resolveInner(this.pos,-1);for(;i&&e.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}matchBefore(e){let i=this.state.doc.lineAt(this.pos),n=Math.max(i.from,this.pos-250),r=i.text.slice(n-i.from,this.pos-i.from),a=r.search(LA(e,!1));return a<0?null:{from:n+a,to:this.pos,text:r.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,i,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(i),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function VS(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function W8(t){let e=Object.create(null),i=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let a=1;a<r.length;a++)i[r[a]]=!0}let n=VS(e)+VS(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function X8(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[i,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:W8(e);return r=>{let a=r.matchBefore(n);return a||r.explicit?{from:a?a.from:r.pos,options:e,validFor:i}:null}}class IS{constructor(e,i,n,r){this.completion=e,this.source=i,this.match=n,this.score=r}}function xs(t){return t.selection.main.from}function LA(t,e){var i;let{source:n}=t,r=e&&n[0]!="^",a=n[n.length-1]!="$";return!r&&!a?t:new RegExp(`${r?"^":""}(?:${n})${a?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}const BA=Sn.define();function Z8(t,e,i,n){let{main:r}=t.selection,a=i-r.from,o=n-r.from;return{...t.changeByRange(c=>{if(c!=r&&i!=n&&t.sliceDoc(c.from+a,c.from+o)!=t.sliceDoc(i,n))return{range:c};let h=t.toText(e);return{changes:{from:c.from+a,to:n==r.from?c.to:c.from+o,insert:h},range:W.cursor(c.from+a+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const QS=new WeakMap;function J8(t){if(!Array.isArray(t))return t;let e=QS.get(t);return e||QS.set(t,e=X8(t)),e}const Th=we.define(),Eo=we.define();class $8{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let i=0;i<e.length;){let n=li(e,i),r=dn(n);this.chars.push(n);let a=e.slice(i,i+r),o=a.toUpperCase();this.folded.push(li(o==a?a.toLowerCase():o,0)),i+=r}this.astral=e.length!=this.chars.length}ret(e,i){return this.score=e,this.matched=i,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:i,folded:n,any:r,precise:a,byWord:o}=this;if(i.length==1){let T=li(e,0),j=dn(T),L=j==e.length?0:-100;if(T!=i[0])if(T==n[0])L+=-200;else return null;return this.ret(L,[0,j])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let h=i.length,d=0;if(c<0){for(let T=0,j=Math.min(e.length,200);T<j&&d<h;){let L=li(e,T);(L==i[d]||L==n[d])&&(r[d++]=T),T+=dn(L)}if(d<h)return null}let p=0,g=0,x=!1,v=0,w=-1,k=-1,C=/[a-z]/.test(e),M=!0;for(let T=0,j=Math.min(e.length,200),L=0;T<j&&g<h;){let D=li(e,T);c<0&&(p<h&&D==i[p]&&(a[p++]=T),v<h&&(D==i[v]||D==n[v]?(v==0&&(w=T),k=T+1,v++):v=0));let U,H=D<255?D>=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(U=Ig(D))!=U.toLowerCase()?1:U!=U.toUpperCase()?2:0;(!T||H==1&&C||L==0&&H!=0)&&(i[g]==D||n[g]==D&&(x=!0)?o[g++]=T:o.length&&(M=!1)),L=H,T+=dn(D)}return g==h&&o[0]==0&&M?this.result(-100+(x?-200:0),o,e):v==h&&w==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==h?this.ret(-900-e.length,[w,k]):g==h?this.result(-100+(x?-200:0)+-700+(M?0:-1100),o,e):i.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,i,n){let r=[],a=0;for(let o of i){let c=o+(this.astral?dn(li(n,o)):1);a&&r[a-1]==o?r[a-1]=c:(r[a++]=o,r[a++]=c)}return this.ret(e-n.length,r)}}class ez{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 i=e.slice(0,this.pattern.length),n=i==this.pattern?0:i.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,i.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Ot=le.define({combine(t){return wn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tz,filterStrict:!1,compareCompletions:(e,i)=>(e.sortText||e.label).localeCompare(i.sortText||i.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,i)=>e&&i,closeOnBlur:(e,i)=>e&&i,icons:(e,i)=>e&&i,tooltipClass:(e,i)=>n=>GS(e(n),i(n)),optionClass:(e,i)=>n=>GS(e(n),i(n)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function GS(t,e){return t?e?t+" "+e:t:e}function tz(t,e,i,n,r,a){let o=t.textDirection==Ze.RTL,c=o,h=!1,d="top",p,g,x=e.left-r.left,v=r.right-e.right,w=n.right-n.left,k=n.bottom-n.top;if(c&&x<Math.min(w,v)?c=!1:!c&&v<Math.min(w,x)&&(c=!0),w<=(c?x:v))p=Math.max(r.top,Math.min(i.top,r.bottom-k))-e.top,g=Math.min(400,c?x:v);else{h=!0,g=Math.min(400,(o?e.right:r.right-e.left)-30);let T=r.bottom-e.bottom;T>=k||T>e.top?p=i.bottom-e.top:(d="bottom",p=e.bottom-i.top)}let C=(e.bottom-e.top)/a.offsetHeight,M=(e.right-e.left)/a.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${g/M}px`,class:"cm-completionInfo-"+(h?o?"left-narrow":"right-narrow":c?"left":"right")}}function iz(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(i){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),i.type&&n.classList.add(...i.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(i,n,r,a){let o=document.createElement("span");o.className="cm-completionLabel";let c=i.displayLabel||i.label,h=0;for(let d=0;d<a.length;){let p=a[d++],g=a[d++];p>h&&o.appendChild(document.createTextNode(c.slice(h,p)));let x=o.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(p,g))),x.className="cm-completionMatchedText",h=g}return h<c.length&&o.appendChild(document.createTextNode(c.slice(h))),o},position:50},{render(i){if(!i.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=i.detail,n},position:80}),e.sort((i,n)=>i.position-n.position).map(i=>i.render)}function rm(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/i);return{from:r*i,to:(r+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class nz{constructor(e,i,n){this.view=e,this.stateField=i,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let r=e.state.field(i),{options:a,selected:o}=r.open,c=e.state.facet(Ot);this.optionContent=iz(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=rm(a.length,o,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{let{options:d}=e.state.field(i).open;for(let p=h.target,g;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(g=/-(\d+)$/.exec(p.id))&&+g[1]<d.length){this.applyCompletion(e,d[+g[1]]),h.preventDefault();return}}),this.dom.addEventListener("focusout",h=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Ot).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:Eo.of(null)})}),this.showOptions(a,r.id)}mount(){this.updateSel()}showOptions(e,i){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,i,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var i;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:a,selected:o,disabled:c}=n.open;(!r.open||r.open.options!=a)&&(this.range=rm(a.length,o,e.state.facet(Ot).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),c!=((i=r.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let i=this.tooltipClass(e);if(i!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of i.split(" "))n&&this.dom.classList.add(n);this.currentClass=i}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),i=e.open;(i.selected>-1&&i.selected<this.range.from||i.selected>=this.range.to)&&(this.range=rm(i.options.length,i.selected,this.view.state.facet(Ot).maxRenderedOptions),this.showOptions(i.options,e.id));let n=this.updateSelectedOption(i.selected);if(n){this.destroyInfo();let{completion:r}=i.options[i.selected],{info:a}=r;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(r);if(!o)return;"then"in o?o.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,r)}).catch(c=>ci(this.view.state,c,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,i){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:a}=e;n.appendChild(r),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let i=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),i=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return i&&sz(this.list,i),i}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let i=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=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 r.top>Math.min(a.bottom,i.bottom)-10||r.bottom<Math.max(a.top,i.top)+10?null:this.view.state.facet(Ot).positionInfo(this.view,i,r,n,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,i,n){const r=document.createElement("ul");r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let a=null;for(let o=n.from;o<n.to;o++){let{completion:c,match:h}=e[o],{section:d}=c;if(d){let x=typeof d=="string"?d:d.name;if(x!=a&&(o>n.from||n.from==0))if(a=x,typeof d!="string"&&d.header)r.appendChild(d.header(d));else{let v=r.appendChild(document.createElement("completion-section"));v.textContent=x}}const p=r.appendChild(document.createElement("li"));p.id=i+"-"+o,p.setAttribute("role","option");let g=this.optionClass(c);g&&(p.className=g);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,h);v&&p.appendChild(v)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function rz(t,e){return i=>new nz(i,t,e)}function sz(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=i.height/t.offsetHeight;n.top<i.top?t.scrollTop-=(i.top-n.top)/r:n.bottom>i.bottom&&(t.scrollTop+=(n.bottom-i.bottom)/r)}function YS(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function lz(t,e){let i=[],n=null,r=null,a=p=>{i.push(p);let{section:g}=p.completion;if(g){n||(n=[]);let x=typeof g=="string"?g:g.name;n.some(v=>v.name==x)||n.push(typeof g=="string"?{name:x}:g)}},o=e.facet(Ot);for(let p of t)if(p.hasResult()){let g=p.result.getMatch;if(p.result.filter===!1)for(let x of p.result.options)a(new IS(x,p.source,g?g(x):[],1e9-i.length));else{let x=e.sliceDoc(p.from,p.to),v,w=o.filterStrict?new ez(x):new $8(x);for(let k of p.result.options)if(v=w.match(k.label)){let C=k.displayLabel?g?g(k,v.matched):[]:v.matched,M=v.score+(k.boost||0);if(a(new IS(k,p.source,C,M)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;r||(r=Object.create(null)),r[T]=Math.max(M,r[T]||-1e9)}}}}if(n){let p=Object.create(null),g=0,x=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?r[w.name]-r[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 n.sort(x))g-=1e5,p[v.name]=g;for(let v of i){let{section:w}=v.completion;w&&(v.score+=p[typeof w=="string"?w:w.name])}}let c=[],h=null,d=o.compareCompletions;for(let p of i.sort((g,x)=>x.score-g.score||d(g.completion,x.completion))){let g=p.completion;!h||h.label!=g.label||h.detail!=g.detail||h.type!=null&&g.type!=null&&h.type!=g.type||h.apply!=g.apply||h.boost!=g.boost?c.push(p):YS(p.completion)>YS(h)&&(c[c.length-1]=p),h=p.completion}return c}class vl{constructor(e,i,n,r,a,o){this.options=e,this.attrs=i,this.tooltip=n,this.timestamp=r,this.selected=a,this.disabled=o}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new vl(this.options,KS(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,n,r,a,o){if(r&&!o&&e.some(d=>d.isPending))return r.setDisabled();let c=lz(e,i);if(!c.length)return r&&e.some(d=>d.isPending)?r.setDisabled():null;let h=i.facet(Ot).selectOnOpen?0:-1;if(r&&r.selected!=h&&r.selected!=-1){let d=r.options[r.selected].completion;for(let p=0;p<c.length;p++)if(c[p].completion==d){h=p;break}}return new vl(c,KS(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:fz,above:a.aboveCursor},r?r.timestamp:Date.now(),h,!1)}map(e){return new vl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new vl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Oh{constructor(e,i,n){this.active=e,this.id=i,this.open=n}static start(){return new Oh(cz,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,n=i.facet(Ot),a=(n.override||i.languageDataAt("autocomplete",xs(i)).map(J8)).map(h=>(this.active.find(p=>p.source==h)||new Fi(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));a.length==this.active.length&&a.every((h,d)=>h==this.active[d])&&(a=this.active);let o=this.open,c=e.effects.some(h=>h.is(w0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||a.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!az(a,this.active)||c?o=vl.build(a,i,this.id,o,n,c):o&&o.disabled&&!a.some(h=>h.isPending)&&(o=null),!o&&a.every(h=>!h.isPending)&&a.some(h=>h.hasResult())&&(a=a.map(h=>h.hasResult()?new Fi(h.source,0):h));for(let h of e.effects)h.is(_A)&&(o=o&&o.setSelected(h.value,this.id));return a==this.active&&o==this.open?this:new Oh(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?oz:uz}}function az(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i<t.length&&!t[i].hasResult();)i++;for(;n<e.length&&!e[n].hasResult();)n++;let r=i==t.length,a=n==e.length;if(r||a)return r==a;if(t[i++].result!=e[n++].result)return!1}}const oz={"aria-autocomplete":"list"},uz={};function KS(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const cz=[];function zA(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(BA);if(n&&e.activateOnCompletion(n))return 12}let i=t.isUserEvent("input.type");return i&&e.activateOnTyping?5:i?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Fi{constructor(e,i,n=!1){this.source=e,this.state=i,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,i){let n=zA(e,i),r=this;(n&8||n&16&&this.touches(e))&&(r=new Fi(r.source,0)),n&4&&r.state==0&&(r=new Fi(this.source,1)),r=r.updateFor(e,n);for(let a of e.effects)if(a.is(Th))r=new Fi(r.source,1,a.value);else if(a.is(Eo))r=new Fi(r.source,0);else if(a.is(w0))for(let o of a.value)o.source==r.source&&(r=o);return r}updateFor(e,i){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(xs(e.state))}}class Tl extends Fi{constructor(e,i,n,r,a,o){super(e,3,i),this.limit=n,this.result=r,this.from=a,this.to=o}hasResult(){return!0}updateFor(e,i){var n;if(!(i&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let a=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),c=xs(e.state);if(c>o||!r||i&2&&(xs(e.startState)==this.from||c<this.limit))return new Fi(this.source,i&4?1:0);let h=e.changes.mapPos(this.limit);return hz(r.validFor,e.state,a,o)?new Tl(this.source,this.explicit,h,r,a,o):r.update&&(r=r.update(r,a,o,new jA(e.state,c,!1)))?new Tl(this.source,this.explicit,h,r,r.from,(n=r.to)!==null&&n!==void 0?n:xs(e.state)):new Fi(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Tl(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Fi(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function hz(t,e,i,n){if(!t)return!1;let r=e.sliceDoc(i,n);return typeof t=="function"?t(r,i,n,e):LA(t,!0).test(r)}const w0=we.define({map(t,e){return t.map(i=>i.map(e))}}),_A=we.define(),ai=It.define({create(){return Oh.start()},update(t,e){return t.update(e)},provide:t=>[a0.from(t,e=>e.tooltip),ie.contentAttributes.from(t,e=>e.attrs)]});function k0(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(ai).active.find(r=>r.source==e.source);return n instanceof Tl?(typeof i=="string"?t.dispatch({...Z8(t.state,i,n.from,n.to),annotations:BA.of(e.completion)}):i(t,e.completion,n.from,n.to),!0):!1}const fz=rz(ai,k0);function Rc(t,e="option"){return i=>{let n=i.state.field(ai,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(Ot).interactionDelay)return!1;let r=1,a;e=="page"&&(a=mC(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,c=n.open.selected>-1?n.open.selected+r*(t?1:-1):t?0:o-1;return c<0?c=e=="page"?0:o-1:c>=o&&(c=e=="page"?o-1:0),i.dispatch({effects:_A.of(c)}),!0}}const dz=t=>{let e=t.state.field(ai,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ot).interactionDelay?!1:k0(t,e.open.options[e.open.selected])},sm=t=>t.state.field(ai,!1)?(t.dispatch({effects:Th.of(!0)}),!0):!1,pz=t=>{let e=t.state.field(ai,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:Eo.of(null)}),!0)};class mz{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}}const gz=50,yz=1e3,xz=ot.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ai).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ai),i=t.state.facet(Ot);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ai)==e)return;let n=t.transactions.some(a=>{let o=zA(a,i);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(n||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>gz&&Date.now()-o.time>yz){for(let c of o.context.abortListeners)try{c()}catch(h){ci(this.view.state,h)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(a=>a.effects.some(o=>o.is(Th)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let a of t.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:t}=this.view,e=t.field(ai);for(let i of e.active)i.isPending&&!this.running.some(n=>n.active.source==i.source)&&this.startQuery(i);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ot).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=xs(e),n=new jA(e,i,t.explicit,this.view),r=new mz(t,n);this.running.push(r),Promise.resolve(t.source(n)).then(a=>{r.context.aborted||(r.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:Eo.of(null)}),ci(this.view.state,a)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ot).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(Ot),n=this.view.state.field(ai);for(let r=0;r<this.running.length;r++){let a=this.running[r];if(a.done===void 0)continue;if(this.running.splice(r--,1),a.done){let c=xs(a.updates.length?a.updates[0].startState:this.view.state),h=Math.min(c,a.done.from+(a.active.explicit?0:1)),d=new Tl(a.active.source,a.active.explicit,h,a.done,a.done.from,(t=a.done.to)!==null&&t!==void 0?t:c);for(let p of a.updates)d=d.update(p,i);if(d.hasResult()){e.push(d);continue}}let o=n.active.find(c=>c.source==a.active.source);if(o&&o.isPending)if(a.done==null){let c=new Fi(a.active.source,0);for(let h of a.updates)c=c.update(h,i);c.isPending||e.push(c)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:w0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ai,!1);if(e&&e.tooltip&&this.view.state.facet(Ot).closeOnBlur){let i=e.open&&mC(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Eo.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Th.of(!1)}),20),this.composing=0}}}),bz=typeof navigator=="object"&&/Win/.test(navigator.platform),vz=Ms.highest(ie.domEventHandlers({keydown(t,e){let i=e.state.field(ai,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(bz&&t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],r=i.active.find(o=>o.source==n.source),a=n.completion.commitCharacters||r.result.commitCharacters;return a&&a.indexOf(t.key)>-1&&k0(e,n),!1}})),Sz=ie.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"},".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"}}}),No={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ms=we.define({map(t,e){let i=e.mapPos(t,-1,Zt.TrackAfter);return i??void 0}}),C0=new class extends Br{};C0.startSide=1;C0.endSide=-1;const HA=It.define({create(){return Re.empty},update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=i.from&&n<=i.to})}for(let i of e.effects)i.is(ms)&&(t=t.update({add:[C0.range(i.value,i.value+1)]}));return t}});function wz(){return[Cz,HA]}const lm="()[]{}<>«»»«[]{}";function UA(t){for(let e=0;e<lm.length;e+=2)if(lm.charCodeAt(e)==t)return lm.charAt(e+1);return Ig(t<128?t:t+1)}function qA(t,e){return t.languageDataAt("closeBrackets",e)[0]||No}const kz=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Cz=ie.inputHandler.of((t,e,i,n)=>{if((kz?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(n.length>2||n.length==2&&dn(li(n,0))==1||e!=r.from||i!=r.to)return!1;let a=Tz(t.state,n);return a?(t.dispatch(a),!0):!1}),Az=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=qA(t,t.selection.main.head).brackets||No.brackets,r=null,a=t.changeByRange(o=>{if(o.empty){let c=Oz(t.doc,o.head);for(let h of n)if(h==c&&$h(t.doc,o.head)==UA(li(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:W.cursor(o.head-h.length)}}return{range:r=o}});return r||e(t.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},Mz=[{key:"Backspace",run:Az}];function Tz(t,e){let i=qA(t,t.selection.main.head),n=i.brackets||No.brackets;for(let r of n){let a=UA(li(r,0));if(e==r)return a==r?Rz(t,r,n.indexOf(r+r+r)>-1,i):Ez(t,r,a,i.before||No.before);if(e==a&&PA(t,t.selection.main.from))return Nz(t,r,a)}return null}function PA(t,e){let i=!1;return t.field(HA).between(0,t.doc.length,n=>{n==e&&(i=!0)}),i}function $h(t,e){let i=t.sliceString(e,e+2);return i.slice(0,dn(li(i,0)))}function Oz(t,e){let i=t.sliceString(e-2,e);return dn(li(i,0))==i.length?i:i.slice(1)}function Ez(t,e,i,n){let r=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:i,from:o.to}],effects:ms.of(o.to+e.length),range:W.range(o.anchor+e.length,o.head+e.length)};let c=$h(t.doc,o.head);return!c||/\s/.test(c)||n.indexOf(c)>-1?{changes:{insert:e+i,from:o.head},effects:ms.of(o.head+e.length),range:W.cursor(o.head+e.length)}:{range:r=o}});return r?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Nz(t,e,i){let n=null,r=t.changeByRange(a=>a.empty&&$h(t.doc,a.head)==i?{changes:{from:a.head,to:a.head+i.length,insert:i},range:W.cursor(a.head+i.length)}:n={range:a});return n?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Rz(t,e,i,n){let r=n.stringPrefixes||No.stringPrefixes,a=null,o=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:ms.of(c.to+e.length),range:W.range(c.anchor+e.length,c.head+e.length)};let h=c.head,d=$h(t.doc,h),p;if(d==e){if(WS(t,h))return{changes:{insert:e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)};if(PA(t,h)){let x=i&&t.sliceDoc(h,h+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:h,to:h+x.length,insert:x},range:W.cursor(h+x.length)}}}else{if(i&&t.sliceDoc(h-2*e.length,h)==e+e&&(p=XS(t,h-2*e.length,r))>-1&&WS(t,p))return{changes:{insert:e+e+e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)};if(t.charCategorizer(h)(d)!=nt.Word&&XS(t,h,r)>-1&&!Dz(t,h,e,r))return{changes:{insert:e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)}}return{range:a=c}});return a?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function WS(t,e){let i=Ft(t).resolveInner(e+1);return i.parent&&i.from==e}function Dz(t,e,i,n){let r=Ft(t).resolveInner(e,-1),a=n.reduce((o,c)=>Math.max(o,c.length),0);for(let o=0;o<5;o++){let c=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+a)),h=c.indexOf(i);if(!h||h>-1&&n.indexOf(c.slice(0,h))>-1){let p=r.firstChild;for(;p&&p.from==r.from&&p.to-p.from>i.length+h;){if(t.sliceDoc(p.to-i.length,p.to)==i)return!1;p=p.firstChild}return!0}let d=r.to==e&&r.parent;if(!d)break;r=d}return!1}function XS(t,e,i){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=nt.Word)return e;for(let r of i){let a=e-r.length;if(t.sliceDoc(a,e)==r&&n(t.sliceDoc(a-1,a))!=nt.Word)return a}return-1}function jz(t={}){return[vz,ai,Ot.of(t),xz,Lz,Sz]}const FA=[{key:"Ctrl-Space",run:sm},{mac:"Alt-`",run:sm},{mac:"Alt-i",run:sm},{key:"Escape",run:pz},{key:"ArrowDown",run:Rc(!0)},{key:"ArrowUp",run:Rc(!1)},{key:"PageDown",run:Rc(!0,"page")},{key:"PageUp",run:Rc(!1,"page")},{key:"Enter",run:dz}],Lz=Ms.highest(Ih.computeN([Ot],t=>t.facet(Ot).defaultKeymap?[FA]:[]));class ZS{constructor(e,i,n){this.from=e,this.to=i,this.diagnostic=n}}class hs{constructor(e,i,n){this.diagnostics=e,this.panel=i,this.selected=n}static init(e,i,n){let r=n.facet(Ro).markerFilter;r&&(e=r(e,n));let a=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),o=new Kn,c=[],h=0,d=n.doc.iter(),p=0,g=n.doc.length;for(let v=0;;){let w=v==a.length?null:a[v];if(!w&&!c.length)break;let k,C;if(c.length)k=h,C=c.reduce((j,L)=>Math.min(j,L.to),w&&w.from>k?w.from:1e8);else{if(k=w.from,k>g)break;C=w.to,c.push(w),v++}for(;v<a.length;){let j=a[v];if(j.from==k&&(j.to>j.from||j.to==k))c.push(j),v++,C=Math.min(j.to,C);else{C=Math.min(j.from,C);break}}C=Math.min(C,g);let M=!1;if(c.some(j=>j.from==k&&(j.to==C||C==g))&&(M=k==C,!M&&C-k<10)){let j=k-(p+d.value.length);j>0&&(d.next(j),p=k);for(let L=k;;){if(L>=C){M=!0;break}if(!d.lineBreak&&p+d.value.length>L)break;L=p+d.value.length,p+=d.value.length,d.next()}}let T=Yz(c);if(M)o.add(k,k,ge.widget({widget:new Vz(T),diagnostics:c.slice()}));else{let j=c.reduce((L,D)=>D.markClass?L+" "+D.markClass:L,"");o.add(k,C,ge.mark({class:"cm-lintRange cm-lintRange-"+T+j,diagnostics:c.slice(),inclusiveEnd:c.some(L=>L.to>C)}))}if(h=C,h==g)break;for(let j=0;j<c.length;j++)c[j].to<=h&&c.splice(j--,1)}let x=o.finish();return new hs(x,i,Pr(x))}}function Pr(t,e=null,i=0){let n=null;return t.between(i,1e9,(r,a,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!n)n=new ZS(r,a,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new ZS(n.from,a,n.diagnostic)}}),n}function Bz(t,e){let i=e.pos,n=e.end||i,r=t.state.facet(Ro).hideOn(t,i,n);if(r!=null)return r;let a=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(VA))||t.changes.touchesRange(a.from,Math.max(a.to,n)))}function zz(t,e){return t.field(Mi,!1)?e:e.concat(we.appendConfig.of(Kz))}const VA=we.define(),A0=we.define(),IA=we.define(),Mi=It.define({create(){return new hs(ge.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,r=t.panel;if(t.selected){let a=e.changes.mapPos(t.selected.from,1);n=Pr(i,t.selected.diagnostic,a)||Pr(i,null,a)}!i.size&&r&&e.state.facet(Ro).autoPanel&&(r=null),t=new hs(i,r,n)}for(let i of e.effects)if(i.is(VA)){let n=e.state.facet(Ro).autoPanel?i.value.length?Do.open:null:t.panel;t=hs.init(i.value,n,e.state)}else i.is(A0)?t=new hs(t.diagnostics,i.value?Do.open:null,t.selected):i.is(IA)&&(t=new hs(t.diagnostics,t.panel,i.value));return t},provide:t=>[Co.from(t,e=>e.panel),ie.decorations.from(t,e=>e.diagnostics)]}),_z=ge.mark({class:"cm-lintRange cm-lintRange-active"});function Hz(t,e,i){let{diagnostics:n}=t.state.field(Mi),r,a=-1,o=-1;n.between(e-(i<0?1:0),e+(i>0?1:0),(h,d,{spec:p})=>{if(e>=h&&e<=d&&(h==d||(e>h||i>0)&&(e<d||i<0)))return r=p.diagnostics,a=h,o=d,!1});let c=t.state.facet(Ro).tooltipFilter;return r&&c&&(r=c(r,t.state)),r?{pos:a,end:o,above:t.state.doc.lineAt(a).to<o,create(){return{dom:Uz(t,r)}}}:null}function Uz(t,e){return Ke("ul",{class:"cm-tooltip-lint"},e.map(i=>GA(t,i,!1)))}const qz=t=>{let e=t.state.field(Mi,!1);(!e||!e.panel)&&t.dispatch({effects:zz(t.state,[A0.of(!0)])});let i=o0(t,Do.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},JS=t=>{let e=t.state.field(Mi,!1);return!e||!e.panel?!1:(t.dispatch({effects:A0.of(!1)}),!0)},Pz=t=>{let e=t.state.field(Mi,!1);if(!e)return!1;let i=t.state.selection.main,n=Pr(e.diagnostics,null,i.to+1);return!n&&(n=Pr(e.diagnostics,null,0),!n||n.from==i.from&&n.to==i.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},Fz=[{key:"Mod-Shift-m",run:qz,preventDefault:!0},{key:"F8",run:Pz}],Ro=le.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...wn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:$S,tooltipFilter:$S,needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i,hideOn:(e,i)=>e?i?(n,r,a)=>e(n,r,a)||i(n,r,a):e:i,autoPanel:(e,i)=>e||i})}}});function $S(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function QA(t){let e=[];if(t)e:for(let{name:i}of t){for(let n=0;n<i.length;n++){let r=i[n];if(/[a-zA-Z]/.test(r)&&!e.some(a=>a.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function GA(t,e,i){var n;let r=i?QA(e.actions):[];return Ke("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ke("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((a,o)=>{let c=!1,h=v=>{if(v.preventDefault(),c)return;c=!0;let w=Pr(t.state.field(Mi).diagnostics,e);w&&a.apply(t,w.from,w.to)},{name:d}=a,p=r[o]?d.indexOf(r[o]):-1,g=p<0?d:[d.slice(0,p),Ke("u",d.slice(p,p+1)),d.slice(p+1)],x=a.markClass?" "+a.markClass:"";return Ke("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:h,onmousedown:h,"aria-label":` Action: ${d}${p<0?"":` (access key "${r[o]})"`}.`},g)}),e.source&&Ke("div",{class:"cm-diagnosticSource"},e.source))}class Vz extends kn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ke("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class e2{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=GA(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Do{constructor(e){this.view=e,this.items=[];let i=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)JS(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=QA(a.actions);for(let c=0;c<o.length;c++)if(o[c].toUpperCase().charCodeAt(0)==r.keyCode){let h=Pr(this.view.state.field(Mi).diagnostics,a);h&&a.actions[c].apply(e,h.from,h.to)}}else return;r.preventDefault()}},n=r=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(r.target)&&this.moveSelection(a)};this.list=Ke("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:n}),this.dom=Ke("div",{class:"cm-panel-lint"},this.list,Ke("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>JS(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Mi).selected;if(!e)return-1;for(let i=0;i<this.items.length;i++)if(this.items[i].diagnostic==e.diagnostic)return i;return-1}update(){let{diagnostics:e,selected:i}=this.view.state.field(Mi),n=0,r=!1,a=null,o=new Set;for(e.between(0,this.view.state.doc.length,(c,h,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let g=-1,x;for(let v=n;v<this.items.length;v++)if(this.items[v].diagnostic==p){g=v;break}g<0?(x=new e2(this.view,p),this.items.splice(n,0,x),r=!0):(x=this.items[g],g>n&&(this.items.splice(n,g-n),r=!0)),i&&x.diagnostic==i.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),a=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new e2(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!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:c,panel:h})=>{let d=h.height/this.list.offsetHeight;c.top<h.top?this.list.scrollTop-=(h.top-c.top)/d:c.bottom>h.bottom&&(this.list.scrollTop+=(c.bottom-h.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function i(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)i();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(Mi),n=Pr(i.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:IA.of(n)})}static open(e){return new Do(e)}}function Iz(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Dc(t){return Iz(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Qz=ie.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:Dc("#d11")},".cm-lintRange-warning":{backgroundImage:Dc("orange")},".cm-lintRange-info":{backgroundImage:Dc("#999")},".cm-lintRange-hint":{backgroundImage:Dc("#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}}});function Gz(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Yz(t){let e="hint",i=1;for(let n of t){let r=Gz(n.severity);r>i&&(i=r,e=n.severity)}return e}const Kz=[Mi,ie.decorations.compute([Mi],t=>{let{selected:e,panel:i}=t.field(Mi);return!e||!i||e.from==e.to?ge.none:ge.set([_z.range(e.from,e.to)])}),_L(Hz,{hideOn:Bz}),Qz];var t2=function(e){e===void 0&&(e={});var{crosshairCursor:i=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(Mz)),e.defaultKeymap!==!1&&(n=n.concat(x8)),e.searchKeymap!==!1&&(n=n.concat(Q8)),e.historyKeymap!==!1&&(n=n.concat(AB)),e.foldKeymap!==!1&&(n=n.concat(U6)),e.completionKeymap!==!1&&(n=n.concat(FA)),e.lintKeymap!==!1&&(n=n.concat(Fz));var r=[];return e.lineNumbers!==!1&&r.push(XL()),e.highlightActiveLineGutter!==!1&&r.push($L()),e.highlightSpecialChars!==!1&&r.push(fL()),e.history!==!1&&r.push(gB()),e.foldGutter!==!1&&r.push(V6()),e.drawSelection!==!1&&r.push(tL()),e.dropCursor!==!1&&r.push(lL()),e.allowMultipleSelections!==!1&&r.push(Be.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(E6()),e.syntaxHighlighting!==!1&&r.push(PC(Y6,{fallback:!0})),e.bracketMatching!==!1&&r.push(eB()),e.closeBrackets!==!1&&r.push(wz()),e.autocompletion!==!1&&r.push(jz()),e.rectangularSelection!==!1&&r.push(ML()),i!==!1&&r.push(EL()),e.highlightActiveLine!==!1&&r.push(xL()),e.highlightSelectionMatches!==!1&&r.push(C8()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Gh.of(" ".repeat(e.tabSize))),r.concat([Ih.of(n.flat())]).filter(Boolean)};const Wz="#e5c07b",i2="#e06c75",Xz="#56b6c2",Zz="#ffffff",Ic="#abb2bf",wg="#7d8799",Jz="#61afef",$z="#98c379",n2="#d19a66",e9="#c678dd",t9="#21252b",r2="#2c313a",s2="#282c34",am="#353a42",i9="#3E4451",l2="#528bff",n9=ie.theme({"&":{color:Ic,backgroundColor:s2},".cm-content":{caretColor:l2},".cm-cursor, .cm-dropCursor":{borderLeftColor:l2},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:i9},".cm-panels":{backgroundColor:t9,color:Ic},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:s2,color:wg,border:"none"},".cm-activeLineGutter":{backgroundColor:r2},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:am},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:am,borderBottomColor:am},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:r2,color:Ic}}},{dark:!0}),r9=Po.define([{tag:I.keyword,color:e9},{tag:[I.name,I.deleted,I.character,I.propertyName,I.macroName],color:i2},{tag:[I.function(I.variableName),I.labelName],color:Jz},{tag:[I.color,I.constant(I.name),I.standard(I.name)],color:n2},{tag:[I.definition(I.name),I.separator],color:Ic},{tag:[I.typeName,I.className,I.number,I.changed,I.annotation,I.modifier,I.self,I.namespace],color:Wz},{tag:[I.operator,I.operatorKeyword,I.url,I.escape,I.regexp,I.link,I.special(I.string)],color:Xz},{tag:[I.meta,I.comment],color:wg},{tag:I.strong,fontWeight:"bold"},{tag:I.emphasis,fontStyle:"italic"},{tag:I.strikethrough,textDecoration:"line-through"},{tag:I.link,color:wg,textDecoration:"underline"},{tag:I.heading,fontWeight:"bold",color:i2},{tag:[I.atom,I.bool,I.special(I.variableName)],color:n2},{tag:[I.processingInstruction,I.string,I.inserted],color:$z},{tag:I.invalid,color:Zz}]),s9=[n9,PC(r9)];var l9=ie.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),a9=function(e){e===void 0&&(e={});var{indentWithTab:i=!0,editable:n=!0,readOnly:r=!1,theme:a="light",placeholder:o="",basicSetup:c=!0}=e,h=[];switch(i&&h.unshift(Ih.of([b8])),c&&(typeof c=="boolean"?h.unshift(t2()):h.unshift(t2(c))),o&&h.unshift(wL(o)),a){case"light":h.push(l9);break;case"dark":h.push(s9);break;case"none":break;default:h.push(a);break}return n===!1&&h.push(ie.editable.of(!1)),r&&h.push(Be.readOnly.of(!0)),[...h]},o9=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class u9{constructor(e,i){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=i,this.timeoutMS=i,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(i=>{try{i()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class a2{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var om=null,c9=()=>typeof window>"u"?new a2:(om||(om=new a2),om),o2=Sn.define(),h9=200,f9=[];function d9(t){var{value:e,selection:i,onChange:n,onStatistics:r,onCreateEditor:a,onUpdate:o,extensions:c=f9,autoFocus:h,theme:d="light",height:p=null,minHeight:g=null,maxHeight:x=null,width:v=null,minWidth:w=null,maxWidth:k=null,placeholder:C="",editable:M=!0,readOnly:T=!1,indentWithTab:j=!0,basicSetup:L=!0,root:D,initialState:U}=t,[H,Z]=E.useState(),[J,ue]=E.useState(),[ae,F]=E.useState(),ee=E.useState(()=>({current:null}))[0],fe=E.useState(()=>({current:null}))[0],de=ie.theme({"&":{height:p,minHeight:g,maxHeight:x,width:v,minWidth:w,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),P=ie.updateListener.of(ce=>{if(ce.docChanged&&typeof n=="function"&&!ce.transactions.some(Q=>Q.annotation(o2))){ee.current?ee.current.reset():(ee.current=new u9(()=>{if(fe.current){var Q=fe.current;fe.current=null,Q()}ee.current=null},h9),c9().add(ee.current));var ye=ce.state.doc,N=ye.toString();n(N,ce)}r&&r(o9(ce))}),X=a9({theme:d,editable:M,readOnly:T,placeholder:C,indentWithTab:j,basicSetup:L}),ne=[P,de,...X];return o&&typeof o=="function"&&ne.push(ie.updateListener.of(o)),ne=ne.concat(c),E.useLayoutEffect(()=>{if(H&&!ae){var ce={doc:e,selection:i,extensions:ne},ye=U?Be.fromJSON(U.json,ce,U.fields):Be.create(ce);if(F(ye),!J){var N=new ie({state:ye,parent:H,root:D});ue(N),a&&a(N,ye)}}return()=>{J&&(F(void 0),ue(void 0))}},[H,ae]),E.useEffect(()=>{t.container&&Z(t.container)},[t.container]),E.useEffect(()=>()=>{J&&(J.destroy(),ue(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[J]),E.useEffect(()=>{h&&J&&J.focus()},[h,J]),E.useEffect(()=>{J&&J.dispatch({effects:we.reconfigure.of(ne)})},[d,c,p,g,x,v,w,k,C,M,T,j,L,n,o]),E.useEffect(()=>{if(e!==void 0){var ce=J?J.state.doc.toString():"";if(J&&e!==ce){var ye=ee.current&&!ee.current.isDone,N=()=>{J&&e!==J.state.doc.toString()&&J.dispatch({changes:{from:0,to:J.state.doc.toString().length,insert:e||""},annotations:[o2.of(!0)]})};ye?fe.current=N:N()}}},[e,J]),{state:ae,setState:F,view:J,setView:ue,container:H,setContainer:Z}}var p9=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],YA=E.forwardRef((t,e)=>{var{className:i,value:n="",selection:r,extensions:a=[],onChange:o,onStatistics:c,onCreateEditor:h,onUpdate:d,autoFocus:p,theme:g="light",height:x,minHeight:v,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:T,placeholder:j,indentWithTab:L,editable:D,readOnly:U,root:H,initialState:Z}=t,J=P5(t,p9),ue=E.useRef(null),{state:ae,view:F,container:ee,setContainer:fe}=d9({root:H,value:n,autoFocus:p,theme:g,height:x,minHeight:v,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:T,placeholder:j,indentWithTab:L,editable:D,readOnly:U,selection:r,onChange:o,onStatistics:c,onCreateEditor:h,onUpdate:d,extensions:a,initialState:Z});E.useImperativeHandle(e,()=>({editor:ue.current,state:ae,view:F}),[ue,ee,ae,F]);var de=E.useCallback(X=>{ue.current=X,fe(X)},[fe]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var P=typeof g=="string"?"cm-theme-"+g:"cm-theme";return b.jsx("div",Em({ref:de,className:""+P+(i?" "+i:"")},J))});YA.displayName="CodeMirror";var u2={};class Eh{constructor(e,i,n,r,a,o,c,h,d,p=0,g){this.p=e,this.stack=i,this.state=n,this.reducePos=r,this.pos=a,this.score=o,this.buffer=c,this.bufferBase=h,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let r=e.parser.context;return new Eh(e,[],i,n,n,0,[],0,r?new c2(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let n=e>>19,r=e&65535,{parser:a}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=a.dynamicPrecedence(r);if(c&&(this.score+=c),n==0){this.pushState(a.getGoto(this.state,r,!0),this.reducePos),r<a.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let h=this.stack.length-(n-1)*3-(e&262144?6:0),d=h?this.stack[h-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((i=this.p.parser.nodeSet.types[r])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=h?this.stack[h-1]:0,x=this.bufferBase+this.buffer.length-g;if(r<a.minRepeatTerm||e&131072){let v=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,v,x+4,!0)}if(e&262144)this.state=this.stack[h];else{let v=this.stack[h-3];this.state=a.getGoto(v,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,i,n,r=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,c=this.buffer.length;if(c==0&&o.parent&&(c=o.bufferBase-o.parent.bufferBase,o=o.parent),c>0&&o.buffer[c-4]==0&&o.buffer[c-1]>-1){if(i==n)return;if(o.buffer[c-2]>=i){o.buffer[c-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(e,i,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let c=!1;for(let h=o;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){c=!0;break}if(c)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=i,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,i,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let a=e,{parser:o}=this.p;this.pos=r;let c=o.stateFlag(a,1);!c&&(r>n||i<=o.maxNode)&&(this.reducePos=r),this.pushState(a,c?n:Math.min(n,this.reducePos)),this.shiftContext(i,n),i<=o.maxNode&&this.buffer.push(i,n,r,4)}else this.pos=r,this.shiftContext(i,n),i<=this.p.parser.maxNode&&this.buffer.push(i,n,r,4)}apply(e,i,n,r){e&65536?this.reduce(e):this.shift(e,i,n,r)}useNode(e,i){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(i,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),r=e.bufferBase+i;for(;e&&r==e.bufferBase;)e=e.parent;return new Eh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,n?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new m9(this);;){let n=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(n==0)return!1;if((n&65536)==0)return!0;i.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let r=[];for(let a=0,o;a<i.length;a+=2)(o=i[a+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(i[a],o);if(this.stack.length<120)for(let a=0;r.length<8&&a<i.length;a+=2){let o=i[a+1];r.some((c,h)=>h&1&&c==o)||r.push(i[a],o)}i=r}let n=[];for(let r=0;r<i.length&&n.length<4;r+=2){let a=i[r+1];if(a==this.state)continue;let o=this.split();o.pushState(a,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(i[r],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if((i&65536)==0)return!1;if(!e.validAction(this.state,i)){let n=i>>19,r=i&65535,a=this.stack.length-n*3;if(a<0||e.getGoto(this.stack[a],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;i=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],n=(r,a)=>{if(!i.includes(r))return i.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let c=(o>>19)-a;if(c>1){let h=o&65535,d=this.stack.length-c*3;if(d>=0&&e.getGoto(this.stack[d],h,!1)>=0)return c<<19|65536|h}}else{let c=n(o,a+1);if(c!=null)return c}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new c2(this.curContext.tracker,e);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class c2{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class m9{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=r}}class Nh{constructor(e,i,n){this.stack=e,this.pos=i,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new Nh(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Nh(this.stack,this.pos,this.index)}}function jc(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let n=0,r=0;n<t.length;){let a=0;for(;;){let o=t.charCodeAt(n++),c=!1;if(o==126){a=65535;break}o>=92&&o--,o>=34&&o--;let h=o-32;if(h>=46&&(h-=46,c=!0),a+=h,c)break;a*=46}i?i[r++]=a:i=new e(a)}return i}class Qc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const h2=new Qc;class g9{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=h2,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let n=this.range,r=this.rangeIndex,a=this.pos+e;for(;a<n.from;){if(!r)return null;let o=this.ranges[--r];a-=n.from-o.to,n=o}for(;i<0?a>n.to:a>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];a+=o.from-n.to,n=o}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,n,r;if(i>=0&&i<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(i);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(n=a,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,i=0){let n=i?this.resolveOffset(i,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=h2,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,i){if(e>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let n="";for(let r of this.ranges){if(r.from>=i)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,i)))}return n}}class Ol{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;y9(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}Ol.prototype.contextual=Ol.prototype.fallback=Ol.prototype.extend=!1;Ol.prototype.fallback=Ol.prototype.extend=!1;function y9(t,e,i,n,r,a){let o=0,c=1<<n,{dialect:h}=i.p.parser;e:for(;(c&t[o])!=0;){let d=t[o+1];for(let v=o+3;v<d;v+=2)if((t[v+1]&c)>0){let w=t[v];if(h.allows(w)&&(e.token.value==-1||e.token.value==w||x9(w,e.token.value,r,a))){e.acceptToken(w);break}}let p=e.next,g=0,x=t[o+2];if(e.next<0&&x>g&&t[d+x*3-3]==65535){o=t[d+x*3-1];continue e}for(;g<x;){let v=g+x>>1,w=d+v+(v<<1),k=t[w],C=t[w+1]||65536;if(p<k)x=v;else if(p>=C)g=v+1;else{o=t[w+2],e.advance();continue e}}break}}function f2(t,e,i){for(let n=e,r;(r=t[n])!=65535;n++)if(r==i)return n-e;return-1}function x9(t,e,i,n){let r=f2(i,n,e);return r<0||f2(i,n,t)<r}const Ci=typeof process<"u"&&u2&&/\bparse\b/.test(u2.LOG);let um=null;function d2(t,e,i){let n=t.cursor(at.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}class b9{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?d2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?d2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let n=this.trees[i],r=this.index[i];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=n.children[r],o=this.start[i]+n.positions[r];if(o>e)return this.nextStart=o,null;if(a instanceof dt){if(o==e){if(o<this.safeFrom)return null;let c=o+a.length;if(c<=this.safeTo){let h=a.prop(Oe.lookAhead);if(!h||c+h<this.fragment.to)return a}}this.index[i]++,o+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[i]++,this.nextStart=o+a.length}}}class v9{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Qc)}getActions(e){let i=0,n=null,{parser:r}=e.p,{tokenizers:a}=r,o=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<a.length;d++){if((1<<d&o)==0)continue;let p=a[d],g=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=o||g.context!=c)&&(this.updateCachedToken(g,p,e),g.mask=o,g.context=c),g.lookAhead>g.end+25&&(h=Math.max(g.lookAhead,h)),g.value!=0)){let x=i;if(g.extended>-1&&(i=this.addActions(e,g.extended,g.end,i)),i=this.addActions(e,g.value,g.end,i),!p.extend&&(n=g,i>x))break}}for(;this.actions.length>i;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new Qc,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,i=this.addActions(e,n.value,n.end,i)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new Qc,{pos:n,p:r}=e;return i.start=n,i.end=Math.min(n+1,r.stream.end),i.value=n==r.stream.end?r.parser.eofTerm:0,i}updateCachedToken(e,i,n){let r=this.stream.clipPos(n.pos);if(i.token(this.stream.reset(r,e),n),e.value>-1){let{parser:a}=n.p;for(let o=0;o<a.specialized.length;o++)if(a.specialized[o]==e.value){let c=a.specializers[o](this.stream.read(e.start,e.end),n);if(c>=0&&n.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,i,n,r){for(let a=0;a<r;a+=3)if(this.actions[a]==e)return r;return this.actions[r++]=e,this.actions[r++]=i,this.actions[r++]=n,r}addActions(e,i,n,r){let{state:a}=e,{parser:o}=e.p,{data:c}=o;for(let h=0;h<2;h++)for(let d=o.stateSlot(a,h?2:1);;d+=3){if(c[d]==65535)if(c[d+1]==1)d=Vn(c,d+2);else{r==0&&c[d+1]==2&&(r=this.putAction(Vn(c,d+2),i,n,r));break}c[d]==i&&(r=this.putAction(Vn(c,d+1),i,n,r))}return r}}class S9{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new g9(i,r),this.tokens=new v9(e,this.stream),this.topTerm=e.top[1];let{from:a}=r[0];this.stacks=[Eh.start(this,e.top[0],a)],this.fragments=n.length&&this.stream.end-a>e.bufferLength*4?new b9(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],r,a;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let c=e[o];for(;;){if(this.tokens.mainToken=null,c.pos>i)n.push(c);else{if(this.advanceStack(c,n,e))continue;{r||(r=[],a=[]),r.push(c);let h=this.tokens.getMainToken(c);a.push(h.value,h.end)}}break}}if(!n.length){let o=r&&k9(r);if(o)return Ci&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ci&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,a,n);if(o)return Ci&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((c,h)=>h.score-c.score);n.length>o;)n.pop();n.some(c=>c.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let c=n[o];for(let h=o+1;h<n.length;h++){let d=n[h];if(c.sameState(d)||c.buffer.length>500&&d.buffer.length>500)if((c.score-d.score||c.buffer.length-d.buffer.length)>0)n.splice(h--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,c)=>c.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let r=e.pos,{parser:a}=this,o=Ci?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(r);g;){let x=this.parser.nodeSet.types[g.type.id]==g.type?a.getGoto(e.state,g.type.id):-1;if(x>-1&&g.length&&(!d||(g.prop(Oe.contextHash)||0)==p))return e.useNode(g,x),Ci&&console.log(o+this.stackID(e)+` (via reuse of ${a.getName(g.type.id)})`),!0;if(!(g instanceof dt)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof dt&&g.positions[0]==0)g=v;else break}}let c=a.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ci&&console.log(o+this.stackID(e)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let d=0;d<h.length;){let p=h[d++],g=h[d++],x=h[d++],v=d==h.length||!n,w=v?e:e.split(),k=this.tokens.mainToken;if(w.apply(p,g,k?k.start:w.pos,x),Ci&&console.log(o+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${a.getName(p&65535)}`} for ${a.getName(g)} @ ${r}${w==e?"":", split"})`),v)return!0;w.pos>r?i.push(w):n.push(w)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return p2(e,i),!0}}runRecovery(e,i,n){let r=null,a=!1;for(let o=0;o<e.length;o++){let c=e[o],h=i[o<<1],d=i[(o<<1)+1],p=Ci?this.stackID(c)+" -> ":"";if(c.deadEnd&&(a||(a=!0,c.restart(),Ci&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let g=c.split(),x=p;for(let v=0;v<10&&g.forceReduce()&&(Ci&&console.log(x+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,n));v++)Ci&&(x=this.stackID(g)+" -> ");for(let v of c.recoverByInsert(h))Ci&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,n);this.stream.end>c.pos?(d==c.pos&&(d++,h=0),c.recoverByDelete(h,d),Ci&&console.log(p+this.stackID(c)+` (via recover-delete ${this.parser.getName(h)})`),p2(c,n)):(!r||r.score<g.score)&&(r=g)}return r}stackToTree(e){return e.close(),dt.build({buffer:Nh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let i=(um||(um=new WeakMap)).get(e);return i||um.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function p2(t,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==t.pos&&n.sameState(t)){e[i].score<t.score&&(e[i]=t);return}}e.push(t)}class w9{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Rh extends AC{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let c=0;c<e.repeatNodeCount;c++)i.push("");let n=Object.keys(e.topRules).map(c=>e.topRules[c][1]),r=[];for(let c=0;c<i.length;c++)r.push([]);function a(c,h,d){r[c].push([h,h.deserialize(String(d))])}if(e.nodeProps)for(let c of e.nodeProps){let h=c[0];typeof h=="string"&&(h=Oe[h]);for(let d=1;d<c.length;){let p=c[d++];if(p>=0)a(p,h,c[d++]);else{let g=c[d+-p];for(let x=-p;x>0;x--)a(c[d++],h,g);d++}}}this.nodeSet=new u0(i.map((c,h)=>fi.define({name:h>=this.minRepeatTerm?void 0:c,id:h,props:r[h],top:n.indexOf(h)>-1,error:h==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(h)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=SC;let o=jc(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(m2),this.states=jc(e.states,Uint32Array),this.data=jc(e.stateData),this.goto=jc(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new Ol(o,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,n){let r=new S9(this,e,i,n);for(let a of this.wrappers)r=a(r,e,i,n);return r}getGoto(e,i,n=!1){let r=this.goto;if(i>=r[0])return-1;for(let a=r[i+1];;){let o=r[a++],c=o&1,h=r[a++];if(c&&n)return h;for(let d=a+(o>>1);a<d;a++)if(r[a]==e)return h;if(c)return-1}}hasAction(e,i){let n=this.data;for(let r=0;r<2;r++)for(let a=this.stateSlot(e,r?2:1),o;;a+=3){if((o=n[a])==65535)if(n[a+1]==1)o=n[a=Vn(n,a+2)];else{if(n[a+1]==2)return Vn(n,a+2);break}if(o==i||o==0)return Vn(n,a+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,n=>n==i?!0:null)}allActions(e,i){let n=this.stateSlot(e,4),r=n?i(n):void 0;for(let a=this.stateSlot(e,1);r==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Vn(this.data,a+2);else break;r=i(Vn(this.data,a+1))}return r}nextStates(e){let i=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Vn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];i.some((a,o)=>o&1&&a==r)||i.push(this.data[n],r)}}return i}configure(e){let i=Object.assign(Object.create(Rh.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=n}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(a=>a.from==n);return r?r.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,r)=>{let a=e.specializers.find(c=>c.from==n.external);if(!a)return n;let o=Object.assign(Object.assign({},n),{external:a.to});return i.specializers[r]=m2(o),o})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),n=i.map(()=>!1);if(e)for(let a of e.split(" ")){let o=i.indexOf(a);o>=0&&(n[o]=!0)}let r=null;for(let a=0;a<i.length;a++)if(!n[a])for(let o=this.dialects[i[a]],c;(c=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new w9(e,n,r)}static deserialize(e){return new Rh(e)}}function Vn(t,e){return t[e]|t[e+1]<<16}function k9(t){let e=null;for(let i of t){let n=i.p.stoppedAt;(i.pos==i.p.stream.end||n!=null&&i.pos>n)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}function m2(t){if(t.external){let e=t.extend?1:0;return(i,n)=>t.external(i,n)<<1|e}return t.get}const C9=MC({String:I.string,Number:I.number,"True False":I.bool,PropertyName:I.propertyName,Null:I.null,", :":I.separator,"[ ]":I.squareBracket,"{ }":I.brace}),A9=Rh.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[C9],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),M9=gh.define({name:"json",parser:A9.configure({props:[NC.add({Object:AS({except:/^\s*\}/}),Array:AS({except:/^\s*\]/})}),DC.add({"Object Array":R6})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function T9(){return new b6(M9)}const cm=[200,201,204,400,401,403,404,500,502,503],O9=["Content-Type","Cache-Control","Authorization","Location","Retry-After","WWW-Authenticate","ETag","Last-Modified","Content-Encoding","Content-Length","X-Request-ID","X-RateLimit-Limit","X-RateLimit-Remaining","Access-Control-Allow-Origin"],E9=["application/json","text/plain","text/html","application/xml","application/octet-stream"],N9=[{key:"content-type",value:"application/json",label:"JSON"},{key:"content-type",value:"text/plain",label:"Text"},{key:"cache-control",value:"no-cache",label:"No-Cache"},{key:"location",value:"/",label:"Location"},{key:"retry-after",value:"5",label:"Retry-After"}];function hm(t){return Object.entries(t).map(([e,i])=>({key:e,value:i}))}function R9(t){const e={};for(const{key:i,value:n}of t)i.trim()&&(e[i.trim().toLowerCase()]=n.trim());return e}function D9({mock:t,specResponses:e,onChange:i}){const[n,r]=E.useState(t.statusCode),[a,o]=E.useState(t.body),[c,h]=E.useState(()=>hm(t.headers)),[d,p]=E.useState(cm.includes(t.statusCode)?"preset":"manual"),[g,x]=E.useState(null);E.useEffect(()=>{r(t.statusCode),o(t.body),h(hm(t.headers)),cm.includes(t.statusCode)||p("manual")},[t.statusCode,t.body,t.headers]),E.useEffect(()=>{if(!a.trim()){x(null);return}try{JSON.parse(a),x(null)}catch(L){x(L instanceof SyntaxError?L.message:"Invalid JSON")}},[a]);const v=E.useCallback((L,D,U)=>{i({statusCode:D,headers:R9(L),body:U})},[i]),w=()=>{try{const L=JSON.stringify(JSON.parse(a),null,2);o(L),v(c,n,L)}catch{}},k=(L,D,U)=>{h(H=>H.map((Z,J)=>J===L?{...Z,[D]:U}:Z))},C=L=>{h(D=>{const U=D.filter((H,Z)=>Z!==L);return v(U,n,a),U})},M=()=>h(L=>[...L,{key:"",value:""}]),T=(L,D)=>{h(U=>{const H=U.findIndex(J=>J.key.toLowerCase()===L.toLowerCase()),Z=H>=0?U.map((J,ue)=>ue===H?{key:J.key,value:D}:J):[...U,{key:L,value:D}];return v(Z,n,a),Z})},j=L=>{const D=L.statusCode,U=L.headers??{"content-type":"application/json"},H=L.body??"";r(D),p("manual"),h(hm(U)),o(H),i({statusCode:D,headers:U,body:H})};return b.jsxs("div",{className:"flex flex-col gap-6 p-2 bg-background",children:[e&&e.length>0&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(Z2,{className:"w-3.5 h-3.5 text-primary"}),"Spec Defined Responses"]}),b.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:e.map((L,D)=>b.jsxs("button",{onClick:()=>j(L),className:"flex items-start gap-3 p-3 text-left rounded-xl border border-border bg-card hover:border-primary/40 hover:bg-primary/5 transition-all group",children:[b.jsx("span",{className:Se("px-1.5 py-0.5 text-[10px] font-black font-mono rounded border shrink-0",L.statusCode<300?"text-emerald-400 border-emerald-400/30":L.statusCode<500?"text-amber-400 border-amber-400/30":"text-rose-400 border-rose-400/30"),children:L.statusCode}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("p",{className:"text-[11px] font-bold text-foreground truncate group-hover:text-primary transition-colors",children:L.name}),L.description&&L.description!==L.name&&b.jsx("p",{className:"text-[9px] text-muted-foreground line-clamp-1 mt-0.5",children:L.description})]})]},D))})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(Zc,{className:"w-3.5 h-3.5"}),"Status Code"]}),b.jsxs("div",{className:"flex flex-wrap gap-2",children:[cm.map(L=>b.jsx("button",{onClick:()=>{r(L),p("preset"),v(c,L,a)},className:Se("px-2.5 py-1.5 text-xs font-mono font-bold rounded-lg border transition-colors duration-75",d==="preset"&&n===L?"bg-mode-mock/20 border-mode-mock text-mode-mock shadow-sm":"bg-muted border-border text-muted-foreground hover:border-mode-mock/40 hover:text-foreground"),children:L},L)),b.jsx("input",{type:"number",value:n,onChange:L=>{r(Number(L.target.value)),p("manual")},onFocus:()=>p("manual"),onBlur:()=>v(c,n,a),className:Se("w-16 px-2.5 py-1.5 text-xs font-mono font-bold bg-background border rounded-lg focus:ring-1 focus:ring-mode-mock focus:border-mode-mock outline-none transition-colors duration-75",d==="manual"?"bg-mode-mock/20 border-mode-mock text-mode-mock shadow-sm":"border-border text-muted-foreground hover:border-mode-mock/20")})]})]}),b.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[b.jsx(Nl,{className:"w-3.5 h-3.5"}),"Headers"]}),b.jsxs("button",{onClick:M,className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors","aria-label":"Add header",children:[b.jsx(Bh,{className:"w-3 h-3"}),"Add"]})]}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:N9.map(L=>b.jsx("button",{onClick:()=>T(L.key,L.value),className:"px-2 py-1 text-[9px] font-black uppercase tracking-wider rounded-md border border-border bg-muted text-muted-foreground hover:border-mode-mock/40 hover:text-foreground hover:bg-accent transition-all",children:L.label},`${L.key}:${L.value}`))}),b.jsx("datalist",{id:"header-names",children:O9.map(L=>b.jsx("option",{value:L},L))}),b.jsxs("div",{className:"space-y-1.5",children:[c.length===0&&b.jsx("p",{className:"text-[10px] text-muted-foreground/50 font-mono px-1 py-2",children:"No headers — use quick-add or + Add"}),c.map((L,D)=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"text",list:"header-names",value:L.key,onChange:U=>k(D,"key",U.target.value),onBlur:()=>v(c,n,a),placeholder:"Header-Name","aria-label":"Header name",className:"w-[45%] px-2.5 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-mode-mock shadow-inner"}),b.jsx("span",{className:"text-muted-foreground/40 text-xs font-mono shrink-0",children:":"}),b.jsx("input",{type:"text",value:L.value,onChange:U=>k(D,"value",U.target.value),onBlur:()=>v(c,n,a),placeholder:"value","aria-label":"Header value",className:"flex-1 px-2.5 py-1.5 text-[11px] font-mono rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-mode-mock shadow-inner"}),b.jsx("button",{onClick:()=>C(D),className:"p-1 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 rounded transition-all shrink-0","aria-label":"Remove header",children:b.jsx(As,{className:"w-3 h-3"})})]}),L.key.toLowerCase()==="content-type"&&b.jsx("div",{className:"flex flex-wrap gap-1 pl-1",children:E9.map(U=>b.jsx("button",{onClick:()=>{k(D,"value",U);const H=c.map((Z,J)=>J===D?{...Z,value:U}:Z);v(H,n,a)},className:Se("px-1.5 py-0.5 text-[9px] font-mono rounded border transition-all",L.value===U?"border-mode-mock/50 text-mode-mock bg-mode-mock/10":"border-border text-muted-foreground/60 hover:border-mode-mock/30 hover:text-muted-foreground"),children:U},U))})]},D))]})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[b.jsx(Wc,{className:"w-3.5 h-3.5"}),"Body"]}),b.jsxs("button",{onClick:w,disabled:!!g||!a.trim(),className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Format JSON",children:[b.jsx(x3,{className:"w-3 h-3"}),"Format"]})]}),b.jsx("div",{className:Se("rounded-xl border bg-background overflow-hidden shadow-inner focus-within:ring-1",g?"border-destructive/50 focus-within:ring-destructive/50":"border-border focus-within:ring-mode-mock"),children:b.jsx(YA,{value:a,onChange:o,onBlur:()=>v(c,n,a),extensions:[T9()],height:"150px",theme:"dark",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"text-[11px] font-mono"})}),g&&b.jsxs("div",{className:"flex items-start gap-1.5 px-1",children:[b.jsx(JN,{className:"w-3 h-3 text-destructive shrink-0 mt-0.5"}),b.jsx("p",{"data-testid":"json-error",className:"text-[10px] text-destructive font-mono leading-tight",children:g})]})]})]})]})}const j9={passthrough:"border-mode-passthrough/20",delay:"border-mode-delay/20",mock:"border-mode-mock/20"},L9={passthrough:"bg-mode-passthrough",delay:"bg-mode-delay",mock:"bg-mode-mock"};function B9({endpoint:t,specName:e,showSpecBadge:i}){const[n,r]=E.useState(!1),a=z5(),o=c=>{const h={mode:c};c==="delay"&&!t.delay&&(h.delay={ms:1e3}),c==="mock"&&!t.mock&&(h.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),a.mutate({id:t.id,config:h}),c!=="passthrough"&&r(!0)};return b.jsxs("div",{className:Se("group relative border sm:rounded-xl card-slab overflow-hidden mb-1 shadow-sm",j9[t.mode]),children:[b.jsx("div",{className:Se("absolute left-0 top-0 bottom-0 w-[2px] transition-all duration-75",L9[t.mode])}),b.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 cursor-pointer select-none hover:bg-primary/5 transition-colors duration-75",onClick:()=>r(!n),children:[b.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsx("button",{className:"text-muted-foreground/40 group-hover:text-primary transition-colors duration-75",children:n?b.jsx(Bo,{className:"w-4 h-4"}):b.jsx(Y2,{className:"w-4 h-4"})}),b.jsx(Vg,{method:t.method})]}),b.jsxs("div",{className:"flex flex-col min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-black font-mono tracking-tight text-foreground/90 truncate",children:t.path}),i&&e&&b.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-black uppercase tracking-widest rounded-[4px] bg-accent text-accent-foreground border border-border",children:e})]}),t.summary&&b.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-medium truncate mt-0.5",children:t.summary})]})]}),b.jsxs("div",{className:"flex items-center gap-4 shrink-0",onClick:c=>c.stopPropagation(),children:[b.jsxs("div",{className:"flex items-center gap-2",children:[t.mode==="delay"&&t.delay&&b.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-black font-mono rounded bg-mode-delay/10 text-mode-delay border border-mode-delay/20 shadow-sm",children:[t.delay.ms,"ms"]}),t.mode==="mock"&&t.mock&&b.jsx("span",{className:Se("px-2 py-0.5 text-[10px] font-black font-mono rounded border shadow-sm",t.mock.statusCode<300?"bg-emerald-400/10 text-emerald-400 border-emerald-400/20":t.mock.statusCode<500?"bg-amber-400/10 text-amber-400 border-amber-400/20":"bg-rose-400/10 text-rose-400 border-rose-400/20"),children:t.mock.statusCode})]}),b.jsx(U5,{value:t.mode,onChange:o})]})]}),n&&b.jsx("div",{className:Se("px-5 pb-5 pt-0","border-t border-border/20 mx-4"),children:b.jsxs("div",{className:"pt-5 space-y-4",children:[t.mode==="delay"&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-delay uppercase tracking-widest px-1",children:[b.jsx(Zc,{className:"w-3 h-3"}),"Configuration"]}),b.jsx("div",{className:"bg-muted rounded-xl p-4 border border-border",children:b.jsx(q5,{delay:t.delay??{ms:1e3},onChange:c=>a.mutate({id:t.id,config:{delay:c}})})})]}),t.mode==="mock"&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-mock uppercase tracking-widest px-1",children:[b.jsx(Zc,{className:"w-3 h-3"}),"Mock Response"]}),b.jsx("div",{className:"bg-muted rounded-xl border border-border overflow-hidden",children:b.jsx(D9,{mock:t.mock??{statusCode:200,headers:{},body:"{}"},specResponses:t.responses,onChange:c=>a.mutate({id:t.id,config:{mock:c}})})})]}),t.mode==="passthrough"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center space-y-2",children:[b.jsx("div",{className:"w-10 h-10 rounded-full bg-mode-passthrough/5 flex items-center justify-center border border-border",children:b.jsx(wm,{className:"w-5 h-5 text-mode-passthrough opacity-40"})}),b.jsxs("div",{className:"max-w-[300px]",children:[b.jsx("p",{className:"text-xs font-semibold text-foreground/80",children:"Passthrough Mode Active"}),b.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mt-1",children:"Requests will be forwarded directly to the upstream server without modification."})]})]})]})})]})}function z9(){const{data:t,isLoading:e}=Xw(),{data:i,isLoading:n}=_h(),r=Zw(),[a,o]=E.useState(""),[c,h]=E.useState(new Set),d=E.useMemo(()=>{const k=new Map;for(const C of i??[])k.set(C.id,C);return k},[i]),p=E.useMemo(()=>new Set(i?.filter(k=>k.active).map(k=>k.id)??[]),[i]),g=E.useMemo(()=>{if(!t)return new Map;let k=t.filter(M=>p.has(M.specId));if(a){const M=a.toLowerCase();k=k.filter(T=>T.path.toLowerCase().includes(M)||T.method.toLowerCase().includes(M)||T.operationId?.toLowerCase().includes(M)||T.summary?.toLowerCase().includes(M))}const C=new Map;for(const M of k){const T=M.tags[0]??"Untagged";C.has(T)||C.set(T,[]),C.get(T).push(M)}return C},[t,a,p]),x=k=>{h(C=>{const M=new Set(C);return M.has(k)?M.delete(k):M.add(k),M})},v=(k,C)=>{const M={};k.forEach(T=>{const j={mode:C};C==="delay"&&!T.delay&&(j.delay={ms:1e3}),C==="mock"&&!T.mock&&(j.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),M[T.id]=j}),r.mutate(M)};return e||n?b.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-4",children:[b.jsx(Jc,{className:"w-10 h-10 animate-spin text-primary/40"}),b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Indexing endpoints..."})]}):!t?.length||p.size===0?b.jsxs("div",{className:"flex flex-col items-center justify-center h-80 text-center space-y-4 px-6",children:[b.jsx("div",{className:"w-16 h-16 rounded-3xl bg-muted border border-border/40 flex items-center justify-center text-muted-foreground opacity-20",children:b.jsx(Zc,{className:"w-8 h-8"})}),b.jsxs("div",{className:"max-w-xs",children:[b.jsx("h3",{className:"text-sm font-black text-foreground uppercase tracking-tight",children:p.size===0?"No Active Specifications":"No endpoints detected"}),b.jsx("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:p.size===0?"Select or import a specification from the header to begin.":"Import an OpenAPI specification to automatically populate your workspace."})]})]}):b.jsxs("div",{className:"space-y-6",children:[b.jsxs("div",{className:"relative group",children:[b.jsx(f3,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),b.jsx("input",{type:"text",placeholder:"Search by path, method, or operation...",value:a,onChange:k=>o(k.target.value),className:"w-full pl-10 pr-9 py-2.5 text-sm font-bold rounded-xl border border-border/60 bg-card/30 backdrop-blur-sm placeholder:text-muted-foreground/40 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/40 shadow-sm transition-all"}),a&&b.jsx("button",{onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground/40 hover:text-foreground rounded transition-colors","aria-label":"Clear search",children:b.jsx(As,{className:"w-3.5 h-3.5"})})]}),b.jsxs("div",{className:"space-y-8",children:[Array.from(g.entries()).map(([k,C])=>{const M=c.has(k);return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-3 w-full",children:[b.jsxs("button",{onClick:()=>x(k),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-muted/40 border border-border/20 text-muted-foreground hover:text-foreground hover:bg-muted/60 hover:border-border/40 transition-all shrink-0",children:[M?b.jsx(Y2,{className:"w-3.5 h-3.5"}):b.jsx(Bo,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:k}),b.jsxs("span",{className:"text-[10px] font-black opacity-40 tabular-nums",children:["(",C.length,")"]})]}),b.jsxs("div",{className:"flex items-center gap-1 bg-muted/20 p-0.5 rounded-lg border border-border/10 shrink-0",children:[b.jsx("button",{onClick:()=>v(C,"passthrough"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-passthrough hover:bg-mode-passthrough/10 rounded-md transition-all",title:"Pass all in group",children:"Pass"}),b.jsx("button",{onClick:()=>v(C,"delay"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-delay hover:bg-mode-delay/10 rounded-md transition-all",title:"Delay all in group",children:"Delay"}),b.jsx("button",{onClick:()=>v(C,"mock"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-mock hover:bg-mode-mock/10 rounded-md transition-all",title:"Mock all in group",children:"Mock"})]}),b.jsx("div",{className:"h-px flex-1 bg-border/20 opacity-40 group-hover:opacity-100 group-hover:bg-primary/20 transition-all"})]}),!M&&b.jsx("div",{className:"grid grid-cols-1 gap-1 px-1",children:C.map(T=>b.jsx(B9,{endpoint:T,specName:d.get(T.specId)?.name,showSpecBadge:p.size>1},T.id))})]},k)}),g.size===0&&a&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[b.jsx(W2,{className:"w-10 h-10 text-muted-foreground opacity-20"}),b.jsxs("div",{className:"max-w-[240px]",children:[b.jsx("p",{className:"text-sm font-bold text-foreground/80",children:"No results found"}),b.jsxs("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:['The search term "',a,'" did not match any active endpoints.']})]})]})]})]})}const _9=["Access-Control-Allow-Origin","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Cache-Control","Content-Type","X-Request-ID"],H9=[{key:"access-control-allow-origin",value:"*",label:"CORS Origin"},{key:"access-control-allow-headers",value:"*",label:"CORS Headers"},{key:"access-control-allow-methods",value:"*",label:"CORS Methods"},{key:"cache-control",value:"no-cache",label:"No-Cache"}];function g2(t={}){return Object.entries(t).map(([e,i])=>({key:e,value:i}))}function U9(t){const e={};for(const{key:i,value:n}of t)i.trim()&&(e[i.trim().toLowerCase()]=n.trim());return e}function q9({spec:t}){const e=Yw(),[i,n]=E.useState(()=>g2(t.globalHeaders));E.useEffect(()=>{n(g2(t.globalHeaders))},[t.globalHeaders]);const r=p=>{e.mutate({specId:t.id,data:{globalHeaders:U9(p)}})},a=()=>n(p=>[...p,{key:"",value:""}]),o=(p,g,x)=>n(v=>v.map((w,k)=>k===p?{...w,[g]:x}:w)),c=p=>{const g=i.filter((x,v)=>v!==p);n(g),r(g)},h=(p,g)=>{n(x=>{const v=x.findIndex(k=>k.key.toLowerCase()===p.toLowerCase()),w=v>=0?x.map((k,C)=>C===v?{key:k.key,value:g}:k):[...x,{key:p,value:g}];return r(w),w})},d=Object.keys(t.globalHeaders??{}).length;return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-[10px] font-black text-foreground/70 uppercase tracking-widest",children:t.name}),d>0&&b.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-black rounded-full bg-primary/15 text-primary border border-primary/20",children:d})]}),b.jsxs("button",{onClick:a,className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors","aria-label":"Add global header",children:[b.jsx(Bh,{className:"w-3 h-3"}),"Add"]})]}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:H9.map(p=>b.jsx("button",{onClick:()=>h(p.key,p.value),className:Se("px-2 py-0.5 text-[9px] font-black uppercase tracking-wider rounded-md border transition-all",i.some(g=>g.key.toLowerCase()===p.key&&g.value===p.value)?"border-primary/40 text-primary bg-primary/10":"border-border bg-muted text-muted-foreground hover:border-primary/30 hover:text-foreground hover:bg-accent"),children:p.label},`${p.key}:${p.value}`))}),b.jsx("datalist",{id:"global-header-names",children:_9.map(p=>b.jsx("option",{value:p},p))}),i.length===0?b.jsx("p",{className:"text-[10px] text-muted-foreground/40 font-mono py-1",children:"No global headers — use quick-add or + Add."}):b.jsx("div",{className:"space-y-1",children:i.map((p,g)=>b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"text",list:"global-header-names",value:p.key,onChange:x=>o(g,"key",x.target.value),onBlur:()=>r(i),placeholder:"Header-Name","aria-label":"Global header name",className:"w-[45%] px-2.5 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("span",{className:"text-muted-foreground/40 text-xs font-mono shrink-0",children:":"}),b.jsx("input",{type:"text",value:p.value,onChange:x=>o(g,"value",x.target.value),onBlur:()=>r(i),placeholder:"value","aria-label":"Global header value",className:"flex-1 px-2.5 py-1.5 text-[11px] font-mono rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>c(g),className:"p-1 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 rounded transition-all shrink-0","aria-label":"Remove global header",children:b.jsx(As,{className:"w-3 h-3"})})]},g))})]})}function P9({open:t}){const{data:e}=_h(),i=e?.filter(n=>n.active)??[];return t?b.jsxs("div",{className:"border-b border-border/60 bg-muted/20 px-6 py-4 space-y-4 animate-in slide-in-from-top-1 duration-150",children:[b.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[b.jsx(Nl,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Global Response Headers"}),b.jsx("span",{className:"text-[9px] text-muted-foreground/40 font-medium",children:"— injected into every response for the spec. Per-endpoint mock headers take priority."})]}),i.length===0?b.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"No active spec selected."}):b.jsx("div",{className:Se("space-y-5",i.length>1&&"divide-y divide-border/40"),children:i.map(n=>b.jsx("div",{className:Se(i.length>1&&"pt-4 first:pt-0"),children:b.jsx(q9,{spec:n})},n.id))})]}):null}function F9({open:t,onToggle:e}){const{data:i}=_h(),r=(i?.filter(a=>a.active)??[]).reduce((a,o)=>a+Object.keys(o.globalHeaders??{}).length,0);return b.jsxs("button",{onClick:e,className:Se("flex items-center gap-1.5 px-2.5 py-1.5 text-[9px] font-black uppercase tracking-widest rounded-lg border transition-all",t?"bg-primary/10 border-primary/20 text-primary":"bg-muted/30 border-border/40 text-muted-foreground hover:bg-accent/40 hover:border-border/60 hover:text-foreground"),title:"Global Response Headers",children:[b.jsx(Nl,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden sm:inline",children:"Global Headers"}),r>0&&b.jsx("span",{className:Se("px-1.5 py-0.5 rounded-full text-[9px] font-black border",t?"bg-primary/20 border-primary/30 text-primary":"bg-muted border-border text-muted-foreground"),children:r})]})}function V9(){return jr({queryKey:["presets"],queryFn:Fe.presets.list})}function I9(){const t=pt();return Nt({mutationFn:e=>Fe.presets.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function Q9(){const t=pt();return Nt({mutationFn:Fe.presets.delete,onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function G9(){const t=pt();return Nt({mutationFn:Fe.presets.apply,onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const KA=[{name:"Slow",icon:y3,match:t=>t.length>0&&t.every(e=>e.mode==="delay"&&e.delay?.ms===2e3),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"delay",delay:{ms:2e3}};return e}},{name:"Errors",icon:g3,match:t=>t.length>0&&t.every(e=>e.mode==="mock"&&e.mock?.statusCode===500),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"mock",mock:{statusCode:500,headers:{"content-type":"application/json"},body:'{"error":"Internal Server Error"}'}};return e}},{name:"Pass All",icon:Bg,match:t=>t.length>0&&t.every(e=>e.mode==="passthrough"),apply:t=>{const e={};for(const i of t)e[i.id]={mode:"passthrough"};return e}}];function Y9(t,e){for(const[i,n]of Object.entries(e.endpoints)){const r=t.find(a=>a.id===i);if(!r||n.mode!==void 0&&r.mode!==n.mode||n.mode==="delay"&&n.delay&&r.delay?.ms!==n.delay.ms||n.mode==="mock"&&n.mock&&(r.mock?.statusCode!==n.mock.statusCode||r.mock?.body!==n.mock.body))return!1}return!0}function K9(t,e){if(!t?.length)return null;for(const i of KA)if(i.match(t))return`builtin:${i.name}`;if(e){for(const i of e)if(Y9(t,i))return`saved:${i.name}`}return null}function W9(){const{data:t}=V9(),{data:e}=Xw(),i=I9(),n=Q9(),r=G9(),a=Zw(),o=E.useMemo(()=>K9(e,t),[e,t]),[c,h]=E.useState(!1),[d,p]=E.useState(!1),[g,x]=E.useState(""),v=E.useRef(null);E.useEffect(()=>{function C(M){v.current&&!v.current.contains(M.target)&&h(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);const w=!!e?.length,k=()=>{if(!g.trim()||!e)return;const C={};for(const M of e)C[M.id]={mode:M.mode,delay:M.delay,mock:M.mock};i.mutate({name:g.trim(),endpoints:C},{onSuccess:()=>{x(""),p(!1)}})};return w?b.jsxs("div",{className:"bg-card/30 backdrop-blur-sm border border-border/40 rounded-xl p-1 flex items-center gap-1 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-1 bg-muted/40 rounded-lg p-0.5 border border-border/20 shadow-inner",children:[b.jsx("div",{className:"px-2 text-[9px] font-black text-muted-foreground uppercase tracking-widest hidden lg:block",children:"Presets"}),KA.map(({name:C,icon:M,apply:T})=>{const j=o===`builtin:${C}`;return b.jsxs("button",{onClick:()=>{e&&a.mutate(T(e))},className:Se("inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-md border transition-colors duration-75",j?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-transparent text-muted-foreground hover:text-foreground hover:bg-white/5"),children:[b.jsx(M,{className:Se("w-3.5 h-3.5")}),b.jsx("span",{className:"hidden sm:inline",children:C}),j&&b.jsx(Xc,{className:"w-3 h-3 ml-0.5"})]},C)})]}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 shrink-0"}),t&&t.length>0&&b.jsxs("div",{className:"relative",ref:v,children:[b.jsxs("button",{onClick:()=>h(!c),className:Se("inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border transition-colors duration-75",c||o&&o.startsWith("saved:")?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-border/40 text-muted-foreground hover:bg-accent/40 hover:text-foreground"),children:[b.jsx(Z2,{className:"w-3.5 h-3.5"}),b.jsxs("span",{className:"hidden sm:inline",children:["Saved (",t.length,")"]}),b.jsx(Bo,{className:Se("w-3 h-3 text-muted-foreground transition-transform duration-75",c&&"rotate-180")})]}),c&&b.jsxs("div",{className:"absolute right-0 top-full mt-2 z-[100] bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[240px]",children:[b.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Saved Configurations"})}),b.jsx("div",{className:"max-h-[300px] overflow-y-auto px-1.5 ",children:t.map(C=>{const M=o===`saved:${C.name}`;return b.jsxs("div",{className:Se("group flex items-center gap-3 px-3 py-2 text-xs rounded-lg transition-colors duration-75 mb-0.5 border border-transparent",M?"bg-primary/10 border-primary/20 text-primary font-bold shadow-sm":"hover:bg-accent/50 text-muted-foreground hover:text-foreground"),children:[b.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer py-0.5",onClick:()=>r.mutate(C.name,{onSuccess:()=>h(!1)}),children:[b.jsx("p",{className:"font-bold truncate",children:C.name}),b.jsxs("p",{className:"text-[9px] opacity-60 font-medium",children:[Object.keys(C.endpoints).length," endpoints"]})]}),b.jsx("div",{className:"flex items-center gap-1 shrink-0",children:b.jsx("button",{onClick:T=>{T.stopPropagation(),n.mutate(C.name)},className:"p-1.5 text-muted-foreground hover:text-rose-500 hover:bg-rose-500/10 rounded-md transition-colors duration-75 opacity-0 group-hover:opacity-100",title:"Delete",children:b.jsx(co,{className:"w-3.5 h-3.5"})})})]},C.name)})})]})]}),d?b.jsxs("div",{className:"flex items-center gap-1.5 bg-accent/20 rounded-lg p-0.5 border border-primary/20 shadow-inner ml-auto",children:[b.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:C=>x(C.target.value),placeholder:"Name...",onKeyDown:C=>{C.key==="Enter"&&k(),C.key==="Escape"&&(p(!1),x(""))},className:"w-28 sm:w-40 px-3 py-1.5 text-[10px] font-bold rounded-md border border-border/40 bg-background/50 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/50 transition-colors duration-75"}),b.jsx("button",{onClick:k,disabled:!g.trim(),className:"px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors duration-75 shadow-sm",children:"Save"}),b.jsx("button",{onClick:()=>{p(!1),x("")},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-white/5 rounded-md transition-colors duration-75",children:b.jsx(As,{className:"w-3.5 h-3.5"})})]}):b.jsxs("button",{onClick:()=>p(!0),disabled:o!==null,className:Se("ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border border-dashed transition-colors duration-75",o!==null?"border-border/20 text-muted-foreground/20 cursor-not-allowed":"border-border/40 text-muted-foreground hover:border-primary/40 hover:text-primary hover:bg-primary/5 shadow-sm"),children:[b.jsx(h3,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]}):null}function X9(){const[t,e]=E.useState([]),[i,n]=E.useState(!1),[r,a]=E.useState(!1),o=E.useRef(null),c=pt();E.useEffect(()=>{Fe.logs.get(500).then(({entries:d})=>{e(p=>{const g=new Set(p.map(v=>v.id)),x=[...p];for(const v of d)g.has(v.id)||x.push(v);return x.slice(0,500)}),a(!0)})},[]),E.useEffect(()=>{const d=new EventSource("/api/logs/stream");return o.current=d,d.addEventListener("connected",()=>n(!0)),d.addEventListener("log",p=>{const g=JSON.parse(p.data);e(x=>[g,...x].slice(0,500))}),d.onerror=()=>n(!1),()=>{d.close(),o.current=null}},[]);const h=E.useCallback(()=>{e([]),Fe.logs.clear().then(()=>{c.invalidateQueries({queryKey:["logs"]})})},[c]);return{entries:t,connected:i,clear:h,loaded:r}}function WA({status:t}){const e=t<300?"text-emerald-400 bg-emerald-400/10 border-emerald-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-success),0.2)]":t<400?"text-blue-400 bg-blue-400/10 border-blue-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-primary),0.2)]":t<500?"text-amber-400 bg-amber-400/10 border-amber-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-warning),0.2)]":"text-rose-400 bg-rose-400/10 border-rose-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-destructive),0.2)]";return b.jsx("span",{className:Se("inline-flex items-center justify-center px-1.5 py-0.5 text-[10px] font-black font-mono rounded border uppercase tracking-wider min-w-[32px] transition-all",e),children:t})}function Z9({entry:t,onClose:e}){return b.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[b.jsx("div",{className:"absolute inset-0 bg-background/60",onClick:e}),b.jsxs("div",{className:"relative w-full max-w-xl bg-card border-l border-border shadow-2xl h-full flex flex-col",onClick:i=>i.stopPropagation(),children:[b.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border bg-muted",children:[b.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Vg,{method:t.method}),b.jsx(WA,{status:t.statusCode}),b.jsx("span",{className:"text-[10px] font-black text-muted-foreground uppercase tracking-widest ml-2",children:t.mode})]}),b.jsx("h2",{className:"text-sm font-black font-mono text-foreground truncate break-all",children:t.path})]}),b.jsx("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:b.jsx(As,{className:"w-5 h-5"})})})]}),b.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[b.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(El,{className:"w-3 h-3"})," Latency"]}),b.jsxs("div",{className:"text-sm font-black font-mono text-primary",children:[t.latencyMs,b.jsx("span",{className:"text-[10px] ml-0.5 opacity-60",children:"ms"})]})]}),b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(Bg,{className:"w-3 h-3"})," Status"]}),b.jsx("div",{className:"text-sm font-black font-mono text-foreground",children:t.statusCode})]}),b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(El,{className:"w-3 h-3"})," Timestamp"]}),b.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:new Date(t.timestamp).toLocaleTimeString()})]})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Sm,{className:"w-4 h-4 text-primary"}),b.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Request Details"})]}),t.requestHeaders&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(Nl,{className:"w-3 h-3"})," Headers"]}),b.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.requestHeaders).map(([i,n])=>`${i}: ${n}`).join(`
54
+ `)})]})]}),b.jsxs("div",{className:"space-y-4 border-t border-border pt-8",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Sm,{className:"w-4 h-4 text-success rotate-180"}),b.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Response Details"})]}),t.responseHeaders&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(Nl,{className:"w-3 h-3"})," Headers"]}),b.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.responseHeaders).map(([i,n])=>`${i}: ${n}`).join(`
55
+ `)})]}),t.responseBody&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(Wc,{className:"w-3 h-3"})," Body"]}),b.jsx("div",{className:"rounded-xl border border-border bg-muted overflow-hidden shadow-inner",children:b.jsx("pre",{className:"text-[11px] font-mono font-medium p-4 overflow-auto max-h-80 leading-relaxed text-foreground/90",children:J9(t.responseBody)})})]})]})]}),b.jsx("div",{className:"p-4 border-t border-border bg-muted flex justify-end gap-3 px-6",children:b.jsx("button",{onClick:e,className:"px-6 py-2 text-xs font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors duration-75 shadow-sm",children:"Dismiss"})})]})]})}function J9(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function $9({isCompact:t}){const{entries:e,connected:i,clear:n,loaded:r}=X9(),[a,o]=E.useState(null),[c,h]=E.useState(""),[d,p]=E.useState(""),[g,x]=E.useState(""),v=E.useMemo(()=>e.filter(k=>!(c&&k.method!==c||d==="2xx"&&(k.statusCode<200||k.statusCode>=300)||d==="4xx"&&(k.statusCode<400||k.statusCode>=500)||d==="5xx"&&k.statusCode<500||g&&k.mode!==g)),[e,c,d,g]),w={mock:"bg-mode-mock/20 text-mode-mock border-mode-mock/20",delay:"bg-mode-delay/20 text-mode-delay border-mode-delay/20",passthrough:"bg-mode-passthrough/20 text-mode-passthrough border-mode-passthrough/20"};return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[!t&&b.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/40 bg-card",children:[b.jsx("div",{className:"flex items-center gap-6",children:b.jsxs("div",{className:"flex items-center gap-2.5",children:[b.jsx("div",{className:"relative",children:b.jsx(u3,{className:Se("w-4 h-4",i?"text-success":"text-destructive")})}),b.jsxs("div",{className:"flex flex-col",children:[b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-0.5",children:"Stream"}),b.jsxs("span",{className:"text-[11px] font-bold text-muted-foreground leading-none",children:[i?"Real-time":"Offline"," · ",e.length," entries"]})]})]})}),b.jsx("button",{onClick:n,className:"p-2 text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10 rounded-lg transition-colors duration-75",title:"Clear logs",children:b.jsx(co,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"px-4 py-2 flex items-center justify-between bg-muted border-b border-border/20",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(n3,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:c,onChange:k=>h(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Method"}),["GET","POST","PUT","PATCH","DELETE"].map(k=>b.jsx("option",{value:k,children:k},k))]})]}),b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(vm,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:d,onChange:k=>p(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Status"}),b.jsx("option",{value:"2xx",children:"2xx"}),b.jsx("option",{value:"4xx",children:"4xx"}),b.jsx("option",{value:"5xx",children:"5xx"})]})]}),b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(El,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:g,onChange:k=>x(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Mode"}),b.jsx("option",{value:"passthrough",children:"Pass"}),b.jsx("option",{value:"delay",children:"Delay"}),b.jsx("option",{value:"mock",children:"Mock"})]})]})]}),t&&b.jsx("button",{onClick:n,className:"p-1.5 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/5 rounded-md transition-colors duration-75",title:"Clear logs",children:b.jsx(co,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-y-auto relative bg-background",children:b.jsxs("div",{className:"min-w-full",children:[!t&&b.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 bg-muted border-b border-border/20 sticky top-0 z-10",children:[b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 shrink-0",children:"Time"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-[52px] shrink-0",children:"Method"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 flex-1",children:"Request Path"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-center",children:"Status"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-right",children:"Latency"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 text-center",children:"Mode"})]}),b.jsx("div",{className:"divide-y divide-border/20",children:v.length===0?b.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[r?b.jsx(vm,{className:"w-12 h-12 text-muted-foreground/10"}):b.jsx(Jc,{className:"w-8 h-8 animate-spin text-primary opacity-40"}),b.jsx("div",{className:"max-w-[200px]",children:b.jsx("p",{className:"text-sm font-bold text-foreground/80",children:e.length===0?"No Traffic Recorded":"No Matches"})})]}):v.slice(0,200).map(k=>b.jsxs("button",{onClick:()=>o(k),className:Se("flex flex-col gap-2 px-4 py-3 w-full text-left transition-colors duration-75 group border-b border-border/10",a?.id===k.id?"bg-primary/5 shadow-inner":"hover:bg-accent/30"),children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Vg,{method:k.method}),b.jsx("span",{className:"text-[10px] text-muted-foreground/60 font-mono font-bold tabular-nums",children:new Date(k.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs("div",{className:"flex items-center gap-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground opacity-60",children:[b.jsx(El,{className:"w-2.5 h-2.5 opacity-40"}),b.jsxs("span",{className:"tabular-nums",children:[k.latencyMs,"ms"]})]}),b.jsx(WA,{status:k.statusCode})]})]}),b.jsxs("div",{className:"flex items-center justify-between gap-4",children:[b.jsx("span",{className:"text-xs font-mono font-bold truncate text-foreground/90 group-hover:text-primary transition-colors duration-75 flex-1",children:k.path}),b.jsx("span",{className:Se("text-[8px] font-black uppercase tracking-[0.1em] px-1.5 py-0.5 rounded border leading-none",w[k.mode]),children:k.mode})]})]},k.id))})]})}),a&&b.jsx(Z9,{entry:a,onClose:()=>o(null)})]})}function e_(){const[t,e]=E.useState(!1);return b.jsxs("div",{className:"flex h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-r border-border/60 bg-background",children:[b.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-border/60 bg-muted/30 shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:b.jsx(Nl,{className:"w-4 h-4"})}),b.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Endpoints Registry"})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(F9,{open:t,onToggle:()=>e(i=>!i)}),b.jsx(W9,{})]})]}),b.jsx(P9,{open:t}),b.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:b.jsx("div",{className:"max-w-5xl mx-auto space-y-6",children:b.jsx(z9,{})})})]}),b.jsxs("div",{className:"w-[400px] lg:w-[450px] xl:w-[500px] hidden lg:flex flex-col bg-muted/5 shrink-0",children:[b.jsxs("div",{className:"px-5 py-4 flex items-center gap-3 border-b border-border/60 bg-muted/30 shrink-0",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:b.jsx(vm,{className:"w-4 h-4"})}),b.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Traffic Monitor"})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx($9,{isCompact:!0})})]})]})}const t_=new DN({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function i_(){return b.jsx(jN,{client:t_,children:b.jsx($E,{children:b.jsx(EE,{children:b.jsxs(Lc,{element:b.jsx(B5,{}),children:[b.jsx(Lc,{path:"/",element:b.jsx(e_,{})}),b.jsx(Lc,{path:"*",element:b.jsx(ME,{to:"/",replace:!0})})]})})})})}OO.createRoot(document.getElementById("root")).render(b.jsx(E.StrictMode,{children:b.jsx(i_,{})}));