interceptr 1.0.1 → 1.2.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 o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function i(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(r){if(r.ep)return;r.ep=!0;const o=i(r);fetch(r.href,o)}})();var yp={exports:{}},Uo={};var M1;function yO(){if(M1)return Uo;M1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:t,type:n,key:a,ref:r!==void 0?r:null,props:o}}return Uo.Fragment=e,Uo.jsx=i,Uo.jsxs=i,Uo}var T1;function xO(){return T1||(T1=1,yp.exports=yO()),yp.exports}var v=xO(),xp={exports:{}},ve={};var O1;function bO(){if(O1)return ve;O1=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"),o=Symbol.for("react.consumer"),a=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 b(E){return E===null||typeof E!="object"?null:(E=x&&E[x]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function M(E,Q,$){this.props=E,this.context=Q,this.refs=C,this.updater=$||w}M.prototype.isReactComponent={},M.prototype.setState=function(E,Q){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,Q,"setState")},M.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function T(){}T.prototype=M.prototype;function D(E,Q,$){this.props=E,this.context=Q,this.refs=C,this.updater=$||w}var j=D.prototype=new T;j.constructor=D,k(j,M.prototype),j.isPureReactComponent=!0;var B=Array.isArray;function P(){}var H={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function J(E,Q,$){var re=$.ref;return{$$typeof:t,type:E,key:Q,ref:re!==void 0?re:null,props:$}}function ue(E,Q){return J(E.type,Q,E.props)}function oe(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function F(E){var Q={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function($){return Q[$]})}var ee=/\/+/g;function fe(E,Q){return typeof E=="object"&&E!==null&&E.key!=null?F(""+E.key):Q.toString(36)}function de(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(P,P):(E.status="pending",E.then(function(Q){E.status==="pending"&&(E.status="fulfilled",E.value=Q)},function(Q){E.status==="pending"&&(E.status="rejected",E.reason=Q)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function q(E,Q,$,re,be){var ke=typeof E;(ke==="undefined"||ke==="boolean")&&(E=null);var ze=!1;if(E===null)ze=!0;else switch(ke){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(E.$$typeof){case t:case e:ze=!0;break;case p:return ze=E._init,q(ze(E._payload),Q,$,re,be)}}if(ze)return be=be(E),ze=re===""?"."+fe(E,0):re,B(be)?($="",ze!=null&&($=ze.replace(ee,"$&/")+"/"),q(be,Q,$,"",function(Ql){return Ql})):be!=null&&(oe(be)&&(be=ue(be,$+(be.key==null||E&&E.key===be.key?"":(""+be.key).replace(ee,"$&/")+"/")+ze)),Q.push(be)),1;ze=0;var Yt=re===""?".":re+":";if(B(E))for(var ut=0;ut<E.length;ut++)re=E[ut],ke=Yt+fe(re,ut),ze+=q(re,Q,$,ke,be);else if(ut=b(E),typeof ut=="function")for(E=ut.call(E),ut=0;!(re=E.next()).done;)re=re.value,ke=Yt+fe(re,ut++),ze+=q(re,Q,$,ke,be);else if(ke==="object"){if(typeof E.then=="function")return q(de(E),Q,$,re,be);throw Q=String(E),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ze}function X(E,Q,$){if(E==null)return E;var re=[],be=0;return q(E,re,"","",function(ke){return Q.call($,ke,be++)}),re}function ne(E){if(E._status===-1){var Q=E._result;Q=Q(),Q.then(function($){(E._status===0||E._status===-1)&&(E._status=1,E._result=$)},function($){(E._status===0||E._status===-1)&&(E._status=2,E._result=$)}),E._status===-1&&(E._status=0,E._result=Q)}if(E._status===1)return E._result.default;throw E._result}var ce=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},ye={map:X,forEach:function(E,Q,$){X(E,function(){Q.apply(this,arguments)},$)},count:function(E){var Q=0;return X(E,function(){Q++}),Q},toArray:function(E){return X(E,function(Q){return Q})||[]},only:function(E){if(!oe(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return ve.Activity=g,ve.Children=ye,ve.Component=M,ve.Fragment=i,ve.Profiler=r,ve.PureComponent=D,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(E){return H.H.useMemoCache(E)}},ve.cache=function(E){return function(){return E.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(E,Q,$){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var re=k({},E.props),be=E.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),Yt=0;Yt<ke;Yt++)ze[Yt]=arguments[Yt+2];re.children=ze}return J(E.type,be,re)},ve.createContext=function(E){return E={$$typeof:a,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:o,_context:E},E},ve.createElement=function(E,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 Yt=Array(ze),ut=0;ut<ze;ut++)Yt[ut]=arguments[ut+2];be.children=Yt}if(E&&E.defaultProps)for(re in ze=E.defaultProps,ze)be[re]===void 0&&(be[re]=ze[re]);return J(E,ke,be)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(E){return{$$typeof:c,render:E}},ve.isValidElement=oe,ve.lazy=function(E){return{$$typeof:p,_payload:{_status:-1,_result:E},_init:ne}},ve.memo=function(E,Q){return{$$typeof:d,type:E,compare:Q===void 0?null:Q}},ve.startTransition=function(E){var Q=H.T,$={};H.T=$;try{var re=E(),be=H.S;be!==null&&be($,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(P,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(E){return H.H.use(E)},ve.useActionState=function(E,Q,$){return H.H.useActionState(E,Q,$)},ve.useCallback=function(E,Q){return H.H.useCallback(E,Q)},ve.useContext=function(E){return H.H.useContext(E)},ve.useDebugValue=function(){},ve.useDeferredValue=function(E,Q){return H.H.useDeferredValue(E,Q)},ve.useEffect=function(E,Q){return H.H.useEffect(E,Q)},ve.useEffectEvent=function(E){return H.H.useEffectEvent(E)},ve.useId=function(){return H.H.useId()},ve.useImperativeHandle=function(E,Q,$){return H.H.useImperativeHandle(E,Q,$)},ve.useInsertionEffect=function(E,Q){return H.H.useInsertionEffect(E,Q)},ve.useLayoutEffect=function(E,Q){return H.H.useLayoutEffect(E,Q)},ve.useMemo=function(E,Q){return H.H.useMemo(E,Q)},ve.useOptimistic=function(E,Q){return H.H.useOptimistic(E,Q)},ve.useReducer=function(E,Q,$){return H.H.useReducer(E,Q,$)},ve.useRef=function(E){return H.H.useRef(E)},ve.useState=function(E){return H.H.useState(E)},ve.useSyncExternalStore=function(E,Q,$){return H.H.useSyncExternalStore(E,Q,$)},ve.useTransition=function(){return H.H.useTransition()},ve.version="19.2.4",ve}var E1;function Sg(){return E1||(E1=1,xp.exports=bO()),xp.exports}var N=Sg(),bp={exports:{}},qo={},vp={exports:{}},Sp={};var N1;function vO(){return N1||(N1=1,(function(t){function e(q,X){var ne=q.length;q.push(X);e:for(;0<ne;){var ce=ne-1>>>1,ye=q[ce];if(0<r(ye,X))q[ce]=X,q[ne]=ye,ne=ce;else break e}}function i(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var X=q[0],ne=q.pop();if(ne!==X){q[0]=ne;e:for(var ce=0,ye=q.length,E=ye>>>1;ce<E;){var Q=2*(ce+1)-1,$=q[Q],re=Q+1,be=q[re];if(0>r($,ne))re<ye&&0>r(be,$)?(q[ce]=be,q[re]=ne,ce=re):(q[ce]=$,q[Q]=ne,ce=Q);else if(re<ye&&0>r(be,ne))q[ce]=be,q[re]=ne,ce=re;else break e}}return X}function r(q,X){var ne=q.sortIndex-X.sortIndex;return ne!==0?ne:q.id-X.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var h=[],d=[],p=1,g=null,x=3,b=!1,w=!1,k=!1,C=!1,M=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function j(q){for(var X=i(d);X!==null;){if(X.callback===null)n(d);else if(X.startTime<=q)n(d),X.sortIndex=X.expirationTime,e(h,X);else break;X=i(d)}}function B(q){if(k=!1,j(q),!w)if(i(h)!==null)w=!0,P||(P=!0,F());else{var X=i(d);X!==null&&de(B,X.startTime-q)}}var P=!1,H=-1,Z=5,J=-1;function ue(){return C?!0:!(t.unstable_now()-J<Z)}function oe(){if(C=!1,P){var q=t.unstable_now();J=q;var X=!0;try{e:{w=!1,k&&(k=!1,T(H),H=-1),b=!0;var ne=x;try{t:{for(j(q),g=i(h);g!==null&&!(g.expirationTime>q&&ue());){var ce=g.callback;if(typeof ce=="function"){g.callback=null,x=g.priorityLevel;var ye=ce(g.expirationTime<=q);if(q=t.unstable_now(),typeof ye=="function"){g.callback=ye,j(q),X=!0;break t}g===i(h)&&n(h),j(q)}else n(h);g=i(h)}if(g!==null)X=!0;else{var E=i(d);E!==null&&de(B,E.startTime-q),X=!1}}break e}finally{g=null,x=ne,b=!1}X=void 0}}finally{X?F():P=!1}}}var F;if(typeof D=="function")F=function(){D(oe)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,fe=ee.port2;ee.port1.onmessage=oe,F=function(){fe.postMessage(null)}}else F=function(){M(oe,0)};function de(q,X){H=M(function(){q(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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(q){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var ne=x;x=X;try{return q()}finally{x=ne}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ne=x;x=q;try{return X()}finally{x=ne}},t.unstable_scheduleCallback=function(q,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,q){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,q={id:p++,callback:X,priorityLevel:q,startTime:ne,expirationTime:ye,sortIndex:-1},ne>ce?(q.sortIndex=ne,e(d,q),i(h)===null&&q===i(d)&&(k?(T(H),H=-1):k=!0,de(B,ne-ce))):(q.sortIndex=ye,e(h,q),w||b||(w=!0,P||(P=!0,F()))),q},t.unstable_shouldYield=ue,t.unstable_wrapCallback=function(q){var X=x;return function(){var ne=x;x=X;try{return q.apply(this,arguments)}finally{x=ne}}}})(Sp)),Sp}var R1;function SO(){return R1||(R1=1,vp.exports=vO()),vp.exports}var wp={exports:{}},qt={};var D1;function wO(){if(D1)return qt;D1=1;var t=Sg();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 o(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 a=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 o(h,d,null,p)},qt.flushSync=function(h){var d=a.T,p=n.p;try{if(a.T=null,n.p=2,h)return h()}finally{a.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,b=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:b}):p==="script"&&n.d.X(h,{crossOrigin:g,integrity:x,fetchPriority:b,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 a.H.useFormState(h,d,p)},qt.useFormStatus=function(){return a.H.useHostTransitionStatus()},qt.version="19.2.4",qt}var j1;function kO(){if(j1)return wp.exports;j1=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(),wp.exports=wO(),wp.exports}var L1;function CO(){if(L1)return qo;L1=1;var t=SO(),e=Sg(),i=kO();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 o(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 a(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(o(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=o(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"),b=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"),D=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),P=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"),oe=Symbol.iterator;function F(s){return s===null||typeof s!="object"?null:(s=oe&&s[oe]||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 B:return"Suspense";case P:return"SuspenseList";case J:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case D:return s.displayName||"Context";case T:return(s._context.displayName||"Context")+".Consumer";case j: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,q=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 E(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=E(null),be=E(null),ke=E(null),ze=E(null);function Yt(s,l){switch($(ke,l),$(be,s),$(re,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?Wb(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=Wb(l),s=Xb(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 Ql(s){s.memoizedState!==null&&$(ze,s);var l=re.current,u=Xb(l,s.type);l!==u&&($(be,s),$(re,u))}function Va(s){be.current===s&&(Q(re),Q(be)),ze.current===s&&(Q(ze),Bo._currentValue=ne)}var Jh,A0;function Vr(s){if(Jh===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);Jh=l&&l[1]||"",A0=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Jh+s+A0}var $h=!1;function ef(s,l){if(!s||$h)return"";$h=!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 U=V}Reflect.construct(s,[],K)}else{try{K.call()}catch(V){U=V}s.call(K.prototype)}}else{try{throw Error()}catch(V){U=V}(K=s())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(V){if(V&&U&&typeof V.stack=="string")return[V.stack,U.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 Y=`
6
+ `+O[f].replace(" at new "," at ");return s.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",s.displayName)),Y}while(1<=f&&0<=m);break}}}finally{$h=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Vr(u):""}function KA(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 ef(s.type,!1);case 11:return ef(s.type.render,!1);case 1:return ef(s.type,!0);case 31:return Vr("Activity");default:return""}}function M0(s){try{var l="",u=null;do l+=KA(s,u),u=s,s=s.return;while(s);return l}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var tf=Object.prototype.hasOwnProperty,nf=t.unstable_scheduleCallback,rf=t.unstable_cancelCallback,WA=t.unstable_shouldYield,XA=t.unstable_requestPaint,di=t.unstable_now,ZA=t.unstable_getCurrentPriorityLevel,T0=t.unstable_ImmediatePriority,O0=t.unstable_UserBlockingPriority,Ia=t.unstable_NormalPriority,JA=t.unstable_LowPriority,E0=t.unstable_IdlePriority,$A=t.log,eM=t.unstable_setDisableYieldValue,Yl=null,pi=null;function Jn(s){if(typeof $A=="function"&&eM(s),pi&&typeof pi.setStrictMode=="function")try{pi.setStrictMode(Yl,s)}catch{}}var mi=Math.clz32?Math.clz32:nM,tM=Math.log,iM=Math.LN2;function nM(s){return s>>>=0,s===0?32:31-(tM(s)/iM|0)|0}var Qa=256,Ya=262144,Ga=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 Ka(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 Gl(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function rM(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 N0(){var s=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),s}function sf(s){for(var l=[],u=0;31>u;u++)l.push(s);return l}function Kl(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function sM(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 Y=31-mi(u),K=1<<Y;A[Y]=0,O[Y]=-1;var U=_[Y];if(U!==null)for(_[Y]=null,Y=0;Y<U.length;Y++){var V=U[Y];V!==null&&(V.lane&=-536870913)}u&=~K}f!==0&&R0(s,f,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(S&~l))}function R0(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 D0(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 j0(s,l){var u=l&-l;return u=(u&42)!==0?1:lf(u),(u&(s.suspendedLanes|l))!==0?0:u}function lf(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 of(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function L0(){var s=X.p;return s!==0?s:(s=window.event,s===void 0?32:b1(s.type))}function B0(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,Ms="__reactContainer$"+$n,af="__reactEvents$"+$n,lM="__reactListeners$"+$n,oM="__reactHandles$"+$n,z0="__reactResources$"+$n,Wl="__reactMarker$"+$n;function uf(s){delete s[Rt],delete s[$t],delete s[af],delete s[lM],delete s[oM]}function Ts(s){var l=s[Rt];if(l)return l;for(var u=s.parentNode;u;){if(l=u[Ms]||u[Rt]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(s=n1(s);s!==null;){if(u=s[Rt])return u;s=n1(s)}return l}s=u,u=s.parentNode}return null}function Os(s){if(s=s[Rt]||s[Ms]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Xl(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Es(s){var l=s[z0];return l||(l=s[z0]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Mt(s){s[Wl]=!0}var _0=new Set,H0={};function Qr(s,l){Ns(s,l),Ns(s+"Capture",l)}function Ns(s,l){for(H0[s]=l,s=0;s<l.length;s++)_0.add(l[s])}var aM=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]*$"),U0={},q0={};function uM(s){return tf.call(q0,s)?!0:tf.call(U0,s)?!1:aM.test(s)?q0[s]=!0:(U0[s]=!0,!1)}function Wa(s,l,u){if(uM(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 Xa(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 P0(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function cM(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 cf(s){if(!s._valueTracker){var l=P0(s)?"checked":"value";s._valueTracker=cM(s,l,""+s[l])}}function F0(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var u=l.getValue(),f="";return s&&(f=P0(s)?s.checked?"true":"false":s.value),s=f,s!==u?(l.setValue(s),!0):!1}function Za(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 hM=/[\n"\\]/g;function Ei(s){return s.replace(hM,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function hf(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?ff(s,S,Oi(l)):u!=null?ff(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 V0(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)){cf(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),cf(s)}function ff(s,l,u){l==="number"&&Za(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Rs(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 I0(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 Q0(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),cf(s)}function Ds(s,l){if(l){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=l;return}}s.textContent=l}var fM=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||fM.has(l)?l==="float"?s.cssFloat=u:s[l]=(""+u).trim():s[l]=u+"px"}function G0(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 df(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 dM=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"]]),pM=/^[\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 Ja(s){return pM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function An(){}var pf=null;function mf(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var js=null,Ls=null;function K0(s){var l=Os(s);if(l&&(s=l.stateNode)){var u=s[$t]||null;e:switch(s=l.stateNode,l.type){case"input":if(hf(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));hf(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&&F0(f)}break e;case"textarea":I0(s,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&Rs(s,!!u.multiple,l,!1)}}}var gf=!1;function W0(s,l,u){if(gf)return s(l,u);gf=!0;try{var f=s(l);return f}finally{if(gf=!1,(js!==null||Ls!==null)&&(Uu(),js&&(l=js,s=Ls,Ls=js=null,K0(l),s)))for(l=0;l<s.length;l++)K0(s[l])}}function Zl(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"),yf=!1;if(Mn)try{var Jl={};Object.defineProperty(Jl,"passive",{get:function(){yf=!0}}),window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{yf=!1}var er=null,xf=null,$a=null;function X0(){if($a)return $a;var s,l=xf,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 $a=m.slice(s,1<f?1-f:void 0)}function eu(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 tu(){return!0}function Z0(){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)?tu:Z0,this.isPropagationStopped=Z0,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=tu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=tu)},persist:function(){},isPersistent:tu}),l}var Yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iu=ei(Yr),$l=g({},Yr,{view:0,detail:0}),mM=ei($l),bf,vf,eo,nu=g({},$l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wf,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!==eo&&(eo&&s.type==="mousemove"?(bf=s.screenX-eo.screenX,vf=s.screenY-eo.screenY):vf=bf=0,eo=s),bf)},movementY:function(s){return"movementY"in s?s.movementY:vf}}),J0=ei(nu),gM=g({},nu,{dataTransfer:0}),yM=ei(gM),xM=g({},$l,{relatedTarget:0}),Sf=ei(xM),bM=g({},Yr,{animationName:0,elapsedTime:0,pseudoElement:0}),vM=ei(bM),SM=g({},Yr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),wM=ei(SM),kM=g({},Yr,{data:0}),$0=ei(kM),CM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AM={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"},MM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TM(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=MM[s])?!!l[s]:!1}function wf(){return TM}var OM=g({},$l,{key:function(s){if(s.key){var l=CM[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=eu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?AM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wf,charCode:function(s){return s.type==="keypress"?eu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?eu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),EM=ei(OM),NM=g({},nu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ey=ei(NM),RM=g({},$l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wf}),DM=ei(RM),jM=g({},Yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),LM=ei(jM),BM=g({},nu,{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}),zM=ei(BM),_M=g({},Yr,{newState:0,oldState:0}),HM=ei(_M),UM=[9,13,27,32],kf=Mn&&"CompositionEvent"in window,to=null;Mn&&"documentMode"in document&&(to=document.documentMode);var qM=Mn&&"TextEvent"in window&&!to,ty=Mn&&(!kf||to&&8<to&&11>=to),iy=" ",ny=!1;function ry(s,l){switch(s){case"keyup":return UM.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sy(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Bs=!1;function PM(s,l){switch(s){case"compositionend":return sy(l);case"keypress":return l.which!==32?null:(ny=!0,iy);case"textInput":return s=l.data,s===iy&&ny?null:s;default:return null}}function FM(s,l){if(Bs)return s==="compositionend"||!kf&&ry(s,l)?(s=X0(),$a=xf=er=null,Bs=!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 ty&&l.locale!=="ko"?null:l.data;default:return null}}var VM={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 ly(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!VM[s.type]:l==="textarea"}function oy(s,l,u,f){js?Ls?Ls.push(f):Ls=[f]:js=f,l=Yu(l,"onChange"),0<l.length&&(u=new iu("onChange","change",null,u,f),s.push({event:u,listeners:l}))}var io=null,no=null;function IM(s){Vb(s,0)}function ru(s){var l=Xl(s);if(F0(l))return s}function ay(s,l){if(s==="change")return l}var uy=!1;if(Mn){var Cf;if(Mn){var Af="oninput"in document;if(!Af){var cy=document.createElement("div");cy.setAttribute("oninput","return;"),Af=typeof cy.oninput=="function"}Cf=Af}else Cf=!1;uy=Cf&&(!document.documentMode||9<document.documentMode)}function hy(){io&&(io.detachEvent("onpropertychange",fy),no=io=null)}function fy(s){if(s.propertyName==="value"&&ru(no)){var l=[];oy(l,no,s,mf(s)),W0(IM,l)}}function QM(s,l,u){s==="focusin"?(hy(),io=l,no=u,io.attachEvent("onpropertychange",fy)):s==="focusout"&&hy()}function YM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ru(no)}function GM(s,l){if(s==="click")return ru(l)}function KM(s,l){if(s==="input"||s==="change")return ru(l)}function WM(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var gi=typeof Object.is=="function"?Object.is:WM;function ro(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(!tf.call(l,m)||!gi(s[m],l[m]))return!1}return!0}function dy(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function py(s,l){var u=dy(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=dy(u)}}function my(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?my(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function gy(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=Za(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=Za(s.document)}return l}function Mf(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 XM=Mn&&"documentMode"in document&&11>=document.documentMode,zs=null,Tf=null,so=null,Of=!1;function yy(s,l,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Of||zs==null||zs!==Za(f)||(f=zs,"selectionStart"in f&&Mf(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}),so&&ro(so,f)||(so=f,f=Yu(Tf,"onSelect"),0<f.length&&(l=new iu("onSelect","select",null,l,u),s.push({event:l,listeners:f}),l.target=zs)))}function Gr(s,l){var u={};return u[s.toLowerCase()]=l.toLowerCase(),u["Webkit"+s]="webkit"+l,u["Moz"+s]="moz"+l,u}var _s={animationend:Gr("Animation","AnimationEnd"),animationiteration:Gr("Animation","AnimationIteration"),animationstart:Gr("Animation","AnimationStart"),transitionrun:Gr("Transition","TransitionRun"),transitionstart:Gr("Transition","TransitionStart"),transitioncancel:Gr("Transition","TransitionCancel"),transitionend:Gr("Transition","TransitionEnd")},Ef={},xy={};Mn&&(xy=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Kr(s){if(Ef[s])return Ef[s];if(!_s[s])return s;var l=_s[s],u;for(u in l)if(l.hasOwnProperty(u)&&u in xy)return Ef[s]=l[u];return s}var by=Kr("animationend"),vy=Kr("animationiteration"),Sy=Kr("animationstart"),ZM=Kr("transitionrun"),JM=Kr("transitionstart"),$M=Kr("transitioncancel"),wy=Kr("transitionend"),ky=new Map,Nf="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(" ");Nf.push("scrollEnd");function Yi(s,l){ky.set(s,l),Qr(l,[s])}var su=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=[],Hs=0,Rf=0;function lu(){for(var s=Hs,l=Rf=Hs=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&&Cy(u,m,y)}}function ou(s,l,u,f){Ni[Hs++]=s,Ni[Hs++]=l,Ni[Hs++]=u,Ni[Hs++]=f,Rf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Df(s,l,u,f){return ou(s,l,u,f),au(s)}function Wr(s,l){return ou(s,null,null,l),au(s)}function Cy(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 au(s){if(50<Oo)throw Oo=0,Pd=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Us={};function eT(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 eT(s,l,u,f)}function jf(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 Ay(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 uu(s,l,u,f,m,y){var S=0;if(f=s,typeof s=="function")jf(s)&&(S=1);else if(typeof s=="string")S=sO(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 B:return s=yi(13,u,l,m),s.elementType=B,s.lanes=y,s;case P:return s=yi(19,u,l,m),s.elementType=P,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case D:S=10;break e;case T:S=9;break e;case j: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 Lf(s,l,u){return s=yi(6,s,null,l),s.lanes=u,s}function My(s){var l=yi(18,null,null,0);return l.stateNode=s,l}function Bf(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 Ty=new WeakMap;function Ri(s,l){if(typeof s=="object"&&s!==null){var u=Ty.get(s);return u!==void 0?u:(l={value:s,source:l,stack:M0(l)},Ty.set(s,l),l)}return{value:s,source:l,stack:M0(l)}}var qs=[],Ps=0,cu=null,lo=0,Di=[],ji=0,tr=null,rn=1,sn="";function On(s,l){qs[Ps++]=lo,qs[Ps++]=cu,cu=s,lo=l}function Oy(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 zf(s){s.return!==null&&(On(s,1),Oy(s,1,0))}function _f(s){for(;s===cu;)cu=qs[--Ps],qs[Ps]=null,lo=qs[--Ps],qs[Ps]=null;for(;s===tr;)tr=Di[--ji],Di[ji]=null,sn=Di[--ji],Di[ji]=null,rn=Di[--ji],Di[ji]=null}function Ey(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,Hf=Error(n(519));function nr(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oo(Ri(l,s)),Hf}function Ny(s){var l=s.stateNode,u=s.type,f=s.memoizedProps;switch(l[Rt]=s,l[$t]=f,u){case"dialog":Ee("cancel",l),Ee("close",l);break;case"iframe":case"object":case"embed":Ee("load",l);break;case"video":case"audio":for(u=0;u<No.length;u++)Ee(No[u],l);break;case"source":Ee("error",l);break;case"img":case"image":case"link":Ee("error",l),Ee("load",l);break;case"details":Ee("toggle",l);break;case"input":Ee("invalid",l),V0(l,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ee("invalid",l);break;case"textarea":Ee("invalid",l),Q0(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||Gb(l.textContent,u)?(f.popover!=null&&(Ee("beforetoggle",l),Ee("toggle",l)),f.onScroll!=null&&Ee("scroll",l),f.onScrollEnd!=null&&Ee("scrollend",l),f.onClick!=null&&(l.onclick=An),l=!0):l=!1,l||nr(s,!0)}function Ry(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 Fs(s){if(s!==Dt)return!1;if(!Le)return Ry(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")||ip(s.type,s.memoizedProps)),u=!u),u&&$e&&nr(s),Ry(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=i1(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));$e=i1(s)}else l===27?(l=$e,yr(s.type)?(s=op,op=null,$e=s):$e=l):$e=Dt?zi(s.stateNode.nextSibling):null;return!0}function Zr(){$e=Dt=null,Le=!1}function Uf(){var s=ir;return s!==null&&(ri===null?ri=s:ri.push.apply(ri,s),ir=null),s}function oo(s){ir===null?ir=[s]:ir.push(s)}var qf=E(null),Jr=null,En=null;function rr(s,l,u){$(qf,l._currentValue),l._currentValue=u}function Nn(s){s._currentValue=qf.current,Q(qf)}function Pf(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 Ff(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),Pf(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),Pf(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 Vs(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(Bo):s=[Bo])}m=m.return}s!==null&&Ff(l,s,u,f),l.flags|=262144}function hu(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 Dy(Jr,s)}function fu(s,l){return Jr===null&&$r(s),Dy(s,l)}function Dy(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 tT=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()})}},iT=t.unstable_scheduleCallback,nT=t.unstable_NormalPriority,mt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vf(){return{controller:new tT,data:new Map,refCount:0}}function ao(s){s.refCount--,s.refCount===0&&iT(nT,function(){s.controller.abort()})}var uo=null,If=0,Is=0,Qs=null;function rT(s,l){if(uo===null){var u=uo=[];If=0,Is=Gd(),Qs={status:"pending",value:void 0,then:function(f){u.push(f)}}}return If++,l.then(jy,jy),l}function jy(){if(--If===0&&uo!==null){Qs!==null&&(Qs.status="fulfilled");var s=uo;uo=null,Is=0,Qs=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function sT(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 Ly=q.S;q.S=function(s,l){yb=di(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&rT(s,l),Ly!==null&&Ly(s,l)};var es=E(null);function Qf(){var s=es.current;return s!==null?s:We.pooledCache}function du(s,l){l===null?$(es,es.current):$(es,l.pool)}function By(){var s=Qf();return s===null?null:{parent:mt._currentValue,pool:s}}var Ys=Error(n(460)),Yf=Error(n(474)),pu=Error(n(542)),mu={then:function(){}};function zy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function _y(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,Uy(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,Uy(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 Hy(){if(is===null)throw Error(n(459));var s=is;return is=null,s}function Uy(s){if(s===Ys||s===pu)throw Error(n(483))}var Gs=null,co=0;function gu(s){var l=co;return co+=1,Gs===null&&(Gs=[]),_y(Gs,s,l)}function ho(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function yu(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 qy(s){function l(L,R){if(s){var z=L.deletions;z===null?(L.deletions=[R],L.flags|=16):z.push(R)}}function u(L,R){if(!s)return null;for(;R!==null;)l(L,R),R=R.sibling;return null}function f(L){for(var R=new Map;L!==null;)L.key!==null?R.set(L.key,L):R.set(L.index,L),L=L.sibling;return R}function m(L,R){return L=Tn(L,R),L.index=0,L.sibling=null,L}function y(L,R,z){return L.index=z,s?(z=L.alternate,z!==null?(z=z.index,z<R?(L.flags|=67108866,R):z):(L.flags|=67108866,R)):(L.flags|=1048576,R)}function S(L){return s&&L.alternate===null&&(L.flags|=67108866),L}function A(L,R,z,G){return R===null||R.tag!==6?(R=Lf(z,L.mode,G),R.return=L,R):(R=m(R,z),R.return=L,R)}function O(L,R,z,G){var me=z.type;return me===k?Y(L,R,z.props.children,G,z.key):R!==null&&(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===Z&&ts(me)===R.type)?(R=m(R,z.props),ho(R,z),R.return=L,R):(R=uu(z.type,z.key,z.props,null,L.mode,G),ho(R,z),R.return=L,R)}function _(L,R,z,G){return R===null||R.tag!==4||R.stateNode.containerInfo!==z.containerInfo||R.stateNode.implementation!==z.implementation?(R=Bf(z,L.mode,G),R.return=L,R):(R=m(R,z.children||[]),R.return=L,R)}function Y(L,R,z,G,me){return R===null||R.tag!==7?(R=Xr(z,L.mode,G,me),R.return=L,R):(R=m(R,z),R.return=L,R)}function K(L,R,z){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Lf(""+R,L.mode,z),R.return=L,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case b:return z=uu(R.type,R.key,R.props,null,L.mode,z),ho(z,R),z.return=L,z;case w:return R=Bf(R,L.mode,z),R.return=L,R;case Z:return R=ts(R),K(L,R,z)}if(de(R)||F(R))return R=Xr(R,L.mode,z,null),R.return=L,R;if(typeof R.then=="function")return K(L,gu(R),z);if(R.$$typeof===D)return K(L,fu(L,R),z);yu(L,R)}return null}function U(L,R,z,G){var me=R!==null?R.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return me!==null?null:A(L,R,""+z,G);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case b:return z.key===me?O(L,R,z,G):null;case w:return z.key===me?_(L,R,z,G):null;case Z:return z=ts(z),U(L,R,z,G)}if(de(z)||F(z))return me!==null?null:Y(L,R,z,G,null);if(typeof z.then=="function")return U(L,R,gu(z),G);if(z.$$typeof===D)return U(L,R,fu(L,z),G);yu(L,z)}return null}function V(L,R,z,G,me){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return L=L.get(z)||null,A(R,L,""+G,me);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return L=L.get(G.key===null?z:G.key)||null,O(R,L,G,me);case w:return L=L.get(G.key===null?z:G.key)||null,_(R,L,G,me);case Z:return G=ts(G),V(L,R,z,G,me)}if(de(G)||F(G))return L=L.get(z)||null,Y(R,L,G,me,null);if(typeof G.then=="function")return V(L,R,z,gu(G),me);if(G.$$typeof===D)return V(L,R,z,fu(R,G),me);yu(R,G)}return null}function ae(L,R,z,G){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=U(L,he,z[Ae],G);if(He===null){he===null&&(he=je);break}s&&he&&He.alternate===null&&l(L,he),R=y(He,R,Ae),_e===null?me=He:_e.sibling=He,_e=He,he=je}if(Ae===z.length)return u(L,he),Le&&On(L,Ae),me;if(he===null){for(;Ae<z.length;Ae++)he=K(L,z[Ae],G),he!==null&&(R=y(he,R,Ae),_e===null?me=he:_e.sibling=he,_e=he);return Le&&On(L,Ae),me}for(he=f(he);Ae<z.length;Ae++)je=V(he,L,Ae,z[Ae],G),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(L,wr)}),Le&&On(L,Ae),me}function xe(L,R,z,G){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=U(L,he,He.value,G);if(wr===null){he===null&&(he=je);break}s&&he&&wr.alternate===null&&l(L,he),R=y(wr,R,Ae),_e===null?me=wr:_e.sibling=wr,_e=wr,he=je}if(He.done)return u(L,he),Le&&On(L,Ae),me;if(he===null){for(;!He.done;Ae++,He=z.next())He=K(L,He.value,G),He!==null&&(R=y(He,R,Ae),_e===null?me=He:_e.sibling=He,_e=He);return Le&&On(L,Ae),me}for(he=f(he);!He.done;Ae++,He=z.next())He=V(he,L,Ae,He.value,G),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(gO){return l(L,gO)}),Le&&On(L,Ae),me}function Ge(L,R,z,G){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 b:e:{for(var me=z.key;R!==null;){if(R.key===me){if(me=z.type,me===k){if(R.tag===7){u(L,R.sibling),G=m(R,z.props.children),G.return=L,L=G;break e}}else if(R.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===Z&&ts(me)===R.type){u(L,R.sibling),G=m(R,z.props),ho(G,z),G.return=L,L=G;break e}u(L,R);break}else l(L,R);R=R.sibling}z.type===k?(G=Xr(z.props.children,L.mode,G,z.key),G.return=L,L=G):(G=uu(z.type,z.key,z.props,null,L.mode,G),ho(G,z),G.return=L,L=G)}return S(L);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(L,R.sibling),G=m(R,z.children||[]),G.return=L,L=G;break e}else{u(L,R);break}else l(L,R);R=R.sibling}G=Bf(z,L.mode,G),G.return=L,L=G}return S(L);case Z:return z=ts(z),Ge(L,R,z,G)}if(de(z))return ae(L,R,z,G);if(F(z)){if(me=F(z),typeof me!="function")throw Error(n(150));return z=me.call(z),xe(L,R,z,G)}if(typeof z.then=="function")return Ge(L,R,gu(z),G);if(z.$$typeof===D)return Ge(L,R,fu(L,z),G);yu(L,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,R!==null&&R.tag===6?(u(L,R.sibling),G=m(R,z),G.return=L,L=G):(u(L,R),G=Lf(z,L.mode,G),G.return=L,L=G),S(L)):u(L,R)}return function(L,R,z,G){try{co=0;var me=Ge(L,R,z,G);return Gs=null,me}catch(he){if(he===Ys||he===pu)throw he;var _e=yi(29,he,null,L.mode);return _e.lanes=G,_e.return=L,_e}}}var ns=qy(!0),Py=qy(!1),sr=!1;function Gf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kf(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 or(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=au(s),Cy(s,null,u),l}return ou(s,f,l,u),au(s)}function fo(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,D0(s,u)}}function Wf(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 Xf=!1;function po(){if(Xf){var s=Qs;if(s!==null)throw s}}function mo(s,l,u,f){Xf=!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 Y=s.alternate;Y!==null&&(Y=Y.updateQueue,A=Y.lastBaseUpdate,A!==S&&(A===null?Y.firstBaseUpdate=_:A.next=_,Y.lastBaseUpdate=O))}if(y!==null){var K=m.baseState;S=0,Y=_=O=null,A=y;do{var U=A.lane&-536870913,V=U!==A.lane;if(V?(De&U)===U:(f&U)===U){U!==0&&U===Is&&(Xf=!0),Y!==null&&(Y=Y.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ae=s,xe=A;U=l;var Ge=u;switch(xe.tag){case 1:if(ae=xe.payload,typeof ae=="function"){K=ae.call(Ge,K,U);break e}K=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=xe.payload,U=typeof ae=="function"?ae.call(Ge,K,U):ae,U==null)break e;K=g({},K,U);break e;case 2:sr=!0}}U=A.callback,U!==null&&(s.flags|=64,V&&(s.flags|=8192),V=m.callbacks,V===null?m.callbacks=[U]:V.push(U))}else V={lane:U,tag:A.tag,payload:A.payload,callback:A.callback,next:null},Y===null?(_=Y=V,O=K):Y=Y.next=V,S|=U;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);Y===null&&(O=K),m.baseState=O,m.firstBaseUpdate=_,m.lastBaseUpdate=Y,y===null&&(m.shared.lanes=0),fr|=S,s.lanes=S,s.memoizedState=K}}function Fy(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function Vy(s,l){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Fy(u[s],l)}var Ks=E(null),xu=E(0);function Iy(s,l){s=Un,$(xu,s),$(Ks,l),Un=s|l.baseLanes}function Zf(){$(xu,Un),$(Ks,Ks.current)}function Jf(){Un=xu.current,Q(Ks),Q(xu)}var xi=E(null),Bi=null;function ar(s){var l=s.alternate;$(ct,ct.current&1),$(xi,s),Bi===null&&(l===null||Ks.current!==null||l.memoizedState!==null)&&(Bi=s)}function $f(s){$(ct,ct.current),$(xi,s),Bi===null&&(Bi=s)}function Qy(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=E(0);function bu(s){for(var l=s;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||sp(u)||lp(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,vu=!1,Ws=!1,rs=!1,Su=0,go=0,Xs=null,lT=0;function st(){throw Error(n(321))}function ed(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 td(s,l,u,f,m,y){return Rn=y,Ce=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,q.H=s===null||s.memoizedState===null?Ox:gd,rs=!1,y=u(f,m),rs=!1,Ws&&(y=Gy(l,u,f,m)),Yy(s),y}function Yy(s){q.H=bo;var l=Qe!==null&&Qe.next!==null;if(Rn=0,gt=Qe=Ce=null,vu=!1,go=0,Xs=null,l)throw Error(n(300));s===null||yt||(s=s.dependencies,s!==null&&hu(s)&&(yt=!0))}function Gy(s,l,u,f){Ce=s;var m=0;do{if(Ws&&(Xs=null),go=0,Ws=!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)}q.H=Ex,y=l(u,f)}while(Ws);return y}function oT(){var s=q.H,l=s.useState()[0];return l=typeof l.then=="function"?yo(l):l,s=s.useState()[0],(Qe!==null?Qe.memoizedState:null)!==s&&(Ce.flags|=1024),l}function id(){var s=Su!==0;return Su=0,s}function nd(s,l,u){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~u}function rd(s){if(vu){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}vu=!1}Rn=0,gt=Qe=Ce=null,Ws=!1,go=Su=0,Xs=null}function Gt(){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 wu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yo(s){var l=go;return go+=1,Xs===null&&(Xs=[]),s=_y(Xs,s,l),l=Ce,(gt===null?l.memoizedState:gt.next)===null&&(l=l.alternate,q.H=l===null||l.memoizedState===null?Ox:gd),s}function ku(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return yo(s);if(s.$$typeof===D)return jt(s)}throw Error(n(438,String(s)))}function sd(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=wu(),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 Cu(s){var l=ht();return ld(l,Qe,s)}function ld(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,Y=!1;do{var K=_.lane&-536870913;if(K!==_.lane?(De&K)===K:(Rn&K)===K){var U=_.revertLane;if(U===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),K===Is&&(Y=!0);else if((Rn&U)===U){_=_.next,U===Is&&(Y=!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|=U,fr|=U;K=_.action,rs&&u(y,K),y=_.hasEagerState?_.eagerState:u(y,K)}else U={lane:K,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},O===null?(A=O=U,S=y):O=O.next=U,Ce.lanes|=K,fr|=K;_=_.next}while(_!==null&&_!==l);if(O===null?S=y:O.next=A,!gi(y,s.memoizedState)&&(yt=!0,Y&&(u=Qs,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 od(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 Ky(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,cd(Zy.bind(null,f,m,s),[s]),m.getSnapshot!==l||S||gt!==null&&gt.memoizedState.tag&1){if(f.flags|=2048,Zs(9,{destroy:void 0},Xy.bind(null,f,m,u,l),null),We===null)throw Error(n(349));y||(Rn&127)!==0||Wy(f,l,u)}return u}function Wy(s,l,u){s.flags|=16384,s={getSnapshot:l,value:u},l=Ce.updateQueue,l===null?(l=wu(),Ce.updateQueue=l,l.stores=[s]):(u=l.stores,u===null?l.stores=[s]:u.push(s))}function Xy(s,l,u,f){l.value=u,l.getSnapshot=f,Jy(l)&&$y(s)}function Zy(s,l,u){return u(function(){Jy(l)&&$y(s)})}function Jy(s){var l=s.getSnapshot;s=s.value;try{var u=l();return!gi(s,u)}catch{return!0}}function $y(s){var l=Wr(s,2);l!==null&&si(l,s,2)}function ad(s){var l=Gt();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 ex(s,l,u,f){return s.baseState=u,ld(s,Qe,typeof f=="function"?f:Dn)}function aT(s,l,u,f,m){if(Tu(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)}};q.T!==null?u(!0):y.isTransition=!1,f(y),u=l.pending,u===null?(y.next=l.pending=y,tx(l,y)):(y.next=u.next,l.pending=u.next=y)}}function tx(s,l){var u=l.action,f=l.payload,m=s.state;if(l.isTransition){var y=q.T,S={};q.T=S;try{var A=u(m,f),O=q.S;O!==null&&O(S,A),ix(s,l,A)}catch(_){ud(s,l,_)}finally{y!==null&&S.types!==null&&(y.types=S.types),q.T=y}}else try{y=u(m,f),ix(s,l,y)}catch(_){ud(s,l,_)}}function ix(s,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){nx(s,l,f)},function(f){return ud(s,l,f)}):nx(s,l,u)}function nx(s,l,u){l.status="fulfilled",l.value=u,rx(l),s.state=u,l=s.pending,l!==null&&(u=l.next,u===l?s.pending=null:(u=u.next,l.next=u,tx(s,u)))}function ud(s,l,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do l.status="rejected",l.reason=u,rx(l),l=l.next;while(l!==f)}s.action=null}function rx(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function sx(s,l){return l}function lx(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=Gt(),u.memoizedState=u.baseState=l,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sx,lastRenderedState:l},u.queue=f,u=Ax.bind(null,Ce,f),f.dispatch=u,f=ad(!1),y=md.bind(null,Ce,!1,f.queue),f=Gt(),m={state:l,dispatch:null,action:s,pending:null},f.queue=m,u=aT.bind(null,Ce,m,y,u),m.dispatch=u,f.memoizedState=s,[l,u,!1]}function ox(s){var l=ht();return ax(l,Qe,s)}function ax(s,l,u){if(l=ld(s,l,sx)[0],s=Cu(Dn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var f=yo(l)}catch(S){throw S===Ys?pu:S}else f=l;l=ht();var m=l.queue,y=m.dispatch;return u!==l.memoizedState&&(Ce.flags|=2048,Zs(9,{destroy:void 0},uT.bind(null,m,u),null)),[f,y,s]}function uT(s,l){s.action=l}function ux(s){var l=ht(),u=Qe;if(u!==null)return ax(l,u,s);ht(),l=l.memoizedState,u=ht();var f=u.queue.dispatch;return u.memoizedState=s,[l,f,!1]}function Zs(s,l,u,f){return s={tag:s,create:u,deps:f,inst:l,next:null},l=Ce.updateQueue,l===null&&(l=wu(),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 cx(){return ht().memoizedState}function Au(s,l,u,f){var m=Gt();Ce.flags|=s,m.memoizedState=Zs(1|l,{destroy:void 0},u,f===void 0?null:f)}function Mu(s,l,u,f){var m=ht();f=f===void 0?null:f;var y=m.memoizedState.inst;Qe!==null&&f!==null&&ed(f,Qe.memoizedState.deps)?m.memoizedState=Zs(l,y,u,f):(Ce.flags|=s,m.memoizedState=Zs(1|l,y,u,f))}function hx(s,l){Au(8390656,8,s,l)}function cd(s,l){Mu(2048,8,s,l)}function cT(s){Ce.flags|=4;var l=Ce.updateQueue;if(l===null)l=wu(),Ce.updateQueue=l,l.events=[s];else{var u=l.events;u===null?l.events=[s]:u.push(s)}}function fx(s){var l=ht().memoizedState;return cT({ref:l,nextImpl:s}),function(){if((qe&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function dx(s,l){return Mu(4,2,s,l)}function px(s,l){return Mu(4,4,s,l)}function mx(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 gx(s,l,u){u=u!=null?u.concat([s]):null,Mu(4,4,mx.bind(null,l,s),u)}function hd(){}function yx(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;return l!==null&&ed(l,f[1])?f[0]:(u.memoizedState=[s,l],s)}function xx(s,l){var u=ht();l=l===void 0?null:l;var f=u.memoizedState;if(l!==null&&ed(l,f[1]))return f[0];if(f=s(),rs){Jn(!0);try{s()}finally{Jn(!1)}}return u.memoizedState=[f,l],f}function fd(s,l,u){return u===void 0||(Rn&1073741824)!==0&&(De&261930)===0?s.memoizedState=l:(s.memoizedState=u,s=bb(),Ce.lanes|=s,fr|=s,u)}function bx(s,l,u,f){return gi(u,l)?u:Ks.current!==null?(s=fd(s,u,f),gi(s,l)||(yt=!0),s):(Rn&42)===0||(Rn&1073741824)!==0&&(De&261930)===0?(yt=!0,s.memoizedState=u):(s=bb(),Ce.lanes|=s,fr|=s,l)}function vx(s,l,u,f,m){var y=X.p;X.p=y!==0&&8>y?y:8;var S=q.T,A={};q.T=A,md(s,!1,l,u);try{var O=m(),_=q.S;if(_!==null&&_(A,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=sT(O,f);xo(s,l,Y,wi(s))}else xo(s,l,f,wi(s))}catch(K){xo(s,l,{then:function(){},status:"rejected",reason:K},wi())}finally{X.p=y,S!==null&&A.types!==null&&(S.types=A.types),q.T=S}}function hT(){}function dd(s,l,u,f){if(s.tag!==5)throw Error(n(476));var m=Sx(s).queue;vx(s,m,l,ne,u===null?hT:function(){return wx(s),u(f)})}function Sx(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 wx(s){var l=Sx(s);l.next===null&&(l=s.alternate.memoizedState),xo(s,l.next.queue,{},wi())}function pd(){return jt(Bo)}function kx(){return ht().memoizedState}function Cx(){return ht().memoizedState}function fT(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var u=wi();s=lr(u);var f=or(l,s,u);f!==null&&(si(f,l,u),fo(f,l,u)),l={cache:Vf()},s.payload=l;return}l=l.return}}function dT(s,l,u){var f=wi();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Tu(s)?Mx(l,u):(u=Df(s,l,u,f),u!==null&&(si(u,s,f),Tx(u,l,f)))}function Ax(s,l,u){var f=wi();xo(s,l,u,f)}function xo(s,l,u,f){var m={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Tu(s))Mx(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&&lu(),!1}catch{}if(u=Df(s,l,m,f),u!==null)return si(u,s,f),Tx(u,l,f),!0}return!1}function md(s,l,u,f){if(f={lane:2,revertLane:Gd(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Tu(s)){if(l)throw Error(n(479))}else l=Df(s,u,f,2),l!==null&&si(l,s,2)}function Tu(s){var l=s.alternate;return s===Ce||l!==null&&l===Ce}function Mx(s,l){Ws=vu=!0;var u=s.pending;u===null?l.next=l:(l.next=u.next,u.next=l),s.pending=l}function Tx(s,l,u){if((u&4194048)!==0){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,D0(s,u)}}var bo={readContext:jt,use:ku,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};bo.useEffectEvent=st;var Ox={readContext:jt,use:ku,useCallback:function(s,l){return Gt().memoizedState=[s,l===void 0?null:l],s},useContext:jt,useEffect:hx,useImperativeHandle:function(s,l,u){u=u!=null?u.concat([s]):null,Au(4194308,4,mx.bind(null,l,s),u)},useLayoutEffect:function(s,l){return Au(4194308,4,s,l)},useInsertionEffect:function(s,l){Au(4,2,s,l)},useMemo:function(s,l){var u=Gt();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=Gt();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=dT.bind(null,Ce,s),[f.memoizedState,s]},useRef:function(s){var l=Gt();return s={current:s},l.memoizedState=s},useState:function(s){s=ad(s);var l=s.queue,u=Ax.bind(null,Ce,l);return l.dispatch=u,[s.memoizedState,u]},useDebugValue:hd,useDeferredValue:function(s,l){var u=Gt();return fd(u,s,l)},useTransition:function(){var s=ad(!1);return s=vx.bind(null,Ce,s.queue,!0,!1),Gt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,u){var f=Ce,m=Gt();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||Wy(f,l,u)}m.memoizedState=u;var y={value:u,getSnapshot:l};return m.queue=y,hx(Zy.bind(null,f,y,s),[s]),f.flags|=2048,Zs(9,{destroy:void 0},Xy.bind(null,f,y,u,l),null),u},useId:function(){var s=Gt(),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=Su++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=lT++,l="_"+l+"r_"+u.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:pd,useFormState:lx,useActionState:lx,useOptimistic:function(s){var l=Gt();l.memoizedState=l.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=md.bind(null,Ce,!0,u),u.dispatch=l,[s,l]},useMemoCache:sd,useCacheRefresh:function(){return Gt().memoizedState=fT.bind(null,Ce)},useEffectEvent:function(s){var l=Gt(),u={impl:s};return l.memoizedState=u,function(){if((qe&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},gd={readContext:jt,use:ku,useCallback:yx,useContext:jt,useEffect:cd,useImperativeHandle:gx,useInsertionEffect:dx,useLayoutEffect:px,useMemo:xx,useReducer:Cu,useRef:cx,useState:function(){return Cu(Dn)},useDebugValue:hd,useDeferredValue:function(s,l){var u=ht();return bx(u,Qe.memoizedState,s,l)},useTransition:function(){var s=Cu(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:yo(s),l]},useSyncExternalStore:Ky,useId:kx,useHostTransitionStatus:pd,useFormState:ox,useActionState:ox,useOptimistic:function(s,l){var u=ht();return ex(u,Qe,s,l)},useMemoCache:sd,useCacheRefresh:Cx};gd.useEffectEvent=fx;var Ex={readContext:jt,use:ku,useCallback:yx,useContext:jt,useEffect:cd,useImperativeHandle:gx,useInsertionEffect:dx,useLayoutEffect:px,useMemo:xx,useReducer:od,useRef:cx,useState:function(){return od(Dn)},useDebugValue:hd,useDeferredValue:function(s,l){var u=ht();return Qe===null?fd(u,s,l):bx(u,Qe.memoizedState,s,l)},useTransition:function(){var s=od(Dn)[0],l=ht().memoizedState;return[typeof s=="boolean"?s:yo(s),l]},useSyncExternalStore:Ky,useId:kx,useHostTransitionStatus:pd,useFormState:ux,useActionState:ux,useOptimistic:function(s,l){var u=ht();return Qe!==null?ex(u,Qe,s,l):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:sd,useCacheRefresh:Cx};Ex.useEffectEvent=fx;function yd(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 xd={enqueueSetState:function(s,l,u){s=s._reactInternals;var f=wi(),m=lr(f);m.payload=l,u!=null&&(m.callback=u),l=or(s,m,f),l!==null&&(si(l,s,f),fo(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=or(s,m,f),l!==null&&(si(l,s,f),fo(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=or(s,f,u),l!==null&&(si(l,s,u),fo(l,s,u))}};function Nx(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?!ro(u,f)||!ro(m,y):!0}function Rx(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&&xd.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 Dx(s){su(s)}function jx(s){console.error(s)}function Lx(s){su(s)}function Ou(s,l){try{var u=s.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(f){setTimeout(function(){throw f})}}function Bx(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 bd(s,l,u){return u=lr(u),u.tag=3,u.payload={element:null},u.callback=function(){Ou(s,l)},u}function zx(s){return s=lr(s),s.tag=3,s}function _x(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(){Bx(l,u,f)}}var S=u.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){Bx(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 pT(s,l,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(l=u.alternate,l!==null&&Vs(l,u,m,!0),u=xi.current,u!==null){switch(u.tag){case 31:case 13:return Bi===null?qu():u.alternate===null&&lt===0&&(lt=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===mu?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([f]):l.add(f),Id(s,f,m)),!1;case 22:return u.flags|=65536,f===mu?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)),Id(s,f,m)),!1}throw Error(n(435,u.tag))}return Id(s,f,m),qu(),!1}if(Le)return l=xi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,f!==Hf&&(s=Error(n(422),{cause:f}),oo(Ri(s,u)))):(f!==Hf&&(l=Error(n(423),{cause:f}),oo(Ri(l,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=Ri(f,u),m=bd(s.stateNode,f,m),Wf(s,m),lt!==4&&(lt=2)),!1;var y=Error(n(520),{cause:f});if(y=Ri(y,u),To===null?To=[y]:To.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=bd(u.stateNode,f,s),Wf(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=zx(m),_x(m,s,u,f),Wf(u,m),!1}u=u.return}while(u!==null);return!1}var vd=Error(n(461)),yt=!1;function Lt(s,l,u,f){l.child=s===null?Py(l,null,u,f):ns(l,s.child,u,f)}function Hx(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=td(s,l,u,S,y,m),A=id(),s!==null&&!yt?(nd(s,l,m),jn(s,l,m)):(Le&&A&&zf(l),l.flags|=1,Lt(s,l,f,m),l.child)}function Ux(s,l,u,f,m){if(s===null){var y=u.type;return typeof y=="function"&&!jf(y)&&y.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=y,qx(s,l,y,f,m)):(s=uu(u.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,!Od(s,m)){var S=y.memoizedProps;if(u=u.compare,u=u!==null?u:ro,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 qx(s,l,u,f,m){if(s!==null){var y=s.memoizedProps;if(ro(y,f)&&s.ref===l.ref)if(yt=!1,l.pendingProps=f=y,Od(s,m))(s.flags&131072)!==0&&(yt=!0);else return l.lanes=s.lanes,jn(s,l,m)}return Sd(s,l,u,f,m)}function Px(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 Fx(s,l,y,u,f)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&du(l,y!==null?y.cachePool:null),y!==null?Iy(l,y):Zf(),Qy(l);else return f=l.lanes=536870912,Fx(s,l,y!==null?y.baseLanes|u:u,u,f)}else y!==null?(du(l,y.cachePool),Iy(l,y),ur(),l.memoizedState=null):(s!==null&&du(l,null),Zf(),ur());return Lt(s,l,m,u),l.child}function vo(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Fx(s,l,u,f,m){var y=Qf();return y=y===null?null:{parent:mt._currentValue,pool:y},l.memoizedState={baseLanes:u,cachePool:y},s!==null&&du(l,null),Zf(),Qy(l),s!==null&&Vs(s,l,f,!0),l.childLanes=m,null}function Eu(s,l){return l=Ru({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function Vx(s,l,u){return ns(l,s.child,null,u),s=Eu(l,l.pendingProps),s.flags|=2,bi(l),l.memoizedState=null,s}function mT(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=Eu(l,f),l.lanes=536870912,vo(null,s);if($f(l),(s=$e)?(s=t1(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=My(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return l.lanes=536870912,null}return Eu(l,f)}var y=s.memoizedState;if(y!==null){var S=y.dehydrated;if($f(l),m)if(l.flags&256)l.flags&=-257,l=Vx(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||Vs(s,l,u,!1),m=(u&s.childLanes)!==0,yt||m){if(f=We,f!==null&&(S=j0(f,u),S!==0&&S!==y.retryLane))throw y.retryLane=S,Wr(s,S),si(f,s,S),vd;qu(),l=Vx(s,l,u)}else s=y.treeContext,$e=zi(S.nextSibling),Dt=l,Le=!0,ir=null,Li=!1,s!==null&&Ey(l,s),l=Eu(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 Nu(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 Sd(s,l,u,f,m){return $r(l),u=td(s,l,u,f,void 0,m),f=id(),s!==null&&!yt?(nd(s,l,m),jn(s,l,m)):(Le&&f&&zf(l),l.flags|=1,Lt(s,l,u,m),l.child)}function Ix(s,l,u,f,m,y){return $r(l),l.updateQueue=null,u=Gy(l,f,u,m),Yy(s),f=id(),s!==null&&!yt?(nd(s,l,y),jn(s,l,y)):(Le&&f&&zf(l),l.flags|=1,Lt(s,l,u,y),l.child)}function Qx(s,l,u,f,m){if($r(l),l.stateNode===null){var y=Us,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=xd,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=f,y.state=l.memoizedState,y.refs={},Gf(l),S=u.contextType,y.context=typeof S=="object"&&S!==null?jt(S):Us,y.state=l.memoizedState,S=u.getDerivedStateFromProps,typeof S=="function"&&(yd(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&&xd.enqueueReplaceState(y,y.state,null),mo(l,f,y,m),po(),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,Y=u.contextType;S=Us,typeof Y=="object"&&Y!==null&&(S=jt(Y));var K=u.getDerivedStateFromProps;Y=typeof K=="function"||typeof y.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,Y||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A||_!==S)&&Rx(l,y,f,S),sr=!1;var U=l.memoizedState;y.state=U,mo(l,f,y,m),po(),_=l.memoizedState,A||U!==_||sr?(typeof K=="function"&&(yd(l,u,K,f),_=l.memoizedState),(O=sr||Nx(l,u,O,f,U,_,S))?(Y||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,Kf(s,l),S=l.memoizedProps,Y=ss(u,S),y.props=Y,K=l.pendingProps,U=y.context,_=u.contextType,O=Us,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||U!==O)&&Rx(l,y,f,O),sr=!1,U=l.memoizedState,y.state=U,mo(l,f,y,m),po();var V=l.memoizedState;S!==K||U!==V||sr||s!==null&&s.dependencies!==null&&hu(s.dependencies)?(typeof A=="function"&&(yd(l,u,A,f),V=l.memoizedState),(Y=sr||Nx(l,u,Y,f,U,V,O)||s!==null&&s.dependencies!==null&&hu(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&&U===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&U===s.memoizedState||(l.flags|=1024),l.memoizedProps=f,l.memoizedState=V),y.props=f,y.state=V,y.context=O,f=Y):(typeof y.componentDidUpdate!="function"||S===s.memoizedProps&&U===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&U===s.memoizedState||(l.flags|=1024),f=!1)}return y=f,Nu(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 wd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kd(s){return{baseLanes:s,cachePool:By()}}function Cd(s,l,u){return s=s!==null?s.childLanes&~u:0,l&&(s|=Si),s}function Gx(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?ar(l):ur(),(s=$e)?(s=t1(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=My(s),u.return=l,l.child=u,Dt=l,$e=null)):s=null,s===null)throw nr(l);return lp(s)?l.lanes=32:l.lanes=536870912,null}var A=f.children;return f=f.fallback,m?(ur(),m=l.mode,A=Ru({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=kd(u),f.childLanes=Cd(s,S,u),l.memoizedState=wd,vo(null,f)):(ar(l),Ad(l,A))}var O=s.memoizedState;if(O!==null&&(A=O.dehydrated,A!==null)){if(y)l.flags&256?(ar(l),l.flags&=-257,l=Md(s,l,u)):l.memoizedState!==null?(ur(),l.child=s.child,l.flags|=128,l=null):(ur(),A=f.fallback,m=l.mode,f=Ru({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=kd(u),f.childLanes=Cd(s,S,u),l.memoizedState=wd,l=vo(null,f));else if(ar(l),lp(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var _=S.dgst;S=_,f=Error(n(419)),f.stack="",f.digest=S,oo({value:f,source:null,stack:null}),l=Md(s,l,u)}else if(yt||Vs(s,l,u,!1),S=(u&s.childLanes)!==0,yt||S){if(S=We,S!==null&&(f=j0(S,u),f!==0&&f!==O.retryLane))throw O.retryLane=f,Wr(s,f),si(S,s,f),vd;sp(A)||qu(),l=Md(s,l,u)}else sp(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&&Ey(l,s),l=Ad(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,vo(null,f),f=l.child,A=s.child.memoizedState,A===null?A=kd(u):(m=A.cachePool,m!==null?(O=mt._currentValue,m=m.parent!==O?{parent:O,pool:O}:m):m=By(),A={baseLanes:A.baseLanes|u,cachePool:m}),f.memoizedState=A,f.childLanes=Cd(s,S,u),l.memoizedState=wd,vo(s.child,f)):(ar(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 Ad(s,l){return l=Ru({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Ru(s,l){return s=yi(22,s,null,l),s.lanes=0,s}function Md(s,l,u){return ns(l,s.child,null,u),s=Ad(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function Kx(s,l,u){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),Pf(s.return,l,u)}function Td(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 Wx(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?lo:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Kx(s,u,l);else if(s.tag===19)Kx(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&&bu(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=l.child,l.child=null):(m=u.sibling,u.sibling=null),Td(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&&bu(s)===null){l.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}Td(l,!0,u,null,y,f);break;case"together":Td(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(Vs(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 Od(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&hu(s)))}function gT(s,l,u){switch(l.tag){case 3:Yt(l,l.stateNode.containerInfo),rr(l,mt,s.memoizedState.cache),Zr();break;case 27:case 5:Ql(l);break;case 4:Yt(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,$f(l),null;break;case 13:var f=l.memoizedState;if(f!==null)return f.dehydrated!==null?(ar(l),l.flags|=128,null):(u&l.child.childLanes)!==0?Gx(s,l,u):(ar(l),s=jn(s,l,u),s!==null?s.sibling:null);ar(l);break;case 19:var m=(s.flags&128)!==0;if(f=(u&l.childLanes)!==0,f||(Vs(s,l,u,!1),f=(u&l.childLanes)!==0),m){if(f)return Wx(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,Px(s,l,u,l.pendingProps);case 24:rr(l,mt,s.memoizedState.cache)}return jn(s,l,u)}function Xx(s,l,u){if(s!==null)if(s.memoizedProps!==l.pendingProps)yt=!0;else{if(!Od(s,u)&&(l.flags&128)===0)return yt=!1,gT(s,l,u);yt=(s.flags&131072)!==0}else yt=!1,Le&&(l.flags&1048576)!==0&&Oy(l,lo,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")jf(s)?(f=ss(s,f),l.tag=1,l=Qx(null,l,s,f,u)):(l.tag=0,l=Sd(null,l,s,f,u));else{if(s!=null){var m=s.$$typeof;if(m===j){l.tag=11,l=Hx(null,l,s,f,u);break e}else if(m===H){l.tag=14,l=Ux(null,l,s,f,u);break e}}throw l=fe(s)||s,Error(n(306,l,""))}}return l;case 0:return Sd(s,l,l.type,l.pendingProps,u);case 1:return f=l.type,m=ss(f,l.pendingProps),Qx(s,l,f,m,u);case 3:e:{if(Yt(l,l.stateNode.containerInfo),s===null)throw Error(n(387));f=l.pendingProps;var y=l.memoizedState;m=y.element,Kf(s,l),mo(l,f,null,u);var S=l.memoizedState;if(f=S.cache,rr(l,mt,f),f!==y.cache&&Ff(l,[mt],u,!0),po(),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),oo(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=Py(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 Nu(s,l),s===null?(u=o1(l.type,null,l.pendingProps,null))?l.memoizedState=u:Le||(u=l.type,s=l.pendingProps,f=Gu(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 Ql(l),s===null&&Le&&(f=l.stateNode=r1(l.type,l.pendingProps,ke.current),Dt=l,Li=!0,m=$e,yr(l.type)?(op=m,$e=zi(f.firstChild)):$e=m),Lt(s,l,l.pendingProps.children,u),Nu(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Le&&((m=f=$e)&&(f=YT(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)),Ql(l),m=l.type,y=l.pendingProps,S=s!==null?s.memoizedProps:null,f=y.children,ip(m,y)?f=null:S!==null&&ip(m,S)&&(l.flags|=32),l.memoizedState!==null&&(m=td(s,l,oT,null,null,u),Bo._currentValue=m),Nu(s,l),Lt(s,l,f,u),l.child;case 6:return s===null&&Le&&((s=u=$e)&&(u=GT(u,l.pendingProps,Li),u!==null?(l.stateNode=u,Dt=l,$e=null,s=!0):s=!1),s||nr(l)),null;case 13:return Gx(s,l,u);case 4:return Yt(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 Hx(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 Ux(s,l,l.type,l.pendingProps,u);case 15:return qx(s,l,l.type,l.pendingProps,u);case 19:return Wx(s,l,u);case 31:return mT(s,l,u);case 22:return Px(s,l,u,l.pendingProps);case 24:return $r(l),f=jt(mt),s===null?(m=Qf(),m===null&&(m=We,y=Vf(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=u),m=y),l.memoizedState={parent:f,cache:m},Gf(l),rr(l,mt,m)):((s.lanes&u)!==0&&(Kf(s,l),mo(l,null,null,u),po()),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&&Ff(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 Ed(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(kb())s.flags|=8192;else throw is=mu,Yf}else s.flags&=-16777217}function Zx(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!f1(l))if(kb())s.flags|=8192;else throw is=mu,Yf}function Du(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?N0():536870912,s.lanes|=l,tl|=l)}function So(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 yT(s,l,u){var f=l.pendingProps;switch(_f(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)&&(Fs(l)?Ln(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Uf())),et(l),null;case 26:var m=l.type,y=l.memoizedState;return s===null?(Ln(l),y!==null?(et(l),Zx(l,y)):(et(l),Ed(l,m,null,f,u))):y?y!==s.memoizedState?(Ln(l),et(l),Zx(l,y)):(et(l),l.flags&=-16777217):(s=s.memoizedProps,s!==f&&Ln(l),et(l),Ed(l,m,s,f,u)),null;case 27:if(Va(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,Fs(l)?Ny(l):(s=r1(m,f,u),l.stateNode=s,Ln(l))}return et(l),null;case 5:if(Va(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,Fs(l))Ny(l);else{var S=Gu(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),Ed(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,Fs(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||Gb(s.nodeValue,u)),s||nr(l,!0)}else s=Gu(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=Fs(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=Uf(),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=Fs(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=Uf(),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),Du(l,l.updateQueue),et(l),null);case 4:return ut(),s===null&&Zd(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)So(f,!1);else{if(lt!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(y=bu(s),y!==null){for(l.flags|=128,So(f,!1),s=y.updateQueue,l.updateQueue=s,Du(l,s),l.subtreeFlags=0,s=u,u=l.child;u!==null;)Ay(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()>_u&&(l.flags|=128,m=!0,So(f,!1),l.lanes=4194304)}else{if(!m)if(s=bu(y),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,Du(l,s),So(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Le)return et(l),null}else 2*di()-f.renderingStartTime>_u&&u!==536870912&&(l.flags|=128,m=!0,So(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),Jf(),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&&Du(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 xT(s,l){switch(_f(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 Va(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),Jf(),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 Jx(s,l){switch(_f(l),l.tag){case 3:Nn(mt),ut();break;case 26:case 27:case 5:Va(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),Jf(),s!==null&&Q(es);break;case 24:Nn(mt)}}function wo(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(Y){Ie(m,O,Y)}}}f=f.next}while(f!==y)}}catch(Y){Ie(l,l.return,Y)}}function $x(s){var l=s.updateQueue;if(l!==null){var u=s.stateNode;try{Vy(l,u)}catch(f){Ie(s,s.return,f)}}}function eb(s,l,u){u.props=ss(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){Ie(s,l,f)}}function ko(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 tb(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 Nd(s,l,u){try{var f=s.stateNode;qT(f,s.type,u,l),f[$t]=l}catch(m){Ie(s,s.return,m)}}function ib(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yr(s.type)||s.tag===4}function Rd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||ib(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 Dd(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(Dd(s,l,u),s=s.sibling;s!==null;)Dd(s,l,u),s=s.sibling}function ju(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(ju(s,l,u),s=s.sibling;s!==null;)ju(s,l,u),s=s.sibling}function nb(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,jd=!1,rb=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function bT(s,l){if(s=s.containerInfo,ep=ec,s=gy(s),Mf(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,Y=0,K=s,U=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;)U=K,K=V;for(;;){if(K===s)break t;if(U===u&&++_===m&&(A=S),U===y&&++Y===f&&(O=S),(V=K.nextSibling)!==null)break;K=U,U=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(tp={focusedElem:s,selectionRange:u},ec=!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 ae=ss(u.type,m);s=f.getSnapshotBeforeUpdate(ae,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)rp(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":rp(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 sb(s,l,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:_n(s,u),f&4&&wo(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&&$x(u),f&512&&ko(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{Vy(s,l)}catch(S){Ie(u,u.return,S)}}break;case 27:l===null&&f&4&&nb(u);case 26:case 5:_n(s,u),l===null&&f&4&&tb(u),f&512&&ko(u,u.return);break;case 12:_n(s,u);break;case 31:_n(s,u),f&4&&ab(s,u);break;case 13:_n(s,u),f&4&&ub(s,u),f&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=OT.bind(null,u),KT(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 lb(s){var l=s.alternate;l!==null&&(s.alternate=null,lb(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&uf(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),Do(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,$b(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),ul(s)):$b(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"&&eb(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 ab(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ul(s)}catch(u){Ie(l,l.return,u)}}}function ub(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ul(s)}catch(u){Ie(l,l.return,u)}}function vT(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new rb),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new rb),l;default:throw Error(n(435,s.tag))}}function Lu(s,l){var u=vT(s);l.forEach(function(f){if(!u.has(f)){u.add(f);var m=ET.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;)cb(l,s),l=l.sibling}var Gi=null;function cb(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),wo(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=Gi;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[Wl]||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=c1("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=c1("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 h1(m,s.type,s.stateNode);else s.stateNode=u1(m,f,s.memoizedProps);else y!==f?(y===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):y.count--,f===null?h1(m,s.type,s.stateNode):u1(m,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Nd(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&&Nd(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{Ds(m,"")}catch(ae){Ie(s,s.return,ae)}}f&4&&s.stateNode!=null&&(m=s.memoizedProps,Nd(s,m,u!==null?u.memoizedProps:m)),f&1024&&(jd=!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(ae){Ie(s,s.return,ae)}}break;case 3:if(Xu=null,m=Gi,Gi=Ku(l.containerInfo),ii(l,s),Gi=m,ni(s),f&4&&u!==null&&u.memoizedState.isDehydrated)try{ul(l.containerInfo)}catch(ae){Ie(s,s.return,ae)}jd&&(jd=!1,hb(s));break;case 4:f=Gi,Gi=Ku(s.stateNode.containerInfo),ii(l,s),ni(s),Gi=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,Lu(s,f)));break;case 13:ii(l,s),ni(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(zu=di()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Lu(s,f)));break;case 22:m=s.memoizedState!==null;var O=u!==null&&u.memoizedState!==null,_=Bn,Y=xt;if(Bn=_||m,xt=Y||O,ii(l,s),xt=Y,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,U=K!=null&&K.hasOwnProperty("display")?K.display:null;A.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ae){Ie(O,O.return,ae)}}}else if(l.tag===6){if(u===null){O=l;try{O.stateNode.nodeValue=m?"":O.memoizedProps}catch(ae){Ie(O,O.return,ae)}}}else if(l.tag===18){if(u===null){O=l;try{var V=O.stateNode;m?e1(V,!0):e1(O.stateNode,!1)}catch(ae){Ie(O,O.return,ae)}}}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,Lu(s,u))));break;case 19:ii(l,s),ni(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Lu(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(ib(f)){u=f;break}f=f.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var m=u.stateNode,y=Rd(s);ju(s,y,m);break;case 5:var S=u.stateNode;u.flags&32&&(Ds(S,""),u.flags&=-33);var A=Rd(s);ju(s,A,S);break;case 3:case 4:var O=u.stateNode.containerInfo,_=Rd(s);Dd(s,_,O);break;default:throw Error(n(161))}}catch(Y){Ie(s,s.return,Y)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function hb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;hb(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;)sb(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"&&eb(l,l.return,u),ls(l);break;case 27:Do(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),wo(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++)Fy(O[m],A)}catch(_){Ie(f,f.return,_)}}u&&S&64&&$x(y),ko(y,y.return);break;case 27:nb(y);case 26:case 5:Hn(m,y,u),u&&f===null&&S&4&&tb(y),ko(y,y.return);break;case 12:Hn(m,y,u);break;case 31:Hn(m,y,u),u&&S&4&&ab(m,y);break;case 13:Hn(m,y,u),u&&S&4&&ub(m,y);break;case 22:y.memoizedState===null&&Hn(m,y,u),ko(y,y.return);break;case 30:break;default:Hn(m,y,u)}l=l.sibling}}function Ld(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&&ao(u))}function Bd(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&ao(s))}function Ki(s,l,u,f){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)fb(s,l,u,f),l=l.sibling}function fb(s,l,u,f){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Ki(s,l,u,f),m&2048&&wo(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&&ao(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):Co(s,l):y._visibility&2?Ki(s,l,u,f):(y._visibility|=2,Js(s,l,u,f,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Ld(S,l);break;case 24:Ki(s,l,u,f),m&2048&&Bd(l.alternate,l);break;default:Ki(s,l,u,f)}}function Js(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:Js(y,S,A,O,m),wo(8,S);break;case 23:break;case 22:var Y=S.stateNode;S.memoizedState!==null?Y._visibility&2?Js(y,S,A,O,m):Co(y,S):(Y._visibility|=2,Js(y,S,A,O,m)),m&&_&2048&&Ld(S.alternate,S);break;case 24:Js(y,S,A,O,m),m&&_&2048&&Bd(S.alternate,S);break;default:Js(y,S,A,O,m)}l=l.sibling}}function Co(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:Co(u,f),m&2048&&Ld(f.alternate,f);break;case 24:Co(u,f),m&2048&&Bd(f.alternate,f);break;default:Co(u,f)}l=l.sibling}}var Ao=8192;function $s(s,l,u){if(s.subtreeFlags&Ao)for(s=s.child;s!==null;)db(s,l,u),s=s.sibling}function db(s,l,u){switch(s.tag){case 26:$s(s,l,u),s.flags&Ao&&s.memoizedState!==null&&lO(u,Gi,s.memoizedState,s.memoizedProps);break;case 5:$s(s,l,u);break;case 3:case 4:var f=Gi;Gi=Ku(s.stateNode.containerInfo),$s(s,l,u),Gi=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Ao,Ao=16777216,$s(s,l,u),Ao=f):$s(s,l,u));break;default:$s(s,l,u)}}function pb(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 Mo(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,gb(f,s)}pb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)mb(s),s=s.sibling}function mb(s){switch(s.tag){case 0:case 11:case 15:Mo(s),s.flags&2048&&cr(9,s,s.return);break;case 3:Mo(s);break;case 12:Mo(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Bu(s)):Mo(s);break;default:Mo(s)}}function Bu(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,gb(f,s)}pb(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:cr(8,l,l.return),Bu(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,Bu(l));break;default:Bu(l)}s=s.sibling}}function gb(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:ao(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(lb(f),f===u){Tt=null;break e}if(m!==null){m.return=y,Tt=m;break e}Tt=y}}}var ST={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}},wT=typeof WeakMap=="function"?WeakMap:Map,qe=0,We=null,Oe=null,De=0,Ve=0,vi=null,hr=!1,el=!1,zd=!1,Un=0,lt=0,fr=0,os=0,_d=0,Si=0,tl=0,To=null,ri=null,Hd=!1,zu=0,yb=0,_u=1/0,Hu=null,dr=null,St=0,pr=null,il=null,qn=0,Ud=0,qd=null,xb=null,Oo=0,Pd=null;function wi(){return(qe&2)!==0&&De!==0?De&-De:q.T!==null?Gd():L0()}function bb(){if(Si===0)if((De&536870912)===0||Le){var s=Ya;Ya<<=1,(Ya&3932160)===0&&(Ya=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)&&(nl(s,0),mr(s,De,Si,!1)),Kl(s,u),((qe&2)===0||s!==We)&&(s===We&&((qe&2)===0&&(os|=u),lt===4&&mr(s,De,Si,!1)),on(s))}function vb(s,l,u){if((qe&6)!==0)throw Error(n(327));var f=!u&&(l&127)===0&&(l&s.expiredLanes)===0||Gl(s,l),m=f?AT(s,l):Vd(s,l,!0),y=f;do{if(m===0){el&&!f&&mr(s,l,0,!1);break}else{if(u=s.current.alternate,y&&!kT(u)){m=Vd(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=To;var O=A.current.memoizedState.isDehydrated;if(O&&(nl(A,S).flags|=256),S=Vd(A,S,!1),S!==2){if(zd&&!O){A.errorRecoveryDisabledLanes|=y,os|=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){nl(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=zu+300-di(),10<m)){if(mr(f,l,Si,!hr),Ka(f,0,!0)!==0)break e;qn=l,f.timeoutHandle=Zb(Sb.bind(null,f,u,ri,Hu,Hd,l,Si,os,tl,hr,y,"Throttled",-0,0),m);break e}Sb(f,u,ri,Hu,Hd,l,Si,os,tl,hr,y,null,-0,0)}}break}while(!0);on(s)}function Sb(s,l,u,f,m,y,S,A,O,_,Y,K,U,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},db(l,y,K);var ae=(y&62914560)===y?zu-di():(y&4194048)===y?yb-di():0;if(ae=oO(K,ae),ae!==null){qn=y,s.cancelPendingCommit=ae(Eb.bind(null,s,l,y,u,f,m,S,A,O,Y,K,null,U,V)),mr(s,y,S,!_);return}}Eb(s,l,y,u,f,m,S,A,O)}function kT(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&=~_d,l&=~os,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&&R0(s,u,l)}function Uu(){return(qe&6)===0?(Eo(0),!1):!0}function Fd(){if(Oe!==null){if(Ve===0)var s=Oe.return;else s=Oe,En=Jr=null,rd(s),Gs=null,co=0,s=Oe;for(;s!==null;)Jx(s.alternate,s),s=s.return;Oe=null}}function nl(s,l){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,VT(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),qn=0,Fd(),We=s,Oe=u=Tn(s.current,null),De=l,Ve=0,vi=null,hr=!1,el=Gl(s,l),zd=!1,tl=Si=_d=os=fr=lt=0,ri=To=null,Hd=!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,lu(),u}function wb(s,l){Ce=null,q.H=bo,l===Ys||l===pu?(l=Hy(),Ve=3):l===Yf?(l=Hy(),Ve=4):Ve=l===vd?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,vi=l,Oe===null&&(lt=1,Ou(s,Ri(l,s.current)))}function kb(){var s=xi.current;return s===null?!0:(De&4194048)===De?Bi===null:(De&62914560)===De||(De&536870912)!==0?s===Bi:!1}function Cb(){var s=q.H;return q.H=bo,s===null?bo:s}function Ab(){var s=q.A;return q.A=ST,s}function qu(){lt=4,hr||(De&4194048)!==De&&xi.current!==null||(el=!0),(fr&134217727)===0&&(os&134217727)===0||We===null||mr(We,De,Si,!1)}function Vd(s,l,u){var f=qe;qe|=2;var m=Cb(),y=Ab();(We!==s||De!==l)&&(Hu=null,nl(s,l)),l=!1;var S=lt;e:do try{if(Ve!==0&&Oe!==null){var A=Oe,O=vi;switch(Ve){case 8:Fd(),S=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(l=!0);var _=Ve;if(Ve=0,vi=null,rl(s,A,O,_),u&&el){S=0;break e}break;default:_=Ve,Ve=0,vi=null,rl(s,A,O,_)}}CT(),S=lt;break}catch(Y){wb(s,Y)}while(!0);return l&&s.shellSuspendCounter++,En=Jr=null,qe=f,q.H=m,q.A=y,Oe===null&&(We=null,De=0,lu()),S}function CT(){for(;Oe!==null;)Mb(Oe)}function AT(s,l){var u=qe;qe|=2;var f=Cb(),m=Ab();We!==s||De!==l?(Hu=null,_u=di()+500,nl(s,l)):el=Gl(s,l);e:do try{if(Ve!==0&&Oe!==null){l=Oe;var y=vi;t:switch(Ve){case 1:Ve=0,vi=null,rl(s,l,y,1);break;case 2:case 9:if(zy(y)){Ve=0,vi=null,Tb(l);break}l=function(){Ve!==2&&Ve!==9||We!==s||(Ve=7),on(s)},y.then(l,l);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:zy(y)?(Ve=0,vi=null,Tb(l)):(Ve=0,vi=null,rl(s,l,y,7));break;case 5:var S=null;switch(Oe.tag){case 26:S=Oe.memoizedState;case 5:case 27:var A=Oe;if(S?f1(S):A.stateNode.complete){Ve=0,vi=null;var O=A.sibling;if(O!==null)Oe=O;else{var _=A.return;_!==null?(Oe=_,Pu(_)):Oe=null}break t}}Ve=0,vi=null,rl(s,l,y,5);break;case 6:Ve=0,vi=null,rl(s,l,y,6);break;case 8:Fd(),lt=6;break e;default:throw Error(n(462))}}MT();break}catch(Y){wb(s,Y)}while(!0);return En=Jr=null,q.H=f,q.A=m,qe=u,Oe!==null?0:(We=null,De=0,lu(),lt)}function MT(){for(;Oe!==null&&!WA();)Mb(Oe)}function Mb(s){var l=Xx(s.alternate,s,Un);s.memoizedProps=s.pendingProps,l===null?Pu(s):Oe=l}function Tb(s){var l=s,u=l.alternate;switch(l.tag){case 15:case 0:l=Ix(u,l,l.pendingProps,l.type,void 0,De);break;case 11:l=Ix(u,l,l.pendingProps,l.type.render,l.ref,De);break;case 5:rd(l);default:Jx(u,l),l=Oe=Ay(l,Un),l=Xx(u,l,Un)}s.memoizedProps=s.pendingProps,l===null?Pu(s):Oe=l}function rl(s,l,u,f){En=Jr=null,rd(l),Gs=null,co=0;var m=l.return;try{if(pT(s,m,l,u,De)){lt=1,Ou(s,Ri(u,s.current)),Oe=null;return}}catch(y){if(m!==null)throw Oe=m,y;lt=1,Ou(s,Ri(u,s.current)),Oe=null;return}l.flags&32768?(Le||f===1?s=!0:el||(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))),Ob(l,s)):Pu(l)}function Pu(s){var l=s;do{if((l.flags&32768)!==0){Ob(l,hr);return}s=l.return;var u=yT(l.alternate,l,Un);if(u!==null){Oe=u;return}if(l=l.sibling,l!==null){Oe=l;return}Oe=l=s}while(l!==null);lt===0&&(lt=5)}function Ob(s,l){do{var u=xT(s.alternate,s);if(u!==null){u.flags&=32767,Oe=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(s=s.sibling,s!==null)){Oe=s;return}Oe=s=u}while(s!==null);lt=6,Oe=null}function Eb(s,l,u,f,m,y,S,A,O){s.cancelPendingCommit=null;do Fu();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|=Rf,sM(s,u,y,S,A,O),s===We&&(Oe=We=null,De=0),il=l,pr=s,qn=u,Ud=y,qd=m,xb=f,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,NT(Ia,function(){return Lb(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,m=X.p,X.p=2,S=qe,qe|=4;try{bT(s,l,u)}finally{qe=S,X.p=m,q.T=f}}St=1,Nb(),Rb(),Db()}}function Nb(){if(St===1){St=0;var s=pr,l=il,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=q.T,q.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{cb(l,s);var y=tp,S=gy(s.containerInfo),A=y.focusedElem,O=y.selectionRange;if(S!==A&&A&&A.ownerDocument&&my(A.ownerDocument.documentElement,A)){if(O!==null&&Mf(A)){var _=O.start,Y=O.end;if(Y===void 0&&(Y=_),"selectionStart"in A)A.selectionStart=_,A.selectionEnd=Math.min(Y,A.value.length);else{var K=A.ownerDocument||document,U=K&&K.defaultView||window;if(U.getSelection){var V=U.getSelection(),ae=A.textContent.length,xe=Math.min(O.start,ae),Ge=O.end===void 0?xe:Math.min(O.end,ae);!V.extend&&xe>Ge&&(S=Ge,Ge=xe,xe=S);var L=py(A,xe),R=py(A,Ge);if(L&&R&&(V.rangeCount!==1||V.anchorNode!==L.node||V.anchorOffset!==L.offset||V.focusNode!==R.node||V.focusOffset!==R.offset)){var z=K.createRange();z.setStart(L.node,L.offset),V.removeAllRanges(),xe>Ge?(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 G=K[A];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}ec=!!ep,tp=ep=null}finally{qe=m,X.p=f,q.T=u}}s.current=l,St=2}}function Rb(){if(St===2){St=0;var s=pr,l=il,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=q.T,q.T=null;var f=X.p;X.p=2;var m=qe;qe|=4;try{sb(s,l.alternate,l)}finally{qe=m,X.p=f,q.T=u}}St=3}}function Db(){if(St===4||St===3){St=0,XA();var s=pr,l=il,u=qn,f=xb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?St=5:(St=0,il=pr=null,jb(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(dr=null),of(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=q.T,m=X.p,X.p=2,q.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{q.T=l,X.p=m}}(qn&3)!==0&&Fu(),on(s),m=s.pendingLanes,(u&261930)!==0&&(m&42)!==0?s===Pd?Oo++:(Oo=0,Pd=s):Oo=0,Eo(0)}}function jb(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,ao(l)))}function Fu(){return Nb(),Rb(),Db(),Lb()}function Lb(){if(St!==5)return!1;var s=pr,l=Ud;Ud=0;var u=of(qn),f=q.T,m=X.p;try{X.p=32>u?32:u,q.T=null,u=qd,qd=null;var y=pr,S=qn;if(St=0,il=pr=null,qn=0,(qe&6)!==0)throw Error(n(331));var A=qe;if(qe|=4,mb(y.current),fb(y,y.current,S,u),qe=A,Eo(0,!1),pi&&typeof pi.onPostCommitFiberRoot=="function")try{pi.onPostCommitFiberRoot(Yl,y)}catch{}return!0}finally{X.p=m,q.T=f,jb(s,l)}}function Bb(s,l,u){l=Ri(u,l),l=bd(s.stateNode,l,2),s=or(s,l,2),s!==null&&(Kl(s,2),on(s))}function Ie(s,l,u){if(s.tag===3)Bb(s,s,u);else for(;l!==null;){if(l.tag===3){Bb(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=zx(2),f=or(l,u,2),f!==null&&(_x(u,f,l,s),Kl(f,2),on(f));break}}l=l.return}}function Id(s,l,u){var f=s.pingCache;if(f===null){f=s.pingCache=new wT;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)||(zd=!0,m.add(u),s=TT.bind(null,s,l,u),l.then(s,s))}function TT(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()-zu?(qe&2)===0&&nl(s,0):_d|=u,tl===De&&(tl=0)),on(s)}function zb(s,l){l===0&&(l=N0()),s=Wr(s,l),s!==null&&(Kl(s,l),on(s))}function OT(s){var l=s.memoizedState,u=0;l!==null&&(u=l.retryLane),zb(s,u)}function ET(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),zb(s,u)}function NT(s,l){return nf(s,l)}var Vu=null,sl=null,Qd=!1,Iu=!1,Yd=!1,gr=0;function on(s){s!==sl&&s.next===null&&(sl===null?Vu=sl=s:sl=sl.next=s),Iu=!0,Qd||(Qd=!0,DT())}function Eo(s,l){if(!Yd&&Iu){Yd=!0;do for(var u=!1,f=Vu;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,qb(f,y))}else y=De,y=Ka(f,f===We?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||Gl(f,y)||(u=!0,qb(f,y));f=f.next}while(u);Yd=!1}}function RT(){_b()}function _b(){Iu=Qd=!1;var s=0;gr!==0&&FT()&&(s=gr);for(var l=di(),u=null,f=Vu;f!==null;){var m=f.next,y=Hb(f,l);y===0?(f.next=null,u===null?Vu=m:u.next=m,m===null&&(sl=u)):(u=f,(s!==0||(y&3)!==0)&&(Iu=!0)),f=m}St!==0&&St!==5||Eo(s),gr!==0&&(gr=0)}function Hb(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]=rM(A,l)):O<=l&&(s.expiredLanes|=A),y&=~A}if(l=We,u=De,u=Ka(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&&rf(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||Gl(s,u)){if(l=u&-u,l===s.callbackPriority)return l;switch(f!==null&&rf(f),of(u)){case 2:case 8:u=O0;break;case 32:u=Ia;break;case 268435456:u=E0;break;default:u=Ia}return f=Ub.bind(null,s),u=nf(u,f),s.callbackPriority=l,s.callbackNode=u,l}return f!==null&&f!==null&&rf(f),s.callbackPriority=2,s.callbackNode=null,2}function Ub(s,l){if(St!==0&&St!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Fu()&&s.callbackNode!==u)return null;var f=De;return f=Ka(s,s===We?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(vb(s,f,l),Hb(s,di()),s.callbackNode!=null&&s.callbackNode===u?Ub.bind(null,s):null)}function qb(s,l){if(Fu())return null;vb(s,l,!0)}function DT(){IT(function(){(qe&6)!==0?nf(T0,RT):_b()})}function Gd(){if(gr===0){var s=Is;s===0&&(s=Qa,Qa<<=1,(Qa&261888)===0&&(Qa=256)),gr=s}return gr}function Pb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ja(""+s)}function Fb(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 jT(s,l,u,f,m){if(l==="submit"&&u&&u.stateNode===m){var y=Pb((m[$t]||null).action),S=f.submitter;S&&(l=(l=S[$t]||null)?Pb(l.formAction):S.getAttribute("formAction"),l!==null&&(y=l,S=null));var A=new iu("action","action",null,f,m);s.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(gr!==0){var O=S?Fb(m,S):new FormData(m);dd(u,{pending:!0,data:O,method:m.method,action:y},null,O)}}else typeof y=="function"&&(A.preventDefault(),O=S?Fb(m,S):new FormData(m),dd(u,{pending:!0,data:O,method:m.method,action:y},y,O))},currentTarget:m}]})}}for(var Kd=0;Kd<Nf.length;Kd++){var Wd=Nf[Kd],LT=Wd.toLowerCase(),BT=Wd[0].toUpperCase()+Wd.slice(1);Yi(LT,"on"+BT)}Yi(by,"onAnimationEnd"),Yi(vy,"onAnimationIteration"),Yi(Sy,"onAnimationStart"),Yi("dblclick","onDoubleClick"),Yi("focusin","onFocus"),Yi("focusout","onBlur"),Yi(ZM,"onTransitionRun"),Yi(JM,"onTransitionStart"),Yi($M,"onTransitionCancel"),Yi(wy,"onTransitionEnd"),Ns("onMouseEnter",["mouseout","mouseover"]),Ns("onMouseLeave",["mouseout","mouseover"]),Ns("onPointerEnter",["pointerout","pointerover"]),Ns("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 No="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(" "),zT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(No));function Vb(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(Y){su(Y)}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(Y){su(Y)}m.currentTarget=null,y=O}}}}function Ee(s,l){var u=l[af];u===void 0&&(u=l[af]=new Set);var f=s+"__bubble";u.has(f)||(Ib(l,s,2,!1),u.add(f))}function Xd(s,l,u){var f=0;l&&(f|=4),Ib(u,s,f,l)}var Qu="_reactListening"+Math.random().toString(36).slice(2);function Zd(s){if(!s[Qu]){s[Qu]=!0,_0.forEach(function(u){u!=="selectionchange"&&(zT.has(u)||Xd(u,!1,s),Xd(u,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Qu]||(l[Qu]=!0,Xd("selectionchange",!1,l))}}function Ib(s,l,u,f){switch(b1(l)){case 2:var m=cO;break;case 8:m=hO;break;default:m=fp}u=m.bind(null,l,u,s),m=void 0,!yf||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 Jd(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=Ts(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}W0(function(){var _=y,Y=mf(u),K=[];e:{var U=ky.get(s);if(U!==void 0){var V=iu,ae=s;switch(s){case"keypress":if(eu(u)===0)break e;case"keydown":case"keyup":V=EM;break;case"focusin":ae="focus",V=Sf;break;case"focusout":ae="blur",V=Sf;break;case"beforeblur":case"afterblur":V=Sf;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=J0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=yM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=DM;break;case by:case vy:case Sy:V=vM;break;case wy:V=LM;break;case"scroll":case"scrollend":V=mM;break;case"wheel":V=zM;break;case"copy":case"cut":case"paste":V=wM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=ey;break;case"toggle":case"beforetoggle":V=HM}var xe=(l&4)!==0,Ge=!xe&&(s==="scroll"||s==="scrollend"),L=xe?U!==null?U+"Capture":null:U;xe=[];for(var R=_,z;R!==null;){var G=R;if(z=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||z===null||L===null||(G=Zl(R,L),G!=null&&xe.push(Ro(R,G,z))),Ge)break;R=R.return}0<xe.length&&(U=new V(U,ae,null,u,Y),K.push({event:U,listeners:xe}))}}if((l&7)===0){e:{if(U=s==="mouseover"||s==="pointerover",V=s==="mouseout"||s==="pointerout",U&&u!==pf&&(ae=u.relatedTarget||u.fromElement)&&(Ts(ae)||ae[Ms]))break e;if((V||U)&&(U=Y.window===Y?Y:(U=Y.ownerDocument)?U.defaultView||U.parentWindow:window,V?(ae=u.relatedTarget||u.toElement,V=_,ae=ae?Ts(ae):null,ae!==null&&(Ge=o(ae),xe=ae.tag,ae!==Ge||xe!==5&&xe!==27&&xe!==6)&&(ae=null)):(V=null,ae=_),V!==ae)){if(xe=J0,G="onMouseLeave",L="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(xe=ey,G="onPointerLeave",L="onPointerEnter",R="pointer"),Ge=V==null?U:Xl(V),z=ae==null?U:Xl(ae),U=new xe(G,R+"leave",V,u,Y),U.target=Ge,U.relatedTarget=z,G=null,Ts(Y)===_&&(xe=new xe(L,R+"enter",ae,u,Y),xe.target=z,xe.relatedTarget=Ge,G=xe),Ge=G,V&&ae)t:{for(xe=_T,L=V,R=ae,z=0,G=L;G;G=xe(G))z++;G=0;for(var me=R;me;me=xe(me))G++;for(;0<z-G;)L=xe(L),z--;for(;0<G-z;)R=xe(R),G--;for(;z--;){if(L===R||R!==null&&L===R.alternate){xe=L;break t}L=xe(L),R=xe(R)}xe=null}else xe=null;V!==null&&Qb(K,U,V,xe,!1),ae!==null&&Ge!==null&&Qb(K,Ge,ae,xe,!0)}}e:{if(U=_?Xl(_):window,V=U.nodeName&&U.nodeName.toLowerCase(),V==="select"||V==="input"&&U.type==="file")var _e=ay;else if(ly(U))if(uy)_e=KM;else{_e=YM;var he=QM}else V=U.nodeName,!V||V.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?_&&df(_.elementType)&&(_e=ay):_e=GM;if(_e&&(_e=_e(s,_))){oy(K,_e,u,Y);break e}he&&he(s,U,_),s==="focusout"&&_&&U.type==="number"&&_.memoizedProps.value!=null&&ff(U,"number",U.value)}switch(he=_?Xl(_):window,s){case"focusin":(ly(he)||he.contentEditable==="true")&&(zs=he,Tf=_,so=null);break;case"focusout":so=Tf=zs=null;break;case"mousedown":Of=!0;break;case"contextmenu":case"mouseup":case"dragend":Of=!1,yy(K,u,Y);break;case"selectionchange":if(XM)break;case"keydown":case"keyup":yy(K,u,Y)}var Ae;if(kf)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 Bs?ry(s,u)&&(je="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(je="onCompositionStart");je&&(ty&&u.locale!=="ko"&&(Bs||je!=="onCompositionStart"?je==="onCompositionEnd"&&Bs&&(Ae=X0()):(er=Y,xf="value"in er?er.value:er.textContent,Bs=!0)),he=Yu(_,je),0<he.length&&(je=new $0(je,s,null,u,Y),K.push({event:je,listeners:he}),Ae?je.data=Ae:(Ae=sy(u),Ae!==null&&(je.data=Ae)))),(Ae=qM?PM(s,u):FM(s,u))&&(je=Yu(_,"onBeforeInput"),0<je.length&&(he=new $0("onBeforeInput","beforeinput",null,u,Y),K.push({event:he,listeners:je}),he.data=Ae)),jT(K,s,_,u,Y)}Vb(K,l)})}function Ro(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=Zl(s,u),m!=null&&f.unshift(Ro(s,m,y)),m=Zl(s,l),m!=null&&f.push(Ro(s,m,y))),s.tag===3)return f;s=s.return}return[]}function _T(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Qb(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?(_=Zl(u,y),_!=null&&S.unshift(Ro(u,_,O))):m||(_=Zl(u,y),_!=null&&S.push(Ro(u,_,O)))),u=u.return}S.length!==0&&s.push({event:l,listeners:S})}var HT=/\r\n?/g,UT=/\u0000|\uFFFD/g;function Yb(s){return(typeof s=="string"?s:""+s).replace(HT,`
9
+ `).replace(UT,"")}function Gb(s,l){return l=Yb(l),Yb(s)===l}function Ye(s,l,u,f,m,y){switch(u){case"children":typeof f=="string"?l==="body"||l==="textarea"&&f===""||Ds(s,f):(typeof f=="number"||typeof f=="bigint")&&l!=="body"&&Ds(s,""+f);break;case"className":Xa(s,"class",f);break;case"tabIndex":Xa(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Xa(s,u,f);break;case"style":G0(s,f,y);break;case"data":if(l!=="object"){Xa(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=Ja(""+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"&&Ye(s,l,"name",m.name,m,null),Ye(s,l,"formEncType",m.formEncType,m,null),Ye(s,l,"formMethod",m.formMethod,m,null),Ye(s,l,"formTarget",m.formTarget,m,null)):(Ye(s,l,"encType",m.encType,m,null),Ye(s,l,"method",m.method,m,null),Ye(s,l,"target",m.target,m,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=Ja(""+f),s.setAttribute(u,f);break;case"onClick":f!=null&&(s.onclick=An);break;case"onScroll":f!=null&&Ee("scroll",s);break;case"onScrollEnd":f!=null&&Ee("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=Ja(""+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":Ee("beforetoggle",s),Ee("toggle",s),Wa(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":Wa(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=dM.get(u)||u,Wa(s,u,f))}}function $d(s,l,u,f,m,y){switch(u){case"style":G0(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"?Ds(s,f):(typeof f=="number"||typeof f=="bigint")&&Ds(s,""+f);break;case"onScroll":f!=null&&Ee("scroll",s);break;case"onScrollEnd":f!=null&&Ee("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(!H0.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,""):Wa(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":Ee("error",s),Ee("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:Ye(s,l,y,S,u,null)}}m&&Ye(s,l,"srcSet",u.srcSet,u,null),f&&Ye(s,l,"src",u.src,u,null);return;case"input":Ee("invalid",s);var A=y=S=m=null,O=null,_=null;for(f in u)if(u.hasOwnProperty(f)){var Y=u[f];if(Y!=null)switch(f){case"name":m=Y;break;case"type":S=Y;break;case"checked":O=Y;break;case"defaultChecked":_=Y;break;case"value":y=Y;break;case"defaultValue":A=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(137,l));break;default:Ye(s,l,f,Y,u,null)}}V0(s,y,A,O,_,S,m,!1);return;case"select":Ee("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:Ye(s,l,m,A,u,null)}l=y,u=S,s.multiple=!!f,l!=null?Rs(s,!!f,l,!1):u!=null&&Rs(s,!!f,u,!0);return;case"textarea":Ee("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:Ye(s,l,S,A,u,null)}Q0(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":Ye(s,l,O,f,u,null));return;case"dialog":Ee("beforetoggle",s),Ee("toggle",s),Ee("cancel",s),Ee("close",s);break;case"iframe":case"object":Ee("load",s);break;case"video":case"audio":for(f=0;f<No.length;f++)Ee(No[f],s);break;case"image":Ee("error",s),Ee("load",s);break;case"details":Ee("toggle",s);break;case"embed":case"source":case"link":Ee("error",s),Ee("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:Ye(s,l,_,f,u,null)}return;default:if(df(l)){for(Y in u)u.hasOwnProperty(Y)&&(f=u[Y],f!==void 0&&$d(s,l,Y,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Ye(s,l,A,f,u,null))}function qT(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,Y=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)||Ye(s,l,V,null,f,K)}}for(var U in f){var V=f[U];if(K=u[U],f.hasOwnProperty(U)&&(V!=null||K!=null))switch(U){case"type":y=V;break;case"name":m=V;break;case"checked":_=V;break;case"defaultChecked":Y=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&&Ye(s,l,U,V,f,K)}}hf(s,S,A,O,_,Y,y,m);return;case"select":V=S=A=U=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)||Ye(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":U=y;break;case"defaultValue":A=y;break;case"multiple":S=y;default:y!==O&&Ye(s,l,m,y,f,O)}l=A,u=S,f=V,U!=null?Rs(s,!!u,U,!1):!!f!=!!u&&(l!=null?Rs(s,!!u,l,!0):Rs(s,!!u,u?[]:"",!1));return;case"textarea":V=U=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:Ye(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":U=m;break;case"defaultValue":V=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==y&&Ye(s,l,S,m,f,y)}I0(s,U,V);return;case"option":for(var ae in u)U=u[ae],u.hasOwnProperty(ae)&&U!=null&&!f.hasOwnProperty(ae)&&(ae==="selected"?s.selected=!1:Ye(s,l,ae,null,f,U));for(O in f)U=f[O],V=u[O],f.hasOwnProperty(O)&&U!==V&&(U!=null||V!=null)&&(O==="selected"?s.selected=U&&typeof U!="function"&&typeof U!="symbol":Ye(s,l,O,U,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)U=u[xe],u.hasOwnProperty(xe)&&U!=null&&!f.hasOwnProperty(xe)&&Ye(s,l,xe,null,f,U);for(_ in f)if(U=f[_],V=u[_],f.hasOwnProperty(_)&&U!==V&&(U!=null||V!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(137,l));break;default:Ye(s,l,_,U,f,V)}return;default:if(df(l)){for(var Ge in u)U=u[Ge],u.hasOwnProperty(Ge)&&U!==void 0&&!f.hasOwnProperty(Ge)&&$d(s,l,Ge,void 0,f,U);for(Y in f)U=f[Y],V=u[Y],!f.hasOwnProperty(Y)||U===V||U===void 0&&V===void 0||$d(s,l,Y,U,f,V);return}}for(var L in u)U=u[L],u.hasOwnProperty(L)&&U!=null&&!f.hasOwnProperty(L)&&Ye(s,l,L,null,f,U);for(K in f)U=f[K],V=u[K],!f.hasOwnProperty(K)||U===V||U==null&&V==null||Ye(s,l,K,U,f,V)}function Kb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function PT(){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&&Kb(S)){for(S=0,A=m.responseEnd,f+=1;f<u.length;f++){var O=u[f],_=O.startTime;if(_>A)break;var Y=O.transferSize,K=O.initiatorType;Y&&Kb(K)&&(O=O.responseEnd,S+=Y*(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 ep=null,tp=null;function Gu(s){return s.nodeType===9?s:s.ownerDocument}function Wb(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 Xb(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 ip(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 np=null;function FT(){var s=window.event;return s&&s.type==="popstate"?s===np?!1:(np=s,!0):(np=null,!1)}var Zb=typeof setTimeout=="function"?setTimeout:void 0,VT=typeof clearTimeout=="function"?clearTimeout:void 0,Jb=typeof Promise=="function"?Promise:void 0,IT=typeof queueMicrotask=="function"?queueMicrotask:typeof Jb<"u"?function(s){return Jb.resolve(null).then(s).catch(QT)}:Zb;function QT(s){setTimeout(function(){throw s})}function yr(s){return s==="head"}function $b(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),ul(l);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")Do(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,Do(u);for(var y=u.firstChild;y;){var S=y.nextSibling,A=y.nodeName;y[Wl]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&y.rel.toLowerCase()==="stylesheet"||u.removeChild(y),y=S}}else u==="body"&&Do(s.ownerDocument.body);u=m}while(u);ul(l)}function e1(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 rp(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":rp(u),uf(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function YT(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[Wl])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 GT(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 t1(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 sp(s){return s.data==="$?"||s.data==="$~"}function lp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function KT(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 op=null;function i1(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 n1(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 r1(s,l,u){switch(l=Gu(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 Do(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);uf(s)}var _i=new Map,s1=new Set;function Ku(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Pn=X.d;X.d={f:WT,r:XT,D:ZT,C:JT,L:$T,m:eO,X:iO,S:tO,M:nO};function WT(){var s=Pn.f(),l=Uu();return s||l}function XT(s){var l=Os(s);l!==null&&l.tag===5&&l.type==="form"?wx(l):Pn.r(s)}var ll=typeof document>"u"?null:document;function l1(s,l,u){var f=ll;if(f&&typeof l=="string"&&l){var m=Ei(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),s1.has(m)||(s1.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 ZT(s){Pn.D(s),l1("dns-prefetch",s,null)}function JT(s,l){Pn.C(s,l),l1("preconnect",s,l)}function $T(s,l,u){Pn.L(s,l,u);var f=ll;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=al(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(jo(y))||l==="script"&&f.querySelector(Lo(y))||(l=f.createElement("link"),Bt(l,"link",s),Mt(l),f.head.appendChild(l)))}}function eO(s,l){Pn.m(s,l);var u=ll;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=al(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(Lo(y)))return}f=u.createElement("link"),Bt(f,"link",s),Mt(f),u.head.appendChild(f)}}}function tO(s,l,u){Pn.S(s,l,u);var f=ll;if(f&&s){var m=Es(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(jo(y)))A.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":l},u),(u=_i.get(y))&&ap(s,u);var O=S=f.createElement("link");Mt(O),Bt(O,"link",s),O._p=new Promise(function(_,Y){O.onload=_,O.onerror=Y}),O.addEventListener("load",function(){A.loading|=1}),O.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Wu(S,l,f)}S={type:"stylesheet",instance:S,count:1,state:A},m.set(y,S)}}}function iO(s,l){Pn.X(s,l);var u=ll;if(u&&s){var f=Es(u).hoistableScripts,m=al(s),y=f.get(m);y||(y=u.querySelector(Lo(m)),y||(s=g({src:s,async:!0},l),(l=_i.get(m))&&up(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 nO(s,l){Pn.M(s,l);var u=ll;if(u&&s){var f=Es(u).hoistableScripts,m=al(s),y=f.get(m);y||(y=u.querySelector(Lo(m)),y||(s=g({src:s,async:!0,type:"module"},l),(l=_i.get(m))&&up(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)?Ku(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=Es(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=Es(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(jo(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||rO(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=al(u),u=Es(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 jo(s){return'link[rel="stylesheet"]['+s+"]"}function a1(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function rO(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 al(s){return'[src="'+Ei(s)+'"]'}function Lo(s){return"script[async]"+s}function u1(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),Wu(f,u.precedence,s),l.instance=f;case"stylesheet":m=ol(u.href);var y=s.querySelector(jo(m));if(y)return l.state.loading|=4,l.instance=y,Mt(y),y;f=a1(u),(m=_i.get(m))&&ap(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,Wu(y,u.precedence,s),l.instance=y;case"script":return y=al(u.src),(m=s.querySelector(Lo(y)))?(l.instance=m,Mt(m),m):(f=u,(m=_i.get(y))&&(f=g({},u),up(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,Wu(f,u.precedence,s));return l.instance}function Wu(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 ap(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function up(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Xu=null;function c1(s,l,u){if(Xu===null){var f=new Map,m=Xu=new Map;m.set(u,f)}else m=Xu,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[Wl]||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 h1(s,l,u){s=s.ownerDocument||s,s.head.insertBefore(u,l==="title"?s.querySelector("head > title"):null)}function sO(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 f1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function lO(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(jo(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Zu.bind(s),l.then(s,s)),u.state.loading|=4,u.instance=y,Mt(y);return}y=l.ownerDocument||l,f=a1(f),(m=_i.get(m))&&ap(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=Zu.bind(s),l.addEventListener("load",u),l.addEventListener("error",u))}}var cp=0;function oO(s,l){return s.stylesheets&&s.count===0&&$u(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var f=setTimeout(function(){if(s.stylesheets&&$u(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+l);0<s.imgBytes&&cp===0&&(cp=62500*PT());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&$u(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>cp?50:800)+l);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(m)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$u(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Ju=null;function $u(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Ju=new Map,l.forEach(aO,s),Ju=null,Zu.call(s))}function aO(s,l){if(!(l.state.loading&4)){var u=Ju.get(s);if(u)var f=u.get(null);else{u=new Map,Ju.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=Zu.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 Bo={$$typeof:D,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function uO(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=sf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sf(0),this.hiddenUpdates=sf(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 d1(s,l,u,f,m,y,S,A,O,_,Y,K){return s=new uO(s,l,u,S,O,_,Y,K,A),l=1,y===!0&&(l|=24),y=yi(3,null,null,l),s.current=y,y.stateNode=s,l=Vf(),l.refCount++,s.pooledCache=l,l.refCount++,y.memoizedState={element:f,isDehydrated:u,cache:l},Gf(y),s}function p1(s){return s?(s=Us,s):Us}function m1(s,l,u,f,m,y){m=p1(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=or(s,f,l),u!==null&&(si(u,s,l),fo(u,s,l))}function g1(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<l?u:l}}function hp(s,l){g1(s,l),(s=s.alternate)&&g1(s,l)}function y1(s){if(s.tag===13||s.tag===31){var l=Wr(s,67108864);l!==null&&si(l,s,67108864),hp(s,67108864)}}function x1(s){if(s.tag===13||s.tag===31){var l=wi();l=lf(l);var u=Wr(s,l);u!==null&&si(u,s,l),hp(s,l)}}var ec=!0;function cO(s,l,u,f){var m=q.T;q.T=null;var y=X.p;try{X.p=2,fp(s,l,u,f)}finally{X.p=y,q.T=m}}function hO(s,l,u,f){var m=q.T;q.T=null;var y=X.p;try{X.p=8,fp(s,l,u,f)}finally{X.p=y,q.T=m}}function fp(s,l,u,f){if(ec){var m=dp(f);if(m===null)Jd(s,l,f,tc,u),v1(s,f);else if(dO(m,s,l,u,f))f.stopPropagation();else if(v1(s,f),l&4&&-1<fO.indexOf(s)){for(;m!==null;){var y=Os(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}on(y),(qe&6)===0&&(_u=di()+500,Eo(0))}}break;case 31:case 13:A=Wr(y,2),A!==null&&si(A,y,2),Uu(),hp(y,2)}if(y=dp(f),y===null&&Jd(s,l,f,tc,u),y===m)break;m=y}m!==null&&f.stopPropagation()}else Jd(s,l,f,null,u)}}function dp(s){return s=mf(s),pp(s)}var tc=null;function pp(s){if(tc=null,s=Ts(s),s!==null){var l=o(s);if(l===null)s=null;else{var u=l.tag;if(u===13){if(s=a(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 tc=s,null}function b1(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(ZA()){case T0:return 2;case O0:return 8;case Ia:case JA:return 32;case E0:return 268435456;default:return 32}default:return 32}}var mp=!1,xr=null,br=null,vr=null,zo=new Map,_o=new Map,Sr=[],fO="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 v1(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":zo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":_o.delete(l.pointerId)}}function Ho(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=Os(l),l!==null&&y1(l)),s):(s.eventSystemFlags|=f,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function dO(s,l,u,f,m){switch(l){case"focusin":return xr=Ho(xr,s,l,u,f,m),!0;case"dragenter":return br=Ho(br,s,l,u,f,m),!0;case"mouseover":return vr=Ho(vr,s,l,u,f,m),!0;case"pointerover":var y=m.pointerId;return zo.set(y,Ho(zo.get(y)||null,s,l,u,f,m)),!0;case"gotpointercapture":return y=m.pointerId,_o.set(y,Ho(_o.get(y)||null,s,l,u,f,m)),!0}return!1}function S1(s){var l=Ts(s.target);if(l!==null){var u=o(l);if(u!==null){if(l=u.tag,l===13){if(l=a(u),l!==null){s.blockedOn=l,B0(s.priority,function(){x1(u)});return}}else if(l===31){if(l=c(u),l!==null){s.blockedOn=l,B0(s.priority,function(){x1(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 ic(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var u=dp(s.nativeEvent);if(u===null){u=s.nativeEvent;var f=new u.constructor(u.type,u);pf=f,u.target.dispatchEvent(f),pf=null}else return l=Os(u),l!==null&&y1(l),s.blockedOn=u,!1;l.shift()}return!0}function w1(s,l,u){ic(s)&&u.delete(l)}function pO(){mp=!1,xr!==null&&ic(xr)&&(xr=null),br!==null&&ic(br)&&(br=null),vr!==null&&ic(vr)&&(vr=null),zo.forEach(w1),_o.forEach(w1)}function nc(s,l){s.blockedOn===l&&(s.blockedOn=null,mp||(mp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,pO)))}var rc=null;function k1(s){rc!==s&&(rc=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){rc===s&&(rc=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(pp(f||u)===null)continue;break}var y=Os(u);y!==null&&(s.splice(l,3),l-=3,dd(y,{pending:!0,data:m,method:u.method,action:f},f,m))}}))}function ul(s){function l(O){return nc(O,s)}xr!==null&&nc(xr,s),br!==null&&nc(br,s),vr!==null&&nc(vr,s),zo.forEach(l),_o.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);)S1(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||k1(u);else if(S){var A=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[$t]||null)A=S.formAction;else if(pp(m)!==null)continue}else A=S.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),k1(u)}}}function C1(){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 gp(s){this._internalRoot=s}sc.prototype.render=gp.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,f=wi();m1(u,f,s,l,null,null)},sc.prototype.unmount=gp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;m1(s.current,2,null,s,null,null),Uu(),l[Ms]=null}};function sc(s){this._internalRoot=s}sc.prototype.unstable_scheduleHydration=function(s){if(s){var l=L0();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&&S1(s)}};var A1=e.version;if(A1!=="19.2.4")throw Error(n(527,A1,"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 mO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lc.isDisabled&&lc.supportsFiber)try{Yl=lc.inject(mO),pi=lc}catch{}}return qo.createRoot=function(s,l){if(!r(s))throw Error(n(299));var u=!1,f="",m=Dx,y=jx,S=Lx;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=d1(s,1,!1,null,null,u,f,null,m,y,S,C1),s[Ms]=l.current,Zd(s),new gp(l)},qo.hydrateRoot=function(s,l,u){if(!r(s))throw Error(n(299));var f=!1,m="",y=Dx,S=jx,A=Lx,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=d1(s,1,!0,l,u??null,f,m,O,y,S,A,C1),l.context=p1(null),u=l.current,f=wi(),f=lf(f),m=lr(f),m.callback=null,or(u,m,f),u=f,l.current.lanes=u,Kl(l,u),on(l),s[Ms]=l.current,Zd(s),new sc(l)},qo.version="19.2.4",qo}var B1;function AO(){if(B1)return bp.exports;B1=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(),bp.exports=CO(),bp.exports}var MO=AO();var z1="popstate";function _1(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function TO(t={}){function e(n,r){let o=r.state?.masked,{pathname:a,search:c,hash:h}=o||n.location;return cm("",{pathname:a,search:c,hash:h},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function i(n,r){return typeof r=="string"?r:aa(r)}return EO(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 OO(){return Math.random().toString(36).substring(2,10)}function H1(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 cm(t,e,i=null,n,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?_l(e):e,state:i,key:e&&e.key||n||OO(),unstable_mask:r}}function aa({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 _l(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 EO(t,e,i,n={}){let{window:r=document.defaultView,v5Compat:o=!1}=n,a=r.history,c="POP",h=null,d=p();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function p(){return(a.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=_1(C)?C:cm(k.location,C,M);d=p()+1;let D=H1(T,d),j=k.createHref(T.unstable_mask||T);try{a.pushState(D,"",j)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;r.location.assign(j)}o&&h&&h({action:c,location:k.location,delta:1})}function b(C,M){c="REPLACE";let T=_1(C)?C:cm(k.location,C,M);d=p();let D=H1(T,d),j=k.createHref(T.unstable_mask||T);a.replaceState(D,"",j),o&&h&&h({action:c,location:k.location,delta:0})}function w(C){return NO(C)}let k={get action(){return c},get location(){return t(r,a)},listen(C){if(h)throw new Error("A history only accepts one active listener");return r.addEventListener(z1,g),h=C,()=>{r.removeEventListener(z1,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:b,go(C){return a.go(C)}};return k}function NO(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:aa(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=i+n),new URL(n,i)}function m2(t,e,i="/"){return RO(t,e,i,!1)}function RO(t,e,i,n){let r=typeof e=="string"?_l(e):e,o=Yn(r.pathname||"/",i);if(o==null)return null;let a=g2(t);DO(a);let c=null;for(let h=0;c==null&&h<a.length;++h){let d=VO(o);c=PO(a[h],d,n)}return c}function g2(t,e=[],i=[],n="",r=!1){let o=(a,c,h=r,d)=>{let p={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};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);a.children&&a.children.length>0&&(rt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),g2(a.children,e,x,g,h)),!(a.path==null&&!a.index)&&e.push({path:g,score:UO(g,a.index),routesMeta:x})};return t.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))o(a,c);else for(let h of y2(a.path))o(a,c,!0,h)}),e}function y2(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),o=i.replace(/\?$/,"");if(n.length===0)return r?[o,""]:[o];let a=y2(n.join("/")),c=[];return c.push(...a.map(h=>h===""?o:[o,h].join("/"))),r&&c.push(...a),c.map(h=>t.startsWith("/")&&h===""?"/":h)}function DO(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:qO(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}var jO=/^:[\w-]+$/,LO=3,BO=2,zO=1,_O=10,HO=-2,U1=t=>t==="*";function UO(t,e){let i=t.split("/"),n=i.length;return i.some(U1)&&(n+=HO),e&&(n+=BO),i.filter(r=>!U1(r)).reduce((r,o)=>r+(jO.test(o)?LO:o===""?zO:_O),n)}function qO(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 PO(t,e,i=!1){let{routesMeta:n}=t,r={},o="/",a=[];for(let c=0;c<n.length;++c){let h=n[c],d=c===n.length-1,p=o==="/"?e:e.slice(o.length)||"/",g=Qc({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),x=h.route;if(!g&&d&&i&&!n[n.length-1].route.index&&(g=Qc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!g)return null;Object.assign(r,g.params),a.push({params:r,pathname:xn([o,g.pathname]),pathnameBase:GO(xn([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=xn([o,g.pathnameBase]))}return a}function Qc(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,n]=FO(t.path,t.caseSensitive,t.end),r=e.match(i);if(!r)return null;let o=r[0],a=o.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((d,{paramName:p,isOptional:g},x)=>{if(p==="*"){let w=c[x]||"";a=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=c[x];return g&&!b?d[p]=void 0:d[p]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:a,pattern:t}}function FO(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,(a,c,h,d,p)=>{if(n.push({paramName:c,isOptional:h!=null}),h){let g=p.charAt(d+a.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 VO(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 Yn(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 IO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function QO(t,e="/"){let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?_l(t):t,o;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?o=q1(i.substring(1),"/"):o=q1(i,e)):o=e,{pathname:o,search:KO(n),hash:WO(r)}}function q1(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 kp(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 YO(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function wg(t){let e=YO(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=_l(t):(r={...t},rt(!r.pathname||!r.pathname.includes("?"),kp("?","pathname","search",r)),rt(!r.pathname||!r.pathname.includes("#"),kp("#","pathname","hash",r)),rt(!r.search||!r.search.includes("#"),kp("#","search","hash",r)));let o=t===""||r.pathname==="",a=o?"/":r.pathname,c;if(a==null)c=i;else{let g=e.length-1;if(!n&&a.startsWith("..")){let x=a.split("/");for(;x[0]==="..";)x.shift(),g-=1;r.pathname=x.join("/")}c=g>=0?e[g]:"/"}let h=QO(r,c),d=a&&a!=="/"&&a.endsWith("/"),p=(o||a===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var xn=t=>t.join("/").replace(/\/\/+/g,"/"),GO=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),KO=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,WO=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,XO=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 ZO(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function JO(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var x2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function b2(t,e){let i=t;if(typeof i!="string"||!IO.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let n=i,r=!1;if(x2)try{let o=new URL(window.location.href),a=i.startsWith("//")?new URL(o.protocol+i):new URL(i),c=Yn(a.pathname,e);a.origin===o.origin&&c!=null?i=c+a.search+a.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 v2=["POST","PUT","PATCH","DELETE"];new Set(v2);var $O=["GET",...v2];new Set($O);var Hl=N.createContext(null);Hl.displayName="DataRouter";var jh=N.createContext(null);jh.displayName="DataRouterState";var eE=N.createContext(!1),S2=N.createContext({isTransitioning:!1});S2.displayName="ViewTransition";var tE=N.createContext(new Map);tE.displayName="Fetchers";var iE=N.createContext(null);iE.displayName="Await";var Ti=N.createContext(null);Ti.displayName="Navigation";var Da=N.createContext(null);Da.displayName="Location";var en=N.createContext({outlet:null,matches:[],isDataRoute:!1});en.displayName="Route";var kg=N.createContext(null);kg.displayName="RouteError";var w2="REACT_ROUTER_ERROR",nE="REDIRECT",rE="ROUTE_ERROR_RESPONSE";function sE(t){if(t.startsWith(`${w2}:${nE}:{`))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 lE(t){if(t.startsWith(`${w2}:${rE}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new XO(e.status,e.statusText,e.data)}catch{}}function oE(t,{relative:e}={}){rt(Ul(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:n}=N.useContext(Ti),{hash:r,pathname:o,search:a}=ja(t,{relative:e}),c=o;return i!=="/"&&(c=o==="/"?i:xn([i,o])),n.createHref({pathname:c,search:a,hash:r})}function Ul(){return N.useContext(Da)!=null}function Zn(){return rt(Ul(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(Da).location}var k2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function C2(t){N.useContext(Ti).static||N.useLayoutEffect(t)}function A2(){let{isDataRoute:t}=N.useContext(en);return t?wE():aE()}function aE(){rt(Ul(),"useNavigate() may be used only in the context of a <Router> component.");let t=N.useContext(Hl),{basename:e,navigator:i}=N.useContext(Ti),{matches:n}=N.useContext(en),{pathname:r}=Zn(),o=JSON.stringify(wg(n)),a=N.useRef(!1);return C2(()=>{a.current=!0}),N.useCallback((h,d={})=>{if(Ji(a.current,k2),!a.current)return;if(typeof h=="number"){i.go(h);return}let p=Dh(h,JSON.parse(o),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,o,r,t])}var uE=N.createContext(null);function cE(t){let e=N.useContext(en).outlet;return N.useMemo(()=>e&&N.createElement(uE.Provider,{value:t},e),[e,t])}function ja(t,{relative:e}={}){let{matches:i}=N.useContext(en),{pathname:n}=Zn(),r=JSON.stringify(wg(i));return N.useMemo(()=>Dh(t,JSON.parse(r),n,e==="path"),[t,r,n,e])}function hE(t,e){return M2(t,e)}function M2(t,e,i){rt(Ul(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=N.useContext(Ti),{matches:r}=N.useContext(en),o=r[r.length-1],a=o?o.params:{},c=o?o.pathname:"/",h=o?o.pathnameBase:"/",d=o&&o.route;{let C=d&&d.path||"";O2(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"?_l(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||"/",b=x;if(h!=="/"){let C=h.replace(/^\//,"").split("/");b="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=m2(t,{pathname:b});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=gE(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},a,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?N.createElement(Da.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function fE(){let t=SE(),e=ZO(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},o={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:o},"ErrorBoundary")," or"," ",N.createElement("code",{style:o},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},e),i?N.createElement("pre",{style:r},i):null,a)}var dE=N.createElement(fE,null),T2=class extends N.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=lE(t.digest);i&&(t=i)}let e=t!==void 0?N.createElement(en.Provider,{value:this.props.routeContext},N.createElement(kg.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?N.createElement(pE,{error:t},e):e}};T2.contextType=eE;var Cp=new WeakMap;function pE({children:t,error:e}){let{basename:i}=N.useContext(Ti);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=sE(e.digest);if(n){let r=Cp.get(e);if(r)throw r;let o=b2(n.location,i);if(x2&&!Cp.get(e))if(o.isExternal||n.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:n.replace}));throw Cp.set(e,a),a}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return t}function mE({routeContext:t,match:e,children:i}){let n=N.useContext(Hl);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),N.createElement(en.Provider,{value:t},i)}function gE(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,o=n?.errors;if(o!=null){let p=r.findIndex(g=>g.route.id&&o?.[g.route.id]!==void 0);rt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,p+1))}let a=!1,c=-1;if(i&&n){a=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:b}=n,w=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||w){i.isStatic&&(a=!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:JO(n.matches),errorInfo:g})}:void 0;return r.reduceRight((p,g,x)=>{let b,w=!1,k=null,C=null;n&&(b=o&&g.route.id?o[g.route.id]:void 0,k=g.route.errorElement||dE,a&&(c<0&&x===0?(O2("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 D;return b?D=k:w?D=C:g.route.Component?D=N.createElement(g.route.Component,null):g.route.element?D=g.route.element:D=p,N.createElement(mE,{match:g,routeContext:{outlet:p,matches:M,isDataRoute:n!=null},children:D})};return n&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?N.createElement(T2,{location:n.location,revalidation:n.revalidation,component:k,error:b,children:T(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):T()},null)}function Cg(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yE(t){let e=N.useContext(Hl);return rt(e,Cg(t)),e}function xE(t){let e=N.useContext(jh);return rt(e,Cg(t)),e}function bE(t){let e=N.useContext(en);return rt(e,Cg(t)),e}function Ag(t){let e=bE(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 vE(){return Ag("useRouteId")}function SE(){let t=N.useContext(kg),e=xE("useRouteError"),i=Ag("useRouteError");return t!==void 0?t:e.errors?.[i]}function wE(){let{router:t}=yE("useNavigate"),e=Ag("useNavigate"),i=N.useRef(!1);return C2(()=>{i.current=!0}),N.useCallback(async(r,o={})=>{Ji(i.current,k2),i.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...o}))},[t,e])}var P1={};function O2(t,e,i){!e&&!P1[t]&&(P1[t]=!0,Ji(!1,i))}N.memo(kE);function kE({routes:t,future:e,state:i,isStatic:n,onError:r}){return M2(t,void 0,{state:i,isStatic:n,onError:r})}function CE({to:t,replace:e,state:i,relative:n}){rt(Ul(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=N.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:o}=N.useContext(en),{pathname:a}=Zn(),c=A2(),h=Dh(t,wg(o),a,n==="path"),d=JSON.stringify(h);return N.useEffect(()=>{c(JSON.parse(d),{replace:e,state:i,relative:n})},[c,d,n,e,i]),null}function AE(t){return cE(t.context)}function jc(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 ME({basename:t="/",children:e=null,location:i,navigationType:n="POP",navigator:r,static:o=!1,unstable_useTransitions:a}){rt(!Ul(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),h=N.useMemo(()=>({basename:c,navigator:r,static:o,unstable_useTransitions:a,future:{}}),[c,r,o,a]);typeof i=="string"&&(i=_l(i));let{pathname:d="/",search:p="",hash:g="",state:x=null,key:b="default",unstable_mask:w}=i,k=N.useMemo(()=>{let C=Yn(d,c);return C==null?null:{location:{pathname:C,search:p,hash:g,state:x,key:b,unstable_mask:w},navigationType:n}},[c,d,p,g,x,b,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:N.createElement(Ti.Provider,{value:h},N.createElement(Da.Provider,{children:e,value:k}))}function TE({children:t,location:e}){return hE(hm(t),e)}function hm(t,e=[]){let i=[];return N.Children.forEach(t,(n,r)=>{if(!N.isValidElement(n))return;let o=[...e,r];if(n.type===N.Fragment){i.push.apply(i,hm(n.props.children,o));return}rt(n.type===jc,`[${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 a={id:n.props.id||o.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&&(a.children=hm(n.props.children,o)),i.push(a)}),i}var Lc="get",Bc="application/x-www-form-urlencoded";function Lh(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function OE(t){return Lh(t)&&t.tagName.toLowerCase()==="button"}function EE(t){return Lh(t)&&t.tagName.toLowerCase()==="form"}function NE(t){return Lh(t)&&t.tagName.toLowerCase()==="input"}function RE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function DE(t,e){return t.button===0&&(!e||e==="_self")&&!RE(t)}var oc=null;function jE(){if(oc===null)try{new FormData(document.createElement("form"),0),oc=!1}catch{oc=!0}return oc}var LE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ap(t){return t!=null&&!LE.has(t)?(Ji(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bc}"`),null):t}function BE(t,e){let i,n,r,o,a;if(EE(t)){let c=t.getAttribute("action");n=c?Yn(c,e):null,i=t.getAttribute("method")||Lc,r=Ap(t.getAttribute("enctype"))||Bc,o=new FormData(t)}else if(OE(t)||NE(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?Yn(h,e):null,i=t.getAttribute("formmethod")||c.getAttribute("method")||Lc,r=Ap(t.getAttribute("formenctype"))||Ap(c.getAttribute("enctype"))||Bc,o=new FormData(c,t),!jE()){let{name:d,type:p,value:g}=t;if(p==="image"){let x=d?`${d}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else d&&o.append(d,g)}}else{if(Lh(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Lc,n=null,r=Bc,a=t}return o&&r==="text/plain"&&(a=o,o=void 0),{action:n,method:i.toLowerCase(),encType:r,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Mg(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function zE(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&&Yn(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function _E(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 HE(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 UE(t,e,i){let n=await Promise.all(t.map(async r=>{let o=e.routes[r.route.id];if(o){let a=await _E(o,i);return a.links?a.links():[]}return[]}));return VE(n.flat(1).filter(HE).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function F1(t,e,i,n,r,o){let a=(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 o==="assets"?e.filter((h,d)=>a(h,d)||c(h,d)):o==="data"?e.filter((h,d)=>{let p=n.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(a(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 qE(t,e,{includeHydrateFallback:i}={}){return PE(t.map(n=>{let r=e.routes[n.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),i&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function PE(t){return[...new Set(t)]}function FE(t){let e={},i=Object.keys(t).sort();for(let n of i)e[n]=t[n];return e}function VE(t,e){let i=new Set;return new Set(e),t.reduce((n,r)=>{let o=JSON.stringify(FE(r));return i.has(o)||(i.add(o),n.push({key:o,link:r})),n},[])}function E2(){let t=N.useContext(Hl);return Mg(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function IE(){let t=N.useContext(jh);return Mg(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Tg=N.createContext(void 0);Tg.displayName="FrameworkContext";function N2(){let t=N.useContext(Tg);return Mg(t,"You must render this element inside a <HydratedRouter> element"),t}function QE(t,e){let i=N.useContext(Tg),[n,r]=N.useState(!1),[o,a]=N.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:g}=e,x=N.useRef(null);N.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let k=M=>{M.forEach(T=>{a(T.isIntersecting)})},C=new IntersectionObserver(k,{threshold:.5});return x.current&&C.observe(x.current),()=>{C.disconnect()}}},[t]),N.useEffect(()=>{if(n){let k=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(k)}}},[n]);let b=()=>{r(!0)},w=()=>{r(!1),a(!1)};return i?t!=="intent"?[o,x,{}]:[o,x,{onFocus:Po(c,b),onBlur:Po(h,w),onMouseEnter:Po(d,b),onMouseLeave:Po(p,w),onTouchStart:Po(g,b)}]:[!1,x,{}]}function Po(t,e){return i=>{t&&t(i),i.defaultPrevented||e(i)}}function YE({page:t,...e}){let{router:i}=E2(),n=N.useMemo(()=>m2(i.routes,t,i.basename),[i.routes,t,i.basename]);return n?N.createElement(KE,{page:t,matches:n,...e}):null}function GE(t){let{manifest:e,routeModules:i}=N2(),[n,r]=N.useState([]);return N.useEffect(()=>{let o=!1;return UE(t,e,i).then(a=>{o||r(a)}),()=>{o=!0}},[t,e,i]),n}function KE({page:t,matches:e,...i}){let n=Zn(),{future:r,manifest:o,routeModules:a}=N2(),{basename:c}=E2(),{loaderData:h,matches:d}=IE(),p=N.useMemo(()=>F1(t,e,d,o,n,"data"),[t,e,d,o,n]),g=N.useMemo(()=>F1(t,e,d,o,n,"assets"),[t,e,d,o,n]),x=N.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let k=new Set,C=!1;if(e.forEach(T=>{let D=o.routes[T.route.id];!D||!D.hasLoader||(!p.some(j=>j.route.id===T.route.id)&&T.route.id in h&&a[T.route.id]?.shouldRevalidate||D.hasClientLoader?C=!0:k.add(T.route.id))}),k.size===0)return[];let M=zE(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,o,p,e,t,a]),b=N.useMemo(()=>qE(g,o),[g,o]),w=GE(g);return N.createElement(N.Fragment,null,x.map(k=>N.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...i})),b.map(k=>N.createElement("link",{key:k,rel:"modulepreload",href:k,...i})),w.map(({key:k,link:C})=>N.createElement("link",{key:k,nonce:i.nonce,...C,crossOrigin:C.crossOrigin??i.crossOrigin})))}function WE(...t){return e=>{t.forEach(i=>{typeof i=="function"?i(e):i!=null&&(i.current=e)})}}var XE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{XE&&(window.__reactRouterVersion="7.13.1")}catch{}function ZE({basename:t,children:e,unstable_useTransitions:i,window:n}){let r=N.useRef();r.current==null&&(r.current=TO({window:n,v5Compat:!0}));let o=r.current,[a,c]=N.useState({action:o.action,location:o.location}),h=N.useCallback(d=>{i===!1?c(d):N.startTransition(()=>c(d))},[i]);return N.useLayoutEffect(()=>o.listen(h),[o,h]),N.createElement(ME,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:o,unstable_useTransitions:i})}var R2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,D2=N.forwardRef(function({onClick:e,discover:i="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,unstable_mask:c,state:h,target:d,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:b,...w},k){let{basename:C,navigator:M,unstable_useTransitions:T}=N.useContext(Ti),D=typeof p=="string"&&R2.test(p),j=b2(p,C);p=j.to;let B=oE(p,{relative:r}),P=Zn(),H=null;if(c){let de=Dh(c,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);C!=="/"&&(de.pathname=de.pathname==="/"?C:xn([C,de.pathname])),H=M.createHref(de)}let[Z,J,ue]=QE(n,w),oe=t3(p,{replace:a,unstable_mask:c,state:h,target:d,preventScrollReset:g,relative:r,viewTransition:x,unstable_defaultShouldRevalidate:b,unstable_useTransitions:T});function F(de){e&&e(de),de.defaultPrevented||oe(de)}let ee=!(j.isExternal||o),fe=N.createElement("a",{...w,...ue,href:(ee?H:void 0)||j.absoluteURL||B,onClick:ee?F:e,ref:WE(k,J),target:d,"data-discover":!D&&i==="render"?"true":void 0});return Z&&!D?N.createElement(N.Fragment,null,fe,N.createElement(YE,{page:B})):fe});D2.displayName="Link";var JE=N.forwardRef(function({"aria-current":e="page",caseSensitive:i=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:c,children:h,...d},p){let g=ja(a,{relative:d.relative}),x=Zn(),b=N.useContext(jh),{navigator:w,basename:k}=N.useContext(Ti),C=b!=null&&l3(g)&&c===!0,M=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,T=x.pathname,D=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;i||(T=T.toLowerCase(),D=D?D.toLowerCase():null,M=M.toLowerCase()),D&&k&&(D=Yn(D,k)||D);const j=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let B=T===M||!r&&T.startsWith(M)&&T.charAt(j)==="/",P=D!=null&&(D===M||!r&&D.startsWith(M)&&D.charAt(M.length)==="/"),H={isActive:B,isPending:P,isTransitioning:C},Z=B?e:void 0,J;typeof n=="function"?J=n(H):J=[n,B?"active":null,P?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ue=typeof o=="function"?o(H):o;return N.createElement(D2,{...d,"aria-current":Z,className:J,ref:p,style:ue,to:a,viewTransition:c},typeof h=="function"?h(H):h)});JE.displayName="NavLink";var $E=N.forwardRef(({discover:t="render",fetcherKey:e,navigate:i,reloadDocument:n,replace:r,state:o,method:a=Lc,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...b},w)=>{let{unstable_useTransitions:k}=N.useContext(Ti),C=r3(),M=s3(c,{relative:d}),T=a.toLowerCase()==="get"?"get":"post",D=typeof c=="string"&&R2.test(c),j=B=>{if(h&&h(B),B.defaultPrevented)return;B.preventDefault();let P=B.nativeEvent.submitter,H=P?.getAttribute("formmethod")||a,Z=()=>C(P||B.currentTarget,{fetcherKey:e,method:H,navigate:i,replace:r,state:o,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&i!==!1?N.startTransition(()=>Z()):Z()};return N.createElement("form",{ref:w,method:T,action:M,onSubmit:n?h:j,...b,"data-discover":!D&&t==="render"?"true":void 0})});$E.displayName="Form";function e3(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j2(t){let e=N.useContext(Hl);return rt(e,e3(t)),e}function t3(t,{target:e,replace:i,unstable_mask:n,state:r,preventScrollReset:o,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let p=A2(),g=Zn(),x=ja(t,{relative:a});return N.useCallback(b=>{if(DE(b,e)){b.preventDefault();let w=i!==void 0?i:aa(g)===aa(x),k=()=>p(t,{replace:w,unstable_mask:n,state:r,preventScrollReset:o,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:h});d?N.startTransition(()=>k()):k()}},[g,p,x,i,n,r,e,t,o,a,c,h,d])}var i3=0,n3=()=>`__${String(++i3)}__`;function r3(){let{router:t}=j2("useSubmit"),{basename:e}=N.useContext(Ti),i=vE(),n=t.fetch,r=t.navigate;return N.useCallback(async(o,a={})=>{let{action:c,method:h,encType:d,formData:p,body:g}=BE(o,e);if(a.navigate===!1){let x=a.fetcherKey||n3();await n(x,i,a.action||c,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:g,formMethod:a.method||h,formEncType:a.encType||d,flushSync:a.flushSync})}else await r(a.action||c,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:g,formMethod:a.method||h,formEncType:a.encType||d,replace:a.replace,state:a.state,fromRouteId:i,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,r,e,i])}function s3(t,{relative:e}={}){let{basename:i}=N.useContext(Ti),n=N.useContext(en);rt(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),o={...ja(t||".",{relative:e})},a=Zn();if(t==null){o.search=a.search;let c=new URLSearchParams(o.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();o.search=p?`?${p}`:""}}return(!t||t===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(o.pathname=o.pathname==="/"?i:xn([i,o.pathname])),aa(o)}function l3(t,{relative:e}={}){let i=N.useContext(S2);rt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=j2("useViewTransitionState"),r=ja(t,{relative:e});if(!i.isTransitioning)return!1;let o=Yn(i.currentLocation.pathname,n)||i.currentLocation.pathname,a=Yn(i.nextLocation.pathname,n)||i.nextLocation.pathname;return Qc(r.pathname,a)!=null||Qc(r.pathname,o)!=null}var ql=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(){}},o3={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},a3=class{#e=o3;#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 a3;function u3(t){setTimeout(t,0)}var bs=typeof window>"u"||"Deno"in globalThis;function Kt(){}function c3(t,e){return typeof t=="function"?t(e):t}function fm(t){return typeof t=="number"&&t>=0&&t!==1/0}function L2(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 V1(t,e){const{type:i="all",exact:n,fetchStatus:r,predicate:o,queryKey:a,stale:c}=t;if(a){if(n){if(e.queryHash!==Og(a,e.options))return!1}else if(!ua(e.queryKey,a))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||o&&!o(e))}function I1(t,e){const{exact:i,status:n,predicate:r,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(i){if(vs(e.options.mutationKey)!==vs(o))return!1}else if(!ua(e.options.mutationKey,o))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Og(t,e){return(e?.queryKeyHashFn||vs)(t)}function vs(t){return JSON.stringify(t,(e,i)=>dm(i)?Object.keys(i).sort().reduce((n,r)=>(n[r]=i[r],n),{}):i)}function ua(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(i=>ua(t[i],e[i])):!1}var h3=Object.prototype.hasOwnProperty;function B2(t,e,i=0){if(t===e)return t;if(i>500)return e;const n=Q1(t)&&Q1(e);if(!n&&!(dm(t)&&dm(e)))return e;const o=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),c=a.length,h=n?new Array(c):{};let d=0;for(let p=0;p<c;p++){const g=n?p:a[p],x=t[g],b=e[g];if(x===b){h[g]=x,(n?p<o:h3.call(t,g))&&d++;continue}if(x===null||b===null||typeof x!="object"||typeof b!="object"){h[g]=b;continue}const w=B2(x,b,i+1);h[g]=w,w===x&&d++}return o===c&&d===o?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 Q1(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function dm(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 f3(t){return new Promise(e=>{fs.setTimeout(e,t)})}function pm(t,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(t,e):i.structuralSharing!==!1?B2(t,e):e}function d3(t,e,i=0){const n=[...t,e];return i&&n.length>i?n.slice(1):n}function p3(t,e,i=0){const n=[e,...t];return i&&n.length>i?n.slice(0,-1):n}var Eg=Symbol();function z2(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Eg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ng(t,e){return typeof t=="function"?t(...e):!!t}function m3(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 g3=class extends ql{#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"}},Rg=new g3;function mm(){let t,e;const i=new Promise((r,o)=>{t=r,e=o});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 y3=u3;function x3(){let t=[],e=0,i=c=>{c()},n=c=>{c()},r=y3;const o=c=>{e?t.push(c):r(()=>{i(c)})},a=()=>{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||a()}return h},batchCalls:c=>(...h)=>{o(()=>{c(...h)})},schedule:o,setNotifyFunction:c=>{i=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{r=c}}}var kt=x3(),b3=class extends ql{#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}},Gc=new b3;function v3(t){return Math.min(1e3*2**t,3e4)}function _2(t){return(t??"online")==="online"?Gc.isOnline():!0}var gm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function H2(t){let e=!1,i=0,n;const r=mm(),o=()=>r.status!=="pending",a=k=>{if(!o()){const C=new gm(k);x(C),t.onCancel?.(C)}},c=()=>{e=!0},h=()=>{e=!1},d=()=>Rg.isFocused()&&(t.networkMode==="always"||Gc.isOnline())&&t.canRun(),p=()=>_2(t.networkMode)&&t.canRun(),g=k=>{o()||(n?.(),r.resolve(k))},x=k=>{o()||(n?.(),r.reject(k))},b=()=>new Promise(k=>{n=C=>{(o()||d())&&k(C)},t.onPause?.()}).then(()=>{n=void 0,o()||t.onContinue?.()}),w=()=>{if(o())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(o())return;const T=t.retry??(bs?0:3),D=t.retryDelay??v3,j=typeof D=="function"?D(i,M):D,B=T===!0||typeof T=="number"&&i<T||typeof T=="function"&&T(i,M);if(e||!B){x(M);return}i++,t.onFail?.(i,M),f3(j).then(()=>d()?void 0:b()).then(()=>{e?x(M):w()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(n?.(),r),cancelRetry:c,continueRetry:h,canStart:p,start:()=>(p()?w():b().then(w),r)}}var U2=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fm(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)}},S3=class extends U2{#e;#t;#i;#r;#n;#l;#o;constructor(t){super(),this.#o=!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=K1(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=K1(this.options);e.data!==void 0&&(this.setState(G1(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(t,e){const i=pm(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===Eg||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:!L2(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.#o?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.#o=!0,i.signal)})},r=()=>{const c=z2(this.options,e),d=(()=>{const p={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(p),p})();return this.#o=!1,this.options.persister?this.options.persister(c,d,this):c(d)},a=(()=>{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(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta}),this.#n=H2({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof gm&&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:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.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 gm){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,...q2(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...G1(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 q2(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_2(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function G1(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function K1(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 w3=class extends ql{constructor(t,e){super(),this.options=e,this.#e=t,this.#s=null,this.#o=mm(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#r=void 0;#n;#l;#o;#s;#m;#f;#d;#u;#c;#a;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),W1(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ym(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ym(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&&X1(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.#a)&&this.#x(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),i=this.createResult(e,t);return C3(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.#o.status==="pending"&&this.#o.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||!fm(t))return;const i=L2(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.#a=t,!(bs||Hi(this.options.enabled,this.#t)===!1||!fm(this.#a)||this.#a===0)&&(this.#c=fs.setInterval(()=>{(this.options.refetchIntervalInBackground||Rg.isFocused())&&this.#h()},this.#a))}#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,o=this.#n,a=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&&W1(t,e),ue=Z&&X1(t,i,e,n);(J||ue)&&(p={...p,...q2(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,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===a?.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=pm(r?.data,Z,e),g=!0)}if(e.select&&x!==void 0&&!C)if(r&&x===o?.data&&e.select===this.#m)x=this.#f;else try{this.#m=e.select,x=e.select(x),x=pm(r?.data,x,e),this.#f=x,this.#s=null}catch(Z){this.#s=Z}this.#s&&(b=this.#s,x=this.#f,w=Date.now(),k="error");const M=p.fetchStatus==="fetching",T=k==="pending",D=k==="error",j=T&&M,B=x!==void 0,H={status:k,fetchStatus:p.fetchStatus,isPending:T,isSuccess:k==="success",isError:D,isInitialLoading:j,isLoading:j,data:x,dataUpdatedAt:p.dataUpdatedAt,error:b,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:D&&!B,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:D&&B,isStale:Dg(t,e),refetch:this.refetch,promise:this.#o,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)},oe=()=>{const ee=this.#o=H.promise=mm();ue(ee)},F=this.#o;switch(F.status){case"pending":t.queryHash===i.queryHash&&ue(F);break;case"fulfilled":(J||H.data!==F.value)&&oe();break;case"rejected":(!J||H.error!==F.reason)&&oe();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 o=new Set(r??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#r).some(a=>{const c=a;return this.#r[c]!==t[c]&&o.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 k3(t,e){return Hi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function W1(t,e){return k3(t,e)||t.state.data!==void 0&&ym(t,e,e.refetchOnMount)}function ym(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&&Dg(t,e)}return!1}function X1(t,e,i,n){return(t!==e||Hi(n.enabled,t)===!1)&&(!i.suspense||t.state.status!=="error")&&Dg(t,i)}function Dg(t,e){return Hi(e.enabled,t)!==!1&&t.isStaleByTime(Nr(e.staleTime,t))}function C3(t,e){return!Yc(t.getCurrentResult(),e)}function Z1(t){return{onFetch:(e,i)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],a=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let p=!1;const g=w=>{m3(w,()=>e.signal,()=>p=!0)},x=z2(e.options,e.fetchOptions),b=async(w,k,C)=>{if(p)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const P={client:e.client,queryKey:e.queryKey,pageParam:k,direction:C?"backward":"forward",meta:e.options.meta};return g(P),P})(),D=await x(T),{maxPages:j}=e.options,B=C?p3:d3;return{pages:B(w.pages,D,j),pageParams:B(w.pageParams,k,j)}};if(r&&o.length){const w=r==="backward",k=w?A3:J1,C={pages:o,pageParams:a},M=k(n,C);c=await b(C,M,w)}else{const w=t??o.length;do{const k=h===0?a[0]??n.initialPageParam:J1(n,c);if(h>0&&k==null)break;c=await b(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 J1(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 A3(t,{pages:e,pageParams:i}){return e.length>0?t.getPreviousPageParam?.(e[0],e,i[0],i):void 0}var M3=class extends U2{#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||P2(),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=H2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#n({type:"failed",failureCount:o,error:a})},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 a=await this.options.onMutate?.(t,i);a!==this.state.context&&this.#n({type:"pending",context:a,variables:t,isPaused:r})}const o=await this.#r.start();return await this.#i.config.onSuccess?.(o,t,this.state.context,this,i),await this.options.onSuccess?.(o,t,this.state.context,i),await this.#i.config.onSettled?.(o,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(o,null,t,this.state.context,i),this.#n({type:"success",data:o}),o}catch(o){try{await this.#i.config.onError?.(o,t,this.state.context,this,i)}catch(a){Promise.reject(a)}try{await this.options.onError?.(o,t,this.state.context,i)}catch(a){Promise.reject(a)}try{await this.#i.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,i)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,o,t,this.state.context,i)}catch(a){Promise.reject(a)}throw this.#n({type:"error",error:o}),o}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 P2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var T3=class extends ql{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 M3({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=ac(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=ac(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=ac(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=ac(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=>I1(e,i))}findAll(t={}){return this.getAll().filter(e=>I1(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 ac(t){return t.options.scope?.id}var O3=class extends ql{#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??P2();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(o){Promise.reject(o)}try{this.#r.onSettled?.(e.data,null,i,n,r)}catch(o){Promise.reject(o)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,i,n,r)}catch(o){Promise.reject(o)}try{this.#r.onSettled?.(void 0,e.error,i,n,r)}catch(o){Promise.reject(o)}}}this.listeners.forEach(i=>{i(this.#t)})})}},E3=class extends ql{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,i){const n=e.queryKey,r=e.queryHash??Og(n,e);let o=this.get(r);return o||(o=new S3({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(o)),o}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=>V1(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>V1(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()})})}},N3=class{#e;#t;#i;#r;#n;#l;#o;#s;constructor(t={}){this.#e=t.queryCache||new E3,this.#t=t.mutationCache||new T3,this.#i=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#l=0}mount(){this.#l++,this.#l===1&&(this.#o=Rg.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Gc.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#l--,this.#l===0&&(this.#o?.(),this.#o=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}),o=this.#e.get(n.queryHash)?.state.data,a=c3(e,o);if(a!==void 0)return this.#e.build(this,n).setData(a,{...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 o=r.fetch(void 0,i);return i.throwOnError||(o=o.catch(Kt)),r.state.fetchStatus==="paused"?Promise.resolve():o}));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=Z1(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Kt).catch(Kt)}ensureInfiniteQueryData(t){return t.behavior=Z1(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Gc.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=>{ua(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=>{ua(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=Og(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===Eg&&(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()}},F2=N.createContext(void 0),pt=t=>{const e=N.useContext(F2);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},R3=({client:t,children:e})=>(N.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(F2.Provider,{value:t,children:e})),V2=N.createContext(!1),D3=()=>N.useContext(V2);V2.Provider;function j3(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var L3=N.createContext(j3()),B3=()=>N.useContext(L3),z3=(t,e,i)=>{const n=i?.state.error&&typeof t.throwOnError=="function"?Ng(t.throwOnError,[i.state.error,i]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},_3=t=>{N.useEffect(()=>{t.clearReset()},[t])},H3=({result:t,errorResetBoundary:e,throwOnError:i,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Ng(i,[t.error,n])),U3=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))}},q3=(t,e)=>t.isLoading&&t.isFetching&&!e,P3=(t,e)=>t?.suspense&&e.isPending,$1=(t,e,i)=>e.fetchOptimistic(t).catch(()=>{i.clearReset()});function F3(t,e,i){const n=D3(),r=B3(),o=pt(),a=o.defaultQueryOptions(t);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const c=o.getQueryCache().get(a.queryHash);a._optimisticResults=n?"isRestoring":"optimistic",U3(a),z3(a,r,c),_3(r);const h=!o.getQueryCache().get(a.queryHash),[d]=N.useState(()=>new e(o,a)),p=d.getOptimisticResult(a),g=!n&&t.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(x=>{const b=g?d.subscribe(kt.batchCalls(x)):Kt;return d.updateResult(),b},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),N.useEffect(()=>{d.setOptions(a)},[a,d]),P3(a,p))throw $1(a,d,r);if(H3({result:p,errorResetBoundary:r,throwOnError:a.throwOnError,query:c,suspense:a.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,p),a.experimental_prefetchInRender&&!bs&&q3(p,n)&&(h?$1(a,d,r):c?.promise)?.catch(Kt).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?p:d.trackResult(p)}function jr(t,e){return F3(t,w3)}function Nt(t,e){const i=pt(),[n]=N.useState(()=>new O3(i,t));N.useEffect(()=>{n.setOptions(t)},[n,t]);const r=N.useSyncExternalStore(N.useCallback(a=>n.subscribe(kt.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=N.useCallback((a,c)=>{n.mutate(a,c).catch(Kt)},[n]);if(r.error&&Ng(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}const V3="/api";async function Pe(t,e){const i=await fetch(`${V3}${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 I3(){return jr({queryKey:["proxyStatus"],queryFn:Fe.proxy.status,refetchInterval:5e3})}function Q3(){const t=pt();return Nt({mutationFn:Fe.proxy.start,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}function Y3(){const t=pt();return Nt({mutationFn:Fe.proxy.stop,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}const G3=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I2=(...t)=>t.filter((e,i,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===i).join(" ").trim();var K3={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 W3=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:a,...c},h)=>N.createElement("svg",{ref:h,...K3,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:I2("lucide",r),...c},[...a.map(([d,p])=>N.createElement(d,p)),...Array.isArray(o)?o:[o]]));const we=(t,e)=>{const i=N.forwardRef(({className:n,...r},o)=>N.createElement(W3,{ref:o,iconNode:e,className:I2(`lucide-${G3(t)}`,n),...r}));return i.displayName=`${t}`,i};const xm=we("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 bm=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Kc=we("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 Wc=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const La=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Q2=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const X3=we("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 Ol=we("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Z3=we("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 J3=we("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 vm=we("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 $3=we("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 eN=we("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 tN=we("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const iN=we("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 Y2=we("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 Xc=we("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 G2=we("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 Zc=we("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 nN=we("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 rN=we("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=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const sN=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const lN=we("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const jg=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const oN=we("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);const aN=we("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 uN=we("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 cN=we("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 hN=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const fN=we("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 dN=we("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 pN=we("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 K2=we("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 mN=we("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 ca=we("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 gN=we("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 W2=we("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 yN=we("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const xN=we("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 bN=we("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 El=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Lg=we("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 X2(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=X2(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function vN(){for(var t,e,i=0,n="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=X2(t))&&(n&&(n+=" "),n+=e);return n}const Bg="-",SN=t=>{const e=kN(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{const c=a.split(Bg);return c[0]===""&&c.length!==1&&c.shift(),Z2(c,e)||wN(a)},getConflictingClassGroupIds:(a,c)=>{const h=i[a]||[];return c&&n[a]?[...h,...n[a]]:h}}},Z2=(t,e)=>{if(t.length===0)return e.classGroupId;const i=t[0],n=e.nextPart.get(i),r=n?Z2(t.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const o=t.join(Bg);return e.validators.find(({validator:a})=>a(o))?.classGroupId},ev=/^\[(.+)\]$/,wN=t=>{if(ev.test(t)){const e=ev.exec(t)[1],i=e?.substring(0,e.indexOf(":"));if(i)return"arbitrary.."+i}},kN=t=>{const{theme:e,prefix:i}=t,n={nextPart:new Map,validators:[]};return AN(Object.entries(t.classGroups),i).forEach(([o,a])=>{Sm(a,n,o,e)}),n},Sm=(t,e,i,n)=>{t.forEach(r=>{if(typeof r=="string"){const o=r===""?e:tv(e,r);o.classGroupId=i;return}if(typeof r=="function"){if(CN(r)){Sm(r(n),e,i,n);return}e.validators.push({validator:r,classGroupId:i});return}Object.entries(r).forEach(([o,a])=>{Sm(a,tv(e,o),i,n)})})},tv=(t,e)=>{let i=t;return e.split(Bg).forEach(n=>{i.nextPart.has(n)||i.nextPart.set(n,{nextPart:new Map,validators:[]}),i=i.nextPart.get(n)}),i},CN=t=>t.isThemeGetter,AN=(t,e)=>e?t.map(([i,n])=>{const r=n.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,c])=>[e+a,c])):o);return[i,r]}):t,MN=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=new Map,n=new Map;const r=(o,a)=>{i.set(o,a),e++,e>t&&(e=0,n=i,i=new Map)};return{get(o){let a=i.get(o);if(a!==void 0)return a;if((a=n.get(o))!==void 0)return r(o,a),a},set(o,a){i.has(o)?i.set(o,a):r(o,a)}}},J2="!",TN=t=>{const{separator:e,experimentalParseClassName:i}=t,n=e.length===1,r=e[0],o=e.length,a=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+o)===e)){h.push(c.slice(p,C)),p=C+o;continue}if(M==="/"){g=C;continue}}M==="["?d++:M==="]"&&d--}const x=h.length===0?c:c.substring(p),b=x.startsWith(J2),w=b?x.substring(1):x,k=g&&g>p?g-p:void 0;return{modifiers:h,hasImportantModifier:b,baseClassName:w,maybePostfixModifierPosition:k}};return i?c=>i({className:c,parseClassName:a}):a},ON=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},EN=t=>({cache:MN(t.cacheSize),parseClassName:TN(t),...SN(t)}),NN=/\s+/,RN=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:r}=e,o=[],a=t.trim().split(NN);let c="";for(let h=a.length-1;h>=0;h-=1){const d=a[h],{modifiers:p,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:b}=i(d);let w=!!b,k=n(w?x.substring(0,b):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=ON(p).join(":"),M=g?C+J2:C,T=M+k;if(o.includes(T))continue;o.push(T);const D=r(k,w);for(let j=0;j<D.length;++j){const B=D[j];o.push(M+B)}c=d+(c.length>0?" "+c:c)}return c};function DN(){let t=0,e,i,n="";for(;t<arguments.length;)(e=arguments[t++])&&(i=$2(e))&&(n&&(n+=" "),n+=i);return n}const $2=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=$2(t[n]))&&(i&&(i+=" "),i+=e);return i};function jN(t,...e){let i,n,r,o=a;function a(h){const d=e.reduce((p,g)=>g(p),t());return i=EN(d),n=i.cache.get,r=i.cache.set,o=c,c(h)}function c(h){const d=n(h);if(d)return d;const p=RN(h,i);return r(h,p),p}return function(){return o(DN.apply(null,arguments))}}const tt=t=>{const e=i=>i[t]||[];return e.isThemeGetter=!0,e},ew=/^\[(?:([a-z-]+):)?(.+)\]$/i,LN=/^\d+\/\d+$/,BN=new Set(["px","full","screen"]),zN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_N=/\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$/,HN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fn=t=>vl(t)||BN.has(t)||LN.test(t),kr=t=>Pl(t,"length",KN),vl=t=>!!t&&!Number.isNaN(Number(t)),Mp=t=>Pl(t,"number",vl),Fo=t=>!!t&&Number.isInteger(Number(t)),PN=t=>t.endsWith("%")&&vl(t.slice(0,-1)),Me=t=>ew.test(t),Cr=t=>zN.test(t),FN=new Set(["length","size","percentage"]),VN=t=>Pl(t,FN,tw),IN=t=>Pl(t,"position",tw),QN=new Set(["image","url"]),YN=t=>Pl(t,QN,XN),GN=t=>Pl(t,"",WN),Vo=()=>!0,Pl=(t,e,i)=>{const n=ew.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):i(n[2]):!1},KN=t=>_N.test(t)&&!HN.test(t),tw=()=>!1,WN=t=>UN.test(t),XN=t=>qN.test(t),ZN=()=>{const t=tt("colors"),e=tt("spacing"),i=tt("blur"),n=tt("brightness"),r=tt("borderColor"),o=tt("borderRadius"),a=tt("borderSpacing"),c=tt("borderWidth"),h=tt("contrast"),d=tt("grayscale"),p=tt("hueRotate"),g=tt("invert"),x=tt("gap"),b=tt("gradientColorStops"),w=tt("gradientColorStopPositions"),k=tt("inset"),C=tt("margin"),M=tt("opacity"),T=tt("padding"),D=tt("saturate"),j=tt("scale"),B=tt("sepia"),P=tt("skew"),H=tt("space"),Z=tt("translate"),J=()=>["auto","contain","none"],ue=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto",Me,e],F=()=>[Me,e],ee=()=>["",Fn,kr],fe=()=>["auto",vl,Me],de=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["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"],E=()=>[vl,Me];return{cacheSize:500,separator:":",theme:{colors:[Vo],spacing:[Fn,kr],blur:["none","",Cr,Me],brightness:E(),borderColor:[t],borderRadius:["none","","full",Cr,Me],borderSpacing:F(),borderWidth:ee(),contrast:E(),grayscale:ce(),hueRotate:E(),invert:ce(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[PN,kr],inset:oe(),margin:oe(),opacity:E(),padding:F(),saturate:E(),scale:E(),sepia:ce(),skew:E(),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",Fo,Me]}],basis:[{basis:oe()}],"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",Fo,Me]}],"grid-cols":[{"grid-cols":[Vo]}],"col-start-end":[{col:["auto",{span:["full",Fo,Me]},Me]}],"col-start":[{"col-start":fe()}],"col-end":[{"col-end":fe()}],"grid-rows":[{"grid-rows":[Vo]}],"row-start-end":[{row:["auto",{span:[Fo,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",Mp]}],"font-family":[{font:[Vo]}],"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",vl,Mp]}],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:[...q(),"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(),IN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",VN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},YN]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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:[...q(),"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:q()}],"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:["",...q()]}],"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,GN]}],"shadow-color":[{shadow:[Vo]}],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:[D]}],sepia:[{sepia:[B]}],"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":[D]}],"backdrop-sepia":[{"backdrop-sepia":[B]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Me]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",Me]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",Me]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Fo,Me]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"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,Mp]}],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"]}}},JN=jN(ZN);function Re(...t){return JN(vN(t))}function $N(){return jr({queryKey:["projects"],queryFn:Fe.projects.list})}function iw(){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}=$N(),{data:e}=iw(),i=eR(),n=tR(),r=nR(),[o,a]=N.useState(!1),[c,h]=N.useState(!1),[d,p]=N.useState(""),g=N.useRef(null);N.useEffect(()=>{function b(w){g.current&&!g.current.contains(w.target)&&(a(!1),h(!1))}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);const x=()=>{d.trim()&&i.mutate(d.trim(),{onSuccess:()=>{p(""),h(!1)}})};return v.jsxs("div",{className:"relative",ref:g,children:[v.jsxs("button",{onClick:()=>a(!o),className:Re("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:[v.jsx(nN,{className:"w-3.5 h-3.5 text-primary opacity-70"}),v.jsx("span",{className:"font-bold truncate max-w-[120px]",children:e?.name??"Select Project"}),v.jsx(La,{className:Re("w-3 h-3 text-muted-foreground transition-transform",o&&"rotate-180")})]}),o&&v.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-[200px] animate-in fade-in zoom-in-95 duration-200",children:[v.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:v.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Switch Project"})}),v.jsx("div",{className:"max-h-60 overflow-y-auto px-1.5",children:t?.map(b=>v.jsxs("div",{className:Re("group flex items-center gap-2 px-3 py-2 text-sm rounded-lg cursor-pointer transition-all",b.id===e?.id?"bg-primary/10 text-primary font-bold shadow-sm":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[v.jsxs("button",{className:"flex-1 text-left truncate flex items-center gap-2",onClick:()=>{n.mutate(b.id),a(!1)},children:[v.jsx(iN,{className:"w-3.5 h-3.5 opacity-40"}),b.name]}),b.id!==e?.id&&v.jsx("button",{onClick:w=>{w.stopPropagation(),r.mutate(b.id)},className:"p-1 text-muted-foreground hover:text-destructive rounded-md transition-all opacity-0 group-hover:opacity-100",children:v.jsx(ca,{className:"w-3 h-3"})})]},b.id))}),v.jsx("div",{className:"border-t border-border mt-1.5 pt-1.5 px-1.5",children:c?v.jsxs("div",{className:"px-1 py-1 flex gap-1.5",children:[v.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:d,onChange:b=>p(b.target.value),onKeyDown:b=>{b.key==="Enter"&&x(),b.key==="Escape"&&h(!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"}),v.jsx("button",{onClick:x,disabled:!d.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"})]}):v.jsxs("button",{onClick:()=>h(!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:[v.jsx(jg,{className:"w-3.5 h-3.5"}),"New Project"]})})]})]})}function nw(t){return typeof t>"u"||t===null}function sR(t){return typeof t=="object"&&t!==null}function lR(t){return Array.isArray(t)?t:nw(t)?[]:[t]}function oR(t,e){var i,n,r,o;if(e)for(o=Object.keys(e),i=0,n=o.length;i<n;i+=1)r=o[i],t[r]=e[r];return t}function aR(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=nw,hR=sR,fR=lR,dR=aR,pR=uR,mR=oR,Ct={isNothing:cR,isObject:hR,toArray:fR,repeat:dR,isNegativeZero:pR,extend:mR};function rw(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 ha(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=rw(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ha.prototype=Object.create(Error.prototype);ha.prototype.constructor=ha;ha.prototype.toString=function(e){return this.name+": "+rw(this,e)};var Xt=ha;function Tp(t,e,i,n,r){var o="",a="",c=Math.floor(r/2)-1;return n-e>c&&(o=" ... ",e=n-c+o.length),i-n>c&&(a=" ...",i=n+c-a.length),{str:o+t.slice(e,i).replace(/\t/g,"→")+a,pos:n-e+o.length}}function Op(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=[],o,a=-1;o=i.exec(t.buffer);)r.push(o.index),n.push(o.index+o[0].length),t.position<=o.index&&a<0&&(a=n.length-2);a<0&&(a=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&&!(a-h<0);h++)d=Tp(t.buffer,n[a-h],r[a-h],t.position-(n[a]-n[a-h]),g),c=Ct.repeat(" ",e.indent)+Op((t.line-h+1).toString(),p)+" | "+d.str+`
14
+ `+c;for(d=Tp(t.buffer,n[a],r[a],t.position,g),c+=Ct.repeat(" ",e.indent)+Op((t.line+1).toString(),p)+" | "+d.str+`
15
+ `,c+=Ct.repeat("-",e.indent+p+3+d.pos)+`^
16
+ `,h=1;h<=e.linesAfter&&!(a+h>=r.length);h++)d=Tp(t.buffer,n[a+h],r[a+h],t.position-(n[a]-n[a+h]),g),c+=Ct.repeat(" ",e.indent)+Op((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 iv(t,e){var i=[];return t[e].forEach(function(n){var r=i.length;i.forEach(function(o,a){o.tag===n.tag&&o.kind===n.kind&&o.multi===n.multi&&(r=a)}),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 wm(t){return this.extend(t)}wm.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(o){if(!(o instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.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(o.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(o){if(!(o instanceof Ht))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(wm.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=iv(r,"implicit"),r.compiledExplicit=iv(r,"explicit"),r.compiledTypeMap=wR(r.compiledImplicit,r.compiledExplicit),r};var sw=wm,lw=new Ht("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),ow=new Ht("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),aw=new Ht("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),uw=new sw({explicit:[lw,ow,aw]});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 cw=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 hw=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 fw=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 dw=new Ht("tag:yaml.org,2002:float",{kind:"scalar",resolve:zR,construct:_R,predicate:qR,represent:UR,defaultStyle:"lowercase"}),pw=uw.extend({implicit:[cw,hw,fw,dw]}),mw=pw,gw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),yw=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:gw.exec(t)!==null||yw.exec(t)!==null}function FR(t){var e,i,n,r,o,a,c,h=0,d=null,p,g,x;if(e=gw.exec(t),e===null&&(e=yw.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(o=+e[4],a=+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,o,a,c,h)),d&&x.setTime(x.getTime()-d),x}function VR(t){return t.toISOString()}var xw=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 bw=new Ht("tag:yaml.org,2002:merge",{kind:"scalar",resolve:IR}),zg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
18
+ \r`;function QR(t){if(t===null)return!1;var e,i,n=0,r=t.length,o=zg;for(i=0;i<r;i++)if(e=o.indexOf(t.charAt(i)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function YR(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,o=zg,a=0,c=[];for(e=0;e<r;e++)e%4===0&&e&&(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)),a=a<<6|o.indexOf(n.charAt(e));return i=r%4*6,i===0?(c.push(a>>16&255),c.push(a>>8&255),c.push(a&255)):i===18?(c.push(a>>10&255),c.push(a>>2&255)):i===12&&c.push(a>>4&255),new Uint8Array(c)}function GR(t){var e="",i=0,n,r,o=t.length,a=zg;for(n=0;n<o;n++)n%3===0&&n&&(e+=a[i>>18&63],e+=a[i>>12&63],e+=a[i>>6&63],e+=a[i&63]),i=(i<<8)+t[n];return r=o%3,r===0?(e+=a[i>>18&63],e+=a[i>>12&63],e+=a[i>>6&63],e+=a[i&63]):r===2?(e+=a[i>>10&63],e+=a[i>>4&63],e+=a[i<<2&63],e+=a[64]):r===1&&(e+=a[i>>2&63],e+=a[i<<4&63],e+=a[64],e+=a[64]),e}function KR(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var vw=new Ht("tag:yaml.org,2002:binary",{kind:"scalar",resolve:QR,construct:YR,predicate:KR,represent:GR}),WR=Object.prototype.hasOwnProperty,XR=Object.prototype.toString;function ZR(t){if(t===null)return!0;var e=[],i,n,r,o,a,c=t;for(i=0,n=c.length;i<n;i+=1){if(r=c[i],a=!1,XR.call(r)!=="[object Object]")return!1;for(o in r)if(WR.call(r,o))if(!a)a=!0;else return!1;if(!a)return!1;if(e.indexOf(o)===-1)e.push(o);else return!1}return!0}function JR(t){return t!==null?t:[]}var Sw=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,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e<i;e+=1){if(n=a[e],$R.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;o[e]=[r[0],n[r[0]]]}return!0}function tD(t){if(t===null)return[];var e,i,n,r,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e<i;e+=1)n=a[e],r=Object.keys(n),o[e]=[r[0],n[r[0]]];return o}var ww=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 kw=new Ht("tag:yaml.org,2002:set",{kind:"mapping",resolve:nD,construct:rD}),_g=mw.extend({implicit:[xw,bw],explicit:[vw,Sw,ww,kw]}),Lr=Object.prototype.hasOwnProperty,$c=1,Cw=2,Aw=3,eh=4,Ep=1,sD=2,nv=3,lD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,oD=/[\x85\u2028\u2029]/,aD=/[,\[\]\{\}]/,Mw=/^(?:!|!!|![a-z\-]+!)$/i,Tw=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function rv(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 pl(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 sv(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 Ow(t,e,i){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[e]=i}var Ew=new Array(256),Nw=new Array(256);for(var cl=0;cl<256;cl++)Ew[cl]=sv(cl)?1:0,Nw[cl]=sv(cl);function dD(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_g,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 Rw(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 Rw(t,e)}function th(t,e){t.onWarning&&t.onWarning.call(null,Rw(t,e))}var lv={YAML:function(e,i,n){var r,o,a;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"),o=parseInt(r[1],10),a=parseInt(r[2],10),o!==1&&pe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&th(e,"unsupported YAML version of the document")},TAG:function(e,i,n){var r,o;n.length!==2&&pe(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],Mw.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'),Tw.test(o)||pe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{pe(e,"tag prefix is malformed: "+o)}e.tagMap[r]=o}};function Rr(t,e,i,n){var r,o,a,c;if(e<i){if(c=t.input.slice(e,i),n)for(r=0,o=c.length;r<o;r+=1)a=c.charCodeAt(r),a===9||32<=a&&a<=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,o,a,c;for(Ct.isObject(i)||pe(t,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),a=0,c=r.length;a<c;a+=1)o=r[a],Lr.call(e,o)||(Ow(e,o,i[o]),n[o]=!0)}function ml(t,e,i,n,r,o,a,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"&&rv(r[d])==="[object Object]"&&(r[d]="[object Object]");if(typeof r=="object"&&rv(r)==="[object Object]"&&(r="[object Object]"),r=String(r),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(d=0,p=o.length;d<p;d+=1)ov(t,e,o[d],i);else ov(t,e,o,i);else!t.json&&!Lr.call(i,r)&&Lr.call(e,r)&&(t.line=a||t.line,t.lineStart=c||t.lineStart,t.position=h||t.position,pe(t,"duplicated mapping key")),Ow(e,r,o),delete i[r];return e}function Hg(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(Hg(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 Bh(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 Ug(t,e){e===1?t.result+=" ":e>1&&(t.result+=Ct.repeat(`
20
+ `,e-1))}function pD(t,e,i){var n,r,o,a,c,h,d,p,g=t.kind,x=t.result,b;if(b=t.input.charCodeAt(t.position),ui(b)||pl(b)||b===35||b===38||b===42||b===33||b===124||b===62||b===39||b===34||b===37||b===64||b===96||(b===63||b===45)&&(r=t.input.charCodeAt(t.position+1),ui(r)||i&&pl(r)))return!1;for(t.kind="scalar",t.result="",o=a=t.position,c=!1;b!==0;){if(b===58){if(r=t.input.charCodeAt(t.position+1),ui(r)||i&&pl(r))break}else if(b===35){if(n=t.input.charCodeAt(t.position-1),ui(n))break}else{if(t.position===t.lineStart&&Bh(t)||i&&pl(b))break;if(bn(b))if(h=t.line,d=t.lineStart,p=t.lineIndent,bt(t,!1,-1),t.lineIndent>=e){c=!0,b=t.input.charCodeAt(t.position);continue}else{t.position=a,t.line=h,t.lineStart=d,t.lineIndent=p;break}}c&&(Rr(t,o,a,!1),Ug(t,t.line-h),o=a=t.position,c=!1),gs(b)||(a=t.position+1),b=t.input.charCodeAt(++t.position)}return Rr(t,o,a,!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),Ug(t,bt(t,!1,e)),n=r=t.position):t.position===t.lineStart&&Bh(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,o,a,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&&Ew[c])t.result+=Nw[c],t.position++;else if((a=cD(c))>0){for(r=a,o=0;r>0;r--)c=t.input.charCodeAt(++t.position),(a=uD(c))>=0?o=(o<<4)+a:pe(t,"expected hexadecimal character");t.result+=fD(o),t.position++}else pe(t,"unknown escape sequence");i=n=t.position}else bn(c)?(Rr(t,i,n,!0),Ug(t,bt(t,!1,e)),i=n=t.position):t.position===t.lineStart&&Bh(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,o,a=t.tag,c,h=t.anchor,d,p,g,x,b,w=Object.create(null),k,C,M,T;if(T=t.input.charCodeAt(t.position),T===91)p=93,b=!1,c=[];else if(T===123)p=125,b=!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=a,t.anchor=h,t.kind=b?"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,o=t.position,Nl(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),Nl(t,e,$c,!1,!0),M=t.result),b?ml(t,c,w,C,k,M,n,r,o):g?c.push(ml(t,null,w,C,k,M,n,r,o)):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=Ep,o=!1,a=!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)Ep===r?r=g===43?nv: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"):a?pe(t,"repeat of an indentation width identifier"):(c=e+p-1,a=!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(Hg(t),t.lineIndent=0,g=t.input.charCodeAt(t.position);(!a||t.lineIndent<c)&&g===32;)t.lineIndent++,g=t.input.charCodeAt(++t.position);if(!a&&t.lineIndent>c&&(c=t.lineIndent),bn(g)){h++;continue}if(t.lineIndent<c){r===nv?t.result+=Ct.repeat(`
21
+ `,o?1+h:h):r===Ep&&o&&(t.result+=`
22
+ `);break}for(n?gs(g)?(d=!0,t.result+=Ct.repeat(`
23
+ `,o?1+h:h)):d?(d=!1,t.result+=Ct.repeat(`
24
+ `,h+1)):h===0?o&&(t.result+=" "):t.result+=Ct.repeat(`
25
+ `,h):t.result+=Ct.repeat(`
26
+ `,o?1+h:h),o=!0,a=!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 av(t,e){var i,n=t.tag,r=t.anchor,o=[],a,c=!1,h;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=o),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||(a=t.input.charCodeAt(t.position+1),!ui(a))));){if(c=!0,t.position++,bt(t,!0,-1)&&t.lineIndent<=e){o.push(null),h=t.input.charCodeAt(t.position);continue}if(i=t.line,Nl(t,e,Aw,!1,!0),o.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=o,!0):!1}function bD(t,e,i){var n,r,o,a,c,h,d=t.tag,p=t.anchor,g={},x=Object.create(null),b=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),o=t.line,(T===63||T===58)&&ui(n))T===63?(C&&(ml(t,g,x,b,w,null,a,c,h),b=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(a=t.line,c=t.lineStart,h=t.position,!Nl(t,i,Cw,!1,!0))break;if(t.line===o){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&&(ml(t,g,x,b,w,null,a,c,h),b=w=k=null),M=!0,C=!1,r=!1,b=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===o||t.lineIndent>e)&&(C&&(a=t.line,c=t.lineStart,h=t.position),Nl(t,e,eh,!0,r)&&(C?w=t.result:k=t.result),C||(ml(t,g,x,b,w,k,a,c,h),b=w=k=null),bt(t,!0,-1),T=t.input.charCodeAt(t.position)),(t.line===o||t.lineIndent>e)&&T!==0)pe(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return C&&ml(t,g,x,b,w,null,a,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,o,a;if(a=t.input.charCodeAt(t.position),a!==33)return!1;if(t.tag!==null&&pe(t,"duplication of a tag property"),a=t.input.charCodeAt(++t.position),a===60?(i=!0,a=t.input.charCodeAt(++t.position)):a===33?(n=!0,r="!!",a=t.input.charCodeAt(++t.position)):r="!",e=t.position,i){do a=t.input.charCodeAt(++t.position);while(a!==0&&a!==62);t.position<t.length?(o=t.input.slice(e,t.position),a=t.input.charCodeAt(++t.position)):pe(t,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!ui(a);)a===33&&(n?pe(t,"tag suffix cannot contain exclamation marks"):(r=t.input.slice(e-1,t.position+1),Mw.test(r)||pe(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),a=t.input.charCodeAt(++t.position);o=t.input.slice(e,t.position),aD.test(o)&&pe(t,"tag suffix cannot contain flow indicator characters")}o&&!Tw.test(o)&&pe(t,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{pe(t,"tag name is malformed: "+o)}return i?t.tag=o:Lr.call(t.tagMap,r)?t.tag=t.tagMap[r]+o:r==="!"?t.tag="!"+o:r==="!!"?t.tag="tag:yaml.org,2002:"+o: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)&&!pl(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)&&!pl(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 Nl(t,e,i,n,r){var o,a,c,h=1,d=!1,p=!1,g,x,b,w,k,C;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,o=a=c=eh===i||Aw===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=o,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||Cw===i?k=e:k=e+1,C=t.position-t.lineStart,h===1?c&&(av(t,C)||bD(t,C,k))||yD(t,k)?p=!0:(a&&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&&av(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,b=t.typeMap.multi[t.kind||"fallback"],g=0,x=b.length;g<x;g+=1)if(t.tag.slice(0,b[g].tag.length)===b[g].tag){w=b[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,o=!1,a;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(a=t.input.charCodeAt(t.position))!==0&&(bt(t,!0,-1),a=t.input.charCodeAt(t.position),!(t.lineIndent>0||a!==37));){for(o=!0,a=t.input.charCodeAt(++t.position),i=t.position;a!==0&&!ui(a);)a=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");a!==0;){for(;gs(a);)a=t.input.charCodeAt(++t.position);if(a===35){do a=t.input.charCodeAt(++t.position);while(a!==0&&!bn(a));break}if(bn(a))break;for(i=t.position;a!==0&&!ui(a);)a=t.input.charCodeAt(++t.position);r.push(t.input.slice(i,t.position))}a!==0&&Hg(t),Lr.call(lv,n)?lv[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)):o&&pe(t,"directives end mark is expected"),Nl(t,t.lineIndent-1,eh,!1,!0),bt(t,!0,-1),t.checkLineBreaks&&oD.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&&Bh(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 Dw(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=Dw(t,i);if(typeof e!="function")return n;for(var r=0,o=n.length;r<o;r+=1)e(n[r])}function AD(t,e){var i=Dw(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,jw={loadAll:MD,load:TD},Lw=Object.prototype.toString,Bw=Object.prototype.hasOwnProperty,qg=65279,OD=9,fa=10,ED=13,ND=32,RD=33,DD=34,km=35,jD=37,LD=38,BD=39,zD=42,zw=44,_D=45,ih=58,HD=61,UD=62,qD=63,PD=64,_w=91,Hw=93,FD=96,Uw=123,VD=124,qw=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 YD(t,e){var i,n,r,o,a,c,h;if(e===null)return{};for(i={},n=Object.keys(e),r=0,o=n.length;r<o;r+=1)a=n[r],c=String(e[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),h=t.compiledTypeMap.fallback[a],h&&Bw.call(h.styleAliases,c)&&(c=h.styleAliases[c]),i[a]=c;return i}function GD(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,da=2;function WD(t){this.schema=t.schema||_g,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=YD(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==='"'?da: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 uv(t,e){for(var i=Ct.repeat(" ",e),n=0,r=-1,o="",a,c=t.length;n<c;)r=t.indexOf(`
28
+ `,n),r===-1?(a=t.slice(n),n=c):(a=t.slice(n,r+1),n=r+1),a.length&&a!==`
29
+ `&&(o+=i),o+=a;return o}function Cm(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 pa(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==qg||65536<=t&&t<=1114111}function cv(t){return pa(t)&&t!==qg&&t!==ED&&t!==fa}function hv(t,e,i){var n=cv(t),r=n&&!nh(t);return(i?n:n&&t!==zw&&t!==_w&&t!==Hw&&t!==Uw&&t!==qw)&&t!==km&&!(e===ih&&!r)||cv(e)&&!nh(e)&&t===km||e===ih&&r}function ZD(t){return pa(t)&&t!==qg&&!nh(t)&&t!==_D&&t!==qD&&t!==ih&&t!==zw&&t!==_w&&t!==Hw&&t!==Uw&&t!==qw&&t!==km&&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 Wo(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 Pw(t){var e=/^\n* /;return e.test(t)}var Fw=1,Am=2,Vw=3,Iw=4,hl=5;function $D(t,e,i,n,r,o,a,c){var h,d=0,p=null,g=!1,x=!1,b=n!==-1,w=-1,k=ZD(Wo(t,0))&&JD(Wo(t,t.length-1));if(e||a)for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Wo(t,h),!pa(d))return hl;k=k&&hv(d,p,c),p=d}else{for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=Wo(t,h),d===fa)g=!0,b&&(x=x||h-w-1>n&&t[w+1]!==" ",w=h);else if(!pa(d))return hl;k=k&&hv(d,p,c),p=d}x=x||b&&h-w-1>n&&t[w+1]!==" "}return!g&&!x?k&&!a&&!r(t)?Fw:o===da?hl:Am:i>9&&Pw(t)?hl:a?o===da?hl:Am:x?Iw:Vw}function e4(t,e,i,n,r){t.dump=(function(){if(e.length===0)return t.quotingType===da?'""':"''";if(!t.noCompatMode&&(ID.indexOf(e)!==-1||QD.test(e)))return t.quotingType===da?'"'+e+'"':"'"+e+"'";var o=t.indent*Math.max(1,i),a=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),c=n||t.flowLevel>-1&&i>=t.flowLevel;function h(d){return XD(t,d)}switch($D(e,c,t.indent,a,h,t.quotingType,t.forceQuotes&&!n,r)){case Fw:return e;case Am:return"'"+e.replace(/'/g,"''")+"'";case Vw:return"|"+fv(e,t.indent)+dv(uv(e,o));case Iw:return">"+fv(e,t.indent)+dv(uv(t4(e,a),o));case hl:return'"'+i4(e)+'"';default:throw new Xt("impossible error: invalid scalar style")}})()}function fv(t,e){var i=Pw(t)?String(e):"",n=t[t.length-1]===`
31
+ `,r=n&&(t[t.length-2]===`
32
+ `||t===`
33
+ `),o=r?"+":n?"":"-";return i+o+`
34
+ `}function dv(t){return t[t.length-1]===`
35
+ `?t.slice(0,-1):t}function t4(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,pv(t.slice(0,d),e)})(),r=t[0]===`
37
+ `||t[0]===" ",o,a;a=i.exec(t);){var c=a[1],h=a[2];o=h[0]===" ",n+=c+(!r&&!o&&h!==""?`
38
+ `:"")+pv(h,e),r=o}return n}function pv(t,e){if(t===""||t[0]===" ")return t;for(var i=/ [^ ]/g,n,r=0,o,a=0,c=0,h="";n=i.exec(t);)c=n.index,c-r>e&&(o=a>r?a:c,h+=`
39
+ `+t.slice(r,o),r=o+1),a=c;return h+=`
40
+ `,t.length-r>e&&a>r?h+=t.slice(r,a)+`
41
+ `+t.slice(a+1):h+=t.slice(r),h.slice(1)}function i4(t){for(var e="",i=0,n,r=0;r<t.length;i>=65536?r+=2:r++)i=Wo(t,r),n=Vt[i],!n&&pa(i)?(e+=t[r],i>=65536&&(e+=t[r+1])):e+=n||GD(i);return e}function n4(t,e,i){var n="",r=t.tag,o,a,c;for(o=0,a=i.length;o<a;o+=1)c=i[o],t.replacer&&(c=t.replacer.call(i,String(o),c)),(Gn(t,e,c,!1,!1)||typeof c>"u"&&Gn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=r,t.dump="["+n+"]"}function mv(t,e,i,n){var r="",o=t.tag,a,c,h;for(a=0,c=i.length;a<c;a+=1)h=i[a],t.replacer&&(h=t.replacer.call(i,String(a),h)),(Gn(t,e+1,h,!0,!0,!1,!0)||typeof h>"u"&&Gn(t,e+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=Cm(t,e)),t.dump&&fa===t.dump.charCodeAt(0)?r+="-":r+="- ",r+=t.dump);t.tag=o,t.dump=r||"[]"}function r4(t,e,i){var n="",r=t.tag,o=Object.keys(i),a,c,h,d,p;for(a=0,c=o.length;a<c;a+=1)p="",n!==""&&(p+=", "),t.condenseFlow&&(p+='"'),h=o[a],d=i[h],t.replacer&&(d=t.replacer.call(i,h,d)),Gn(t,e,h,!1,!1)&&(t.dump.length>1024&&(p+="? "),p+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Gn(t,e,d,!1,!1)&&(p+=t.dump,n+=p));t.tag=r,t.dump="{"+n+"}"}function s4(t,e,i,n){var r="",o=t.tag,a=Object.keys(i),c,h,d,p,g,x;if(t.sortKeys===!0)a.sort();else if(typeof t.sortKeys=="function")a.sort(t.sortKeys);else if(t.sortKeys)throw new Xt("sortKeys must be a boolean or a function");for(c=0,h=a.length;c<h;c+=1)x="",(!n||r!=="")&&(x+=Cm(t,e)),d=a[c],p=i[d],t.replacer&&(p=t.replacer.call(i,d,p)),Gn(t,e+1,d,!0,!0,!0)&&(g=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,g&&(t.dump&&fa===t.dump.charCodeAt(0)?x+="?":x+="? "),x+=t.dump,g&&(x+=Cm(t,e)),Gn(t,e+1,p,!0,g)&&(t.dump&&fa===t.dump.charCodeAt(0)?x+=":":x+=": ",x+=t.dump,r+=x));t.tag=o,t.dump=r||"{}"}function gv(t,e,i){var n,r,o,a,c,h;for(r=i?t.explicitTypes:t.implicitTypes,o=0,a=r.length;o<a;o+=1)if(c=r[o],(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,Lw.call(c.represent)==="[object Function]")n=c.represent(e,h);else if(Bw.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 Gn(t,e,i,n,r,o,a){t.tag=null,t.dump=i,gv(t,i,!1)||gv(t,i,!0);var c=Lw.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?(s4(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(r4(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!a&&e>0?mv(t,e-1,t.dump,r):mv(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(n4(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object String]")t.tag!=="?"&&e4(t,t.dump,e,o,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 l4(t,e){var i=[],n=[],r,o;for(Mm(t,i,n),r=0,o=n.length;r<o;r+=1)e.duplicates.push(i[n[r]]);e.usedDuplicates=new Array(o)}function Mm(t,e,i){var n,r,o;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,o=t.length;r<o;r+=1)Mm(t[r],e,i);else for(n=Object.keys(t),r=0,o=n.length;r<o;r+=1)Mm(t[n[r]],e,i)}function o4(t,e){e=e||{};var i=new WD(e);i.noRefs||l4(t,i);var n=t;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Gn(i,0,n,!0,!0)?i.dump+`
42
+ `:""}var a4=o4,u4={dump:a4};function Pg(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 c4=Ht,h4=sw,f4=uw,d4=pw,p4=mw,m4=_g,g4=jw.load,y4=jw.loadAll,x4=u4.dump,b4=Xt,v4={binary:vw,float:dw,map:aw,null:cw,pairs:ww,set:kw,timestamp:xw,bool:hw,int:fw,merge:bw,omap:Sw,seq:ow,str:lw},S4=Pg("safeLoad","load"),w4=Pg("safeLoadAll","loadAll"),k4=Pg("safeDump","dump"),yv={Type:c4,Schema:h4,FAILSAFE_SCHEMA:f4,JSON_SCHEMA:d4,CORE_SCHEMA:p4,DEFAULT_SCHEMA:m4,load:g4,loadAll:y4,dump:x4,YAMLException:b4,types:v4,safeLoad:S4,safeLoadAll:w4,safeDump:k4};function Qw(){return jr({queryKey:["specs"],queryFn:Fe.specs.list})}function C4(){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 A4(){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 M4(){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 T4(){const t=pt();return Nt({mutationFn:e=>Fe.specs.toggle(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function O4(){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 E4(){const t=pt();return Nt({mutationFn:e=>Fe.specs.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function N4(){const{data:t}=Qw(),e=T4(),i=E4(),n=C4(),r=A4(),o=M4(),a=O4(),[c,h]=N.useState(!1),[d,p]=N.useState(!1),[g,x]=N.useState(null),[b,w]=N.useState("url"),[k,C]=N.useState(""),[M,T]=N.useState(""),[D,j]=N.useState(""),B=N.useRef(null);N.useEffect(()=>{function F(ee){B.current&&!B.current.contains(ee.target)&&(h(!1),p(!1),x(null))}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);const P=N.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)?yv.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)a.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 q=await de.text(),ne=/\.ya?ml$/i.test(de.name)?yv.load(q):JSON.parse(q);a.mutate({specId:F.id,spec:ne})}catch{alert("Invalid file")}},ee.click()}},J=F=>{o.mutate({specId:F,data:{upstreamUrl:D.trim()}},{onSuccess:()=>x(null)})},ue=t?.filter(F=>F.active)??[],oe=ue.length===1?ue[0].name:ue.length>1?`${ue.length} Specs`:"Select Spec";return v.jsxs("div",{className:"relative",ref:B,children:[v.jsxs("button",{onClick:()=>h(!c),className:Re("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:[v.jsx(Kc,{className:"w-3.5 h-3.5 text-mode-mock opacity-70"}),v.jsx("span",{className:"font-bold truncate max-w-[150px]",children:oe}),v.jsx(La,{className:Re("w-3 h-3 text-muted-foreground transition-transform",c&&"rotate-180")})]}),c&&v.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:[v.jsxs("div",{className:"px-3 py-1 mb-1 border-b border-border/40 flex items-center justify-between",children:[v.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"API Specifications"}),v.jsx("button",{onClick:()=>{p(!d),x(null),C(""),T("")},className:"p-1 hover:bg-primary/10 text-primary rounded-md transition-all",children:d?v.jsx(El,{className:"w-3.5 h-3.5"}):v.jsx(jg,{className:"w-3.5 h-3.5"})})]}),v.jsx("div",{className:"max-h-[450px] overflow-y-auto px-1.5 py-1 ",children:d?v.jsxs("div",{className:"p-3 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Spec Identifier"}),v.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"})]}),v.jsxs("div",{className:"flex p-0.5 bg-muted rounded-lg border border-border/40",children:[v.jsxs("button",{onClick:()=>w("url"),className:Re("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",b==="url"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[v.jsx(Y2,{className:"w-3 h-3"})," URL"]}),v.jsxs("button",{onClick:()=>w("file"),className:Re("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",b==="file"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[v.jsx(W2,{className:"w-3 h-3"})," File"]})]}),b==="url"?v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"relative group",children:[v.jsx(rN,{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"}),v.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"})]}),v.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?v.jsx(Jc,{className:"w-3.5 h-3.5 animate-spin"}):v.jsx(Wc,{className:"w-3.5 h-3.5"}),"Import from URL"]})]}):v.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:[v.jsx(eN,{className:"w-8 h-8 text-muted-foreground/40 group-hover:text-primary transition-colors mb-2"}),v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground group-hover:text-primary",children:"Click to select file"}),v.jsx("input",{type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:F=>{const ee=F.target.files?.[0];ee&&P(ee)}})]})]}):v.jsxs("div",{className:"space-y-1",children:[t?.length===0&&v.jsxs("div",{className:"py-10 text-center px-6 space-y-2",children:[v.jsx(Kc,{className:"w-8 h-8 mx-auto text-muted-foreground opacity-20"}),v.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=>v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:Re("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:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:Re("font-black truncate text-xs uppercase tracking-tight",F.active?"text-foreground":"text-muted-foreground"),children:F.name}),F.active&&v.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--color-primary),0.5)]"})]}),v.jsxs("p",{className:"text-[10px] font-bold opacity-40 truncate leading-none mt-1",children:[F.metadata.title," (v",F.metadata.version,")"]})]}),v.jsxs("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[v.jsx("button",{onClick:ee=>{ee.stopPropagation(),x(g===F.id?null:F.id),j(F.upstreamUrl)},className:"p-1.5 text-muted-foreground hover:text-primary rounded-md hover:bg-primary/10 transition-all",title:"Configure",children:v.jsx(dN,{className:"w-3.5 h-3.5"})}),v.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:v.jsx(ca,{className:"w-3.5 h-3.5"})})]})]}),g===F.id&&v.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:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Upstream URL"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{autoFocus:!0,type:"url",value:D,onChange:ee=>j(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"}),v.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:v.jsx(Wc,{className:"w-4 h-4"})})]})]}),v.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[v.jsxs("button",{onClick:()=>Z(F),disabled:a.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:[a.isPending?v.jsx(Jc,{className:"w-3 h-3 animate-spin"}):v.jsx(uN,{className:"w-3 h-3"}),"Reimport"]}),v.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))]})}),v.jsx("div",{className:"border-t border-border mt-1.5 pt-2 px-3 pb-1",children:v.jsxs("div",{className:"flex items-center justify-between text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.2em]",children:[v.jsxs("span",{children:["Total: ",t?.length??0]}),v.jsxs("span",{className:"text-primary/60",children:[ue.length," Active"]})]})})]})]})}const Yw=N.createContext(void 0);function R4(){const t=N.useContext(Yw);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Gw="/assets/logo-full-DJtzE5xc.png",D4="#181717",j4=N.forwardRef(function({title:e="GitHub",color:i="currentColor",size:n=24,...r},o){return i==="default"&&(i=D4),v.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,fill:i,viewBox:"0 0 24 24",ref:o,...r,children:[v.jsx("title",{children:e}),v.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 L4({open:t,onClose:e}){const i=pt(),{data:n}=jr({queryKey:["config"],queryFn:Fe.config.get}),{data:r}=jr({queryKey:["health"],queryFn:Fe.health}),{data:o}=iw(),a=iR(),[c,h]=N.useState("config"),[d,p]=N.useState(4e3),[g,x]=N.useState(!1),[b,w]=N.useState("");N.useEffect(()=>{n&&p(n.proxyPort)},[n]),N.useEffect(()=>{o&&w(o.name)},[o]);const k=Nt({mutationFn:()=>Fe.config.update({proxyPort:d}),onSuccess:()=>{i.invalidateQueries({queryKey:["config"]}),e()}}),C=async()=>{const D=await Fe.config.export(),j=new Blob([JSON.stringify(D,null,2)],{type:"application/json"}),B=URL.createObjectURL(j),P=document.createElement("a");P.href=B,P.download=`interceptr-config-${new Date().toISOString().slice(0,10)}.json`,P.click(),URL.revokeObjectURL(B)},M=async D=>{const j=await D.text(),B=JSON.parse(j);await Fe.config.import(B),i.invalidateQueries()},T=()=>{!o||!b.trim()||a.mutate({id:o.id,name:b.trim()},{onSuccess:()=>x(!1)})};return t?v.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[v.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md",onClick:e}),v.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:[v.jsxs("div",{className:"px-6 py-4 border-b border-border/40 bg-muted flex items-center justify-between shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(fN,{className:"w-4 h-4 text-primary"}),v.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-foreground/80",children:"System Control"})]}),v.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:v.jsx(El,{className:"w-4 h-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/20 bg-muted/30 shrink-0 px-4",children:[v.jsx("button",{onClick:()=>h("config"),className:Re("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",c==="config"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Configuration"}),v.jsx("button",{onClick:()=>h("about"),className:Re("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",c==="about"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"About"})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:c==="config"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 px-1",children:[v.jsx(yN,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Project Identity"})]}),o&&v.jsx("div",{className:"space-y-3",children:g?v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{autoFocus:!0,type:"text",value:b,onChange:D=>w(D.target.value),className:"flex-1 px-4 py-2.5 text-sm font-bold rounded-xl border border-primary/20 bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:T,className:"p-2.5 bg-success/10 text-success rounded-xl hover:bg-success hover:text-success-foreground transition-colors duration-75 shadow-sm",children:v.jsx(Wc,{className:"w-4 h-4"})}),v.jsx("button",{onClick:()=>{w(o.name),x(!1)},className:"p-2.5 bg-muted text-muted-foreground rounded-xl transition-colors duration-75",children:v.jsx(El,{className:"w-4 h-4"})})]})]}):v.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border/40 bg-muted/10 group",children:[v.jsxs("div",{className:"flex flex-col",children:[v.jsx("span",{className:"text-sm font-black text-foreground",children:o.name}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground opacity-60 uppercase mt-0.5 tracking-tighter",children:["Project ID: ",o.id]})]}),v.jsxs("button",{onClick:()=>x(!0),className:"flex items-center gap-2 px-3 py-1.5 text-[10px] font-black uppercase tracking-widest text-primary hover:bg-primary/5 rounded-lg transition-all border border-transparent hover:border-primary/20",children:[v.jsx(lN,{className:"w-3 h-3"}),"Rename"]})]})})]}),v.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[v.jsxs("div",{className:"flex items-center gap-2 px-1",children:[v.jsx(Y2,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Network Environment"})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex-1 space-y-1",children:[v.jsx("p",{className:"text-xs font-black text-foreground uppercase tracking-tight leading-none mb-1",children:"Proxy Port"}),v.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-medium",children:"Internal server interface listener port."})]}),v.jsx("input",{type:"number",value:d,onChange:D=>p(Number(D.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"})]})]}),v.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[v.jsxs("div",{className:"flex items-center gap-2 px-1",children:[v.jsx(Z3,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Data Sovereignty"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("button",{onClick:C,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:[v.jsx(J3,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Backup"]}),v.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:[v.jsx(W2,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Restore",v.jsx("input",{type:"file",accept:".json",className:"hidden",onChange:D=>{const j=D.target.files?.[0];j&&M(j)}})]})]})]})]}):v.jsxs("div",{className:"flex flex-col items-center text-center space-y-8 py-4",children:[v.jsx("div",{className:"max-w-[300px] p-4",children:v.jsx("img",{src:Gw,alt:"Interceptr Full Logo",className:"w-full h-auto object-contain"})}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xl font-black tracking-tighter uppercase",children:"Interceptr"}),v.jsxs("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest",children:["Version ",r?.version??"—"]})]}),v.jsx("div",{className:"max-w-md",children:v.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."})}),v.jsxs("div",{className:"w-full grid grid-cols-1 gap-3 pt-4",children:[v.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:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:v.jsx(j4,{className:"w-4 h-4"})}),v.jsxs("div",{className:"text-left",children:[v.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"GitHub Repository"}),v.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Contribute or report issues."})]})]}),v.jsx(vm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]}),v.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:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:v.jsx(G2,{className:"w-4 h-4 text-primary"})}),v.jsxs("div",{className:"text-left",children:[v.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"Developer"}),v.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Patrick Hieber"})]})]}),v.jsx(vm,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]})]}),v.jsx("p",{className:"text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.3em] pt-4",children:"API Simulation Made Simple."})]})}),v.jsx("div",{className:"p-4 border-t border-border/40 bg-muted flex justify-end gap-3 px-6 shrink-0",children:c==="config"?v.jsxs(v.Fragment,{children:[v.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"}),v.jsx("button",{onClick:()=>k.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"})]}):v.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 B4(){const{theme:t,toggleTheme:e}=R4(),{data:i}=I3(),n=Q3(),r=Y3(),[o,a]=N.useState(!1),c=i?.running??!1,h=n.isPending||r.isPending;return v.jsxs(v.Fragment,{children:[v.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:[v.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-white/5"}),v.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[v.jsx("div",{className:"flex items-center group cursor-pointer h-8",children:v.jsx("img",{src:Gw,alt:"Interceptr",className:"h-7 w-auto object-contain transition-transform duration-75 group-hover:scale-105"})}),v.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 hidden sm:block"}),v.jsx(rR,{}),v.jsx(N4,{})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:Re("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:[v.jsx("div",{className:Re("w-2 h-2 rounded-full",c?"bg-success animate-pulse":"bg-muted-foreground/20")}),v.jsx("span",{children:c?`:${i?.port}`:"Offline"})]}),v.jsxs("button",{onClick:()=>c?r.mutate():n.mutate(),disabled:h,className:Re("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:[v.jsx(oN,{className:"w-3.5 h-3.5"}),v.jsx("span",{className:"hidden lg:inline",children:c?"Stop":"Start"})]}),v.jsx("div",{className:"h-6 w-px bg-border/40 mx-1"}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.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"?v.jsx(mN,{className:"w-4 h-4"}):v.jsx(sN,{className:"w-4 h-4"})}),v.jsx("button",{onClick:()=>a(!0),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Settings",children:v.jsx(pN,{className:"w-4 h-4"})})]})]})]}),v.jsx(L4,{open:o,onClose:()=>a(!1)})]})}function z4(){const[t,e]=N.useState(()=>typeof window<"u"&&localStorage.getItem("theme")||"dark");N.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 v.jsx(Yw.Provider,{value:{theme:t,toggleTheme:i},children:v.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background text-foreground",children:[v.jsx(B4,{}),v.jsx("main",{className:"flex-1 overflow-hidden relative",children:v.jsx(AE,{})})]})})}function Kw(){return jr({queryKey:["endpoints"],queryFn:Fe.endpoints.list})}function _4(){const t=pt();return Nt({mutationFn:({id:e,config:i})=>Fe.endpoints.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}function Ww(){const t=pt();return Nt({mutationFn:e=>Fe.endpoints.bulkUpdate(e),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const H4={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 Fg({method:t}){return v.jsx("span",{className:Re("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",H4[t]??"text-muted-foreground bg-muted/20 border-border"),children:t})}const U4=[{value:"passthrough",label:"Pass",icon:bm,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:Ol,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:$3,activeClass:"bg-mode-mock/20 text-mode-mock border-mode-mock/30 shadow-[0_0_8px_-2px_rgba(var(--mode-mock),0.3)]"}];function q4({value:t,onChange:e}){return v.jsx("div",{className:"inline-flex rounded-lg border border-border/60 bg-muted/30 p-1 shadow-inner backdrop-blur-sm",children:U4.map(({value:i,label:n,icon:r,activeClass:o})=>v.jsxs("button",{onClick:()=>e(i),className:Re("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?Re("font-bold",o):"text-muted-foreground/60 hover:text-foreground hover:bg-white/5"),children:[v.jsx(r,{className:Re("w-3.5 h-3.5",t===i?"animate-in zoom-in-75 duration-300":"opacity-50")}),v.jsx("span",{className:"hidden sm:inline",children:n})]},i))})}function P4({delay:t,onChange:e}){const[i,n]=N.useState(t.ms),[r,o]=N.useState(t.jitterMs??0);N.useEffect(()=>{n(t.ms),o(t.jitterMs??0)},[t.ms,t.jitterMs]);const a=()=>{e({ms:i,jitterMs:r||void 0})};return v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 max-w-2xl py-2",children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[v.jsx(Ol,{className:"w-3.5 h-3.5 text-mode-delay"}),"Base Delay"]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("input",{type:"number",value:i,onChange:c=>n(Number(c.target.value)),onBlur:a,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"}),v.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),v.jsx("input",{type:"range",min:0,max:1e4,step:50,value:i,onChange:c=>n(Number(c.target.value)),onMouseUp:a,className:"w-full accent-mode-delay h-4 bg-transparent cursor-pointer"}),v.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[v.jsx("span",{children:"0ms"}),v.jsx("span",{children:"5,000ms"}),v.jsx("span",{children:"10,000ms"})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[v.jsx(Lg,{className:"w-3.5 h-3.5 text-mode-delay/60"}),"Jitter (±)"]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("input",{type:"number",value:r,onChange:c=>o(Number(c.target.value)),onBlur:a,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"}),v.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),v.jsx("input",{type:"range",min:0,max:2e3,step:10,value:r,onChange:c=>o(Number(c.target.value)),onMouseUp:a,className:"w-full accent-mode-delay/60 h-4 bg-transparent cursor-pointer"}),v.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[v.jsx("span",{children:"0ms"}),v.jsx("span",{children:"1,000ms"}),v.jsx("span",{children:"2,000ms"})]})]})]})}function Tm(){return Tm=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},Tm.apply(null,arguments)}function F4(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 Om=[],Xw=[];(()=>{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?Xw:Om).push(i=i+t[e])})();function V4(t){if(t<768)return!1;for(let e=0,i=Om.length;;){let n=e+i>>1;if(t<Om[n])i=n;else if(t>=Xw[n])e=n+1;else return!0;if(e==i)return!1}}function xv(t){return t>=127462&&t<=127487}const bv=8205;function I4(t,e,i=!0,n=!0){return(i?Zw:Q4)(t,e,n)}function Zw(t,e,i){if(e==t.length)return e;e&&Jw(t.charCodeAt(e))&&$w(t.charCodeAt(e-1))&&e--;let n=Np(t,e);for(e+=vv(n);e<t.length;){let r=Np(t,e);if(n==bv||r==bv||i&&V4(r))e+=vv(r),n=r;else if(xv(r)){let o=0,a=e-2;for(;a>=0&&xv(Np(t,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function Q4(t,e,i){for(;e>0;){let n=Zw(t,e-2,i);if(n<e)return n;e--}return 0}function Np(t,e){let i=t.charCodeAt(e);if(!$w(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Jw(n)?(i-55296<<10)+(n-56320)+65536:i}function Jw(t){return t>=56320&&t<57344}function $w(t){return t>=55296&&t<56320}function vv(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]=Rl(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]=Rl(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 ea(this),o=new ea(e);for(let a=i,c=i;;){if(r.next(a),o.next(a),a=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new ea(this,e)}iterRange(e,i=this.length){return new ek(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 tk(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=Y4(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 o=0;;o++){let a=this.text[o],c=r+a.length;if((i?n:c)>=e)return new G4(r,c,n,a);r=c+1,n++}}decompose(e,i,n,r){let o=e<=0&&i>=this.length?this:new ft(Sv(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let a=n.pop(),c=zc(o.text,a.text.slice(),0,o.length);if(c.length<=32)n.push(new ft(c,a.length+o.length));else{let h=c.length>>1;n.push(new ft(c.slice(0,h)),new ft(c.slice(h)))}}else n.push(o)}replace(e,i,n){if(!(n instanceof ft))return super.replace(e,i,n);[e,i]=Rl(this,e,i);let r=zc(this.text,zc(n.text,Sv(this.text,0,e)),i),o=this.length+n.length-(i-e);return r.length<=32?new ft(r,o):fn.from(ft.split(r,[]),o)}sliceString(e,i=this.length,n=`
43
+ `){[e,i]=Rl(this,e,i);let r="";for(let o=0,a=0;o<=i&&a<this.text.length;a++){let c=this.text[a],h=o+c.length;o>e&&a&&(r+=n),e<h&&i>o&&(r+=c.slice(Math.max(0,e-o),i-o)),o=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 o of e)n.push(o),r+=o.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 o=0;;o++){let a=this.children[o],c=r+a.length,h=n+a.lines-1;if((i?h:c)>=e)return a.lineInner(e,i,n,r);r=c+1,n=h+1}}decompose(e,i,n,r){for(let o=0,a=0;a<=i&&o<this.children.length;o++){let c=this.children[o],h=a+c.length;if(e<=h&&i>=a){let d=r&((a<=e?1:0)|(h>=i?2:0));a>=e&&h<=i&&!d?n.push(c):c.decompose(e-a,i-a,n,d)}a=h+1}}replace(e,i,n){if([e,i]=Rl(this,e,i),n.lines<this.lines)for(let r=0,o=0;r<this.children.length;r++){let a=this.children[r],c=o+a.length;if(e>=o&&i<=c){let h=a.replace(e-o,i-o,n),d=this.lines-a.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[r]=h,new fn(p,this.length-(i-e)+n.length)}return super.replace(o,c,h)}o=c+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
44
+ `){[e,i]=Rl(this,e,i);let r="";for(let o=0,a=0;o<this.children.length&&a<=i;o++){let c=this.children[o],h=a+c.length;a>e&&o&&(r+=n),e<h&&i>a&&(r+=c.sliceString(e-a,i-a,n)),a=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,o,a,c]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,o+=i){if(r==a||o==c)return n;let h=this.children[r],d=e.children[o];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 b of e)n+=b.lines;if(n<32){let b=[];for(let w of e)w.flatten(b);return new ft(b,i)}let r=Math.max(32,n>>5),o=r<<1,a=r>>1,c=[],h=0,d=-1,p=[];function g(b){let w;if(b.lines>o&&b instanceof fn)for(let k of b.children)g(k);else b.lines>a&&(h>a||!h)?(x(),c.push(b)):b instanceof ft&&h&&(w=p[p.length-1])instanceof ft&&b.lines+w.lines<=32?(h+=b.lines,d+=b.length+1,p[p.length-1]=new ft(w.text.concat(b.text),w.length+1+b.length)):(h+b.lines>r&&x(),h+=b.lines,d+=b.length+1,p.push(b))}function x(){h!=0&&(c.push(p.length==1?p[0]:fn.from(p,d)),d=-1,h=p.length=0)}for(let b of e)g(b);return x(),c.length==1?c[0]:new fn(c,i)}}Ue.empty=new ft([""],0);function Y4(t){let e=-1;for(let i of t)e+=i.length+1;return e}function zc(t,e,i=0,n=1e9){for(let r=0,o=0,a=!0;o<t.length&&r<=n;o++){let c=t[o],h=r+c.length;h>=i&&(h>n&&(c=c.slice(0,n-r)),r<i&&(c=c.slice(i-r)),a?(e[e.length-1]+=c,a=!1):e.push(c)),r=h+1}return e}function Sv(t,e,i){return zc(t,[""],e,i)}class ea{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],o=this.offsets[n],a=o>>1,c=r instanceof ft?r.text.length:r.children.length;if(a==(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((o&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[a+(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[a+(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 ek{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new ea(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 tk{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()},ea.prototype[Symbol.iterator]=ek.prototype[Symbol.iterator]=tk.prototype[Symbol.iterator]=function(){return this});class G4{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 Rl(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 I4(t,e,i,n)}function K4(t){return t>=56320&&t<57344}function W4(t){return t>=55296&&t<56320}function li(t,e){let i=t.charCodeAt(e);if(!W4(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return K4(n)?(i-55296<<10)+(n-56320)+65536:i}function Vg(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 Em=/\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 o=this.sections[i++],a=this.sections[i++];a<0?(e(n,r,o),r+=o):r+=a,n+=o}}iterChangedRanges(e,i=!1){Nm(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:ik(this,e)}mapDesc(e,i=!1){return e.empty?this:Rm(this,e,i)}mapPos(e,i=-1,n=Zt.Simple){let r=0,o=0;for(let a=0;a<this.sections.length;){let c=this.sections[a++],h=this.sections[a++],d=r+c;if(h<0){if(d>e)return o+(e-r);o+=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?o:o+h;o+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let o=this.sections[n++],a=this.sections[n++],c=r+o;if(a>=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 Nm(this,(i,n,r,o,a)=>e=e.replace(r,r+(n-i),a),!1),e}mapDesc(e,i=!1){return Rm(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,o=0;r<i.length;r+=2){let a=i[r],c=i[r+1];if(c>=0){i[r]=c,i[r+1]=a;let h=r>>1;for(;n.length<h;)n.push(Ue.empty);n.push(a?e.slice(o,o+a):Ue.empty)}o+=a}return new wt(i,n)}compose(e){return this.empty?e:e.empty?this:ik(this,e,!0)}map(e,i=!1){return e.empty?this:Rm(this,e,i,!0)}iterChanges(e,i=!1){Nm(this,e,i)}get desc(){return vn.create(this.sections)}filter(e){let i=[],n=[],r=[],o=new ma(this);e:for(let a=0,c=0;;){let h=a==e.length?1e9:e[a++];for(;c<h||c==h&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,h-c);Pt(r,p,-1);let g=o.ins==-1?-1:o.off==0?o.ins:0;Pt(i,p,g),g>0&&Or(n,i,o.text),o.forward(p),c+=p}let d=e[a++];for(;c<d;){if(o.done)break e;let p=Math.min(o.len,d-c);Pt(i,p,-1),Pt(r,p,o.ins==-1?-1:o.off==0?o.ins:0),o.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=[],o=[],a=0,c=null;function h(p=!1){if(!p&&!r.length)return;a<i&&Pt(r,i-a,-1);let g=new wt(r,o);c=c?c.compose(g.map(c)):g,r=[],o=[],a=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:b}=p;if(g>x||g<0||x>i)throw new RangeError(`Invalid change range ${g} to ${x} (in doc of length ${i})`);let w=b?typeof b=="string"?Ue.of(b.split(n||Em)):b:Ue.empty,k=w.length;if(g==x&&k==0)return;g<a&&h(),g>a&&Pt(r,g-a,-1),Pt(r,x-g,k),Or(o,r,w),a=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 o=e[r];if(typeof o=="number")i.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((a,c)=>c&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;n.length<r;)n.push(Ue.empty);n[r]=Ue.of(o.slice(1)),i.push(o[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 Nm(t,e,i){let n=t.inserted;for(let r=0,o=0,a=0;a<t.sections.length;){let c=t.sections[a++],h=t.sections[a++];if(h<0)r+=c,o+=c;else{let d=r,p=o,g=Ue.empty;for(;d+=c,p+=h,h&&n&&(g=g.append(n[a-2>>1])),!(i||a==t.sections.length||t.sections[a+1]<0);)c=t.sections[a++],h=t.sections[a++];e(r,d,o,p,g),r=d,o=p}}}function Rm(t,e,i,n=!1){let r=[],o=n?[]:null,a=new ma(t),c=new ma(e);for(let h=-1;;){if(a.done&&c.len||c.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&c.ins==-1){let d=Math.min(a.len,c.len);Pt(r,d,-1),a.forward(d),c.forward(d)}else if(c.ins>=0&&(a.ins<0||h==a.i||a.off==0&&(c.len<a.len||c.len==a.len&&!i))){let d=c.len;for(Pt(r,c.ins,-1);d;){let p=Math.min(a.len,d);a.ins>=0&&h<a.i&&a.len<=p&&(Pt(r,0,a.ins),o&&Or(o,r,a.text),h=a.i),a.forward(p),d-=p}c.next()}else if(a.ins>=0){let d=0,p=a.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<a.i?a.ins:0),o&&h<a.i&&Or(o,r,a.text),h=a.i,a.forward(a.len-p)}else{if(a.done&&c.done)return o?wt.createSet(r,o):vn.create(r);throw new Error("Mismatched change set lengths")}}}function ik(t,e,i=!1){let n=[],r=i?[]:null,o=new ma(t),a=new ma(e);for(let c=!1;;){if(o.done&&a.done)return r?wt.createSet(n,r):vn.create(n);if(o.ins==0)Pt(n,o.len,0,c),o.next();else if(a.len==0&&!a.done)Pt(n,0,a.ins,c),r&&Or(r,n,a.text),a.next();else{if(o.done||a.done)throw new Error("Mismatched change set lengths");{let h=Math.min(o.len2,a.len),d=n.length;if(o.ins==-1){let p=a.ins==-1?-1:a.off?0:a.ins;Pt(n,h,p,c),r&&p&&Or(r,n,a.text)}else a.ins==-1?(Pt(n,o.off?0:o.len,h,c),r&&Or(r,n,o.textBit(h))):(Pt(n,o.off?0:o.len,a.off?0:a.ins,c),r&&!a.off&&Or(r,n,a.text));c=(o.ins>h||a.ins>=0&&a.len>h)&&(c||n.length>d),o.forward2(h),a.forward(h)}}}}class ma{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 o=e[r];if(o.empty?o.from<=n:o.from<n)return W.normalized(e.slice(),i);n=o.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 o=(n??16777215)<<6|(r==null?7:Math.min(6,r));return i<e?ds.create(i,e,48|o):ds.create(e,i,(i>e?8:0)|o)}static normalized(e,i=0){let n=e[i];e.sort((r,o)=>r.from-o.from),i=e.indexOf(n);for(let r=1;r<e.length;r++){let o=e[r],a=e[r-1];if(o.empty?o.from<=a.to:o.from<a.to){let c=a.from,h=Math.max(o.to,a.to);r<=i&&i--,e.splice(--r,2,o.anchor>o.head?W.range(h,c):W.range(c,h))}}return new W(e,i)}}function nk(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let Ig=0;class le{constructor(e,i,n,r,o){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=r,this.id=Ig++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}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:Qg),!!e.static,e.enables)}of(e){return new _c([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new _c(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new _c(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Qg(t,e){return t==e||t.length==e.length&&t.every((i,n)=>i===e[n])}class _c{constructor(e,i,n,r){this.dependencies=e,this.facet=i,this.type=n,this.value=r,this.id=Ig++}dynamicSlot(e){var i;let n=this.value,r=this.facet.compareInput,o=this.id,a=e[o]>>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[a]=n(g),1},update(g,x){if(h&&x.docChanged||d&&(x.docChanged||x.selection)||Dm(g,p)){let b=n(g);if(c?!wv(b,g.values[a],r):!r(b,g.values[a]))return g.values[a]=b,1}return 0},reconfigure:(g,x)=>{let b,w=x.config.address[o];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?wv(b=n(g),k,r):r(b=n(g),k)))return g.values[a]=k,0}else b=n(g);return g.values[a]=b,1}}}}function wv(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 Dm(t,e){let i=!1;for(let n of e)ta(t,n)&1&&(i=!0);return i}function X4(t,e,i){let n=i.map(h=>t[h.id]),r=i.map(h=>h.type),o=n.filter(h=>!(h&1)),a=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)ta(h,d);return h.values[a]=c(h),1},update(h,d){if(!Dm(h,o))return 0;let p=c(h);return e.compare(p,h.values[a])?0:(h.values[a]=p,1)},reconfigure(h,d){let p=Dm(h,n),g=d.config.facets[e.id],x=d.facet(e);if(g&&!p&&Qg(i,g))return h.values[a]=x,0;let b=c(h);return e.compare(b,x)?(h.values[a]=x,0):(h.values[a]=b,1)}}}const uc=le.define({static:!0});class It{constructor(e,i,n,r,o){this.id=e,this.createF=i,this.updateF=n,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let i=new It(Ig++,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(uc).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 o=n.values[i],a=this.updateF(o,r);return this.compareF(o,a)?0:(n.values[i]=a,1)},reconfigure:(n,r)=>{let o=n.facet(uc),a=r.facet(uc),c;return(c=o.find(h=>h.field==this))&&c!=a.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,uc.of({field:this,create:e})]}get extension(){return this}}const cs={lowest:4,low:3,default:2,high:1,highest:0};function Io(t){return e=>new rk(e,t)}const As={highest:Io(cs.highest),high:Io(cs.high),default:Io(cs.default),low:Io(cs.low),lowest:Io(cs.lowest)};class rk{constructor(e,i){this.inner=e,this.prec=i}}class zh{of(e){return new jm(this,e)}reconfigure(e){return zh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class jm{constructor(e,i){this.compartment=e,this.inner=i}}class rh{constructor(e,i,n,r,o,a){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=r,this.staticValues=o,this.facets=a,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=[],o=Object.create(null),a=new Map;for(let x of Z4(e,i,a))x instanceof It?r.push(x):(o[x.facet.id]||(o[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(b=>x.slot(b));let p=n?.config.facets;for(let x in o){let b=o[x],w=b[0].facet,k=p&&p[x]||[];if(b.every(C=>C.type==0))if(c[w.id]=h.length<<1|1,Qg(k,b))h.push(n.facet(w));else{let C=w.combine(b.map(M=>M.value));h.push(n&&w.compare(C,n.facet(w))?n.facet(w):C)}else{for(let C of b)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=>X4(C,w,b))}}let g=d.map(x=>x(c));return new rh(e,a,g,c,h,o)}}function Z4(t,e,i){let n=[[],[],[],[],[]],r=new Map;function o(a,c){let h=r.get(a);if(h!=null){if(h<=c)return;let d=n[h].indexOf(a);d>-1&&n[h].splice(d,1),a instanceof jm&&i.delete(a.compartment)}if(r.set(a,c),Array.isArray(a))for(let d of a)o(d,c);else if(a instanceof jm){if(i.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;i.set(a.compartment,d),o(d,c)}else if(a instanceof rk)o(a.inner,a.prec);else if(a instanceof It)n[c].push(a),a.provides&&o(a.provides,c);else if(a instanceof _c)n[c].push(a),a.facet.extensions&&o(a.facet.extensions,cs.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,c)}}return o(t,cs.default),n.reduce((a,c)=>a.concat(c))}function ta(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 sk=le.define(),Lm=le.define({combine:t=>t.some(e=>e),static:!0}),lk=le.define({combine:t=>t.length?t[0]:void 0,static:!0}),ok=le.define(),ak=le.define(),uk=le.define(),ck=le.define({combine:t=>t.length?t[0]:!1});class Sn{constructor(e,i){this.type=e,this.value=i}static define(){return new J4}}class J4{of(e){return new Sn(this,e)}}class $4{constructor(e){this.map=e}of(e){return new Se(this,e)}}class Se{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 Se(this.type,i)}is(e){return this.type==e}static define(e={}){return new $4(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let o=r.map(i);o&&n.push(o)}return n}}Se.reconfigure=Se.define();Se.appendConfig=Se.define();class At{constructor(e,i,n,r,o,a){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,n&&nk(n,i.newLength),o.some(c=>c.type==At.time)||(this.annotations=o.concat(At.time.of(Date.now())))}static create(e,i,n,r,o,a){return new At(e,i,n,r,o,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let 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 e5(t,e){let i=[];for(let n=0,r=0;;){let o,a;if(n<t.length&&(r==e.length||e[r]>=t[n]))o=t[n++],a=t[n++];else if(r<e.length)o=e[r++],a=e[r++];else return i;!i.length||i[i.length-1]<o?i.push(o,a):i[i.length-1]<a&&(i[i.length-1]=a)}}function hk(t,e,i){var n;let r,o,a;return i?(r=e.changes,o=wt.empty(e.changes.length),a=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(o):(n=t.selection)===null||n===void 0?void 0:n.map(r),effects:Se.mapEffects(t.effects,r).concat(Se.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Bm(t,e,i){let n=e.selection,r=Sl(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(lk)),selection:n&&(n instanceof W?n:W.single(n.anchor,n.head)),effects:Sl(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function fk(t,e,i){let n=Bm(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(i=!1);let a=!!e[o].sequential;n=hk(n,Bm(t,e[o],a?n.changes.newLength:t.doc.length),a)}let r=At.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return i5(i?t5(r):r)}function t5(t){let e=t.startState,i=!0;for(let r of e.facet(ok)){let o=r(t);if(o===!1){i=!1;break}Array.isArray(o)&&(i=i===!0?o:e5(i,o))}if(i!==!0){let r,o;if(i===!1)o=t.changes.invertedDesc,r=wt.empty(e.doc.length);else{let a=t.changes.filter(i);r=a.changes,o=a.filtered.mapDesc(a.changes).invertedDesc}t=At.create(e,r,t.selection&&t.selection.map(o),Se.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let n=e.facet(ak);for(let r=n.length-1;r>=0;r--){let o=n[r](t);o instanceof At?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof At?t=o[0]:t=fk(e,Sl(o),!1)}return t}function i5(t){let e=t.startState,i=e.facet(uk),n=t;for(let r=i.length-1;r>=0;r--){let o=i[r](t);o&&Object.keys(o).length&&(n=hk(n,Bm(e,o,t.changes.newLength),!0))}return n==t?t:At.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const n5=[];function Sl(t){return t==null?n5: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 r5=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let zm;try{zm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function s5(t){if(zm)return zm.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||r5.test(i)))return!0}return!1}function l5(t){return e=>{if(!/\S/.test(e))return nt.Space;if(s5(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,o,a){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)ta(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 ta(this,n),sh(this,n)}update(...e){return fk(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let c of e.effects)c.is(zh.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(Se.reconfigure)?(i=null,n=c.value):c.is(Se.appendConfig)&&(i=null,n=Sl(n).concat(c.value));let o;i?o=e.startState.values.slice():(i=rh.resolve(n,r,this),o=new Be(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let a=e.startState.facet(Lm)?e.newSelection:e.newSelection.asSingle();new Be(i,e.newDoc,a,o,(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),o=[n.range],a=Sl(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++)o[x]=o[x].map(p);let g=r.mapDesc(d,!0);o.push(h.range.map(g)),r=r.compose(p),a=Se.mapEffects(a,p).concat(Se.mapEffects(Sl(h.effects),g))}return{changes:r,selection:W.create(o,i.mainIndex),effects:a}}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)||Em))}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:(ta(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 o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let a=n[o],c=e[o];r.push(a.init(h=>a.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)||Em)),r=e.selection?e.selection instanceof W?e.selection:W.single(e.selection.anchor,e.selection.head):W.single(0);return nk(r,n.length),i.staticFacet(Lm)||(r=r.asSingle()),new Be(i,n,r,i.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(Be.tabSize)}get lineBreak(){return this.facet(Be.lineSeparator)||`
46
+ `}get readOnly(){return this.facet(ck)}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 o=+(r||1);return!o||o>i.length?n:i[o-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let o of this.facet(sk))for(let a of o(this,i,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return l5(i.length?i[0]:"")}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-n,c=e-n;for(;a>0;){let h=Et(i,a,!1);if(o(i.slice(h,a))!=nt.Word)break;a=h}for(;c<r;){let h=Et(i,c);if(o(i.slice(c,h))!=nt.Word)break;c=h}return a==c?null:W.range(a+n,c+n)}}Be.allowMultipleSelections=Lm;Be.tabSize=le.define({combine:t=>t.length?t[0]:4});Be.lineSeparator=lk;Be.readOnly=ck;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=sk;Be.changeFilter=ok;Be.transactionFilter=ak;Be.transactionExtender=uk;zh.reconfigure=Se.define();function wn(t,e,i={}){let n={};for(let r of t)for(let o of Object.keys(r)){let a=r[o],c=n[o];if(c===void 0)n[o]=a;else if(!(c===a||a===void 0))if(Object.hasOwnProperty.call(i,o))n[o]=i[o](c,a);else throw new Error("Config merge conflict for field "+o)}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 _m.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 _m=class dk{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new dk(e,i,n)}};function Hm(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Gg{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 o=n?this.to:this.from;for(let a=r,c=o.length;;){if(a==c)return a;let h=a+c>>1,d=o[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-i;if(h==a)return d>=0?a:c;d>=0?c=h:a=h+1}}between(e,i,n,r){for(let o=this.findIndex(i,-1e9,!0),a=this.findIndex(n,1e9,!1,o);o<a;o++)if(r(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,i){let n=[],r=[],o=[],a=-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,b;if(p==g){let w=i.mapPos(p,d.startSide,d.mapMode);if(w==null||(x=b=w,d.startSide!=d.endSide&&(b=i.mapPos(p,d.endSide),b<x)))continue}else if(x=i.mapPos(p,d.startSide),b=i.mapPos(g,d.endSide),x>b||x==b&&d.startSide>0&&d.endSide<=0)continue;(b-x||d.endSide-d.startSide)<0||(a<0&&(a=x),d.point&&(c=Math.max(c,b-x)),n.push(d),r.push(x-a),o.push(b-a))}return{mapped:n.length?new Gg(r,o,n,c):null,pos:a}}}class Ne{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 Ne(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:o=this.length}=e,a=e.filter;if(i.length==0&&!a)return this;if(n&&(i=i.slice().sort(Hm)),this.isEmpty)return i.length?Ne.of(i):this;let c=new pk(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)&&(!a||r>this.chunkEnd(c.chunkIndex)||o<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!a||r>c.to||o<c.from||a(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(_m.create(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Ne.empty:this.nextLayer.update({add:d,filter:a,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let a=0;a<this.chunk.length;a++){let c=this.chunkPos[a],h=this.chunk[a],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 o=this.nextLayer.map(e);return i.length==0?o:new Ne(n,i,o||Ne.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],a=this.chunk[r];if(i>=o&&e<=o+a.length&&a.between(o,e-o,i-o,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ga.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ga.from(e).goto(i)}static compare(e,i,n,r,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),c=i.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),h=kv(a,c,n),d=new Qo(a,h,o),p=new Qo(c,h,o);n.iterGaps((g,x,b)=>Cv(d,g,p,x,b,r)),n.empty&&n.length==0&&Cv(d,0,p,0,0,r)}static eq(e,i,n=0,r){r==null&&(r=999999999);let o=e.filter(p=>!p.isEmpty&&i.indexOf(p)<0),a=i.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let c=kv(o,a),h=new Qo(o,c,0).goto(n),d=new Qo(a,c,0).goto(n);for(;;){if(h.to!=d.to||!Um(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,o=-1){let a=new Qo(e,null,o).goto(i),c=i,h=a.openStart;for(;;){let d=Math.min(a.to,n);if(a.point){let p=a.activeForPoint(a.to),g=a.pointFrom<i?p.length+1:a.point.startSide<0?p.length:Math.min(p.length,h);r.point(c,d,a.point,p,g,a.pointRank),h=Math.min(a.openEnd(d),p.length)}else d>c&&(r.span(c,d,a.active,h),h=a.openEnd(d));if(a.to>n)return h+(a.point&&a.to>n?1:0);c=a.to,a.next()}}static of(e,i=!1){let n=new Kn;for(let r of e instanceof _m?[e]:i?o5(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Ne.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Ne.empty;r=r.nextLayer)i=new Ne(r.chunkPos,r.chunk,i,Math.max(r.maxPoint,i.maxPoint));return i}}Ne.empty=new Ne([],[],null,-1);function o5(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(Hm(e,n)>0)return t.slice().sort(Hm);e=n}return t}Ne.empty.nextLayer=Ne.empty;class Kn{finishChunk(e){this.chunks.push(new Gg(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(Ne.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=Ne.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function kv(t,e,i){let n=new Map;for(let o of t)for(let a=0;a<o.chunk.length;a++)o.chunk[a].maxPoint<=0&&n.set(o.chunk[a],o.chunkPos[a]);let r=new Set;for(let o of e)for(let a=0;a<o.chunk.length;a++){let c=n.get(o.chunk[a]);c!=null&&(i?i.mapPos(c):c)==o.chunkPos[a]&&!i?.touchesRange(c,c+o.chunk[a].length)&&r.add(o.chunk[a])}return r}class pk{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 ga{constructor(e){this.heap=e}static from(e,i=null,n=-1){let r=[];for(let o=0;o<e.length;o++)for(let a=e[o];!a.isEmpty;a=a.nextLayer)a.maxPoint>=n&&r.push(new pk(a,i,n,o));return r.length==1?r[0]:new ga(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--)Rp(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--)Rp(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(),Rp(this.heap,0)}}}function Rp(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 Qo{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=ga.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){cc(this.active,e),cc(this.activeTo,e),cc(this.activeRank,e),this.minActive=Av(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:r,rank:o}=this.cursor;for(;i<this.activeRank.length&&(o-this.activeRank[i]||r-this.activeTo[i])>0;)i++;hc(this.active,i,n),hc(this.activeTo,i,r),hc(this.activeRank,i,o),e&&hc(e,i,this.cursor.from),this.minActive=Av(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&&cc(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 o=this.cursor.value;if(!o.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=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let 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 Cv(t,e,i,n,r,o){t.goto(e),i.goto(n);let a=n+r,c=n,h=n-e,d=!!o.boundChange;for(let p=!1;;){let g=t.to+h-i.to,x=g||t.endSide-i.endSide,b=x<0?t.to+h:i.to,w=Math.min(b,a);if(t.point||i.point?(t.point&&i.point&&Yg(t.point,i.point)&&Um(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(c,w,t.point,i.point),p=!1):(p&&o.boundChange(c),w>c&&!Um(t.active,i.active)&&o.compareRange(c,w,t.active,i.active),d&&w<a&&(g||t.openEnd(b)!=i.openEnd(b))&&(p=!0)),b>a)break;c=b,x<=0&&t.next(),x>=0&&i.next()}}function Um(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 cc(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function hc(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function Av(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 Fl(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 qm(t,e,i,n){for(let r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=t.charCodeAt(r)==9?i-o%i:1,r=Et(t,r)}return n===!0?-1:t.length}const Pm="ͼ",Mv=typeof Symbol>"u"?"__"+Pm:Symbol.for(Pm),Fm=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zr{constructor(e,i){this.rules=[];let{finish:n}=i||{};function r(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,c,h,d){let p=[],g=/^@(\w+)\b/.exec(a[0]),x=g&&g[1]=="keyframes";if(g&&c==null)return h.push(a[0]+";");for(let b in c){let w=c[b];if(/&/.test(b))o(b.split(/,\s*/).map(k=>a.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 ("+b+") should be a primitive value.");o(r(b),w,p,x)}else w!=null&&p.push(b.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+w+";")}(p.length||x)&&h.push((n&&!g&&!d?a.map(n):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(r(a),e[a],this.rules)}getRules(){return this.rules.join(`
47
+ `)}static newName(){let e=Tv[Mv]||1;return Tv[Mv]=e+1,Pm+e.toString(36)}static mount(e,i,n){let r=e[Fm],o=n&&n.nonce;r?o&&r.setNonce(o):r=new a5(e,o),r.mount(Array.isArray(i)?i:[i],e)}}let Ov=new Map;class a5{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let o=Ov.get(n);if(o)return e[Fm]=o;this.sheet=new r.CSSStyleSheet,Ov.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Fm]=this}mount(e,i){let n=this.sheet,r=0,o=0;for(let a=0;a<e.length;a++){let c=e[a],h=this.modules.indexOf(c);if(h<o&&h>-1&&(this.modules.splice(h,1),o--,h=-1),h==-1){if(this.modules.splice(o++,0,c),n)for(let d=0;d<c.rules.length;d++)n.insertRule(c.rules[d],r++)}else{for(;o<h;)r+=this.modules[o++].rules.length;r+=c.rules.length,o++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let a="";for(let h=0;h<this.modules.length;h++)a+=this.modules[h].getRules()+`
48
+ `;this.styleTag.textContent=a;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:"'"},ya={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},u5=typeof navigator<"u"&&/Mac/.test(navigator.platform),c5=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),ya[_t]=String.fromCharCode(_t);for(var Dp in _r)ya.hasOwnProperty(Dp)||(ya[Dp]=_r[Dp]);function h5(t){var e=u5&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||c5&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?ya:_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++)mk(t,arguments[e]);return t}function mk(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++)mk(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}let Wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Vm=typeof document<"u"?document:{documentElement:{style:{}}};const Im=/Edge\/(\d+)/.exec(Wt.userAgent),gk=/MSIE \d/.test(Wt.userAgent),Qm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wt.userAgent),_h=!!(gk||Qm||Im),Ev=!_h&&/gecko\/(\d+)/i.test(Wt.userAgent),jp=!_h&&/Chrome\/(\d+)/.exec(Wt.userAgent),f5="webkitFontSmoothing"in Vm.documentElement.style,Ym=!_h&&/Apple Computer/.test(Wt.vendor),Nv=Ym&&(/Mobile\/\w+/.test(Wt.userAgent)||Wt.maxTouchPoints>2);var se={mac:Nv||/Mac/.test(Wt.platform),windows:/Win/.test(Wt.platform),linux:/Linux|X11/.test(Wt.platform),ie:_h,ie_version:gk?Vm.documentMode||6:Qm?+Qm[1]:Im?+Im[1]:0,gecko:Ev,gecko_version:Ev?+(/Firefox\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,chrome:!!jp,chrome_version:jp?+jp[1]:0,ios:Nv,android:/Android\b/.test(Wt.userAgent),webkit_version:f5?+(/\bAppleWebKit\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,safari:Ym,safari_version:Ym?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Wt.userAgent)||[0,0])[1]:0,tabSize:Vm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Kg(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 Wg(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 o of n)if(o!=i&&(r.indexOf(o)==-1||t[o]!==e[o]))return!1;return!0}function d5(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 Rv(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 p5(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 Ba(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:o,end:a}=yk(e,i);n=(o?i?-3e8:-1:5e8)-1,r=(a?i?2e8:1:-6e8)+1}return new Ss(e,n,r,i,e.widget||null,!0)}static line(e){return new za(e)}static set(e,i=!1){return Ne.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ge.none=Ne.empty;class Ba extends ge{constructor(e){let{start:i,end:n}=yk(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Kg(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||lh}eq(e){return this==e||e instanceof Ba&&this.tagName==e.tagName&&Wg(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)}}Ba.prototype.point=!1;class za extends ge{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof za&&this.spec.class==e.spec.class&&Wg(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)}}za.prototype.mapMode=Zt.TrackBefore;za.prototype.point=!0;class Ss extends ge{constructor(e,i,n,r,o,a){super(i,n,o,e),this.block=r,this.isReplace=a,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&&m5(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 yk(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 m5(t,e){return t==e||!!(t&&e&&t.compare(e))}function wl(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 xa extends Br{constructor(e,i){super(),this.tagName=e,this.attributes=i}eq(e){return e==this||e instanceof xa&&this.tagName==e.tagName&&Wg(this.attributes,e.attributes)}static create(e){return new xa(e.tagName,e.attributes||lh)}static set(e,i=!1){return Ne.of(e,i)}}xa.prototype.startSide=xa.prototype.endSide=-1;function ba(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Gm(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function ia(t,e){if(!e.anchorNode)return!1;try{return Gm(t,e.anchorNode)}catch{return!1}}function na(t){return t.nodeType==3?Sa(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ra(t,e,i,n){return i?Dv(t,e,i,n,-1)||Dv(t,e,i,n,1):!1}function Hr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function oh(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Dv(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 o=t.parentNode;if(!o||o.nodeType!=1)return!1;e=Hr(t)+(r<0?0:1),t=o}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 va(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function g5(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 xk(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 y5(t,e,i,n,r,o,a,c){let h=t.ownerDocument,d=h.defaultView||window;for(let p=t,g=!1;p&&!g;)if(p.nodeType==1){let x,b=p==h.body,w=1,k=1;if(b)x=g5(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}=xk(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+a),i>0&&e.bottom>x.bottom+M&&(M=e.bottom-x.bottom+a)):e.bottom>x.bottom&&(M=e.bottom-x.bottom+a,i<0&&e.top-M<x.top&&(M=e.top-(x.top+a)));else{let T=e.bottom-e.top,D=x.bottom-x.top;M=(r=="center"&&T<=D?e.top+T/2-D/2:r=="start"||r=="center"&&i<0?e.top-a:e.bottom-D+a)-x.top}if(n=="nearest"?e.left<x.left?(C=e.left-(x.left+o),i>0&&e.right>x.right+C&&(C=e.right-x.right+o)):e.right>x.right&&(C=e.right-x.right+o,i<0&&e.left<x.left+C&&(C=e.left-(x.left+o))):C=(n=="center"?e.left+(e.right-e.left)/2-(x.right-x.left)/2:n=="start"==c?e.left-o:e.right-(x.right-x.left)+o)-x.left,C||M)if(b)d.scrollBy(C,M);else{let T=0,D=0;if(M){let j=p.scrollTop;p.scrollTop+=M/k,D=(p.scrollTop-j)*k}if(C){let j=p.scrollLeft;p.scrollLeft+=C/w,T=(p.scrollLeft-j)*w}e={left:e.left-T,top:e.top-D,right:e.right-T,bottom:e.bottom-D},T&&Math.abs(T-C)<1&&(n="nearest"),D&&Math.abs(D-M)<1&&(r="nearest")}if(b)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 x5(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 b5{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 bk(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++],o=e[i++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let jv;function Sa(t,e,i=e){let n=jv||(jv=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function kl(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 o=new KeyboardEvent("keydown",r);o.synthetic=!0,t.dispatchEvent(o);let a=new KeyboardEvent("keyup",r);return a.synthetic=!0,t.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function v5(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function S5(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 vk(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Sk(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&&!oh(i))n=Hr(i),i=i.parentNode;else return null}}function wk(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&&!oh(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,Xg=Ze.RTL;function kk(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const w5=kk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),k5=kk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Km=Object.create(null),an=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Km[e]=i,Km[i]=-e}function Ck(t){return t<=247?w5[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?k5[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const C5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class mn{get dir(){return this.level%2?Xg: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 o=-1;for(let a=0;a<e.length;a++){let c=e[a];if(c.from<=i&&c.to>=i){if(c.level==n)return a;(o<0||(r!=0?r<0?c.from<i:c.to>i:e[o].level>c.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function Ak(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||!Ak(n.inner,r.inner))return!1}return!0}const Xe=[];function A5(t,e,i,n,r){for(let o=0;o<=n.length;o++){let a=o?n[o-1].to:e,c=o<n.length?n[o].from:i,h=o?256:r;for(let d=a,p=h,g=h;d<c;d++){let x=Ck(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=a,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 b=d+1;for(;b<c&&Xe[b]==64;)b++;let w=d&&p==8||b<i&&Xe[b]==8?g==1?1:8:256;for(let k=d;k<b;k++)Xe[k]=w;d=b-1}else x==8&&g==1&&(Xe[d]=1);p=x,x&7&&(g=x)}}}function M5(t,e,i,n,r){let o=r==1?2:1;for(let a=0,c=0,h=0;a<=n.length;a++){let d=a?n[a-1].to:e,p=a<n.length?n[a].from:i;for(let g=d,x,b,w;g<p;g++)if(b=Km[x=t.charCodeAt(g)])if(b<0){for(let k=c-3;k>=0;k-=3)if(an[k+1]==-b){let C=an[k+2],M=C&2?r:C&4?C&1?o:r:0;M&&(Xe[g]=Xe[an[k]]=M),c=k;break}}else{if(an.length==189)break;an[c++]=g,an[c++]=x,an[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=an[C+2];if(M&2)break;if(k)an[C+2]|=2;else{if(M&4)break;an[C+2]|=4}}}}}function T5(t,e,i,n){for(let r=0,o=n;r<=i.length;r++){let a=r?i[r-1].to:t,c=r<i.length?i[r].from:e;for(let h=a;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=o==1,x=(p<e?Xe[p]:n)==1,b=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]=b;h=p}else o=d,h++}}}function Wm(t,e,i,n,r,o,a){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==o.length||h<o[d].from){let k=Xe[h];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,b=p?n:n+1,w=h;e:for(;;)if(d<o.length&&w==o[d].from){if(g)break e;let k=o[d];if(!p)for(let C=k.to,M=d+1;;){if(C==i)break e;if(M<o.length&&o[M].from==C)C=o[M++].to;else{if(Xe[C]==c)break e;break}}if(d++,x)x.push(k);else{k.from>h&&a.push(new mn(h,k.from,b));let C=k.direction==ws!=!(b%2);Xm(t,C?n+1:n,r,k.inner,k.from,k.to,a),h=k.to}w=k.to}else{if(w==i||(p?Xe[w]!=c:Xe[w]==c))break;w++}x?Wm(t,h,w,n+1,r,x,a):h<w&&a.push(new mn(h,w,b)),h=w}else for(let h=i,d=o.length;h>e;){let p=!0,g=!1;if(!d||h>o[d-1].to){let k=Xe[h-1];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,b=p?n:n+1,w=h;e:for(;;)if(d&&w==o[d-1].to){if(g)break e;let k=o[--d];if(!p)for(let C=k.from,M=d;;){if(C==e)break e;if(M&&o[M-1].to==C)C=o[--M].from;else{if(Xe[C-1]==c)break e;break}}if(x)x.push(k);else{k.to<h&&a.push(new mn(k.to,h,b));let C=k.direction==ws!=!(b%2);Xm(t,C?n+1:n,r,k.inner,k.from,k.to,a),h=k.from}w=k.from}else{if(w==e||(p?Xe[w-1]!=c:Xe[w-1]==c))break;w--}x?Wm(t,w,h,n+1,r,x,a):w<h&&a.push(new mn(w,h,b)),h=w}}function Xm(t,e,i,n,r,o,a){let c=e%2?2:1;A5(t,r,o,n,c),M5(t,r,o,n,c),T5(r,o,n,c),Wm(t,r,o,e,i,n,a)}function O5(t,e,i){if(!t)return[new mn(0,0,e==Xg?1:0)];if(e==ws&&!i.length&&!C5.test(t))return Mk(t.length);if(i.length)for(;t.length>Xe.length;)Xe[Xe.length]=256;let n=[],r=e==ws?0:1;return Xm(t,r,r,i,0,t.length,n),n}function Mk(t){return[new mn(0,t,0)]}let Tk="";function E5(t,e,i,n,r){var o;let a=n.head-t.from,c=mn.find(e,a,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),h=e[c],d=h.side(r,i);if(a==d){let x=c+=r?1:-1;if(x<0||x>=e.length)return null;h=e[c=x],a=h.side(!r,i),d=h.side(r,i)}let p=Et(t.text,a,h.forward(r,i));(p<h.from||p>h.to)&&(p=d),Tk=t.text.slice(Math.min(a,p),Math.max(a,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 N5(t,e,i){for(let n=e;n<i;n++){let r=Ck(t.charCodeAt(n));if(r==1)return ws;if(r==2||r==4)return Xg}return ws}const Ok=le.define(),Ek=le.define(),Nk=le.define(),Rk=le.define(),Zm=le.define(),Dk=le.define(),jk=le.define(),Zg=le.define(),Jg=le.define(),Lk=le.define({combine:t=>t.some(e=>e)}),Bk=le.define({combine:t=>t.some(e=>e)}),zk=le.define();class Cl{constructor(e,i="nearest",n="nearest",r=5,o=5,a=!1){this.range=e,this.y=i,this.x=n,this.yMargin=r,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new Cl(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 Cl(W.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const fc=Se.define({map:(t,e)=>t.map(e)}),_k=Se.define();function ci(t,e,i){let n=t.facet(Rk);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 R5=0;const gl=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 at{constructor(e,i,n,r,o){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(gl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(gl.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:r,provide:o,decorations:a}=i||{};return new at(R5++,e,n,r,c=>{let h=[];return a&&h.push(Hh.of(d=>{let p=d.plugin(c);return p?a(p):ge.none})),o&&h.push(o(c)),h})}static fromClass(e,i){return at.define((n,r)=>new e(n,r),i)}}class Lp{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 Hk=le.define(),$g=le.define(),Hh=le.define(),Uk=le.define(),e0=le.define(),_a=le.define(),qk=le.define();function Lv(t,e){let i=t.state.facet(qk);if(!i.length)return i;let n=i.map(o=>o instanceof Function?o(t):o),r=[];return Ne.spans(n,e.from,e.to,{point(){},span(o,a,c,h){let d=o-e.from,p=a-e.from,g=r;for(let x=c.length-1;x>=0;x--,h--){let b=c[x].spec.bidiIsolate,w;if(b==null&&(b=N5(e.text,d,p)),h>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==b)w.to=p,g=w.inner;else{let k={from:d,to:p,direction:b,inner:[]};g.push(k),g=k.inner}}}}),r}const Pk=le.define();function t0(t){let e=0,i=0,n=0,r=0;for(let o of t.state.facet(Pk)){let a=o(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(i=Math.max(i,a.right)),a.top!=null&&(n=Math.max(n,a.top)),a.bottom!=null&&(r=Math.max(r,a.bottom)))}return{left:e,right:i,top:n,bottom:r}}const Xo=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,o=0,a=0;;){let c=r<e.length?e[r].fromB:1e9,h=o<i.length?i[o]:1e9,d=Math.min(c,h);if(d==1e9)break;let p=d+a,g=d,x=p;for(;;)if(o<i.length&&i[o]<=g){let b=i[o+1];o+=2,g=Math.max(g,b);for(let w=r;w<e.length&&e[w].fromB<=g;w++)a=e[w].toA-e[w].toB;x=Math.max(x,b+a)}else if(r<e.length&&e[r].fromB<=g){let b=e[r++];g=Math.max(g,b.toB),x=Math.max(x,b.toA),a=b.toA-b.toB}else break;n.push(new qi(p,x,d,g))}return n}}class ah{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 o of n)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,a,c,h)=>r.push(new qi(o,a,c,h))),this.changedRanges=r}static create(e,i,n){return new ah(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 D5=[];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 D5}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&&d5(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 qh)return e;return null}static get(e){return e.cmTile}}class Uh 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,o=e?.node==i?e:null,a=0;for(let c of this.children){if(c.sync(e),a+=c.length+c.breakAfter,r=n?n.nextSibling:i.firstChild,o&&r!=c.dom&&(o.written=!0),c.dom.parentNode==i)for(;r&&r!=c.dom;)r=Bv(r);else i.insertBefore(c.dom,r);n=c.dom}for(r=n?n.nextSibling:i.firstChild,o&&r&&(o.written=!0);r;)r=Bv(r);this.length=a}}function Bv(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class qh extends Uh{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,o=0;;)if(r==n.children.length){if(!i.length)return;n=n.parent,n.breakAfter&&o++,r=i.pop()}else{let a=n.children[r++];if(a instanceof Qn)i.push(r),n=a,r=0;else{let c=o+a.length,h=e(a,o);if(h!==void 0)return h;o=c+a.breakAfter}}}resolveBlock(e,i){let n,r=-1,o,a=-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)))&&(!o||!c.isWidget()&&o.isWidget())&&(o=c,a=e-h)}}),!n&&!o)throw new Error("No tile at position "+e);return n&&i<0||!o?{tile:n,offset:r}:{tile:o,offset:a}}}class Qn extends Uh{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 Dl extends Uh{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,n){let r=new Dl(i||document.createElement("div"),e);return(!i||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,i,n){let r=null,o=-1,a=null,c=-1;function h(p,g){for(let x=0,b=0;x<p.children.length&&b<=g;x++){let w=p.children[x],k=b+w.length;k>=g&&(w.isComposite()?h(w,g-b):(!a||a.isHidden&&(i>0||n&&L5(a,w)))&&(k>g||w.flags&32)?(a=w,c=g-b):(b<g||w.flags&16&&!w.isHidden)&&(r=w,o=g-b)),b=k}}h(this,e);let d=(i<0?r:a)||r||a;return d?{tile:d,offset:d==r?o:c}:null}coordsIn(e,i){let n=this.resolveInline(e,i,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),i):j5(this)}domIn(e,i){let n=this.resolveInline(e,i);if(n){let{tile:r,offset:o}=n;if(this.dom.contains(r.dom))return r.isText()?new Xi(r.dom,Math.min(r.dom.nodeValue.length,o)):r.domPosFor(o,r.flags&16?1:r.flags&32?-1:i);let a=n.tile.parent,c=!1;for(let h of a.children){if(c)return new Xi(h.dom,0);h==n.tile&&(c=!0)}}return new Xi(this.dom,0)}}function j5(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=na(e);return i[i.length-1]||null}function L5(t,e){let i=t.coordsIn(0,1),n=e.coordsIn(0,1);return i&&n&&n.top<i.bottom}class ai extends Uh{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let n=new ai(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,o=e,a=0;e==0&&i<0||e==n&&i>=0?se.chrome||se.gecko||(e?(r--,a=1):o<n&&(o++,a=-1)):i<0?r--:o<n&&o++;let c=Sa(this.dom,r,o).getClientRects();if(!c.length)return null;let h=c[(a?a<0:i>=0)?0:c.length-1];return se.safari&&!a&&h.width==0&&(h=Array.prototype.find.call(c,d=>d.width)||h),a?va(h,a<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 va(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=c?o.length-1:0;a=o[h],!(e>0?h==0:h==o.length-1||a.top<a.bottom);h+=c?-1:1);return va(a,!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,o){return o||(o=e.toDOM(i),e.editable||(o.contentEditable="false")),new ks(o,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 B5{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,n){let{tile:r,index:o,beforeBreak:a,parents:c}=this;for(;e||i>0;)if(r.isComposite())if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(o==r.children.length){if(!e&&!c.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:o}=c.pop(),o++}else{let h=r.children[o],d=h.breakAfter;(i>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(a=!!d,o++,e-=h.length):(c.push({tile:r,index:o}),r=h,o=0,n&&h.isComposite()&&n.enter(h))}else if(o==r.length)a=!!r.breakAfter,{tile:r,index:o}=c.pop(),o++;else if(e){let h=Math.min(e,r.length-o);n&&n.skip(r,o,o+h),e-=h,o+=h}else break;return this.tile=r,this.index=o,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class z5{constructor(e,i,n,r){this.from=e,this.to=i,this.wrapper=n,this.rank=r}}class _5{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 o;this.flushBuffer();let a=this.ensureMarks(i,n),c=a.lastChild;if(c&&c.isText()&&!(c.flags&8)&&c.length+e.length<512){this.cache.reused.set(c,2);let h=a.children[a.children.length-1]=new ps(c.dom,c.text+e);h.parent=a}else a.append(r||ps.of(e,(o=this.cache.find(ps))===null||o===void 0?void 0:o.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)?Bp(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 ai&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(Bp(h.dom)),r=d;else{if(this.cache.reused.get(h)){let g=vt.get(h.dom);g&&g.setDOM(Bp(h.dom))}let p=ai.of(h.mark,h.dom);r.append(p),r=p}this.cache.reused.set(h,2)}let o=vt.get(e.text);o&&this.cache.reused.set(o,2);let a=new ps(e.text,e.text.nodeValue);a.flags|=8,r.append(a)}addInlineWidget(e,i,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let o=this.ensureMarks(i,n);!r&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.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=Fk);let r=Dl.start(e,i||((n=this.cache.find(Dl))===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 o=e.length-1;o>=0;o--){let a=e[o],c;if(i>0&&(c=r.lastChild)&&c instanceof ai&&c.mark.eq(a))r=c,i--;else{let h=ai.of(a,(n=this.cache.find(ai,d=>d.mark.eq(a)))===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||!zv(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(se.ios&&zv(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(zp,0,32)||new ks(zp.toDOM(),0,zp,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 z5(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 o=Qn.of(n.wrapper,(e=this.cache.find(Qn,a=>a.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);i.append(o),i=o}}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 H5{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:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=r;let c=this.textOff=Math.min(e,r.length);return o?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,Dl,ps,ai,uh,Qn,qh];for(let t=0;t<ch.length;t++)ch[t].bucket=t;class U5{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,o=this.buckets[r],a=this.index[r];for(let c=o.length-1;c>=0;c--){let h=(c+a)%o.length,d=o[h];if((!i||i(d))&&!this.reused.has(d))return o.splice(h,1),h<a&&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 o=0,a=0;;o++){if(o==r.length){if(a)return null;a=1,o=0}let c=r[o];if(!this.reused.has(c)&&(a==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return r.splice(o,1),o<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 q5{constructor(e,i,n,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new U5(e),this.text=new H5(e.state.doc),this.builder=new _5(this.cache,new qh(e,e.contentDOM),Ne.iter(n)),this.cache.reused.set(i,2),this.old=new B5(i),this.reuseWalker={skip:(a,c,h)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,i){let n=i&&this.getCompositionContext(i.text);for(let r=0,o=0,a=0;;){let c=a<e.length?e[a++]:null,h=c?c.fromA:this.old.root.length;if(h>r){let d=h-r;this.preserve(d,!a,!c),r=h,o+=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(o,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(o,c.toB)),o=c.toB,r=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,n){let r=V5(this.old),o=this.openMarks;this.old.advance(e,n?1:-1,{skip:(a,c,h)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(h-c);else{let d=h>0||c<a.length?ks.of(a.widget,this.view,h-c,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,o),o=r.length)}else if(a.isText())this.builder.ensureLine(null),!c&&h==a.length?this.builder.addText(a.text,r,o,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(c,h),r,o)),o=r.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof uh)this.cache.add(a);else if(a instanceof ai)this.builder.ensureLine(null),this.builder.addMark(a,r,o),this.cache.reused.set(a,1),o=r.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof ai&&r.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?r.length&&(r.length=o=0):a instanceof ai&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let n=null,r=this.builder,o=0,a=Ne.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(o=p.length,g>p.length)r.continueWidget(h-c);else{let b=d.widget||(d.block?jl.block:jl.inline),w=P5(d),k=this.cache.findWidget(b,h-c,w)||ks.of(b,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=F5(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=a>o,this.openMarks=a}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 o=vt.get(r);if(r==this.view.contentDOM)break;o instanceof ai?i.push(o):o?.isLine()?n=o:o instanceof Qn||(r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new Dl(r,Fk):n||i.push(ai.of(new Ba({tagName:r.nodeName.toLowerCase(),attributes:p5(r)}),r)))}return{line:n,marks:i}}}function zv(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 P5(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 Fk={class:"cm-line"};function F5(t,e){let i=e.spec.attributes,n=e.spec.class;return!i&&!n||(t||(t={class:"cm-line"}),i&&Kg(i,t),n&&(t.class+=" "+n)),t}function V5(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 ai&&e.push(n.mark)}return e}function Bp(t){let e=vt.get(t);return e&&e.setDOM(t.cloneNode()),t}class jl 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}}jl.inline=new jl("span");jl.block=new jl("div");const zp=new class extends kn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class _v{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 qh(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:!J5(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?Q5(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=o?{from:o.range.fromB,to:o.range.toB}:null,(se.ie||se.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,c=this.blockWrappers;this.updateDeco();let h=K5(a,this.decorations,e.changes);h.length&&(n=qi.extendWithRanges(n,h));let d=X5(c,this.blockWrappers,e.changes);return d.length&&(n=qi.extendWithRanges(n,d)),o&&!n.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(n=o.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(i||e.length){let a=this.tile,c=new q5(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,i),Jm(a,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 o=se.chrome||se.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||n.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof _p&&r.push(o.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(_k)&&(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,o=r==n,a=!o&&!(this.view.state.facet(In)||n.tabIndex>-1)&&ia(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(o||i||a))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&&I5(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||(!ra(d.node,d.offset,g.anchorNode,g.anchorOffset)||!ra(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,h))&&(this.view.observer.ignore(()=>{se.android&&se.chrome&&n.contains(g.focusNode)&&Z5(g.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let x=ba(this.view.root);if(x)if(h.empty){if(se.gecko){let b=Y5(d.node,d.offset);if(b&&b!=3){let w=(b==1?Sk:wk)(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 b=document.createRange();h.anchor>h.head&&([d,p]=[p,d]),b.setEnd(p.node,p.offset),b.setStart(d.node,d.offset),x.removeAllRanges(),x.addRange(b)}a&&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&&ra(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=ba(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let a=this.lineAt(i.head,i.assoc);if(!a)return;let c=a.posAtStart;if(i.head==c||i.head==c+a.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,o)}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 o;if(e==n.dom)o=n.dom.childNodes[i];else{let a=Wn(e)==0?0:i==0?-1:1;for(;;){let c=e.parentNode;if(c==n.dom)break;a==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?a=-1:a=1),e=c}a<0?o=e:o=e.nextSibling}if(o==n.dom.firstChild)return r;for(;o&&!vt.get(o);)o=o.nextSibling;if(!o)return r+n.length;for(let a=0,c=r;;a++){let h=n.children[a];if(h.dom==o)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,o=!1,a,c=-1,h=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let g=p+d.length;if(p<=e&&(n=d,r=e-p,o=g<e),g>=e&&!a&&(a=d,c=e-p,h=p>e),p>e&&a)return!0}}),!n&&!a?this.domAtPos(e,i):(o&&a?n=null:h&&n&&(a=null),n&&i<0||!a?n.domIn(r,i):a.domIn(c,i))}coordsAt(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.widget instanceof _p?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(o,a){if(o.isComposite())for(let c of o.children){if(c.length>=a){let h=r(c,a);if(h)return h}if(a-=c.length,a<0)break}else if(o.isText()&&a<o.length){let c=Et(o.text,a);if(c==a)return null;let h=Sa(o.dom,a,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,o=this.view.contentDOM.clientWidth,a=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==Ze.LTR,d=0,p=(g,x,b)=>{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(b&&!w&&(d+=M.top-b.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,a)){let D=k.dom.lastChild,j=D?na(D):[];if(j.length){let B=j[j.length-1],P=h?B.right-M.left:M.right-B.left;P>c&&(c=P,this.minWidth=o,this.minWidthFrom=x,this.minWidthTo=C)}}b&&w==g.children.length-1&&(d+=b.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(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let c=0,h;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=na(d.dom);if(p.length!=1)return;c+=p[0].width,h=p[0].height}if(c)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:c/a.length,textHeight:h}}});if(e)return e;let i=document.createElement("div"),n,r,o;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 a=na(i.firstChild)[0];n=i.getBoundingClientRect().height,r=a&&a.width?a.width/27:7,o=a&&a.height?a.height:n,i.remove()}),{lineHeight:n,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,r=0;;r++){let o=r==i.viewports.length?null:i.viewports[r],a=o?o.from-1:this.view.state.doc.length;if(a>n){let c=(i.lineBlockAt(a).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(ge.replace({widget:new _p(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!o)break;n=o.to+1}return ge.set(e)}updateDeco(){let e=1,i=this.view.state.facet(Hh).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,r=this.view.state.facet(e0).map((o,a)=>{let c=typeof o=="function";return c&&(n=!0),c?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[e++]=n,i.push(Ne.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(Uk).map(o=>typeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(zk))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 o=t0(this.view),a={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:c,offsetHeight:h}=this.view.scrollDOM;if(y5(this.view.scrollDOM,a,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(){Jm(this.tile)}}function Jm(t,e){let i=e?.get(t);if(i!=1){i==null&&t.destroy();for(let n of t.children)Jm(n,e)}}function I5(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 Vk(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=Sk(i.focusNode,i.focusOffset),r=wk(i.focusNode,i.focusOffset),o=n||r;if(r&&n&&r.node!=n.node){let c=vt.get(r.node);if(!c||c.isText()&&c.text!=r.node.nodeValue)o=r;else if(t.docView.lastCompositionAfterCursor){let h=vt.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(o=r)}}if(t.docView.lastCompositionAfterCursor=o!=n,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function Q5(t,e,i){let n=Vk(t,i);if(!n)return null;let{node:r,from:o,to:a}=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(o),h.mapPos(a),o,a),text:r}}function Y5(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 G5=class{constructor(){this.changes=[]}compareRange(e,i){wl(e,i,this.changes)}comparePoint(e,i){wl(e,i,this.changes)}boundChange(e){wl(e,e,this.changes)}};function K5(t,e,i){let n=new G5;return Ne.compare(t,e,i,n),n.changes}class W5{constructor(){this.changes=[]}compareRange(e,i){wl(e,i,this.changes)}comparePoint(){}boundChange(e){wl(e,e,this.changes)}}function X5(t,e,i){let n=new W5;return Ne.compare(t,e,i,n),n.changes}function Z5(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 J5(t,e){let i=!1;return e&&t.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(i=!0)}),i}class _p 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 $5(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(r.length==0)return W.cursor(e);o==0?i=1:o==r.length&&(i=-1);let a=o,c=o;i<0?a=Et(r.text,o,!1):c=Et(r.text,o);let h=n(r.text.slice(a,c));for(;a>0;){let d=Et(r.text,a,!1);if(n(r.text.slice(d,a))!=h)break;a=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(a+r.from,c+r.from)}function ej(t,e,i,n,r){let o=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);o+=h*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(i.from,i.to);return i.from+qm(a,o,t.state.tabSize)}function $m(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!r||o.type==Ut.Text&&(r.type!=o.type||(i<0?o.from<e:o.to>e)))&&(r=o)}}return r||n}return n}function tj(t,e,i,n){let r=$m(t,e.head,e.assoc||-1),o=!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(o){let a=t.dom.getBoundingClientRect(),c=t.textDirectionAt(r.from),h=t.posAtCoords({x:i==(c==Ze.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(h!=null)return W.cursor(h,i?-1:1)}return W.cursor(i?r.to:r.from,i?-1:1)}function Hv(t,e,i,n){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),a=t.textDirectionAt(r.from);for(let c=e,h=null;;){let d=E5(r,o,a,c,i),p=Tk;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)),o=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 ij(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return o=>{let a=n(o);return r==nt.Space&&(r=a),r==a}}function nj(t,e,i,n){let r=e.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return W.cursor(r,e.assoc);let a=e.goalColumn,c,h=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(r,(e.empty?e.assoc:0)||(i?1:-1)),p=t.documentTop;if(d)a==null&&(a=d.left-h.left),c=o<0?d.top:d.bottom;else{let w=t.viewState.lineBlockAt(r);a==null&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-w.from))),c=(o<0?w.top:w.bottom)+p}let g=h.left+a,x=n??t.viewState.heightOracle.textHeight>>1,b=eg(t,{x:g,y:c+x*o},!1,o);return W.cursor(b.pos,b.assoc,void 0,a)}function sa(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(o,a,c)=>{if(e>o&&e<a){let h=n||i||(e-o<a-e?-1:1);e=h<0?o:a,n=h}});if(!n)return e}}function Ik(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],o=null;if(r.empty){let a=sa(t,r.from,0);a!=r.from&&(o=W.cursor(a,-1))}else{let a=sa(t,r.from,-1),c=sa(t,r.to,1);(a!=r.from||c!=r.to)&&(o=W.range(r.from==r.anchor?a:c,r.from==r.head?a:c))}o&&(i||(i=e.ranges.slice()),i[n]=o)}return i?W.create(i,e.mainIndex):e}function Hp(t,e,i){let n=sa(t.state.facet(_a).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 eg(t,e,i,n){let r=t.contentDOM.getBoundingClientRect(),o=r.top+t.viewState.paddingTop,{x:a,y:c}=e,h=c-o,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+o:x.bottom>=h+o))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=ej(t,r,d,a,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 rj(t,a,c,t.textDirectionAt(d.from)).scanTile(p,d.from)}class rj{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,o=new Set,a=this.bidiIn(e[0],e[r]),c,h,d=-1,p=1e9,g;e:for(;n<r;){let b=r-n,w=n+r>>1;t:if(o.has(w)){let C=n+Math.floor(Math.random()*b);for(let M=0;M<b;M++){if(!o.has(C)){w=C;break t}C++,C==r&&(C=n)}break e}o.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 D=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,j=Math.abs(D);j<p&&(d=w,p=j,g=M),D&&(T=D<0==(this.baseDir==Ze.LTR)?-1:1)}T==-1&&(!a||this.baseDirAt(e[w],1))?r=w:T==1&&(!a||this.baseDirAt(e[w+1],-1))&&(n=w+1)}}if(!g){let b=c&&(!h||this.y-c.bottom<h.top-this.y)?c:h;return this.y=(b.top+b.bottom)/2,this.scan(e,i)}let x=(a?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 o=0;o<e.length;o=Et(e.text,o))n.push(i+o);n.push(i+e.length);let r=this.scan(n,o=>{let a=n[o]-i,c=n[o+1]-i;return Sa(e.dom,a,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:Sa(h.dom,0,h.length)).getClientRects()}),o=e.children[r.i],a=n[r.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):r.after?new pn(n[r.i+1],-1):new pn(a,1)}}const Zo="￿";class sj{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+=Zo}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let o=this.text.length;this.readNode(r);let a=vt.get(r),c=r.nextSibling;if(c==i){a?.breakAfter&&!c&&n!=this.view.contentDOM&&this.lineBreak();break}let h=vt.get(c);(a&&h?a.breakAfter:(a?a.breakAfter:oh(r))||oh(c)&&(r.nodeName!="BR"||a?.isWidget())&&this.text.length>o)&&!oj(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 o=-1,a=1,c;if(this.lineSeparator?(o=i.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(c=r.exec(i))&&(o=c.index,a=c[0].length),this.append(i.slice(n,o<0?i.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=a-1);n=o+a}}readNode(e){let 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+(lj(e,n.node,n.offset)?i:0))}}function lj(t,e,i){for(;;){if(!e||i<Wn(e))return!1;if(e==t)return!0;i=Hr(e)+1,e=e.parentNode}}function oj(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 Uv{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:o,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=Qk(e.docView.tile,i,n,0))){let c=o||a?[]:cj(e),h=new sj(c,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=hj(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=o&&o.node==c.focusNode&&o.offset==c.focusOffset||!Gm(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!Gm(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),b=p.from-g,w=p.to-x;(b==0||b==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 Qk(t,e,i,n){if(t.isComposite()){let r=-1,o=-1,a=-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 Qk(g,e,i,d);if(x>=e&&r==-1&&(r=h,o=d),d>i&&g.dom.parentNode==t.dom){a=h,c=p;break}p=x,d=x+g.breakAfter}return{from:o,to:c<0?n+t.length:c,startDOM:(r?t.children[r-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:a<t.children.length&&a>=0?t.children[a].dom:null}}else return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Yk(t,e){let i,{newSel:n}=e,r=t.state.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:c}=e.bounds,h=r.from,d=null;(o===8||se.android&&e.text.length<c-a)&&(h=r.to,d="end");let p=Gk(t.state.doc.sliceString(a,c,Zo),e.text,h-a,d);p&&(se.chrome&&o==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==Zo+Zo&&p.toB--,i={from:a+p.from,to:a+p.toA,insert:Ue.of(e.text.slice(p.from,p.toB).split(Zo))})}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 i0(t,i,n,o);if(n&&!hh(n,r)){let a=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=Ik(t.state.facet(_a).map(h=>h(t)),n))),t.dispatch({selection:n,scrollIntoView:a,userEvent:c}),!0}else return!1}function i0(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&&kl(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)&&kl(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&kl(t.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,c=()=>a||(a=uj(t,e,i));return t.state.facet(Dk).some(h=>h(t,e.from,e.to,o,c))||t.dispatch(c()),!0}function uj(t,e,i){let n,r=t.state,o=r.selection.main,a=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let h=e.from<o.from?-1:1,d=h<0?o.from:o.to,p=sa(r.facet(_a).map(g=>g(t)),d,h);e.from==p&&(a=p)}if(a>-1)n={changes:e,selection:W.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let h=o.from<e.from?r.sliceDoc(o.from,e.from):"",d=o.to>e.to?r.sliceDoc(e.to,o.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<=o.to+10&&e.to>=o.to-10){let p=t.state.sliceDoc(e.from,e.to),g,x=i&&Vk(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(o.head);let b=o.to-e.to;n=r.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:h,range:d||w.map(h)};let k=w.to-b,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-o.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 Gk(t,e,i,n){let r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;let a=t.length,c=e.length;for(;a>0&&c>0&&t.charCodeAt(a-1)==e.charCodeAt(c-1);)a--,c--;if(n=="end"){let h=Math.max(0,o-Math.min(a,c));i-=a+h-o}if(a<o&&t.length<e.length){let h=i<=o&&i>=a?o-i:0;o-=h,c=o+(c-a),a=o}else if(c<o){let h=i<=o&&i>=c?o-i:0;o-=h,a=o+(a-c),c=o}return{from:o,toA:a,toB:c}}function cj(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}=t.observer.selectionRange;return i&&(e.push(new Uv(i,n)),(r!=i||o!=n)&&e.push(new Uv(r,o))),e}function hj(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 fj{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&&Tj(e.contentDOM.ownerDocument)}handleEvent(e){!vj(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=dj(e),n=this.handlers,r=this.view.contentDOM;for(let o in i)if(o!="scroll"){let a=!i[o].handlers.length,c=n[o];c&&a!=!c.handlers.length&&(r.removeEventListener(o,this.handleEvent),c=null),c||r.addEventListener(o,this.handleEvent,{passive:a})}for(let o in n)o!="scroll"&&!i[o]&&r.removeEventListener(o,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&&Wk.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=Kk.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||pj.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,kl(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 qv(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(r){ci(i.state,r)}}}function dj(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,o=r&&r.plugin.domEventHandlers,a=r&&r.plugin.domEventObservers;if(o)for(let c in o){let h=o[c];h&&i(c).handlers.push(qv(n.value,h))}if(a)for(let c in a){let h=a[c];h&&i(c).observers.push(qv(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 Kk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],pj="dthko",Wk=[16,17,18,20,91,92,224,225],dc=6;function pc(t){return Math.max(0,t)*.7+8}function mj(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class gj{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=x5(e.contentDOM),this.atoms=e.state.facet(_a).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(Be.allowMultipleSelections)&&yj(e,i),this.dragging=bj(e,i)&&Jk(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&&mj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=0,o=0,a=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:c}=this.scrollParents.y.getBoundingClientRect());let h=t0(this.view);e.clientX-h.left<=r+dc?i=-pc(r-e.clientX):e.clientX+h.right>=a-dc&&(i=pc(e.clientX-a)),e.clientY-h.top<=o+dc?n=-pc(o-e.clientY):e.clientY+h.bottom>=c-dc&&(n=pc(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=Ik(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 yj(t,e){let i=t.state.facet(Ok);return i.length?i[0](e):se.mac?e.metaKey:e.ctrlKey}function xj(t,e){let i=t.state.facet(Ek);return i.length?i[0](e):se.mac?!e.altKey:!e.ctrlKey}function bj(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ba(t.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let a=r[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function vj(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),Xk=se.ie&&se.ie_version<15||se.ios&&se.webkit_version<604;function Sj(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(),Zk(t,i.value)},50)}function Ph(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function Zk(t,e){e=Ph(t.state,Zg,e);let{state:i}=t,n,r=1,o=i.toText(e),a=o.lines==i.selection.ranges.length;if(tg!=null&&i.selection.ranges.every(h=>h.empty)&&tg==o.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((a?o.line(r++).text:e)+i.lineBreak);return{changes:{from:p.from,insert:g},range:W.cursor(d.from+g.length)}})}else a?n=i.changeByRange(h=>{let d=o.line(r++);return{changes:{from:h.from,to:h.to,insert:d.text},range:W.cursor(h.from+d.length)}}):n=i.replaceSelection(o);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(Nk))if(i=n(t,e),i)break;if(!i&&e.button==0&&(i=kj(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new gj(t,e,i,n)),n&&t.observer.ignore(()=>{bk(t.contentDOM);let o=t.root.activeElement;o&&!o.contains(t.contentDOM)&&o.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Pv(t,e,i,n){if(n==1)return W.cursor(e,i);if(n==2)return $5(t.state,e,i);{let r=t.docView.lineAt(e,i),o=t.state.doc.lineAt(r?r.posAtEnd:e),a=r?r.posAtStart:o.from,c=r?r.posAtEnd:o.to;return c<t.state.doc.length&&c==o.to&&c++,W.range(a,c)}}const wj=se.ie&&se.ie_version<=11;let Fv=null,Vv=0,Iv=0;function Jk(t){if(!wj)return t.detail;let e=Fv,i=Iv;return Fv=t,Iv=Date.now(),Vv=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Vv+1)%3:1}function kj(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=Jk(e),r=t.state.selection;return{update(o){o.docChanged&&(i.pos=o.changes.mapPos(i.pos),r=r.map(o.changes))},get(o,a,c){let h=t.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=Pv(t,h.pos,h.assoc,n);if(i.pos!=h.pos&&!a){let g=Pv(t,i.pos,i.assoc,n),x=Math.min(g.from,p.from),b=Math.max(g.to,p.to);p=x<p.from?W.range(x,b):W.range(b,x)}return a?r.replaceRange(r.main.extend(p.from,p.to)):c&&n==1&&r.ranges.length>1&&(d=Cj(r,h.pos))?d:c?r.addRange(p):W.create([p])}}}function Cj(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 o=r.posAtStart,a=o+r.length;(o>=i.to||a<=i.from)&&(i=W.range(o,a))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Ph(t.state,Jg,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};$i.dragend=t=>(t.inputState.draggedContent=null,!1);function Qv(t,e,i,n){if(i=Ph(t.state,Zg,i),!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,a=n&&o&&xj(t,e)?{from:o.from,to:o.to}:null,c={from:r,insert:i},h=t.state.changes(a?[a,c]:c);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:a?"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,o=()=>{++r==i.length&&Qv(t,e,n.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<i.length;a++){let c=new FileReader;c.onerror=o,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[a]=c.result),o()},c.readAsText(i[a])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Qv(t,e,n,!0),!0}return!1};$i.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Xk?null:e.clipboardData;return i?(Zk(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(Sj(t),!1)};function Aj(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 Mj(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:o}of t.selection.ranges){let a=t.doc.lineAt(o);a.number>r&&(e.push(a.text),i.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),r=a.number}n=!0}return{text:Ph(t,Jg,e.join(t.lineBreak)),ranges:i,linewise:n}}let tg=null;$i.copy=$i.cut=(t,e)=>{if(!ia(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:r}=Mj(t.state);if(!i&&!r)return!1;tg=r?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Xk?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(Aj(t,i),!1)};const $k=Sn.define();function eC(t,e){let i=[];for(let n of t.facet(jk)){let r=n(t,e);r&&i.push(r)}return i.length?t.update({effects:i,annotations:$k.of(!0)}):null}function tC(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=eC(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),tC(t)};Ii.blur=t=>{t.observer.clearSelectionRange(),tC(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 o=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let c=a[0],h=t.posAtDOM(c.startContainer,c.startOffset),d=t.posAtDOM(c.endContainer,c.endOffset);return i0(t,{from:h,to:d,insert:t.state.toText(o)},null),!0}}let r;if(se.chrome&&se.android&&(r=Kk.find(o=>o.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&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 Tj(t){Yv.has(t)||(Yv.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Gv=["pre-wrap","normal","pre-line","break-spaces"];let Ll=!1;function Kv(){Ll=!1}class Oj{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 Gv.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,o,a){let c=Gv.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=o,h){this.heightSamples={};for(let d=0;d<a.length;d++){let p=a[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return h}}class Ej{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,o){this.from=e,this.length=i,this.top=n,this.height=r,this._content=o}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 Hc=.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)>Hc&&(Ll=!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 o=this,a=n.doc;for(let c=r.length-1;c>=0;c--){let{fromA:h,toA:d,fromB:p,toB:g}=r[c],x=o.lineAt(h,Je.ByPosNoHeight,n.setDoc(i),0,0),b=x.to>=d?x:o.lineAt(d,Je.ByPosNoHeight,n,0,0);for(g+=b.to-d,d=b.to;c>0&&x.from<=r[c-1].toA;)h=r[c-1].fromA,p=r[c-1].fromB,c--,h<x.from&&(x=o.lineAt(h,Je.ByPosNoHeight,n,0,0));p+=x.from-h,h=x.from;let w=n0.build(n.setDoc(a),e,p,g);o=fh(o,o.replace(h,d,w))}return o.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,o=0;for(;;)if(i==n)if(r>o*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(o>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,o-=c.size}else break;else if(r<o){let c=e[i++];c&&(r+=c.size)}else{let c=e[--n];c&&(o+=c.size)}let a=0;return e[i-1]==null?(a=1,i--):e[i]==null&&(a=1,n++),new Rj(Jt.of(e.slice(0,i)),a,Jt.of(e.slice(n)))}}function fh(t,e){return t==e?t:(t.constructor!=e.constructor&&(Ll=!0),e)}Jt.prototype.size=1;const Nj=ge.replace({});class iC 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,Nj):this.mainBlock(n,r)}lineAt(e,i,n,r,o){let a=this.mainBlock(r,o);return this.spaceAbove?this.blockAt(0,n,r,o).join(a):a}forEachLine(e,i,n,r,o,a){e<=o+this.length&&i>=o&&a(this.lineAt(0,Je.ByPos,n,r,o))}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 iC{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,o=r-n+1,a,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*o);a=h/o,this.length>o+1&&(c=(this.height-h)/(this.length-o-1))}else a=this.height/o;return{firstLine:n,lastLine:r,perLine:a,perChar:c}}blockAt(e,i,n,r){let{firstLine:o,lastLine:a,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(a-o,Math.floor((e-n)/c))),{from:p,length:g}=i.doc.line(o+d);return new Wi(p,g,n+c*d,c,0)}}lineAt(e,i,n,r,o){if(i==Je.ByHeight)return this.blockAt(e,n,r,o);if(i==Je.ByPosNoHeight){let{from:b,to:w}=n.doc.lineAt(e);return new Wi(b,w-b,0,0,0)}let{firstLine:a,perLine:c,perChar:h}=this.heightMetrics(n,o),d=n.doc.lineAt(e),p=c+d.length*h,g=d.number-a,x=r+c*g+h*(d.from-o-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,o,a){e=Math.max(e,o),i=Math.min(i,o+this.length);let{firstLine:c,perLine:h,perChar:d}=this.heightMetrics(n,o);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-o-w)}let b=h+d*x.length;a(new Wi(x.from,x.length,g,b,0)),g+=b,p=x.to+1}}replace(e,i,n){let r=this.length-i;if(r>0){let o=n[n.length-1];o instanceof zt?n[n.length-1]=new zt(o.length+r):n.push(null,new zt(r-1))}if(e>0){let o=n[0];o instanceof zt?n[0]=new zt(e+o.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 o=i+this.length;if(r&&r.from<=i+this.length&&r.more){let a=[],c=Math.max(i,r.from),h=-1;for(r.from>i&&a.push(new zt(r.from-i-1).updateHeight(e,i));c<=o&&r.more;){let p=e.doc.lineAt(c).length;a.length&&a.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)>=Hc&&(h=-2);let b=new Ai(p,g,x);b.outdated=!1,a.push(b),c+=p+1}c<=o&&a.push(null,new zt(o-c).updateHeight(e,c));let d=Jt.of(a);return(h<0||Math.abs(d.height-this.height)>=Hc||Math.abs(h-this.heightMetrics(e,i).perLine)>=Hc)&&(Ll=!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 Rj 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 o=n+this.left.height;return e<o?this.left.blockAt(e,i,n,r):this.right.blockAt(e,i,o,r+this.left.length+this.break)}lineAt(e,i,n,r,o){let a=r+this.left.height,c=o+this.left.length+this.break,h=i==Je.ByHeight?e<a:e<c,d=h?this.left.lineAt(e,i,n,r,o):this.right.lineAt(e,i,n,a,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,a,c)):this.left.lineAt(c,p,n,r,o).join(d)}forEachLine(e,i,n,r,o,a){let c=r+this.left.height,h=o+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,i,n,r,o,a),i>=h&&this.right.forEachLine(e,i,n,c,h,a);else{let d=this.lineAt(h,Je.ByPos,n,r,o);e<d.from&&this.left.forEachLine(e,d.from-1,n,r,o,a),d.to>=e&&d.from<=i&&a(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,c,h,a)}}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 o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let c of n)o.push(c);if(e>0&&Wv(o,a-1),i<this.length){let c=o.length;this.decomposeRight(i,o),Wv(o,c)}return Jt.of(o)}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:o,right:a}=this,c=i+o.length+this.break,h=null;return r&&r.from<=i+o.length&&r.more?h=o=o.updateHeight(e,i,n,r):o.updateHeight(e,i,n),r&&r.from<=c+a.length&&r.more?h=a=a.updateHeight(e,c,n,r):a.updateHeight(e,c,n),h?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Wv(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 Dj=5;class n0{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,o=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=i-e;n.block?this.addBlock(new iC(a,r,n)):(a||o||r>=Dj)&&this.addLineDeco(r,o,a)}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 o=new n0(n,e);return Ne.spans(i,n,r,o,0),o.finish(n)}}function jj(t,e,i){let n=new Lj;return Ne.compare(t,e,i,n,0),n.changes}class Lj{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,r){(e<i||n&&n.heightRelevant||r&&r.heightRelevant)&&wl(e,i,this.changes,5)}}function Bj(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,r=n.defaultView||window,o=Math.max(0,i.left),a=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();o=Math.max(o,x.left),a=Math.min(a,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:o-i.left,right:Math.max(o,a)-i.left,top:c-(i.top+e),bottom:Math.max(c,h)-(i.top+e)}}function zj(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 _j(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Up{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],o=i[n];if(r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1}return!0}draw(e,i){return ge.replace({widget:new Hj(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class Hj 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 Xv{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=Zv,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ze.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet($g).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Oj(i),this.stateDeco=Jv(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:o,to:a})=>r>=o&&r<=a)){let{from:o,to:a}=this.lineBlockAt(r);e.push(new mc(o,a))}}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?Zv:new r0(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(Jo(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Jv(this.state);let r=e.changedRanges,o=qi.extendWithRanges(r,jj(n,this.stateDeco,e?e.changes:wt.empty(this.state.doc.length))),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Kv(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Ll)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let h=o.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(Bk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ze.RTL:Ze.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",c=i.getBoundingClientRect(),h=a||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:j,scaleY:B}=xk(i,c);(j>.005&&Math.abs(this.scaleX-j)>.005||B>.005&&Math.abs(this.scaleY-B)>.005)&&(this.scaleX=j,this.scaleY=B,d|=16,a=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 b=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=b&&(this.scrollAnchorHeight=-1,this.scrollTop=b),this.scrolledToBottom=vk(e.scrollDOM);let w=(this.printing?_j:Bj)(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&&!zj(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 j=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(j)&&(a=!0),a||r.lineWrapping&&Math.abs(T-this.contentDOMWidth)>r.charWidth){let{lineHeight:B,charWidth:P,textHeight:H}=e.docView.measureTextSize();a=B>0&&r.refresh(o,B,P,H,Math.max(5,T/P),j),a&&(e.docView.minWidth=0,d|=16)}k>0&&C>0?p=Math.max(k,C):k<0&&C<0&&(p=Math.min(k,C)),Kv();for(let B of this.viewports){let P=B.from==this.viewport.from?j:e.docView.measureVisibleLineHeights(B);this.heightMap=(a?Jt.empty().applyChanges(this.stateDeco,Ue.empty,this.heightOracle,[new qi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Ej(B.from,P))}Ll&&(d|=2)}let D=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return D&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||D)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:c}=this,h=new mc(r.lineAt(a-n*1e3,Je.ByHeight,o,0,0).from,r.lineAt(c+(1-n)*1e3,Je.ByHeight,o,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,o,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 mc(r.lineAt(x-1e3/2,Je.ByHeight,o,0,0).from,r.lineAt(x+p+1e3/2,Je.ByHeight,o,0,0).to)}}return h}mapViewport(e,i){let n=i.mapPos(e.from,-1),r=i.mapPos(e.to,1);return new mc(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:o}=this.heightMap.lineAt(i,Je.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:c}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||o>=c+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&o<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 Up(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,o=r>>1,a=r<<1;if(this.defaultTextDirection!=Ze.LTR&&!n)return[];let c=[],h=(p,g,x,b)=>{if(g-p<o)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,b),h(M+10,g,x,b);return}let C=qj(e,M=>M.from>=x.from&&M.to<=x.to&&Math.abs(M.from-p)<o&&Math.abs(M.to-g)<o&&!k.some(T=>M.from<T&&M.to>T));if(!C){if(g<x.to&&i&&n&&i.visibleRanges.some(D=>D.from<=g&&D.to>=g)){let D=i.moveToLineBoundary(W.cursor(g),!1,!0).head;D>p&&(g=D)}let M=this.gapSize(x,p,g,b),T=n||M<2e6?M:2e6;C=new Up(p,g,M,T)}c.push(C)},d=p=>{if(p.length<a||p.type!=Ut.Text)return;let g=Uj(p.from,p.to,this.stateDeco);if(g.total<a)return;let x=this.scrollTarget?this.scrollTarget.range.head:null,b,w;if(n){let k=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,M;if(x!=null){let T=yc(g,x),D=((this.visibleBottom-this.visibleTop)/2+k)/p.height;C=T-D,M=T+D}else C=(this.visibleTop-p.top-k)/p.height,M=(this.visibleBottom-p.top+k)/p.height;b=gc(g,C),w=gc(g,M)}else{let k=g.total*this.heightOracle.charWidth,C=r*this.heightOracle.charWidth,M=0;if(k>2e6)for(let P of e)P.from>=p.from&&P.from<p.to&&P.size!=P.displaySize&&P.from*this.heightOracle.charWidth+M<this.pixelViewport.left&&(M=P.size-P.displaySize);let T=this.pixelViewport.left+M,D=this.pixelViewport.right+M,j,B;if(x!=null){let P=yc(g,x),H=((D-T)/2+C)/k;j=P-H,B=P+H}else j=(T-C)/k,B=(D+C)/k;b=gc(g,j),w=gc(g,B)}b>p.from&&h(p.from,b,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 o=yc(r,n)-yc(r,i);return this.heightOracle.lineWrapping?e.height*o:r.total*this.heightOracle.charWidth*o}updateLineGaps(e){Up.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=[];Ne.spans(i,this.viewport.from,this.viewport.to,{span(o,a){n.push({from:o,to:a})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let o=0;o<n.length&&!(r&8);o++){let a=this.visibleRanges[o],c=n[o];(a.from!=c.from||a.to!=c.to)&&(r|=4,e&&e.mapPos(a.from,-1)==c.from&&e.mapPos(a.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)||Jo(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)||Jo(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 Jo(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 mc{constructor(e,i){this.from=e,this.to=i}}function Uj(t,e,i){let n=[],r=t,o=0;return Ne.spans(i,t,e,{span(){},point(a,c){a>r&&(n.push({from:r,to:a}),o+=a-r),r=c}},20),r<e&&(n.push({from:r,to:e}),o+=e-r),{total:o,ranges:n}}function gc({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:o,to:a}=e[r],c=a-o;if(n<=c)return o+n;n-=c}}function yc(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 qj(t,e){for(let i of t)if(e(i))return i}const Zv={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function Jv(t){let e=t.facet(Hh).filter(n=>typeof n!="function"),i=t.facet(e0).filter(n=>typeof n!="function");return i.length&&e.push(Ne.join(i)),e}class r0{constructor(e,i,n){let r=0,o=0,a=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=a+(c.top-o)*this.scale,a=c.domBottom=c.domTop+(c.bottom-c.top),o=c.bottom}toDOM(e){for(let i=0,n=0,r=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.top)return r+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,r=o.domBottom}}fromDOM(e){for(let i=0,n=0,r=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.domTop)return n+(e-r)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,r=o.domBottom}}eq(e){return e instanceof r0?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 Jo(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=>Jo(r,e)):t._content)}const xc=le.define({combine:t=>t.join(" ")}),ig=le.define({combine:t=>t.indexOf(!0)>-1}),ng=zr.newName(),nC=zr.newName(),rC=zr.newName(),sC={"&light":"."+nC,"&dark":"."+rC};function rg(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 Pj=rg("."+ng,{"&":{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"}},sC),Fj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},qp=se.ie&&se.ie_version<=11;class Vj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new b5,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 Qj(e),e.state.facet(In)&&(e.contentDOM.editContext=this.editContext.editContext)),qp&&(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:!ia(this.dom,r))return;let o=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(o&&o.isWidget()&&o.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&&ra(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=ba(e.root);if(!i)return!1;let n=se.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ij(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let r=ia(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&S5(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,Fj),qp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),qp&&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 o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&kl(this.dom,o.key,o.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 o of e){let a=this.readMutation(o);a&&(a.typeOver&&(r=!0),i==-1?{from:i,to:n}=a:(i=Math.min(a.from,i),n=Math.max(a.to,n)))}return{from:i,to:n,typeOver:r}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ia(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 o=new aj(this.view,e,i,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,r=Yk(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=$v(i,e.previousSibling||e.target.previousSibling,-1),r=$v(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 $v(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 eS(t,e){let i=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor,1);return ra(a.node,a.offset,r,o)&&([i,n,r,o]=[r,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}}function Ij(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return eS(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?eS(t,i):null}class Qj{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:o,head:a}=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&&o<this.from?c=o:h==this.to&&o>this.to&&(h=o);let p=Gk(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==a-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);i0(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=[],o=null;for(let a=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);a<c;a++){let h=e.coordsForChar(a);o=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||o||new DOMRect,r.push(o)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let o of n.getTextFormats()){let a=o.underlineStyle,c=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(c)){let h=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;r.push(ge.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:_k.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=ba(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((o,a,c,h,d)=>{if(n)return;let p=d.length-(a-o);if(r&&a>=r.to)if(r.from==o&&r.to==a&&r.insert.eq(d)){r=this.pendingContextChange=null,i+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(o+=i,a+=i,a<=this.from)this.from+=p,this.to+=p;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}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(o=>n(o,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||v5(e.parent)||document,this.viewState=new Xv(e.state||Be.create(e)),e.scrollTo&&e.scrollTo.is(fc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(gl).map(r=>new Lp(r));for(let r of this.plugins)r.update(this);this.observer=new Vj(this),this.inputState=new fj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new _v(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,o=this.state;for(let x of e){if(x.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=x.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,c=0,h=null;e.some(x=>x.annotation($k))?(this.inputState.notifiedFocused=a,c=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,h=eC(o,a),h||(c=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(Be.phrases)!=this.state.facet(Be.phrases))return this.setState(o);r=ah.create(this,o,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:b}=x.state.selection;g=new Cl(b.empty?b:W.cursor(b.head,b.head>b.anchor?-1:1))}for(let b of x.effects)b.is(fc)&&(g=b.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(Xo)!=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(xc)!=r.state.facet(xc)&&(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(Zm))try{x(r)}catch(b){ci(this.state,b,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!Yk(this,p)&&d.force&&kl(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 Xv(e),this.plugins=e.facet(gl).map(n=>new Lp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new _v(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(gl),n=e.state.facet(gl);if(i!=n){let r=[];for(let o of n){let a=i.indexOf(o);if(a<0)r.push(new Lp(o));else{let c=this.plugins[a];c.mustUpdate=e,r.push(c)}}for(let o of this.plugins)o.mustUpdate!=e&&o.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:o,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(a<0)if(vk(n))o=-1,a=this.viewState.heightMap.height;else{let b=this.viewState.scrollAnchorAt(r);o=b.from,a=b.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(b=>{try{return b.read(this)}catch(w){return ci(this.state,w),tS}}),g=ah.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 b=0;b<d.length;b++)if(p[b]!=tS)try{let w=d[b];w.write&&w.write(p[b],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,a=-1;continue}else{let w=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-a;if(w>1||w<-1){r=r+w,n.scrollTop=r/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let c of this.state.facet(Zm))c(i)}get themeClasses(){return ng+" "+(this.state.facet(ig)?rC:nC)+" "+this.state.facet(xc)}updateAttrs(){let e=iS(this,Hk,{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"),iS(this,$g,i);let n=this.observer.ignore(()=>{let r=Rv(this.contentDOM,this.contentAttrs,i),o=Rv(this.dom,this.editorAttrs,e);return r||o});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 o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Xo);let e=this.state.facet(ie.cspNonce);zr.mount(this.root,this.styleModules.concat(Pj).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 Hp(this,e,Hv(this,e,i,n))}moveByGroup(e,i){return Hp(this,e,Hv(this,e,i,n=>ij(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=n[i?n.length-1:0];return W.cursor(o.side(i,r)+e.from,o.forward(!i,r)?1:-1)}moveToLineBoundary(e,i,n=!0){return tj(this,e,i,n)}moveVertically(e,i,n){return Hp(this,e,nj(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=eg(this,e,i);return n&&n.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),eg(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),o=this.bidiSpans(r),a=o[mn.find(o,e-r.from,-1,i)];return va(n,a.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(Lk)||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>Yj)return Mk(e.length);let i=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||Ak(o.isolates,n=Lv(this,e))))return o.order;n||(n=Lv(this,e));let r=O5(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(()=>{bk(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 fc.of(new Cl(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 fc.of(new Cl(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 at.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return at.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=zr.newName(),r=[xc.of(n),Xo.of(rg(`.${n}`,e))];return i&&i.dark&&r.push(ig.of(!0)),r}static baseTheme(e){return As.lowest(Xo.of(rg("."+ng,e,sC)))}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=Xo;ie.inputHandler=Dk;ie.clipboardInputFilter=Zg;ie.clipboardOutputFilter=Jg;ie.scrollHandler=zk;ie.focusChangeEffect=jk;ie.perLineTextDirection=Lk;ie.exceptionSink=Rk;ie.updateListener=Zm;ie.editable=In;ie.mouseSelectionStyle=Nk;ie.dragMovesSelection=Ek;ie.clickAddsSelectionRange=Ok;ie.decorations=Hh;ie.blockWrappers=Uk;ie.outerDecorations=e0;ie.atomicRanges=_a;ie.bidiIsolatedRanges=qk;ie.scrollMargins=Pk;ie.darkTheme=ig;ie.cspNonce=le.define({combine:t=>t.length?t[0]:""});ie.contentAttributes=$g;ie.editorAttributes=Hk;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=Se.define();const Yj=4096,tS={};class dh{constructor(e,i,n,r,o,a){this.from=e,this.to=i,this.dir=n,this.isolates=r,this.fresh=o,this.order=a}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Ze.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==r&&!i.touchesRange(a.from,a.to)&&n.push(new dh(i.mapPos(a.from,1),i.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return n}}function iS(t,e,i){for(let n=t.state.facet(e),r=n.length-1;r>=0;r--){let o=n[r],a=typeof o=="function"?o(t):o;a&&Kg(a,i)}return i}const Gj=se.mac?"mac":se.windows?"win":se.linux?"linux":"key";function Kj(t,e){const i=t.split(/-(?!$)/);let n=i[i.length-1];n=="Space"&&(n=" ");let r,o,a,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))o=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?c=!0:o=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),c&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function bc(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 Wj=As.default(ie.domEventHandlers({keydown(t,e){return oC(lC(e.state),t,e,"editor")}})),Fh=le.define({enables:Wj}),nS=new WeakMap;function lC(t){let e=t.facet(Fh),i=nS.get(e);return i||nS.set(e,i=Jj(e.reduce((n,r)=>n.concat(r),[]))),i}function Xj(t,e,i){return oC(lC(t.state),e,t,i)}let Tr=null;const Zj=4e3;function Jj(t,e=Gj){let i=Object.create(null),n=Object.create(null),r=(a,c)=>{let h=n[a];if(h==null)n[a]=c;else if(h!=c)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,c,h,d,p)=>{var g,x;let b=i[a]||(i[a]=Object.create(null)),w=c.split(/ (?!$)/).map(M=>Kj(M,e));for(let M=1;M<w.length;M++){let T=w.slice(0,M).join(" ");r(T,!0),b[T]||(b[T]={preventDefault:!0,stopPropagation:!1,run:[D=>{let j=Tr={view:D,prefix:T,scope:a};return setTimeout(()=>{Tr==j&&(Tr=null)},Zj),!0}]})}let k=w.join(" ");r(k,!1);let C=b[k]||(b[k]={preventDefault:!1,stopPropagation:!1,run:((x=(g=b._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 a of t){let c=a.scope?a.scope.split(" "):["editor"];if(a.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}=a;for(let x in p)p[x].run.push(b=>g(b,sg))}let h=a[e]||a.key;if(h)for(let d of c)o(d,h,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+h,a.shift,a.preventDefault,a.stopPropagation)}return i}let sg=null;function oC(t,e,i,n){sg=e;let r=h5(e),o=li(r,0),a=dn(o)==r.length&&r!=" ",c="",h=!1,d=!1,p=!1;Tr&&Tr.view==i&&Tr.scope==n&&(c=Tr.prefix+" ",Wk.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},b=t[n],w,k;return b&&(x(b[c+bc(r,e,!a)])?h=!0:a&&(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(b[c+bc(w,e,!0)])||e.shiftKey&&(k=ya[e.keyCode])!=r&&k!=w&&x(b[c+bc(k,e,!1)]))&&(h=!0):a&&e.shiftKey&&x(b[c+bc(r,e,!0)])&&(h=!0),!h&&x(b._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),sg=null,h}class Ha{constructor(e,i,n,r,o){this.className=e,this.left=i,this.top=n,this.width=r,this.height=o}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 o=aC(e);return[new Ha(i,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}else return $j(e,i,n)}}function aC(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 rS(t,e,i,n){let r=t.coordsAtPos(e,i*2);if(!r)return n;let o=t.dom.getBoundingClientRect(),a=(r.top+r.bottom)/2,c=t.posAtCoords({x:o.left+1,y:a}),h=t.posAtCoords({x:o.right-1,y:a});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 $j(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),o=t.textDirection==Ze.LTR,a=t.contentDOM,c=a.getBoundingClientRect(),h=aC(t),d=a.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),b=$m(t,n,1),w=$m(t,r,-1),k=b.type==Ut.Text?b:null,C=w.type==Ut.Text?w:null;if(k&&(t.lineWrapping||b.widgetLineBreaks)&&(k=rS(t,n,1,k)),C&&(t.lineWrapping||w.widgetLineBreaks)&&(C=rS(t,r,-1,C)),k&&C&&k.from==C.from&&k.to==C.to)return T(D(i.from,i.to,k));{let B=k?D(i.from,null,k):j(b,!1),P=C?D(null,i.to,C):j(w,!0),H=[];return(k||b).to<(C||w).from-(k&&C?1:0)||b.widgetLineBreaks>1&&B.bottom+t.defaultLineHeight/2<P.top?H.push(M(g,B.bottom,x,P.top)):B.bottom<P.top&&t.elementAtHeight((B.bottom+P.top)/2).type==Ut.Text&&(B.bottom=P.top=(B.bottom+P.top)/2),T(B).concat(H).concat(T(P))}function M(B,P,H,Z){return new Ha(e,B-h.left,P-h.top,Math.max(0,H-B),Z-P)}function T({top:B,bottom:P,horizontal:H}){let Z=[];for(let J=0;J<H.length;J+=2)Z.push(M(H[J],B,H[J+1],P));return Z}function D(B,P,H){let Z=1e9,J=-1e9,ue=[];function oe(fe,de,q,X,ne){let ce=t.coordsAtPos(fe,fe==H.to?-2:2),ye=t.coordsAtPos(q,q==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(o&&de?g:ce.left,o&&X?x:ye.right):ue.push(!o&&X?g:ye.left,!o&&de?x:ce.right))}let F=B??H.from,ee=P??H.to;for(let fe of t.visibleRanges)if(fe.to>F&&fe.from<ee)for(let de=Math.max(fe.from,F),q=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>=q)break;ye>de&&oe(Math.max(ce,de),B==null&&ce<=F,Math.min(ye,q),P==null&&ye>=ee,ne.dir)}if(de=X.to+1,de>=q)break}return ue.length==0&&oe(F,B==null,ee,P==null,t.textDirection),{top:Z,bottom:J,horizontal:ue}}function j(B,P){let H=c.top+(P?B.top:B.bottom);return{top:H,bottom:H,horizontal:[]}}}function eL(t,e){return t.constructor==e.constructor&&t.eq(e)}class tL{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(Uc)!=e.state.facet(Uc)&&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(Uc);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)=>!eL(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 Uc=le.define();function uC(t){return[at.define(e=>new tL(e,t)),Uc.of(t)]}const wa=le.define({combine(t){return wn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function iL(t={}){return[wa.of(t),nL,rL,sL,Bk.of(!0)]}function cC(t){return t.startState.facet(wa)!=t.state.facet(wa)}const nL=uC({above:!0,markers(t){let{state:e}=t,i=e.facet(wa),n=[];for(let r of e.selection.ranges){let o=r==e.selection.main;if(r.empty||i.drawRangeCursor){let a=o?"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 Ha.forRange(t,a,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=cC(t);return i&&sS(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){sS(e.state,t)},class:"cm-cursorLayer"});function sS(t,e){e.style.animationDuration=t.facet(wa).cursorBlinkRate+"ms"}const rL=uC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Ha.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||cC(t)},class:"cm-selectionLayer"}),sL=As.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"}}}})),hC=Se.define({map(t,e){return t==null?null:e.mapPos(t)}}),$o=It.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,n)=>n.is(hC)?n.value:i,t)}}),lL=at.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($o);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($o)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field($o),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($o)!=t&&this.view.dispatch({effects:hC.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 oL(){return[$o,lL]}function lS(t,e,i,n,r){e.lastIndex=0;for(let o=t.iterRange(i,n),a=i,c;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;c=e.exec(o.value);)r(a+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:o}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=o:n.push({from:r,to:o});return n}class uL{constructor(e){const{regexp:i,decoration:n,decorate:r,boundary:o,maxLength:a=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=o,this.maxLength=a}createDeco(e){let i=new Kn,n=i.add.bind(i);for(let{from:r,to:o}of aL(e,this.maxLength))lS(e.state.doc,this.regexp,r,o,(a,c)=>this.addMatch(c,e,a,n));return i.finish()}updateDeco(e,i){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((o,a,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 o of e.visibleRanges){let a=Math.max(o.from,n),c=Math.min(o.to,r);if(c>=a){let h=e.state.doc.lineAt(a),d=h.to<c?e.state.doc.lineAt(c):h,p=Math.max(o.from,h.from),g=Math.min(o.to,d.to);if(this.boundary){for(;a>h.from;a--)if(this.boundary.test(h.text[a-1-h.from])){p=a;break}for(;c<d.to;c++)if(this.boundary.test(d.text[c-d.from])){g=c;break}}let x=[],b,w=(k,C,M)=>x.push(M.range(k,C));if(h==d)for(this.regexp.lastIndex=p-h.from;(b=this.regexp.exec(h.text))&&b.index<g-h.from;)this.addMatch(b,e,b.index+h.from,w);else lS(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 lg=/x/.unicode!=null?"gu":"g",cL=new RegExp(`[\0-\b
52
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,lg),hL={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 Pp=null;function fL(){var t;if(Pp==null&&typeof document<"u"&&document.body){let e=document.body.style;Pp=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Pp||!1}const qc=le.define({combine(t){let e=wn(t,{render:null,specialChars:cL,addSpecialChars:null});return(e.replaceTabs=!fL())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,lg)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,lg)),e}});function dL(t={}){return[qc.of(t),pL()]}let oS=null;function pL(){return oS||(oS=at.fromClass(class{constructor(t){this.view=t,this.decorations=ge.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(qc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new uL({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,o=li(e[0],0);if(o==9){let a=r.lineAt(n),c=i.state.tabSize,h=Fl(a.text,c,n-a.from);return ge.replace({widget:new xL((c-h%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ge.replace({widget:new yL(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(qc);t.startState.facet(qc)!=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 mL="•";function gL(t){return t>=32?mL:t==10?"␤":String.fromCharCode(9216+t)}class yL extends kn{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=gL(this.code),n=e.state.phrase("Control character")+" "+(hL[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let o=document.createElement("span");return o.textContent=i,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class xL 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 bL(){return SL}const vL=ge.line({class:"cm-activeLine"}),SL=at.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(vL.range(r.from)),e=r.from)}return ge.set(i)}},{decorations:t=>t.decorations});class wL 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?na(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=va(i[0],n.direction!="rtl"),o=parseInt(n.lineHeight);return r.bottom-r.top>o*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}}function kL(t){let e=at.fromClass(class{constructor(i){this.view=i,this.placeholder=t?ge.set([ge.widget({widget:new wL(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 og=2e3;function CL(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),o=[];if(e.off>og||i.off>og||e.col<0||i.col<0){let a=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&&o.push(W.range(d.from+a,d.to+c))}}else{let a=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=qm(d.text,a,t.tabSize,!0);if(p<0)o.push(W.cursor(d.to));else{let g=qm(d.text,c,t.tabSize);o.push(W.range(d.from+p,d.from+g))}}}return o}function AL(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function aS(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,o=r>og?-1:r==n.length?AL(t,e.clientX):Fl(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:o,off:r}}function ML(t,e){let i=aS(t,e),n=t.state.selection;return i?{update(r){if(r.docChanged){let o=r.changes.mapPos(r.startState.doc.line(i.line).from),a=r.state.doc.lineAt(o);i={line:a.number,col:i.col,off:Math.min(i.off,a.length)},n=n.map(r.changes)}},get(r,o,a){let c=aS(t,r);if(!c)return n;let h=CL(t.state,i,c);return h.length?a?W.create(h.concat(n.ranges)):W.create(h):n}}:null}function TL(t){let e=(i=>i.altKey&&i.button==0);return ie.mouseSelectionStyle.of((i,n)=>e(n)?ML(i,n):null)}const OL={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},EL={style:"cursor: crosshair"};function NL(t={}){let[e,i]=OL[t.key||"Alt"],n=at.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 o;return!((o=r.plugin(n))===null||o===void 0)&&o.isDown?EL:null})]}const vc="-10000px";class fC{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(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=n(a,o))}update(e,i){var n;let r=e.state.facet(this.facet),o=r.filter(h=>h);if(r===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let a=[],c=i?[]:null;for(let h=0;h<o.length;h++){let d=o[h],p=-1;if(d){for(let g=0;g<this.tooltips.length;g++){let x=this.tooltips[g];x&&x.create==d.create&&(p=g)}if(p<0)a[h]=this.createTooltipView(d,h?a[h-1]:null),c&&(c[h]=!!d.above);else{let g=a[h]=this.tooltipViews[p];c&&(c[h]=i[p]),g.update&&g.update(e)}}}for(let h of this.tooltipViews)a.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return i&&(c.forEach((h,d)=>i[d]=h),i.length=c.length),this.input=r,this.tooltips=o,this.tooltipViews=a,!0}}function RL(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Fp=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)||RL}}}),uS=new WeakMap,s0=at.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(Fp);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 fC(t,l0,(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(Fp);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=vc,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:o}=this.manager.tooltipViews[0];if(se.safari){let a=o.getBoundingClientRect();i=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else i=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(i||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();o.width&&o.height&&(t=o.width/this.parent.offsetWidth,e=o.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),r=t0(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((o,a)=>{let c=this.manager.tooltipViews[a];return c.getCoords?c.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(Fp).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:o}=t,a=[];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=vc;continue}let b=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=b?7:0,k=x.right-x.left,C=(e=uS.get(d))!==null&&e!==void 0?e:x.bottom-x.top,M=d.offset||jL,T=this.view.textDirection==Ze.LTR,D=x.width>n.right-n.left?T?n.left:n.right-x.width:T?Math.max(n.left,Math.min(g.left-(b?14:0)+M.x,n.right-k)):Math.min(Math.max(n.left,g.left-k+(b?14:0)-M.x),n.right-k),j=this.above[c];!h.strictSide&&(j?g.top-C-w-M.y<n.top:g.bottom+C+w+M.y>n.bottom)&&j==n.bottom-g.bottom>g.top-n.top&&(j=this.above[c]=!j);let B=(j?g.top-n.top:n.bottom-g.bottom)-w;if(B<C&&d.resize!==!1){if(B<this.view.defaultLineHeight){p.style.top=vc;continue}uS.set(d,C),p.style.height=(C=B)/o+"px"}else p.style.height&&(p.style.height="");let P=j?g.top-C-w-M.y:g.bottom+w+M.y,H=D+k;if(d.overlap!==!0)for(let Z of a)Z.left<H&&Z.right>D&&Z.top<P+C&&Z.bottom>P&&(P=j?Z.top-C-2-w:Z.bottom+w+2);if(this.position=="absolute"?(p.style.top=(P-t.parent.top)/o+"px",cS(p,(D-t.parent.left)/r)):(p.style.top=P/o+"px",cS(p,D/r)),b){let Z=g.left+(T?M.x:-M.x)-(D+14-7);b.style.left=Z/r+"px"}d.overlap!==!0&&a.push({left:D,top:P,right:H,bottom:P+C}),p.classList.toggle("cm-tooltip-above",j),p.classList.toggle("cm-tooltip-below",!j),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=vc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function cS(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const DL=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"}}}),jL={x:0,y:0},l0=le.define({enables:[s0,DL]}),ph=le.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])});class Vh{static create(e){return new Vh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new fC(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 LL=l0.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:Vh.create,above:e[0].above,arrow:e.some(i=>i.arrow)}});class BL{constructor(e,i,n,r,o){this.view=e,this.source=i,this.field=n,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){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,o=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;o=i.x<c.left?-d:d}let a=this.source(e,r,o);if(a?.then){let c=this.pending={pos:r};a.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 a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(s0),i=e?e.manager.tooltips.findIndex(n=>n.create==Vh.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:o}=this;if(r.length&&o&&!zL(o.dom,e)||this.pending){let{pos:a}=r[0]||this.pending,c=(n=(i=r[0])===null||i===void 0?void 0:i.end)!==null&&n!==void 0?n:a;(a==c?this.view.posAtCoords(this.lastMove)!=a:!_L(this.view,a,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 Sc=4;function zL(t,e){let{left:i,right:n,top:r,bottom:o}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let c=a.getBoundingClientRect();r=Math.min(c.top,r),o=Math.max(c.bottom,o)}return e.clientX>=i-Sc&&e.clientX<=n+Sc&&e.clientY>=r-Sc&&e.clientY<=o+Sc}function _L(t,e,i,n,r,o){let a=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>n||a.right<n||a.top>r||Math.min(a.bottom,c)<r)return!1;let h=t.posAtCoords({x:n,y:r},!1);return h>=e&&h<=i}function HL(t,e={}){let i=Se.define(),n=It.define({create(){return[]},update(r,o){if(r.length&&(e.hideOnChange&&(o.docChanged||o.selection)?r=[]:e.hideOn&&(r=r.filter(a=>!e.hideOn(o,a))),o.docChanged)){let a=[];for(let c of r){let h=o.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=o.changes.mapPos(d.end)),a.push(d)}}r=a}for(let a of o.effects)a.is(i)&&(r=a.value),a.is(UL)&&(r=[]);return r},provide:r=>ph.from(r)});return{active:n,extension:[n,at.define(r=>new BL(r,t,n,i,e.hoverTime||300)),LL]}}function dC(t,e){let i=t.plugin(s0);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const UL=Se.define(),hS=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(pC),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const pC=at.fromClass(class{constructor(t){this.input=t.state.facet(ka),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(hS);this.top=new wc(t,!0,e.topContainer),this.bottom=new wc(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(hS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new wc(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new wc(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(ka);if(i!=this.input){let n=i.filter(h=>h),r=[],o=[],a=[],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?o:a).push(p)}this.specs=n,this.panels=r,this.top.sync(o),this.bottom.sync(a);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 wc{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=fS(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=fS(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 fS(t){let e=t.nextSibling;return t.remove(),e}const ka=le.define({enables:pC});function qL(t,e){let i,n=new Promise(a=>i=a),r=a=>PL(a,e,i);t.state.field(Vp,!1)?t.dispatch({effects:mC.of(r)}):t.dispatch({effects:Se.appendConfig.of(Vp.init(()=>[r]))});let o=gC.of(r);return{close:o,result:n.then(a=>((t.win.queueMicrotask||(h=>t.win.setTimeout(h,10)))(()=>{t.state.field(Vp).indexOf(r)>-1&&t.dispatch({effects:o})}),a))}}const Vp=It.define({create(){return[]},update(t,e){for(let i of e.effects)i.is(mC)?t=[i.value].concat(t):i.is(gC)&&(t=t.filter(n=>n!=i.value));return t},provide:t=>ka.computeN([t],e=>e.field(t))}),mC=Se.define(),gC=Se.define();function PL(t,e,i){let n=e.content?e.content(t,()=>a(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(),a(null)):d.keyCode==13&&(d.preventDefault(),a(h))}),h.addEventListener("submit",d=>{d.preventDefault(),a(h)})}let o=Ke("div",n,Ke("button",{onclick:()=>a(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");function a(c){o.contains(o.ownerDocument.activeElement)&&t.focus(),i(c)}return{dom:o,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 Pc=le.define(),FL=le.define(),VL={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ne.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},la=le.define();function IL(t){return[yC(),la.of({...VL,...t})]}const dS=le.define({combine:t=>t.some(e=>e)});function yC(t){return[QL]}const QL=at.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(la).map(e=>new mS(t,e)),this.fixed=!t.state.facet(dS);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(dS)!=!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=Ne.iter(this.view.state.facet(Pc),this.view.viewport.from),n=[],r=this.gutters.map(o=>new YL(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(o.type)){let a=!0;for(let c of o.type)if(c.type==Ut.Text&&a){ag(i,n,c.from);for(let h of r)h.line(this.view,c,n);a=!1}else if(c.widget)for(let h of r)h.widget(this.view,c)}else if(o.type==Ut.Text){ag(i,n,o.from);for(let a of r)a.line(this.view,o,n)}else if(o.widget)for(let a of r)a.widget(this.view,o);for(let o of r)o.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(la),i=t.state.facet(la),n=t.docChanged||t.heightChanged||t.viewportChanged||!Ne.eq(t.startState.facet(Pc),t.state.facet(Pc),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 o of i){let a=e.indexOf(o);a<0?r.push(new mS(this.view,o)):(this.gutters[a].update(t),r.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.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 pS(t){return Array.isArray(t)?t:[t]}function ag(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class YL{constructor(e,i,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ne.iter(e.markers,i.from)}addElement(e,i,n){let{gutter:r}=this,o=(i.top-this.height)/e.scaleY,a=i.height/e.scaleY;if(this.i==r.elements.length){let c=new xC(e,a,o,n);r.elements.push(c),r.dom.appendChild(c.dom)}else r.elements[this.i].update(e,a,o,n);this.height=i.bottom,this.i++}line(e,i,n){let r=[];ag(this.cursor,r,i.from),n.length&&(r=r.concat(n));let o=this.gutter.config.lineMarker(e,i,r);o&&r.unshift(o);let a=this.gutter;r.length==0&&!a.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 o of e.state.facet(FL)){let a=o(e,i.widget,i);a&&(r||(r=[])).push(a)}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 mS{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 o=r.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let h=o.getBoundingClientRect();a=(h.top+h.bottom)/2}else a=r.clientY;let c=e.lineBlockAtHeight(a-e.documentTop);i.domEventHandlers[n](e,c,r)&&r.preventDefault()});this.markers=pS(i.markers(e)),i.initialSpacer&&(this.spacer=new xC(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=pS(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!Ne.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 xC{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 o=0,a=0;;){let c=a,h=o<i.length?i[o++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let g=a;g<this.markers.length;g++)if(this.markers[g].compare(h)){c=g,d=!0;break}}else c=this.markers.length;for(;a<c;){let p=this.markers[a++];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&&a++}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 KL=le.define(),WL=le.define(),yl=le.define({combine(t){return wn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let n=Object.assign({},e);for(let r in i){let o=n[r],a=i[r];n[r]=o?(c,h,d)=>o(c,h,d)||a(c,h,d):a}return n}})}});class Ip extends Xn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Qp(t,e){return t.state.facet(yl).formatNumber(e,t.state)}const XL=la.compute([yl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(KL)},lineMarker(e,i,n){return n.some(r=>r.toDOM)?null:new Ip(Qp(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,n)=>{for(let r of e.state.facet(WL)){let o=r(e,i,n);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(yl)!=e.state.facet(yl),initialSpacer(e){return new Ip(Qp(e,gS(e.state.doc.lines)))},updateSpacer(e,i){let n=Qp(i.view,gS(i.view.state.doc.lines));return n==e.number?e:new Ip(n)},domEventHandlers:t.facet(yl).domEventHandlers,side:"before"}));function ZL(t={}){return[yl.of(t),yC(),XL]}function gS(t){let e=9;for(;e<t;)e=e*10+9;return e}const JL=new class extends Xn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},$L=Pc.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(JL.range(r)))}return Ne.of(e)});function e6(){return $L}const bC=1024;let t6=0;class Yp{constructor(e,i){this.from=e,this.to=i}}class Te{constructor(e={}){this.id=t6++,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]}}}Te.closedBy=new Te({deserialize:t=>t.split(" ")});Te.openedBy=new Te({deserialize:t=>t.split(" ")});Te.group=new Te({deserialize:t=>t.split(" ")});Te.isolate=new Te({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Te.contextHash=new Te({perNode:!0});Te.lookAhead=new Te({perNode:!0});Te.mounted=new Te({perNode:!0});class oa{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[Te.mounted.id]}}const i6=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):i6,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 o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[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(Te.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(Te.group),o=-1;o<(r?r.length:0);o++){let a=i[o<0?n.name:r[o]];if(a)return a}}}}fi.none=new fi("",Object.create(null),0,8);class a0{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 o of e){let a=o(n);if(a){r||(r=Object.assign({},n.props));let c=a[1],h=a[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 a0(i)}}const kc=new WeakMap,yS=new WeakMap;var ot;(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"})(ot||(ot={}));class dt{constructor(e,i,n,r,o){if(this.type=e,this.children=i,this.positions=n,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,c]of o)this.props[typeof a=="number"?a:a.id]=c}}toString(){let e=oa.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 cg(this.topNode,e)}cursorAt(e,i=0,n=0){let r=kc.get(this)||this.topNode,o=new cg(r);return o.moveTo(e,i),kc.set(this,o._tree),o}get topNode(){return new Vi(this,0,0,null)}resolve(e,i=0){let n=Ca(kc.get(this)||this.topNode,e,i,!1);return kc.set(this,n),n}resolveInner(e,i=0){let n=Ca(yS.get(this)||this.topNode,e,i,!0);return yS.set(this,n),n}resolveStack(e,i=0){return s6(this,e,i)}iterate(e){let{enter:i,leave:n,from:r=0,to:o=this.length}=e,a=e.mode||0,c=(a&ot.IncludeAnonymous)>0;for(let h=this.cursor(a|ot.IncludeAnonymous);;){let d=!1;if(h.from<=o&&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:h0(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 l6(e)}}dt.empty=new dt(fi.none,[],[],0);class u0{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 u0(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],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,i,n,r,o){let{buffer:a}=this,c=-1;for(let h=e;h!=i&&!(vC(o,r,a[h+1],a[h+2])&&(c=h,n>0));h=a[h+3]);return c}slice(e,i,n){let r=this.buffer,o=new Uint16Array(i-e),a=0;for(let c=e,h=0;c<i;){o[h++]=r[c++],o[h++]=r[c++]-n;let d=o[h++]=r[c++]-n;o[h++]=r[c++]-e,a=Math.max(a,d)}return new Ur(o,a,this.set)}}function vC(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 Ca(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 a=!n&&t instanceof Vi&&t.index<0?null:t.parent;if(!a)return t;t=a}let o=n?0:ot.IgnoreOverlays;if(n)for(let a=t,c=a.parent;c;a=c,c=a.parent)a instanceof Vi&&a.index<0&&((r=c.enter(e,i,o))===null||r===void 0?void 0:r.from)!=a.from&&(t=c);for(;;){let a=t.enter(e,i,o);if(!a)return t;t=a}}class SC{cursor(e=0){return new cg(this,e)}getChild(e,i=null,n=null){let r=xS(this,e,i,n);return r.length?r[0]:null}getChildren(e,i=null,n=null){return xS(this,e,i,n)}resolve(e,i=0){return Ca(this,e,i,!1)}resolveInner(e,i=0){return Ca(this,e,i,!0)}matchContext(e){return ug(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 SC{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,o=0){for(let a=this;;){for(let{children:c,positions:h}=a._tree,d=i>0?c.length:-1;e!=d;e+=i){let p=c[e],g=h[e]+a.from,x;if(!(!(o&ot.EnterBracketed&&p instanceof dt&&(x=oa.get(p))&&!x.overlay&&x.bracketed&&n>=g&&n<=g+p.length)&&!vC(r,n,g,g+p.length))){if(p instanceof Ur){if(o&ot.ExcludeBuffers)continue;let b=p.findChild(0,p.buffer.length,i,n-g,r);if(b>-1)return new Er(new n6(a,p,e,g),null,b)}else if(o&ot.IncludeAnonymous||!p.type.isAnonymous||c0(p)){let b;if(!(o&ot.IgnoreMounts)&&(b=oa.get(p))&&!b.overlay)return new Vi(b.tree,g,e,a);let w=new Vi(p,g,e,a);return o&ot.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?p.children.length-1:0,i,n,r,o)}}}if(o&ot.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+i:e=i<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,i,n=0){let r;if(!(n&ot.IgnoreOverlays)&&(r=oa.get(this._tree))&&r.overlay){let o=e-this.from,a=n&ot.EnterBracketed&&r.bracketed;for(let{from:c,to:h}of r.overlay)if((i>0||a?c<=o:c<o)&&(i<0||a?h>=o:h>o))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 xS(t,e,i,n){let r=t.cursor(),o=[];if(!r.firstChild())return o;if(i!=null){for(let a=!1;!a;)if(a=r.type.is(i),!r.nextSibling())return o}for(;;){if(n!=null&&r.type.is(n))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return n==null?o:[]}}function ug(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 n6{constructor(e,i,n,r){this.parent=e,this.buffer=i,this.index=n,this.start=r}}class Er extends SC{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,o=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.context.start,n);return o<0?null:new Er(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,i,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new Er(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,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,o=n.buffer[this.index+3];if(o>r){let a=n.buffer[this.index+1];e.push(n.slice(r,o,a)),i.push(0)}return new dt(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wC(t){if(!t.length)return null;let e=0,i=t[0];for(let o=1;o<t.length;o++){let a=t[o];(a.from>i.from||a.to<i.to)&&(i=a,e=o)}let n=i instanceof Vi&&i.index<0?null:i.parent,r=t.slice();return n?r[e]=n:r.splice(e,1),new r6(r,i)}class r6{constructor(e,i){this.heads=e,this.node=i}get next(){return wC(this.heads)}}function s6(t,e,i){let n=t.resolveInner(e,i),r=null;for(let o=n instanceof Vi?n:n.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(r||(r=[n])).push(a.resolve(e,i)),o=a}else{let a=oa.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let c=new Vi(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[n])).push(Ca(c,e,i,!1))}}return r?wC(r):n}class cg{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&~ot.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,o=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.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 o=0;o<this.index;o++)if(r.buffer.buffer[o+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 o=i+e,a=e<0?-1:n._tree.children.length;o!=a;o+=e){let c=n._tree.children[o];if(this.mode&ot.IncludeAnonymous||c instanceof Ur||!c.type.isAnonymous||c0(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,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;i=a,n=o+1;break e}r=this.stack[--o]}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 ug(this.node.parent,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return ug(this._tree,e,r);let a=n[i.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function c0(t){return t.children.some(e=>e instanceof Ur||!e.type.isAnonymous||c0(e))}function l6(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=bC,reused:o=[],minRepeatType:a=n.types.length}=t,c=Array.isArray(i)?new u0(i,i.length):i,h=n.types,d=0,p=0;function g(B,P,H,Z,J,ue){let{id:oe,start:F,end:ee,size:fe}=c,de=p,q=d;if(fe<0)if(c.next(),fe==-1){let E=o[oe];H.push(E),Z.push(F-B);return}else if(fe==-3){d=oe;return}else if(fe==-4){p=oe;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let X=h[oe],ne,ce,ye=F-B;if(ee-F<=r&&(ce=C(c.pos-P,J))){let E=new Uint16Array(ce.size-ce.skip),Q=c.pos-ce.size,$=E.length;for(;c.pos>Q;)$=M(ce.start,E,$);ne=new Ur(E,ee-ce.start,n),ye=ce.start-B}else{let E=c.pos-fe;c.next();let Q=[],$=[],re=oe>=a?oe:-1,be=0,ke=ee;for(;c.pos>E;)re>=0&&c.id==re&&c.size>=0?(c.end<=ke-r&&(w(Q,$,F,be,c.end,ke,re,de,q),be=Q.length,ke=c.end),c.next()):ue>2500?x(F,E,Q,$):g(F,E,Q,$,re,ue+1);if(re>=0&&be>0&&be<Q.length&&w(Q,$,F,be,F,ke,re,de,q),Q.reverse(),$.reverse(),re>-1&&be>0){let ze=b(X,q);ne=h0(X,Q,$,0,Q.length,0,ee-F,ze,ze)}else ne=k(X,Q,$,ee-F,de-ee,q)}H.push(ne),Z.push(ye)}function x(B,P,H,Z){let J=[],ue=0,oe=-1;for(;c.pos>P;){let{id:F,start:ee,end:fe,size:de}=c;if(de>4)c.next();else{if(oe>-1&&ee<oe)break;oe<0&&(oe=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-B)}}function b(B,P){return(H,Z,J)=>{let ue=0,oe=H.length-1,F,ee;if(oe>=0&&(F=H[oe])instanceof dt){if(!oe&&F.type==B&&F.length==J)return F;(ee=F.prop(Te.lookAhead))&&(ue=Z[oe]+F.length+ee)}return k(B,H,Z,J,ue,P)}}function w(B,P,H,Z,J,ue,oe,F,ee){let fe=[],de=[];for(;B.length>Z;)fe.push(B.pop()),de.push(P.pop()+H-J);B.push(k(n.types[oe],fe,de,ue-J,F-ue,ee)),P.push(J-H)}function k(B,P,H,Z,J,ue,oe){if(ue){let F=[Te.contextHash,ue];oe=oe?[F].concat(oe):[F]}if(J>25){let F=[Te.lookAhead,J];oe=oe?[F].concat(oe):[F]}return new dt(B,P,H,Z,oe)}function C(B,P){let H=c.fork(),Z=0,J=0,ue=0,oe=H.end-r,F={size:0,start:0,skip:0};e:for(let ee=H.pos-B;H.pos>ee;){let fe=H.size;if(H.id==P&&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<oe)break;let q=H.id>=a?4:0,X=H.start;for(H.next();H.pos>de;){if(H.size<0)if(H.size==-3||H.size==-4)q+=4;else break e;else H.id>=a&&(q+=4);H.next()}J=X,Z+=fe,ue+=q}return(P<0||Z==B)&&(F.size=Z,F.start=J,F.skip=ue),F.size>4?F:void 0}function M(B,P,H){let{id:Z,start:J,end:ue,size:oe}=c;if(c.next(),oe>=0&&Z<a){let F=H;if(oe>4){let ee=c.pos-(oe-4);for(;c.pos>ee;)H=M(B,P,H)}P[--H]=F,P[--H]=ue-B,P[--H]=J-B,P[--H]=Z}else oe==-3?d=Z:oe==-4&&(p=Z);return H}let T=[],D=[];for(;c.pos>0;)g(t.start||0,t.bufferStart||0,T,D,-1,0);let j=(e=t.length)!==null&&e!==void 0?e:T.length?D[0]+T[0].length:0;return new dt(h[t.topID],T.reverse(),D.reverse(),j)}const bS=new WeakMap;function Fc(t,e){if(!t.isAnonymous||e instanceof Ur||e.type!=t)return 1;let i=bS.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof dt)){i=1;break}i+=Fc(t,n)}bS.set(e,i)}return i}function h0(t,e,i,n,r,o,a,c,h){let d=0;for(let w=n;w<r;w++)d+=Fc(t,e[w]);let p=Math.ceil(d*1.5/8),g=[],x=[];function b(w,k,C,M,T){for(let D=C;D<M;){let j=D,B=k[D],P=Fc(t,w[D]);for(D++;D<M;D++){let H=Fc(t,w[D]);if(P+H>=p)break;P+=H}if(D==j+1){if(P>p){let H=w[j];b(H.children,H.positions,0,H.children.length,k[j]+T);continue}g.push(w[j])}else{let H=k[D-1]+w[D-1].length-B;g.push(h0(t,w,k,j,D,B,H,null,h))}x.push(B+T-o)}}return b(e,i,n,r,0),(c||h)(g,x,a)}class ys{constructor(e,i,n,r,o=!1,a=!1){this.from=e,this.to=i,this.tree=n,this.offset=r,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],n=!1){let r=[new ys(0,e.length,e,0,!1,n)];for(let o of i)o.to>e.length&&r.push(o);return r}static applyChanges(e,i,n=128){if(!i.length)return e;let r=[],o=1,a=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(;a&&a.from<g;){let x=a;if(h>=x.from||g<=x.to||d){let b=Math.max(x.from,h)-d,w=Math.min(x.to,g)-d;x=b>=w?null:new ys(b,w,x.tree,x.offset+d,c>0,!!p)}if(x&&r.push(x),a.to>g)break;a=o<e.length?e[o++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return r}}class kC{startParse(e,i,n){return typeof e=="string"&&(e=new o6(e)),n=n?n.length?n.map(r=>new Yp(r.from,r.to)):[new Yp(0,0)]:[new Yp(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let r=this.startParse(e,i,n);for(;;){let o=r.advance();if(o)return o}}}class o6{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 Te({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 o of i.set)r.set.push(o);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,o)=>r.id-o.id))}}let u6=0;class mh{constructor(e){this.name=e,this.instances=[],this.id=u6++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(c=>c.base==e&&c6(i,c.modified));if(n)return n;let r=[],o=new Ui(e.name,r,e,i);for(let c of i)c.instances.push(o);let a=h6(i);for(let c of e.set)if(!c.modified.length)for(let h of a)r.push(mh.get(c,h));return o}}function c6(t,e){return t.length==e.length&&t.every((i,n)=>i==e[n])}function h6(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 CC(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 o=[],a=2,c=r;for(let g=0;;){if(c=="..."&&g>0&&g+3==r.length){a=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+r);if(o.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),g+=x[0].length,g==r.length)break;let b=r[g++];if(g==r.length&&b=="!"){a=0;break}if(b!="/")throw new RangeError("Invalid path: "+r);c=r.slice(g)}let h=o.length-1,d=o[h];if(!d)throw new RangeError("Invalid path: "+r);let p=new Aa(n,a,h>0?o.slice(0,h):null);e[d]=p.sort(e[d])}}return AC.add(e)}const AC=new Te({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 o=new Aa(r.tags,r.mode,r.context);i?i.next=o:n=o,i=o}return n}});class Aa{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}}Aa.empty=new Aa([],2,null);function MC(t,e){let i=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))i[o.tag.id]=o.class;else for(let a of o.tag)i[a.id]=o.class;let{scope:n,all:r=null}=e||{};return{style:o=>{let a=r;for(let c of o)for(let h of c.set){let d=i[h.id];if(d){a=a?a+" "+d:d;break}}return a},scope:n}}function f6(t,e){let i=null;for(let n of t){let r=n.style(e);r&&(i=i?i+" "+r:r)}return i}function d6(t,e,i,n=0,r=t.length){let o=new p6(n,Array.isArray(e)?e:[e],i);o.highlightRange(t.cursor(),n,r,"",o.highlighters),o.flush(r)}class p6{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,o){let{type:a,from:c,to:h}=e;if(c>=n||h<=i)return;a.isTop&&(o=this.highlighters.filter(b=>!b.scope||b.scope(a)));let d=r,p=m6(e)||Aa.empty,g=f6(o,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(Te.mounted);if(x&&x.overlay){let b=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,D=T?T.from+c:h,j=Math.max(i,M),B=Math.min(n,D);if(j<B&&k)for(;e.from<B&&(this.highlightRange(e,j,B,r,o),this.startSpan(Math.min(B,e.to),d),!(e.to>=D||!e.nextSibling())););if(!T||D>n)break;M=T.to+c,M>i&&(this.highlightRange(b.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,o),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function m6(t){let e=t.type.prop(AC);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const te=Ui.define,Cc=te(),Ar=te(),vS=te(Ar),SS=te(Ar),Mr=te(),Ac=te(Mr),Gp=te(Mr),hn=te(),as=te(hn),un=te(),cn=te(),hg=te(),Yo=te(hg),Mc=te(),I={comment:Cc,lineComment:te(Cc),blockComment:te(Cc),docComment:te(Cc),name:Ar,variableName:te(Ar),typeName:vS,tagName:te(vS),propertyName:SS,attributeName:te(SS),className:te(Ar),labelName:te(Ar),namespace:te(Ar),macroName:te(Ar),literal:Mr,string:Ac,docString:te(Ac),character:te(Ac),attributeValue:te(Ac),number:Gp,integer:te(Gp),float:te(Gp),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:hg,separator:te(hg),bracket:Yo,angleBracket:te(Yo),squareBracket:te(Yo),paren:te(Yo),brace:te(Yo),content:hn,heading:as,heading1:te(as),heading2:te(as),heading3:te(as),heading4:te(as),heading5:te(as),heading6:te(as),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:Mc,documentMeta:te(Mc),annotation:te(Mc),processingInstruction:te(Mc),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)}MC([{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 Kp;const xl=new Te;function g6(t){return le.define({combine:t?e=>e.concat(t):void 0})}const y6=new Te;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((o,a,c)=>{let h=wS(o,a,c),d=h.type.prop(xl);if(!d)return[];let p=o.facet(d),g=h.type.prop(y6);if(g){let x=h.resolve(a-h.from,c);for(let b of g)if(b.test(x,o)){let w=o.facet(b.facet);return b.type=="replace"?w:w.concat(p)}}return p})].concat(n)}isActiveAt(e,i,n=-1){return wS(e,i,n).type.prop(xl)==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=(o,a)=>{if(o.prop(xl)==this.data){n.push({from:a,to:a+o.length});return}let c=o.prop(Te.mounted);if(c){if(c.tree.prop(xl)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+a,to:h.to+a});else n.push({from:a,to:a+o.length});return}else if(c.overlay){let h=n.length;if(r(c.tree,c.overlay[0].from+a),n.length>h)return}}for(let h=0;h<o.children.length;h++){let d=o.children[h];d instanceof dt&&r(d,o.positions[h]+a)}};return r(Ft(e),0),n}get allowsNesting(){return!0}}Zi.setState=Se.define();function wS(t,e,i){let n=t.facet(qr),r=Ft(t).topNode;if(!n||n.allowsNesting)for(let o=r;o;o=o.enter(e,i,ot.ExcludeBuffers|ot.EnterBracketed))o.type.isTop&&(r=o);return r}class gh extends Zi{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=g6(e.languageData);return new gh(i,e.parser.configure({props:[xl.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 x6{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 Go=null;class yh{constructor(e,i,n=[],r,o,a,c,h){this.parser=e,this.state=i,this.fragments=n,this.tree=r,this.treeLen=o,this.viewport=a,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 x6(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=Go;Go=this;try{return e()}finally{Go=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=kS(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:r,treeLen:o,viewport:a,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,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.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,o,a,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:o}=this.skipped[n];r<e.to&&o>e.from&&(this.fragments=kS(this.fragments,r,o),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 kC{createParse(i,n,r){let o=r[0].from,a=r[r.length-1].to;return{parsedPos:o,advance(){let h=Go;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=a,new dt(fi.none,[],[],a-o)},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 Go}}function kS(t,e,i){return ys.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Bl{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 Bl(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 Bl(n)}}Zi.state=It.define({create:Bl.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)?Bl.init(e.state):t.apply(e)}});let TC=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(TC=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Wp=typeof navigator<"u"&&(!((Kp=navigator.scheduling)===null||Kp===void 0)&&Kp.isInputPending)?()=>navigator.scheduling.isInputPending():null,b6=at.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=TC(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,o=n.field(Zi.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!Wp?Math.max(25,e.timeRemaining()-5):1e9),c=o.context.treeLen<r&&n.doc.length>r+1e3,h=o.context.work(()=>Wp&&Wp()||Date.now()>a,r+(c?0:1e5));this.chunkBudget-=Date.now()-i,(h||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new Bl(o.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(o.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,b6,ie.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class v6{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const S6=le.define(),Ih=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(Ih);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Ma(t,e){let i="",n=t.tabSize,r=t.facet(Ih)[0];if(r==" "){for(;e>=n;)i+=" ",e-=n;r=" "}for(let o=0;o<e;o++)i+=r;return i}function f0(t,e){t instanceof Be&&(t=new Qh(t));for(let n of t.state.facet(S6)){let r=n(t,e);if(r!==void 0)return r}let i=Ft(t.state);return i.length>=e?w6(t,i,e):null}class Qh{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:o}=this.options;return r!=null&&r>=n.from&&r<=n.to?o&&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),o=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(o+=a-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,i=e.length){return Fl(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:n,from:r}=this.lineAt(e,i),o=this.options.overrideIndentation;if(o){let a=o(r);if(a>-1)return a}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const OC=new Te;function w6(t,e,i){let n=e.resolveStack(i),r=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(r!=n.node){let o=[];for(let a=r;a&&!(a.from<n.node.from||a.to>n.node.to||a.from==n.node.from&&a.type==n.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)n={node:o[a],next:n}}return EC(n,t,i)}function EC(t,e,i){for(let n=t;n;n=n.next){let r=C6(n.node);if(r)return r(d0.create(e,i,n))}return 0}function k6(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function C6(t){let e=t.type.prop(OC);if(e)return e;let i=t.firstChild,n;if(i&&(n=i.type.prop(Te.closedBy))){let r=t.lastChild,o=r&&n.indexOf(r.name)>-1;return a=>O6(a,!0,1,void 0,o&&!k6(a)?r.from:void 0)}return t.parent==null?A6:null}function A6(){return 0}class d0 extends Qh{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 d0(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(M6(n,e))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}continue(){return EC(this.context.next,this.base,this.pos)}}function M6(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function T6(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,o=t.state.doc.lineAt(i.from),a=r==null||r<=o.from?o.to:Math.min(o.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>=a)return null;let d=/^ */.exec(o.text.slice(i.to-o.from))[0].length;return{from:i.from,to:i.to+d}}c=h.to}}function O6(t,e,i,n,r){let o=t.textAfter,a=o.match(/^\s*/)[0].length,c=n&&o.slice(a,a+n.length)==n||r==t.pos+a,h=T6(t);return h?c?t.column(h.from):t.column(h.to):t.baseIndent+(c?0:t.unit*i)}function CS({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const E6=200;function N6(){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+E6)return t;let o=i.sliceString(r.from,n);if(!e.some(d=>d.test(o)))return t;let{state:a}=t,c=-1,h=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==c)continue;c=p.from;let g=f0(a,p.from);if(g==null)continue;let x=/^\s*/.exec(p.text)[0],b=Ma(a,g);x!=b&&h.push({from:p.from,to:p.from+x.length,insert:b})}return h.length?[t,{changes:h,sequential:!0}]:t})}const R6=le.define(),NC=new Te;function D6(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 j6(t,e,i){let n=Ft(t);if(n.length<i)return null;let r=n.resolveStack(i,1),o=null;for(let a=r;a;a=a.next){let c=a.node;if(c.to<=i||c.from>i)continue;if(o&&c.from<e)break;let h=c.type.prop(NC);if(h&&(c.to<n.length-50||n.length==t.doc.length||!L6(c))){let d=h(c,t);d&&d.from<=i&&d.from>=e&&d.to>i&&(o=d)}}return o}function L6(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(R6)){let r=n(t,e,i);if(r)return r}return j6(t,e,i)}function RC(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 Yh=Se.define({map:RC}),Ua=Se.define({map:RC});function DC(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=AS(t,i,n)),t=t.map(e.changes);for(let i of e.effects)if(i.is(Yh)&&!B6(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(BC),r=n?ge.replace({widget:new F6(n(e.state,i.value))}):MS;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Ua)&&(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=AS(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(MS.range(n,r))}return ge.set(e,!0)}});function AS(t,e,i=e){let n=!1;return t.between(e,i,(r,o)=>{r<i&&o>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(r,o)=>r>=i||o<=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,(o,a)=>{(!r||r.from>o)&&(r={from:o,to:a})}),r}function B6(t,e,i){let n=!1;return t.between(e,e,(r,o)=>{r==e&&o==i&&(n=!0)}),n}function jC(t,e){return t.field(Cs,!1)?e:e.concat(Se.appendConfig.of(zC()))}const z6=t=>{for(let e of DC(t)){let i=bh(t.state,e.from,e.to);if(i)return t.dispatch({effects:jC(t.state,[Yh.of(i),LC(t,i)])}),!0}return!1},_6=t=>{if(!t.state.field(Cs,!1))return!1;let e=[];for(let i of DC(t)){let n=vh(t.state,i.from,i.to);n&&e.push(Ua.of(n),LC(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function LC(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 H6=t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let r=t.lineBlockAt(n),o=bh(e,r.from,r.to);o&&i.push(Yh.of(o)),n=(o?t.lineBlockAt(o.to):r).to+1}return i.length&&t.dispatch({effects:jC(t.state,i)}),!!i.length},U6=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(Ua.of({from:n,to:r}))}),t.dispatch({effects:i}),!0},q6=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:z6},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:_6},{key:"Ctrl-Alt-[",run:H6},{key:"Ctrl-Alt-]",run:U6}],P6={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},BC=le.define({combine(t){return wn(t,P6)}});function zC(t){return[Cs,Q6]}function _C(t,e){let{state:i}=t,n=i.facet(BC),r=a=>{let c=t.lineBlockAt(t.posAtDOM(a.target)),h=vh(t.state,c.from,c.to);h&&t.dispatch({effects:Ua.of(h)}),a.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let o=document.createElement("span");return o.textContent=n.placeholderText,o.setAttribute("aria-label",i.phrase("folded code")),o.title=i.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const MS=ge.replace({widget:new class extends kn{toDOM(t){return _C(t,null)}}});class F6 extends kn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return _C(e,this.value)}}const V6={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Xp 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 I6(t={}){let e={...V6,...t},i=new Xp(e,!0),n=new Xp(e,!1),r=at.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(qr)!=a.state.facet(qr)||a.startState.field(Cs,!1)!=a.state.field(Cs,!1)||Ft(a.startState)!=Ft(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let c=new Kn;for(let h of a.viewportLineBlocks){let d=vh(a.state,h.from,h.to)?n:bh(a.state,h.from,h.to)?i:null;d&&c.add(h.from,h.from,d)}return c.finish()}}),{domEventHandlers:o}=e;return[r,IL({class:"cm-foldGutter",markers(a){var c;return((c=a.plugin(r))===null||c===void 0?void 0:c.markers)||Ne.empty},initialSpacer(){return new Xp(e,!1)},domEventHandlers:{...o,click:(a,c,h)=>{if(o.click&&o.click(a,c,h))return!0;let d=vh(a.state,c.from,c.to);if(d)return a.dispatch({effects:Ua.of(d)}),!0;let p=bh(a.state,c.from,c.to);return p?(a.dispatch({effects:Yh.of(p)}),!0):!1}}}),zC()]}const Q6=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 qa{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 o=typeof i.all=="string"?i.all:i.all?r(i.all):void 0,a=i.scope;this.scope=a instanceof Zi?c=>c.prop(xl)==a.data:a?c=>c==a:void 0,this.style=MC(e.map(c=>({tag:c.tag,class:c.class||r(Object.assign({},c,{tag:null}))})),{all:o}).style,this.module=n?new zr(n):null,this.themeType=i.themeType}static define(e,i){return new qa(e,i||{})}}const fg=le.define(),HC=le.define({combine(t){return t.length?[t[0]]:null}});function Zp(t){let e=t.facet(fg);return e.length?e:t.facet(HC)}function UC(t,e){let i=[G6],n;return t instanceof qa&&(t.module&&i.push(ie.styleModule.of(t.module)),n=t.themeType),e?.fallback?i.push(HC.of(t)):n?i.push(fg.computeN([ie.darkTheme],r=>r.facet(ie.darkTheme)==(n=="dark")?[t]:[])):i.push(fg.of(t)),i}class Y6{constructor(e){this.markCache=Object.create(null),this.tree=Ft(e.state),this.decorations=this.buildDeco(e,Zp(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Ft(e.state),n=Zp(e.state),r=n!=Zp(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);i.length<o.to&&!r&&i.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(i!=this.tree||e.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,i){if(!i||!this.tree.length)return ge.none;let n=new Kn;for(let{from:r,to:o}of e.visibleRanges)d6(this.tree,i,(a,c,h)=>{n.add(a,c,this.markCache[h]||(this.markCache[h]=ge.mark({class:h})))},r,o);return n.finish()}}const G6=As.high(at.fromClass(Y6,{decorations:t=>t.decorations})),K6=qa.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"}]),W6=ie.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),qC=1e4,PC="()[]{}",FC=le.define({combine(t){return wn(t,{afterCursor:!0,brackets:PC,maxScanDistance:qC,renderMatch:J6})}}),X6=ge.mark({class:"cm-matchingBracket"}),Z6=ge.mark({class:"cm-nonmatchingBracket"});function J6(t){let e=[],i=t.matched?X6:Z6;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 TS(t){let e=[],i=t.facet(FC);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 $6=at.fromClass(class{constructor(t){this.paused=!1,this.decorations=TS(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=TS(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),eB=[$6,W6];function tB(t={}){return[FC.of(t),eB]}const iB=new Te;function dg(t,e,i){let n=t.prop(e<0?Te.openedBy:Te.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 pg(t){let e=t.type.prop(iB);return e?e(t.node):t}function gn(t,e,i,n={}){let r=n.maxScanDistance||qC,o=n.brackets||PC,a=Ft(t),c=a.resolveInner(e,i);for(let h=c;h;h=h.parent){let d=dg(h.type,i,o);if(d&&h.from<h.to){let p=pg(h);if(p&&(i>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return nB(t,e,i,h,p,d,o)}}return rB(t,e,i,a,c.type,r,o)}function nB(t,e,i,n,r,o,a){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&&o.indexOf(p.type.name)>-1&&p.from<p.to){let g=pg(p);return{start:h,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(dg(p.type,i,a))d++;else if(dg(p.type,-i,a)){if(d==0){let g=pg(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 rB(t,e,i,n,r,o,a){let c=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=a.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<=o;){let b=p.value;i<0&&(x+=b.length);let w=e+x*i;for(let k=i>0?0:b.length-1,C=i>0?b.length:-1;k!=C;k+=i){let M=a.indexOf(b[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+=b.length)}return p.done?{start:d,matched:!1}:null}const sB=Object.create(null),OS=[fi.none],ES=[],NS=Object.create(null),lB=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"]])lB[t]=oB(sB,e);function Jp(t,e){ES.indexOf(t)>-1||(ES.push(t),console.warn(e))}function oB(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):Jp(d,`Modifier ${d} used at start of tag`):h.length?Jp(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:Jp(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),o=NS[r];if(o)return o.id;let a=NS[r]=fi.define({id:OS.length,name:n,props:[CC({[n]:i})]});return OS.push(a),a.id}Ze.RTL,Ze.LTR;const aB=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=m0(t.state,i.from);return n.line?uB(t):n.block?hB(t):!1};function p0(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 uB=p0(pB,0),cB=p0(VC,0),hB=p0((t,e)=>VC(t,e,dB(e)),0);function m0(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const Ko=50;function fB(t,{open:e,close:i},n,r){let o=t.sliceDoc(n-Ko,n),a=t.sliceDoc(r,r+Ko),c=/\s*$/.exec(o)[0].length,h=/^\s*/.exec(a)[0].length,d=o.length-c;if(o.slice(d-e.length,d)==e&&a.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*Ko?p=g=t.sliceDoc(n,r):(p=t.sliceDoc(n,n+Ko),g=t.sliceDoc(r-Ko,r));let x=/^\s*/.exec(p)[0].length,b=/\s*$/.exec(g)[0].length,w=g.length-b-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-b-i.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function dB(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 o=e.length-1;o>=0&&e[o].to>n.from?e[o].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function VC(t,e,i=e.selection.ranges){let n=i.map(o=>m0(e,o.from).block);if(!n.every(o=>o))return null;let r=i.map((o,a)=>fB(e,n[a],o.from,o.to));if(t!=2&&!r.every(o=>o))return{changes:e.changes(i.map((o,a)=>r[a]?[]:[{from:o.from,insert:n[a].open+" "},{from:o.to,insert:" "+n[a].close}]))};if(t!=1&&r.some(o=>o)){let o=[];for(let a=0,c;a<r.length;a++)if(c=r[a]){let h=n[a],{open:d,close:p}=c;o.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:o}}return null}function pB(t,e,i=e.selection.ranges){let n=[],r=-1;e:for(let{from:o,to:a}of i){let c=n.length,h=1e9,d;for(let p=o;p<=a;){let g=e.doc.lineAt(p);if(d==null&&(d=m0(e,g.from).line,!d))continue e;if(g.from>r&&(o==a||a>g.from)){r=g.from;let x=/^\s*/.exec(g.text)[0].length,b=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:b,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(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:h,indent:d,empty:p,single:g}of n)(g||!p)&&o.push({from:c.from+d,insert:h+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:c,token:h}of n)if(c>=0){let d=a.from+c,p=d+h.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const mg=Sn.define(),mB=Sn.define(),gB=le.define(),IC=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)})}}),QC=It.define({create(){return yn.empty},update(t,e){let i=e.state.facet(IC),n=e.annotation(mg);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=KC(p,e.startState.selection),new yn(d==0?n.rest:p,d==0?p:n.rest)}let r=e.annotation(mB);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(At.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=hi.fromTransaction(e),a=e.annotation(At.time),c=e.annotation(At.userEvent);return o?t=t.addChanges(o,a,c,i,e):e.selection&&(t=t.addSelection(e.startState.selection,a,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 yB(t={}){return[QC,IC.of(t),ie.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?YC:e.inputType=="historyRedo"?gg:null;return n?(e.preventDefault(),n(i)):!1}})]}function Gh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(QC,!1);if(!r)return!1;let o=r.pop(t,i,e);return o?(n(o),!0):!1}}const YC=Gh(0,!1),gg=Gh(1,!1),xB=Gh(0,!0),bB=Gh(1,!0);class hi{constructor(e,i,n,r,o){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}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(gB)){let o=r(e);o.length&&(n=n.concat(o))}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,o=t.slice(r,e);return o.push(n),o}function vB(t,e){let i=[],n=!1;return t.iterChangedRanges((r,o)=>i.push(r,o)),e.iterChangedRanges((r,o,a,c)=>{for(let h=0;h<i.length;){let d=i[h++],p=i[h++];c>=d&&a<=p&&(n=!0)}}),n}function SB(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function GC(t,e){return t.length?e.length?t.concat(e):t:e}const Pi=[],wB=200;function KC(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-wB));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 kB(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 $p(t,e){if(!t.length)return t;let i=t.length,n=Pi;for(;i;){let r=CB(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=t.slice(0,i);return o[i-1]=r,o}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[hi.selection(n)]:Pi}function CB(t,e,i){let n=GC(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),o=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(o):o;return new hi(r,Se.mapEffects(t.effects,e),a,t.startSelection.map(o),n)}const AB=/^(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,o){let a=this.done,c=a[a.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||AB.test(n))&&(!c.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,vB(c.changes,e.changes))||n=="input.type.compose")?a=Sh(a,a.length-1,r.minDepth,new hi(e.changes.compose(c.changes),GC(Se.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,Pi)):a=Sh(a,a.length,r.minDepth,e),new yn(a,Pi,i,n)}addSelection(e,i,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:Pi;return o.length>0&&i-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&SB(o[o.length-1],e)?this:new yn(KC(this.done,e),this.undone,i,n)}addMapping(e){return new yn($p(this.done,e),$p(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 o=r[r.length-1],a=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):i.selection);if(n&&o.selectionsAfter.length)return i.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:mg.of({side:e,rest:kB(r),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let c=r.length==1?Pi:r.slice(0,r.length-1);return o.mapped&&(c=$p(c,o.mapped)),i.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:mg.of({side:e,rest:c,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}yn.empty=new yn(Pi,Pi);const MB=[{key:"Mod-z",run:YC,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:gg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:gg,preventDefault:!0},{key:"Mod-u",run:xB,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:bB,preventDefault:!0}];function Vl(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=Vl(t.selection,i);return n.eq(t.selection,!0)?!1:(e(tn(t,n)),!0)}function Kh(t,e){return W.cursor(e?t.to:t.from)}function WC(t,e){return nn(t,i=>i.empty?t.moveByChar(i,e):Kh(i,e))}function Qt(t){return t.textDirectionAt(t.state.selection.main.head)==Ze.LTR}const XC=t=>WC(t,!Qt(t)),ZC=t=>WC(t,Qt(t));function JC(t,e){return nn(t,i=>i.empty?t.moveByGroup(i,e):Kh(i,e))}const TB=t=>JC(t,!Qt(t)),OB=t=>JC(t,Qt(t));function EB(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 Wh(t,e,i){let n=Ft(t).resolveInner(e.head),r=i?Te.closedBy:Te.openedBy;for(let h=e.head;;){let d=i?n.childAfter(h):n.childBefore(h);if(!d)break;EB(t,d,r)?n=d:h=i?d.to:d.from}let o=n.type.prop(r),a,c;return o&&(a=i?gn(t,n.from,1):gn(t,n.to,-1))&&a.matched?c=i?a.end.to:a.end.from:c=i?n.to:n.from,W.cursor(c,i?-1:1)}const NB=t=>nn(t,e=>Wh(t.state,e,!Qt(t))),RB=t=>nn(t,e=>Wh(t.state,e,Qt(t)));function $C(t,e){return nn(t,i=>{if(!i.empty)return Kh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}const eA=t=>$C(t,!1),tA=t=>$C(t,!0);function iA(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,n=0,r;if(e){for(let o of t.state.facet(ie.scrollMargins)){let a=o(t);a?.top&&(i=Math.max(a?.top,i)),a?.bottom&&(n=Math.max(a?.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 nA(t,e){let i=iA(t),{state:n}=t,r=Vl(n.selection,a=>a.empty?t.moveVertically(a,e,i.height):Kh(a,e));if(r.eq(n.selection))return!1;let o;if(i.selfScroll){let a=t.coordsAtPos(n.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),h=c.top+i.marginTop,d=c.bottom-i.marginBottom;a&&a.top>h&&a.bottom<d&&(o=ie.scrollIntoView(r.main.head,{y:"start",yMargin:a.top-h}))}return t.dispatch(tn(n,r),{effects:o}),!0}const RS=t=>nA(t,!1),yg=t=>nA(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 o=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&e.head!=n.from+o&&(r=W.cursor(n.from+o))}return r}const DB=t=>nn(t,e=>Fr(t,e,!0)),jB=t=>nn(t,e=>Fr(t,e,!1)),LB=t=>nn(t,e=>Fr(t,e,!Qt(t))),BB=t=>nn(t,e=>Fr(t,e,Qt(t))),zB=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).from,1)),_B=t=>nn(t,e=>W.cursor(t.lineBlockAt(e.head).to,-1));function HB(t,e,i){let n=!1,r=Vl(t.selection,o=>{let a=gn(t,o.head,-1)||gn(t,o.head,1)||o.head>0&&gn(t,o.head-1,1)||o.head<t.doc.length&&gn(t,o.head+1,-1);if(!a||!a.end)return o;n=!0;let c=a.start.from==o.head?a.end.to:a.end.from;return W.cursor(c)});return n?(e(tn(t,r)),!0):!1}const UB=({state:t,dispatch:e})=>HB(t,e);function Qi(t,e){let i=Vl(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 rA(t,e){return Qi(t,i=>t.moveByChar(i,e))}const sA=t=>rA(t,!Qt(t)),lA=t=>rA(t,Qt(t));function oA(t,e){return Qi(t,i=>t.moveByGroup(i,e))}const qB=t=>oA(t,!Qt(t)),PB=t=>oA(t,Qt(t)),FB=t=>Qi(t,e=>Wh(t.state,e,!Qt(t))),VB=t=>Qi(t,e=>Wh(t.state,e,Qt(t)));function aA(t,e){return Qi(t,i=>t.moveVertically(i,e))}const uA=t=>aA(t,!1),cA=t=>aA(t,!0);function hA(t,e){return Qi(t,i=>t.moveVertically(i,e,iA(t).height))}const DS=t=>hA(t,!1),jS=t=>hA(t,!0),IB=t=>Qi(t,e=>Fr(t,e,!0)),QB=t=>Qi(t,e=>Fr(t,e,!1)),YB=t=>Qi(t,e=>Fr(t,e,!Qt(t))),GB=t=>Qi(t,e=>Fr(t,e,Qt(t))),KB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).from)),WB=t=>Qi(t,e=>W.cursor(t.lineBlockAt(e.head).to)),LS=({state:t,dispatch:e})=>(e(tn(t,{anchor:0})),!0),BS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.doc.length})),!0),zS=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:0})),!0),_S=({state:t,dispatch:e})=>(e(tn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),XB=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),ZB=({state:t,dispatch:e})=>{let i=Xh(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},JB=({state:t,dispatch:e})=>{let i=Vl(t.selection,n=>{let r=Ft(t),o=r.resolveStack(n.from,1);if(n.empty){let a=r.resolveStack(n.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:c}=a;if((c.from<n.from&&c.to>=n.to||c.to>n.to&&c.from<=n.from)&&a.next)return W.range(c.to,c.from)}return n});return i.eq(t.selection)?!1:(e(tn(t,i)),!0)};function fA(t,e){let{state:i}=t,n=i.selection,r=i.selection.ranges.slice();for(let o of i.selection.ranges){let a=i.doc.lineAt(o.head);if(e?a.to<t.state.doc.length:a.from>0)for(let c=o;;){let h=t.moveVertically(c,e);if(h.head<a.from||h.head>a.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 $B=t=>fA(t,!1),e8=t=>fA(t,!0),t8=({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 Pa(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(o=>{let{from:a,to:c}=o;if(a==c){let h=e(o);h<a?(i="delete.backward",h=Tc(t,h,!1)):h>a&&(i="delete.forward",h=Tc(t,h,!0)),a=Math.min(a,h),c=Math.max(c,h)}else a=Tc(t,a,!1),c=Tc(t,c,!0);return a==c?{range:o}:{changes:{from:a,to:c},range:W.cursor(a,a<o.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 Tc(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,o)=>{r<e&&o>e&&(e=i?o:r)});return e}const dA=(t,e,i)=>Pa(t,n=>{let r=n.from,{state:o}=t,a=o.doc.lineAt(r),c,h;if(i&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(c=a.text.slice(0,r-a.from))){if(c[c.length-1]==" ")return r-1;let d=Fl(c,o.tabSize),p=d%xh(o)||xh(o);for(let g=0;g<p&&c[c.length-1-g]==" ";g++)r--;h=r}else h=Et(a.text,r-a.from,e,e)+a.from,h==r&&a.number!=(e?o.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(h-a.from,r-a.from))&&(h=Et(a.text,h-a.from,!1,!1)+a.from);return h}),xg=t=>dA(t,!1,!0),pA=t=>dA(t,!0,!1),mA=(t,e)=>Pa(t,i=>{let n=i.head,{state:r}=t,o=r.doc.lineAt(n),a=r.charCategorizer(n);for(let c=null;;){if(n==(e?o.to:o.from)){n==i.head&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=Et(o.text,n-o.from,e)+o.from,d=o.text.slice(Math.min(n,h)-o.from,Math.max(n,h)-o.from),p=a(d);if(c!=null&&p!=c)break;(d!=" "||n!=i.head)&&(c=p),n=h}return n}),gA=t=>mA(t,!1),i8=t=>mA(t,!0),n8=t=>Pa(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),r8=t=>Pa(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),s8=t=>Pa(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),l8=({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},o8=({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,o=t.doc.lineAt(r),a=r==o.from?r-1:Et(o.text,r-o.from,!1)+o.from,c=r==o.to?r+1:Et(o.text,r-o.from,!0)+o.from;return{changes:{from:a,to:c,insert:t.doc.slice(r,c).append(t.doc.slice(a,r))},range:W.cursor(c)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xh(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=t.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=t.doc.lineAt(n.to-1)),i>=r.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(n)}else e.push({from:r.from,to:o.to,ranges:[n]});i=o.number+1}return e}function yA(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let o of Xh(t)){if(i?o.to==t.doc.length:o.from==0)continue;let a=t.doc.lineAt(i?o.to+1:o.from-1),c=a.length+1;if(i){n.push({from:o.to,to:a.to},{from:o.from,insert:a.text+t.lineBreak});for(let h of o.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:a.from,to:o.from},{from:o.to,insert:t.lineBreak+a.text});for(let h of o.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})=>yA(t,e,!1),u8=({state:t,dispatch:e})=>yA(t,e,!0);function xA(t,e,i){if(t.readOnly)return!1;let n=[];for(let o of Xh(t))i?n.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):n.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.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 c8=({state:t,dispatch:e})=>xA(t,e,!1),h8=({state:t,dispatch:e})=>xA(t,e,!0),f8=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Xh(e).map(({from:r,to:o})=>(r>0?r--:o<e.doc.length&&o++,{from:r,to:o}))),n=Vl(e.selection,r=>{let o;if(t.lineWrapping){let a=t.lineBlockAt(r.head),c=t.coordsAtPos(r.head,r.assoc||1);c&&(o=a.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,o)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function d8(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),o;return n&&r&&n.to<=e&&r.from>=e&&(o=n.type.prop(Te.closedBy))&&o.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 HS=bA(!1),p8=bA(!0);function bA(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:o,to:a}=r,c=e.doc.lineAt(o),h=!t&&o==a&&d8(e,o);t&&(o=a=(a<=c.to?c:e.doc.lineAt(a)).to);let d=new Qh(e,{simulateBreak:o,simulateDoubleBreak:!!h}),p=f0(d,o);for(p==null&&(p=Fl(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<c.to&&/\s/.test(c.text[a-c.from]);)a++;h?{from:o,to:a}=h:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let g=["",Ma(e,p)];return h&&g.push(Ma(e,d.lineIndent(c.from,-1))),{changes:{from:o,to:a,insert:Ue.of(g)},range:W.cursor(o+1+g[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function g0(t,e){let i=-1;return t.changeByRange(n=>{let r=[];for(let a=n.from;a<=n.to;){let c=t.doc.lineAt(a);c.number>i&&(n.empty||n.to>c.from)&&(e(c,r,n),i=c.number),a=c.to+1}let o=t.changes(r);return{changes:r,range:W.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const m8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Qh(t,{overrideIndentation:o=>{let a=i[o];return a??-1}}),r=g0(t,(o,a,c)=>{let h=f0(n,o.from);if(h==null)return;/\S/.test(o.text)||(h=0);let d=/^\s*/.exec(o.text)[0],p=Ma(t,h);(d!=p||c.from<o.from+d.length)&&(i[o.from]=h,a.push({from:o.from,to:o.from+d.length,insert:p}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},vA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Ih)})}),{userEvent:"input.indent"})),!0),SA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let o=Fl(r,t.tabSize),a=0,c=Ma(t,Math.max(0,o-xh(t)));for(;a<r.length&&a<c.length&&r.charCodeAt(a)==c.charCodeAt(a);)a++;n.push({from:i.from+a,to:i.from+r.length,insert:c.slice(a)})}),{userEvent:"delete.dedent"})),!0),g8=t=>(t.setTabFocusMode(),!0),y8=[{key:"Ctrl-b",run:XC,shift:sA,preventDefault:!0},{key:"Ctrl-f",run:ZC,shift:lA},{key:"Ctrl-p",run:eA,shift:uA},{key:"Ctrl-n",run:tA,shift:cA},{key:"Ctrl-a",run:zB,shift:KB},{key:"Ctrl-e",run:_B,shift:WB},{key:"Ctrl-d",run:pA},{key:"Ctrl-h",run:xg},{key:"Ctrl-k",run:n8},{key:"Ctrl-Alt-h",run:gA},{key:"Ctrl-o",run:l8},{key:"Ctrl-t",run:o8},{key:"Ctrl-v",run:yg}],x8=[{key:"ArrowLeft",run:XC,shift:sA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:TB,shift:qB,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:LB,shift:YB,preventDefault:!0},{key:"ArrowRight",run:ZC,shift:lA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:OB,shift:PB,preventDefault:!0},{mac:"Cmd-ArrowRight",run:BB,shift:GB,preventDefault:!0},{key:"ArrowUp",run:eA,shift:uA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:LS,shift:zS},{mac:"Ctrl-ArrowUp",run:RS,shift:DS},{key:"ArrowDown",run:tA,shift:cA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:BS,shift:_S},{mac:"Ctrl-ArrowDown",run:yg,shift:jS},{key:"PageUp",run:RS,shift:DS},{key:"PageDown",run:yg,shift:jS},{key:"Home",run:jB,shift:QB,preventDefault:!0},{key:"Mod-Home",run:LS,shift:zS},{key:"End",run:DB,shift:IB,preventDefault:!0},{key:"Mod-End",run:BS,shift:_S},{key:"Enter",run:HS,shift:HS},{key:"Mod-a",run:XB},{key:"Backspace",run:xg,shift:xg,preventDefault:!0},{key:"Delete",run:pA,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gA,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:i8,preventDefault:!0},{mac:"Mod-Backspace",run:r8,preventDefault:!0},{mac:"Mod-Delete",run:s8,preventDefault:!0}].concat(y8.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),b8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:NB,shift:FB},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:RB,shift:VB},{key:"Alt-ArrowUp",run:a8},{key:"Shift-Alt-ArrowUp",run:c8},{key:"Alt-ArrowDown",run:u8},{key:"Shift-Alt-ArrowDown",run:h8},{key:"Mod-Alt-ArrowUp",run:$B},{key:"Mod-Alt-ArrowDown",run:e8},{key:"Escape",run:t8},{key:"Mod-Enter",run:p8},{key:"Alt-l",mac:"Ctrl-l",run:ZB},{key:"Mod-i",run:JB,preventDefault:!0},{key:"Mod-[",run:SA},{key:"Mod-]",run:vA},{key:"Mod-Alt-\\",run:m8},{key:"Shift-Mod-k",run:f8},{key:"Shift-Mod-\\",run:UB},{key:"Mod-/",run:aB},{key:"Alt-A",run:cB},{key:"Ctrl-m",mac:"Shift-Alt-m",run:g8}].concat(x8),v8={key:"Tab",run:vA,shift:SA},US=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class zl{constructor(e,i,n=0,r=e.length,o,a){this.test=a,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=o?c=>o(US(c)):US,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=Vg(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=dn(e);let r=this.normalize(i);if(r.length)for(let o=0,a=n;;o++){let c=r.charCodeAt(o),h=this.match(c,a,this.bufferPos+this.bufferStart);if(o==r.length-1){if(h)return this.value=h,this;break}a==n&&o<i.length&&i.charCodeAt(o)==c&&a++}}}match(e,i,n){let r=null;for(let o=0;o<this.matches.length;o+=2){let a=this.matches[o],c=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?r={from:this.matches[o+1],to:n}:(this.matches[o]++,c=!0)),c||(this.matches.splice(o,2),o-=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"&&(zl.prototype[Symbol.iterator]=function(){return this});const wA={from:-1,to:-1,match:/.*/.exec("")},y0="gm"+(/x/.unicode==null?"":"u");class kA{constructor(e,i,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=wA,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new CA(e,i,n,r,o);this.re=new RegExp(i,y0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.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 em=new WeakMap;class Al{constructor(e,i){this.from=e,this.text=i}get to(){return this.from+this.text.length}static get(e,i,n){let r=em.get(e);if(!r||r.from>=n||r.to<=i){let c=new Al(i,e.sliceString(i,n));return em.set(e,c),c}if(r.from==i&&r.to==n)return r;let{text:o,from:a}=r;return a>i&&(o=e.sliceString(i,a)+o,a=i),r.to<n&&(o+=e.sliceString(r.to,n)),em.set(e,new Al(a,o)),new Al(i,o.slice(i-a,n-a))}}class CA{constructor(e,i,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=wA,this.matchPos=wh(e,r),this.re=new RegExp(i,y0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=Al.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=Al.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(kA.prototype[Symbol.iterator]=CA.prototype[Symbol.iterator]=function(){return this});function S8(t){try{return new RegExp(t,y0),!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 w8=t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:r}=qL(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return r.then(o=>{let a=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!a){t.dispatch({effects:n});return}let c=e.doc.lineAt(e.selection.main.head),[,h,d,p,g]=a,x=p?+p.slice(1):0,b=d?+d:c.number;if(d&&g){let C=b/100;h&&(C=C*(h=="-"?-1:1)+c.number/e.doc.lines),b=Math.round(e.doc.lines*C)}else d&&h&&(b=b*(h=="-"?-1:1)+c.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,b))),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},k8={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},C8=le.define({combine(t){return wn(t,k8,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function A8(t){return[N8,E8]}const M8=ge.mark({class:"cm-selectionMatch"}),T8=ge.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function qS(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 O8(t,e,i,n){return t(e.sliceDoc(i,i+1))==nt.Word&&t(e.sliceDoc(n-1,n))==nt.Word}const E8=at.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(C8),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ge.none;let r=n.main,o,a=null;if(r.empty){if(!e.highlightWordAroundCursor)return ge.none;let h=i.wordAt(r.head);if(!h)return ge.none;a=i.charCategorizer(r.head),o=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(o=i.sliceDoc(r.from,r.to),a=i.charCategorizer(r.head),!(qS(a,i,r.from,r.to)&&O8(a,i,r.from,r.to)))return ge.none}else if(o=i.sliceDoc(r.from,r.to),!o)return ge.none}let c=[];for(let h of t.visibleRanges){let d=new zl(i.doc,o,h.from,h.to);for(;!d.next().done;){let{from:p,to:g}=d.value;if((!a||qS(a,i,p,g))&&(r.empty&&p<=r.from&&g>=r.to?c.push(T8.range(p,g)):(p>=r.to||g<=r.from)&&c.push(M8.range(p,g)),c.length>e.maxMatches))return ge.none}}return ge.set(c)}},{decorations:t=>t.decorations}),N8=ie.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),R8=({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 D8(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),o=r&&r.from==i.from&&r.to==i.to;for(let a=!1,c=new zl(t.doc,e,n[n.length-1].to);;)if(c.next(),c.done){if(a)return null;c=new zl(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(h=>h.from==c.value.from))continue;if(o){let h=t.wordAt(c.value.from);if(!h||h.from!=c.value.from||h.to!=c.value.to)continue}return c.value}}const j8=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return R8({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=n))return!1;let r=D8(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},Il=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 AA{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||S8(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 U8(this):new z8(this)}getCursor(e,i=0,n){let r=e.doc?e:Be.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?dl(this,r,i,n):fl(this,r,i,n)}}class MA{constructor(e){this.spec=e}}function L8(t,e,i){return(n,r,o,a)=>{if(i&&!i(n,r,o,a))return!1;let c=n>=a&&r<=a+o.length?o.slice(n-a,r-a):e.doc.sliceString(n,r);return t(c,e,n,r)}}function fl(t,e,i,n){let r;return t.wholeWord&&(r=B8(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(r=L8(t.test,e,r)),new zl(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:o=>o.toLowerCase(),r)}function B8(t,e){return(i,n,r,o)=>((o>i||o+r.length<n)&&(o=Math.max(0,i-2),r=t.sliceString(o,Math.min(t.length,n+2))),(e(kh(r,i-o))!=nt.Word||e(Ch(r,i-o))!=nt.Word)&&(e(Ch(r,n-o))!=nt.Word||e(kh(r,n-o))!=nt.Word))}class z8 extends MA{constructor(e){super(e)}nextMatch(e,i,n){let r=fl(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,i+this.spec.unquoted.length);r=fl(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let o=Math.max(i,r-1e4-this.spec.unquoted.length),a=fl(this.spec,e,o,r),c=null;for(;!a.nextOverlapping().done;)c=a.value;if(c)return c;if(o==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=fl(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 o=fl(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function _8(t,e,i){return(n,r,o)=>(!i||i(n,r,o))&&t(o[0],e,n,r)}function dl(t,e,i,n){let r;return t.wholeWord&&(r=H8(e.charCategorizer(e.selection.main.head))),t.test&&(r=_8(t.test,e,r)),new kA(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 H8(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 U8 extends MA{nextMatch(e,i,n){let r=dl(this.spec,e,n,e.doc.length).next();return r.done&&(r=dl(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let o=Math.max(i,n-r*1e4),a=dl(this.spec,e,o,n),c=null;for(;!a.next().done;)c=a.value;if(c&&(o==i||c.from>o+10))return c;if(o==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 o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return i})}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 o=dl(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}const Ta=Se.define(),x0=Se.define(),Dr=It.define({create(t){return new tm(bg(t).create(),null)},update(t,e){for(let i of e.effects)i.is(Ta)?t=new tm(i.value.create(),t.panel):i.is(x0)&&(t=new tm(t.query,i.value?b0:null));return t},provide:t=>ka.from(t,e=>e.panel)});class tm{constructor(e,i){this.query=e,this.panel=i}}const q8=ge.mark({class:"cm-searchMatch"}),P8=ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),F8=at.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,o=i.visibleRanges,a=o.length;r<a;r++){let{from:c,to:h}=o[r];for(;r<a-1&&h>o[r+1].from-500;)h=o[++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?P8:q8)})}return n.finish()}},{decorations:t=>t.decorations});function Fa(t){return e=>{let i=e.state.field(Dr,!1);return i&&i.query.spec.valid?t(e,i):EA(e)}}const Ah=Fa((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),o=t.state.facet(Il);return t.dispatch({selection:r,effects:[v0(t,n),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),OA(t),!0}),Mh=Fa((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let o=W.single(r.from,r.to),a=t.state.facet(Il);return t.dispatch({selection:o,effects:[v0(t,r),a.scrollToMatch(o.main,t)],userEvent:"select.search"}),OA(t),!0}),V8=Fa((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)}),I8=({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,o=[],a=0;for(let c=new zl(t.doc,t.sliceDoc(n,r));!c.next().done;){if(o.length>1e3)return!1;c.value.from==n&&(a=o.length),o.push(W.range(c.value.from,c.value.to))}return e(t.update({selection:W.create(o,a),userEvent:"select.search.matches"})),!0},PS=Fa((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let o=e.nextMatch(i,n,n);if(!o)return!1;let a=o,c=[],h,d,p=[];a.from==n&&a.to==r&&(d=i.toText(e.getReplacement(a)),c.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(i,a.from,a.to),p.push(ie.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+".")));let g=t.state.changes(c);return a&&(h=W.single(a.from,a.to).map(g),p.push(v0(t,a)),p.push(i.facet(Il).scrollToMatch(h.main,t))),t.dispatch({changes:g,selection:h,effects:p,userEvent:"input.replace"}),!0}),Q8=Fa((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(r=>{let{from:o,to:a}=r;return{from:o,to:a,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 b0(t){return t.state.facet(Il).createPanel(t)}function bg(t,e){var i,n,r,o,a;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(Il);return new AA({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:(o=e?.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function TA(t){let e=o0(t,b0);return e&&e.dom.querySelector("[main-field]")}function OA(t){let e=TA(t);e&&e==t.root.activeElement&&e.select()}const EA=t=>{let e=t.state.field(Dr,!1);if(e&&e.panel){let i=TA(t);if(i&&i!=t.root.activeElement){let n=bg(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ta.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[x0.of(!0),e?Ta.of(bg(t.state,e.query.spec)):Se.appendConfig.of(W8)]});return!0},NA=t=>{let e=t.state.field(Dr,!1);if(!e||!e.panel)return!1;let i=o0(t,b0);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:x0.of(!1)}),!0},Y8=[{key:"Mod-f",run:EA,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:NA,scope:"editor search-panel"},{key:"Mod-Shift-l",run:I8},{key:"Mod-Alt-g",run:w8},{key:"Mod-d",run:j8,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,o,a){return Ke("button",{class:"cm-button",name:r,onclick:o,type:"button"},a)}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",()=>V8(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",()=>PS(e),[ki(e,"replace")]),n("replaceAll",()=>Q8(e),[ki(e,"replace all")])],Ke("button",{name:"close",onclick:()=>NA(e),"aria-label":ki(e,"close"),type:"button"},["×"])])}commit(){let e=new AA({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:Ta.of(e)}))}keydown(e){Xj(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(),PS(this.view))}update(e){for(let i of e.transactions)for(let n of i.effects)n.is(Ta)&&!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(Il).top}}function ki(t,e){return t.state.phrase(e)}const Oc=30,Ec=/[\s\.,:;?!]/;function v0(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,o=Math.max(n.from,e-Oc),a=Math.min(r,i+Oc),c=t.state.sliceDoc(o,a);if(o!=n.from){for(let h=0;h<Oc;h++)if(!Ec.test(c[h+1])&&Ec.test(c[h])){c=c.slice(h);break}}if(a!=r){for(let h=c.length-1;h>c.length-Oc;h--)if(!Ec.test(c[h-1])&&Ec.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 K8=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"}}),W8=[Dr,As.low(F8),K8];class RA{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),o=r.search(DA(e,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}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 FS(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 X8(t){let e=Object.create(null),i=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let o=1;o<r.length;o++)i[r[o]]=!0}let n=FS(e)+FS(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Z8(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[i,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:X8(e);return r=>{let o=r.matchBefore(n);return o||r.explicit?{from:o?o.from:r.pos,options:e,validFor:i}:null}}class VS{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 DA(t,e){var i;let{source:n}=t,r=e&&n[0]!="^",o=n[n.length-1]!="$";return!r&&!o?t:new RegExp(`${r?"^":""}(?:${n})${o?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}const jA=Sn.define();function J8(t,e,i,n){let{main:r}=t.selection,o=i-r.from,a=n-r.from;return{...t.changeByRange(c=>{if(c!=r&&i!=n&&t.sliceDoc(c.from+o,c.from+a)!=t.sliceDoc(i,n))return{range:c};let h=t.toText(e);return{changes:{from:c.from+o,to:n==r.from?c.to:c.from+a,insert:h},range:W.cursor(c.from+o+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const IS=new WeakMap;function $8(t){if(!Array.isArray(t))return t;let e=IS.get(t);return e||IS.set(t,e=Z8(t)),e}const Th=Se.define(),Oa=Se.define();class ez{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 o=e.slice(i,i+r),a=o.toUpperCase();this.folded.push(li(a==o?o.toLowerCase():a,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:o,byWord:a}=this;if(i.length==1){let T=li(e,0),D=dn(T),j=D==e.length?0:-100;if(T!=i[0])if(T==n[0])j+=-200;else return null;return this.ret(j,[0,D])}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,D=Math.min(e.length,200);T<D&&d<h;){let j=li(e,T);(j==i[d]||j==n[d])&&(r[d++]=T),T+=dn(j)}if(d<h)return null}let p=0,g=0,x=!1,b=0,w=-1,k=-1,C=/[a-z]/.test(e),M=!0;for(let T=0,D=Math.min(e.length,200),j=0;T<D&&g<h;){let B=li(e,T);c<0&&(p<h&&B==i[p]&&(o[p++]=T),b<h&&(B==i[b]||B==n[b]?(b==0&&(w=T),k=T+1,b++):b=0));let P,H=B<255?B>=48&&B<=57||B>=97&&B<=122?2:B>=65&&B<=90?1:0:(P=Vg(B))!=P.toLowerCase()?1:P!=P.toUpperCase()?2:0;(!T||H==1&&C||j==0&&H!=0)&&(i[g]==B||n[g]==B&&(x=!0)?a[g++]=T:a.length&&(M=!1)),j=H,T+=dn(B)}return g==h&&a[0]==0&&M?this.result(-100+(x?-200:0),a,e):b==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]):b==h?this.ret(-900-e.length,[w,k]):g==h?this.result(-100+(x?-200:0)+-700+(M?0:-1100),a,e):i.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,i,n){let r=[],o=0;for(let a of i){let c=a+(this.astral?dn(li(n,a)):1);o&&r[o-1]==a?r[o-1]=c:(r[o++]=a,r[o++]=c)}return this.ret(e-n.length,r)}}class tz{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:iz,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=>QS(e(n),i(n)),optionClass:(e,i)=>n=>QS(e(n),i(n)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function QS(t,e){return t?e?t+" "+e:t:e}function iz(t,e,i,n,r,o){let a=t.textDirection==Ze.RTL,c=a,h=!1,d="top",p,g,x=e.left-r.left,b=r.right-e.right,w=n.right-n.left,k=n.bottom-n.top;if(c&&x<Math.min(w,b)?c=!1:!c&&b<Math.min(w,x)&&(c=!0),w<=(c?x:b))p=Math.max(r.top,Math.min(i.top,r.bottom-k))-e.top,g=Math.min(400,c?x:b);else{h=!0,g=Math.min(400,(a?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)/o.offsetHeight,M=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${g/M}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}function nz(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,o){let a=document.createElement("span");a.className="cm-completionLabel";let c=i.displayLabel||i.label,h=0;for(let d=0;d<o.length;){let p=o[d++],g=o[d++];p>h&&a.appendChild(document.createTextNode(c.slice(h,p)));let x=a.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(p,g))),x.className="cm-completionMatchedText",h=g}return h<c.length&&a.appendChild(document.createTextNode(c.slice(h))),a},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 im(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 rz{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:o,selected:a}=r.open,c=e.state.facet(Ot);this.optionContent=nz(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=im(o.length,a,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:Oa.of(null)})}),this.showOptions(o,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:o,selected:a,disabled:c}=n.open;(!r.open||r.open.options!=o)&&(this.range=im(o.length,a,e.state.facet(Ot).maxRenderedOptions),this.showOptions(o,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=im(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:o}=r;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(r);if(!a)return;"then"in a?a.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(a,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:o}=e;n.appendChild(r),this.infoDestroy=o||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&&lz(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(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return r.top>Math.min(o.bottom,i.bottom)-10||r.bottom<Math.max(o.top,i.top)+10?null:this.view.state.facet(Ot).positionInfo(this.view,i,r,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,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",a=>{a.target==r&&a.preventDefault()});let o=null;for(let a=n.from;a<n.to;a++){let{completion:c,match:h}=e[a],{section:d}=c;if(d){let x=typeof d=="string"?d:d.name;if(x!=o&&(a>n.from||n.from==0))if(o=x,typeof d!="string"&&d.header)r.appendChild(d.header(d));else{let b=r.appendChild(document.createElement("completion-section"));b.textContent=x}}const p=r.appendChild(document.createElement("li"));p.id=i+"-"+a,p.setAttribute("role","option");let g=this.optionClass(c);g&&(p.className=g);for(let x of this.optionContent){let b=x(c,this.view.state,this.view,h);b&&p.appendChild(b)}}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 sz(t,e){return i=>new rz(i,t,e)}function lz(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 oz(t,e){let i=[],n=null,r=null,o=p=>{i.push(p);let{section:g}=p.completion;if(g){n||(n=[]);let x=typeof g=="string"?g:g.name;n.some(b=>b.name==x)||n.push(typeof g=="string"?{name:x}:g)}},a=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)o(new VS(x,p.source,g?g(x):[],1e9-i.length));else{let x=e.sliceDoc(p.from,p.to),b,w=a.filterStrict?new tz(x):new ez(x);for(let k of p.result.options)if(b=w.match(k.label)){let C=k.displayLabel?g?g(k,b.matched):[]:b.matched,M=b.score+(k.boost||0);if(o(new VS(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=(b,w)=>(b.rank==="dynamic"&&w.rank==="dynamic"?r[w.name]-r[b.name]:0)||(typeof b.rank=="number"?b.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(b.name<w.name?-1:1);for(let b of n.sort(x))g-=1e5,p[b.name]=g;for(let b of i){let{section:w}=b.completion;w&&(b.score+=p[typeof w=="string"?w:w.name])}}let c=[],h=null,d=a.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 bl{constructor(e,i,n,r,o,a){this.options=e,this.attrs=i,this.tooltip=n,this.timestamp=r,this.selected=o,this.disabled=a}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new bl(this.options,GS(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,n,r,o,a){if(r&&!a&&e.some(d=>d.isPending))return r.setDisabled();let c=oz(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 bl(c,GS(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:dz,above:o.aboveCursor},r?r.timestamp:Date.now(),h,!1)}map(e){return new bl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new bl(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(hz,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,n=i.facet(Ot),o=(n.override||i.languageDataAt("autocomplete",xs(i)).map($8)).map(h=>(this.active.find(p=>p.source==h)||new Fi(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((h,d)=>h==this.active[d])&&(o=this.active);let a=this.open,c=e.effects.some(h=>h.is(S0));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!az(o,this.active)||c?a=bl.build(o,i,this.id,a,n,c):a&&a.disabled&&!o.some(h=>h.isPending)&&(a=null),!a&&o.every(h=>!h.isPending)&&o.some(h=>h.hasResult())&&(o=o.map(h=>h.hasResult()?new Fi(h.source,0):h));for(let h of e.effects)h.is(BA)&&(a=a&&a.setSelected(h.value,this.id));return o==this.active&&a==this.open?this:new Oh(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?uz:cz}}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,o=n==e.length;if(r||o)return r==o;if(t[i++].result!=e[n++].result)return!1}}const uz={"aria-autocomplete":"list"},cz={};function GS(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const hz=[];function LA(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(jA);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=LA(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 o of e.effects)if(o.is(Th))r=new Fi(r.source,1,o.value);else if(o.is(Oa))r=new Fi(r.source,0);else if(o.is(S0))for(let a of o.value)a.source==r.source&&(r=a);return r}updateFor(e,i){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(xs(e.state))}}class Ml extends Fi{constructor(e,i,n,r,o,a){super(e,3,i),this.limit=n,this.result=r,this.from=o,this.to=a}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 o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),c=xs(e.state);if(c>a||!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 fz(r.validFor,e.state,o,a)?new Ml(this.source,this.explicit,h,r,o,a):r.update&&(r=r.update(r,o,a,new RA(e.state,c,!1)))?new Ml(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 Ml(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 fz(t,e,i,n){if(!t)return!1;let r=e.sliceDoc(i,n);return typeof t=="function"?t(r,i,n,e):DA(t,!0).test(r)}const S0=Se.define({map(t,e){return t.map(i=>i.map(e))}}),BA=Se.define(),oi=It.define({create(){return Oh.start()},update(t,e){return t.update(e)},provide:t=>[l0.from(t,e=>e.tooltip),ie.contentAttributes.from(t,e=>e.attrs)]});function w0(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(oi).active.find(r=>r.source==e.source);return n instanceof Ml?(typeof i=="string"?t.dispatch({...J8(t.state,i,n.from,n.to),annotations:jA.of(e.completion)}):i(t,e.completion,n.from,n.to),!0):!1}const dz=sz(oi,w0);function Nc(t,e="option"){return i=>{let n=i.state.field(oi,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(Ot).interactionDelay)return!1;let r=1,o;e=="page"&&(o=dC(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=n.open.options,c=n.open.selected>-1?n.open.selected+r*(t?1:-1):t?0:a-1;return c<0?c=e=="page"?0:a-1:c>=a&&(c=e=="page"?a-1:0),i.dispatch({effects:BA.of(c)}),!0}}const pz=t=>{let e=t.state.field(oi,!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:w0(t,e.open.options[e.open.selected])},nm=t=>t.state.field(oi,!1)?(t.dispatch({effects:Th.of(!0)}),!0):!1,mz=t=>{let e=t.state.field(oi,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:Oa.of(null)}),!0)};class gz{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}}const yz=50,xz=1e3,bz=at.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(oi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(oi),i=t.state.facet(Ot);if(!t.selectionSet&&!t.docChanged&&t.startState.field(oi)==e)return;let n=t.transactions.some(o=>{let a=LA(o,i);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;o<this.running.length;o++){let a=this.running[o];if(n||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>yz&&Date.now()-a.time>xz){for(let c of a.context.abortListeners)try{c()}catch(h){ci(this.view.state,h)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(a=>a.is(Th)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let o of t.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(oi);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 RA(e,i,t.explicit,this.view),r=new gz(t,n);this.running.push(r),Promise.resolve(t.source(n)).then(o=>{r.context.aborted||(r.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Oa.of(null)}),ci(this.view.state,o)})}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(oi);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(o.done===void 0)continue;if(this.running.splice(r--,1),o.done){let c=xs(o.updates.length?o.updates[0].startState:this.view.state),h=Math.min(c,o.done.from+(o.active.explicit?0:1)),d=new Ml(o.active.source,o.active.explicit,h,o.done,o.done.from,(t=o.done.to)!==null&&t!==void 0?t:c);for(let p of o.updates)d=d.update(p,i);if(d.hasResult()){e.push(d);continue}}let a=n.active.find(c=>c.source==o.active.source);if(a&&a.isPending)if(o.done==null){let c=new Fi(o.active.source,0);for(let h of o.updates)c=c.update(h,i);c.isPending||e.push(c)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:S0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(oi,!1);if(e&&e.tooltip&&this.view.state.facet(Ot).closeOnBlur){let i=e.open&&dC(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Oa.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Th.of(!1)}),20),this.composing=0}}}),vz=typeof navigator=="object"&&/Win/.test(navigator.platform),Sz=As.highest(ie.domEventHandlers({keydown(t,e){let i=e.state.field(oi,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(vz&&t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],r=i.active.find(a=>a.source==n.source),o=n.completion.commitCharacters||r.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&w0(e,n),!1}})),wz=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"}}}),Ea={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ms=Se.define({map(t,e){let i=e.mapPos(t,-1,Zt.TrackAfter);return i??void 0}}),k0=new class extends Br{};k0.startSide=1;k0.endSide=-1;const zA=It.define({create(){return Ne.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:[k0.range(i.value,i.value+1)]}));return t}});function kz(){return[Az,zA]}const rm="()[]{}<>«»»«[]{}";function _A(t){for(let e=0;e<rm.length;e+=2)if(rm.charCodeAt(e)==t)return rm.charAt(e+1);return Vg(t<128?t:t+1)}function HA(t,e){return t.languageDataAt("closeBrackets",e)[0]||Ea}const Cz=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Az=ie.inputHandler.of((t,e,i,n)=>{if((Cz?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 o=Oz(t.state,n);return o?(t.dispatch(o),!0):!1}),Mz=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=HA(t,t.selection.main.head).brackets||Ea.brackets,r=null,o=t.changeByRange(a=>{if(a.empty){let c=Ez(t.doc,a.head);for(let h of n)if(h==c&&Zh(t.doc,a.head)==_A(li(h,0)))return{changes:{from:a.head-h.length,to:a.head+h.length},range:W.cursor(a.head-h.length)}}return{range:r=a}});return r||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},Tz=[{key:"Backspace",run:Mz}];function Oz(t,e){let i=HA(t,t.selection.main.head),n=i.brackets||Ea.brackets;for(let r of n){let o=_A(li(r,0));if(e==r)return o==r?Dz(t,r,n.indexOf(r+r+r)>-1,i):Nz(t,r,o,i.before||Ea.before);if(e==o&&UA(t,t.selection.main.from))return Rz(t,r,o)}return null}function UA(t,e){let i=!1;return t.field(zA).between(0,t.doc.length,n=>{n==e&&(i=!0)}),i}function Zh(t,e){let i=t.sliceString(e,e+2);return i.slice(0,dn(li(i,0)))}function Ez(t,e){let i=t.sliceString(e-2,e);return dn(li(i,0))==i.length?i:i.slice(1)}function Nz(t,e,i,n){let r=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:i,from:a.to}],effects:ms.of(a.to+e.length),range:W.range(a.anchor+e.length,a.head+e.length)};let c=Zh(t.doc,a.head);return!c||/\s/.test(c)||n.indexOf(c)>-1?{changes:{insert:e+i,from:a.head},effects:ms.of(a.head+e.length),range:W.cursor(a.head+e.length)}:{range:r=a}});return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Rz(t,e,i){let n=null,r=t.changeByRange(o=>o.empty&&Zh(t.doc,o.head)==i?{changes:{from:o.head,to:o.head+i.length,insert:i},range:W.cursor(o.head+i.length)}:n={range:o});return n?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Dz(t,e,i,n){let r=n.stringPrefixes||Ea.stringPrefixes,o=null,a=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=Zh(t.doc,h),p;if(d==e){if(KS(t,h))return{changes:{insert:e+e,from:h},effects:ms.of(h+e.length),range:W.cursor(h+e.length)};if(UA(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=WS(t,h-2*e.length,r))>-1&&KS(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&&WS(t,h,r)>-1&&!jz(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:o=c}});return o?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function KS(t,e){let i=Ft(t).resolveInner(e+1);return i.parent&&i.from==e}function jz(t,e,i,n){let r=Ft(t).resolveInner(e,-1),o=n.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<5;a++){let c=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+o)),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 WS(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 o=e-r.length;if(t.sliceDoc(o,e)==r&&n(t.sliceDoc(o-1,o))!=nt.Word)return o}return-1}function Lz(t={}){return[Sz,oi,Ot.of(t),bz,Bz,wz]}const qA=[{key:"Ctrl-Space",run:nm},{mac:"Alt-`",run:nm},{mac:"Alt-i",run:nm},{key:"Escape",run:mz},{key:"ArrowDown",run:Nc(!0)},{key:"ArrowUp",run:Nc(!1)},{key:"PageDown",run:Nc(!0,"page")},{key:"PageUp",run:Nc(!1,"page")},{key:"Enter",run:pz}],Bz=As.highest(Fh.computeN([Ot],t=>t.facet(Ot).defaultKeymap?[qA]:[]));class XS{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(Na).markerFilter;r&&(e=r(e,n));let o=e.slice().sort((b,w)=>b.from-w.from||b.to-w.to),a=new Kn,c=[],h=0,d=n.doc.iter(),p=0,g=n.doc.length;for(let b=0;;){let w=b==o.length?null:o[b];if(!w&&!c.length)break;let k,C;if(c.length)k=h,C=c.reduce((D,j)=>Math.min(D,j.to),w&&w.from>k?w.from:1e8);else{if(k=w.from,k>g)break;C=w.to,c.push(w),b++}for(;b<o.length;){let D=o[b];if(D.from==k&&(D.to>D.from||D.to==k))c.push(D),b++,C=Math.min(D.to,C);else{C=Math.min(D.from,C);break}}C=Math.min(C,g);let M=!1;if(c.some(D=>D.from==k&&(D.to==C||C==g))&&(M=k==C,!M&&C-k<10)){let D=k-(p+d.value.length);D>0&&(d.next(D),p=k);for(let j=k;;){if(j>=C){M=!0;break}if(!d.lineBreak&&p+d.value.length>j)break;j=p+d.value.length,p+=d.value.length,d.next()}}let T=Kz(c);if(M)a.add(k,k,ge.widget({widget:new Iz(T),diagnostics:c.slice()}));else{let D=c.reduce((j,B)=>B.markClass?j+" "+B.markClass:j,"");a.add(k,C,ge.mark({class:"cm-lintRange cm-lintRange-"+T+D,diagnostics:c.slice(),inclusiveEnd:c.some(j=>j.to>C)}))}if(h=C,h==g)break;for(let D=0;D<c.length;D++)c[D].to<=h&&c.splice(D--,1)}let x=a.finish();return new hs(x,i,Pr(x))}}function Pr(t,e=null,i=0){let n=null;return t.between(i,1e9,(r,o,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!n)n=new XS(r,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new XS(n.from,o,n.diagnostic)}}),n}function zz(t,e){let i=e.pos,n=e.end||i,r=t.state.facet(Na).hideOn(t,i,n);if(r!=null)return r;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(PA))||t.changes.touchesRange(o.from,Math.max(o.to,n)))}function _z(t,e){return t.field(Mi,!1)?e:e.concat(Se.appendConfig.of(Wz))}const PA=Se.define(),C0=Se.define(),FA=Se.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 o=e.changes.mapPos(t.selected.from,1);n=Pr(i,t.selected.diagnostic,o)||Pr(i,null,o)}!i.size&&r&&e.state.facet(Na).autoPanel&&(r=null),t=new hs(i,r,n)}for(let i of e.effects)if(i.is(PA)){let n=e.state.facet(Na).autoPanel?i.value.length?Ra.open:null:t.panel;t=hs.init(i.value,n,e.state)}else i.is(C0)?t=new hs(t.diagnostics,i.value?Ra.open:null,t.selected):i.is(FA)&&(t=new hs(t.diagnostics,t.panel,i.value));return t},provide:t=>[ka.from(t,e=>e.panel),ie.decorations.from(t,e=>e.diagnostics)]}),Hz=ge.mark({class:"cm-lintRange cm-lintRange-active"});function Uz(t,e,i){let{diagnostics:n}=t.state.field(Mi),r,o=-1,a=-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,o=h,a=d,!1});let c=t.state.facet(Na).tooltipFilter;return r&&c&&(r=c(r,t.state)),r?{pos:o,end:a,above:t.state.doc.lineAt(o).to<a,create(){return{dom:qz(t,r)}}}:null}function qz(t,e){return Ke("ul",{class:"cm-tooltip-lint"},e.map(i=>IA(t,i,!1)))}const Pz=t=>{let e=t.state.field(Mi,!1);(!e||!e.panel)&&t.dispatch({effects:_z(t.state,[C0.of(!0)])});let i=o0(t,Ra.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},ZS=t=>{let e=t.state.field(Mi,!1);return!e||!e.panel?!1:(t.dispatch({effects:C0.of(!1)}),!0)},Fz=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)},Vz=[{key:"Mod-Shift-m",run:Pz,preventDefault:!0},{key:"F8",run:Fz}],Na=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:JS,tooltipFilter:JS,needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i,hideOn:(e,i)=>e?i?(n,r,o)=>e(n,r,o)||i(n,r,o):e:i,autoPanel:(e,i)=>e||i})}}});function JS(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function VA(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(o=>o.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function IA(t,e,i){var n;let r=i?VA(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((o,a)=>{let c=!1,h=b=>{if(b.preventDefault(),c)return;c=!0;let w=Pr(t.state.field(Mi).diagnostics,e);w&&o.apply(t,w.from,w.to)},{name:d}=o,p=r[a]?d.indexOf(r[a]):-1,g=p<0?d:[d.slice(0,p),Ke("u",d.slice(p,p+1)),d.slice(p+1)],x=o.markClass?" "+o.markClass:"";return Ke("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:h,onmousedown:h,"aria-label":` Action: ${d}${p<0?"":` (access key "${r[a]})"`}.`},g)}),e.source&&Ke("div",{class:"cm-diagnosticSource"},e.source))}class Iz 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 $S{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=IA(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ra{constructor(e){this.view=e,this.items=[];let i=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)ZS(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:o}=this.items[this.selectedIndex],a=VA(o.actions);for(let c=0;c<a.length;c++)if(a[c].toUpperCase().charCodeAt(0)==r.keyCode){let h=Pr(this.view.state.field(Mi).diagnostics,o);h&&o.actions[c].apply(e,h.from,h.to)}}else return;r.preventDefault()}},n=r=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(r.target)&&this.moveSelection(o)};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:()=>ZS(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,o=null,a=new Set;for(e.between(0,this.view.state.doc.length,(c,h,{spec:d})=>{for(let p of d.diagnostics){if(a.has(p))continue;a.add(p);let g=-1,x;for(let b=n;b<this.items.length;b++)if(this.items[b].diagnostic==p){g=b;break}g<0?(x=new $S(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"),o=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 $S(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.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:FA.of(n)})}static open(e){return new Ra(e)}}function Qz(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 Rc(t){return Qz(`<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 Yz=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:Rc("#d11")},".cm-lintRange-warning":{backgroundImage:Rc("orange")},".cm-lintRange-info":{backgroundImage:Rc("#999")},".cm-lintRange-hint":{backgroundImage:Rc("#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 Kz(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 Wz=[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([Hz.range(e.from,e.to)])}),HL(Uz,{hideOn:zz}),Yz];var e2=function(e){e===void 0&&(e={});var{crosshairCursor:i=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(Tz)),e.defaultKeymap!==!1&&(n=n.concat(b8)),e.searchKeymap!==!1&&(n=n.concat(Y8)),e.historyKeymap!==!1&&(n=n.concat(MB)),e.foldKeymap!==!1&&(n=n.concat(q6)),e.completionKeymap!==!1&&(n=n.concat(qA)),e.lintKeymap!==!1&&(n=n.concat(Vz));var r=[];return e.lineNumbers!==!1&&r.push(ZL()),e.highlightActiveLineGutter!==!1&&r.push(e6()),e.highlightSpecialChars!==!1&&r.push(dL()),e.history!==!1&&r.push(yB()),e.foldGutter!==!1&&r.push(I6()),e.drawSelection!==!1&&r.push(iL()),e.dropCursor!==!1&&r.push(oL()),e.allowMultipleSelections!==!1&&r.push(Be.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(N6()),e.syntaxHighlighting!==!1&&r.push(UC(K6,{fallback:!0})),e.bracketMatching!==!1&&r.push(tB()),e.closeBrackets!==!1&&r.push(kz()),e.autocompletion!==!1&&r.push(Lz()),e.rectangularSelection!==!1&&r.push(TL()),i!==!1&&r.push(NL()),e.highlightActiveLine!==!1&&r.push(bL()),e.highlightSelectionMatches!==!1&&r.push(A8()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Ih.of(" ".repeat(e.tabSize))),r.concat([Fh.of(n.flat())]).filter(Boolean)};const Xz="#e5c07b",t2="#e06c75",Zz="#56b6c2",Jz="#ffffff",Vc="#abb2bf",vg="#7d8799",$z="#61afef",e9="#98c379",i2="#d19a66",t9="#c678dd",i9="#21252b",n2="#2c313a",r2="#282c34",sm="#353a42",n9="#3E4451",s2="#528bff",r9=ie.theme({"&":{color:Vc,backgroundColor:r2},".cm-content":{caretColor:s2},".cm-cursor, .cm-dropCursor":{borderLeftColor:s2},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:n9},".cm-panels":{backgroundColor:i9,color:Vc},".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:r2,color:vg,border:"none"},".cm-activeLineGutter":{backgroundColor:n2},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:sm},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:sm,borderBottomColor:sm},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:n2,color:Vc}}},{dark:!0}),s9=qa.define([{tag:I.keyword,color:t9},{tag:[I.name,I.deleted,I.character,I.propertyName,I.macroName],color:t2},{tag:[I.function(I.variableName),I.labelName],color:$z},{tag:[I.color,I.constant(I.name),I.standard(I.name)],color:i2},{tag:[I.definition(I.name),I.separator],color:Vc},{tag:[I.typeName,I.className,I.number,I.changed,I.annotation,I.modifier,I.self,I.namespace],color:Xz},{tag:[I.operator,I.operatorKeyword,I.url,I.escape,I.regexp,I.link,I.special(I.string)],color:Zz},{tag:[I.meta,I.comment],color:vg},{tag:I.strong,fontWeight:"bold"},{tag:I.emphasis,fontStyle:"italic"},{tag:I.strikethrough,textDecoration:"line-through"},{tag:I.link,color:vg,textDecoration:"underline"},{tag:I.heading,fontWeight:"bold",color:t2},{tag:[I.atom,I.bool,I.special(I.variableName)],color:i2},{tag:[I.processingInstruction,I.string,I.inserted],color:e9},{tag:I.invalid,color:Jz}]),l9=[r9,UC(s9)];var o9=ie.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),a9=function(e){e===void 0&&(e={});var{indentWithTab:i=!0,editable:n=!0,readOnly:r=!1,theme:o="light",placeholder:a="",basicSetup:c=!0}=e,h=[];switch(i&&h.unshift(Fh.of([v8])),c&&(typeof c=="boolean"?h.unshift(e2()):h.unshift(e2(c))),a&&h.unshift(kL(a)),o){case"light":h.push(o9);break;case"dark":h.push(l9);break;case"none":break;default:h.push(o);break}return n===!1&&h.push(ie.editable.of(!1)),r&&h.push(Be.readOnly.of(!0)),[...h]},u9=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 c9{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 l2{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 lm=null,h9=()=>typeof window>"u"?new l2:(lm||(lm=new l2),lm),o2=Sn.define(),f9=200,d9=[];function p9(t){var{value:e,selection:i,onChange:n,onStatistics:r,onCreateEditor:o,onUpdate:a,extensions:c=d9,autoFocus:h,theme:d="light",height:p=null,minHeight:g=null,maxHeight:x=null,width:b=null,minWidth:w=null,maxWidth:k=null,placeholder:C="",editable:M=!0,readOnly:T=!1,indentWithTab:D=!0,basicSetup:j=!0,root:B,initialState:P}=t,[H,Z]=N.useState(),[J,ue]=N.useState(),[oe,F]=N.useState(),ee=N.useState(()=>({current:null}))[0],fe=N.useState(()=>({current:null}))[0],de=ie.theme({"&":{height:p,minHeight:g,maxHeight:x,width:b,minWidth:w,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),q=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 c9(()=>{if(fe.current){var Q=fe.current;fe.current=null,Q()}ee.current=null},f9),h9().add(ee.current));var ye=ce.state.doc,E=ye.toString();n(E,ce)}r&&r(u9(ce))}),X=a9({theme:d,editable:M,readOnly:T,placeholder:C,indentWithTab:D,basicSetup:j}),ne=[q,de,...X];return a&&typeof a=="function"&&ne.push(ie.updateListener.of(a)),ne=ne.concat(c),N.useLayoutEffect(()=>{if(H&&!oe){var ce={doc:e,selection:i,extensions:ne},ye=P?Be.fromJSON(P.json,ce,P.fields):Be.create(ce);if(F(ye),!J){var E=new ie({state:ye,parent:H,root:B});ue(E),o&&o(E,ye)}}return()=>{J&&(F(void 0),ue(void 0))}},[H,oe]),N.useEffect(()=>{t.container&&Z(t.container)},[t.container]),N.useEffect(()=>()=>{J&&(J.destroy(),ue(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[J]),N.useEffect(()=>{h&&J&&J.focus()},[h,J]),N.useEffect(()=>{J&&J.dispatch({effects:Se.reconfigure.of(ne)})},[d,c,p,g,x,b,w,k,C,M,T,D,j,n,a]),N.useEffect(()=>{if(e!==void 0){var ce=J?J.state.doc.toString():"";if(J&&e!==ce){var ye=ee.current&&!ee.current.isDone,E=()=>{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=E:E()}}},[e,J]),{state:oe,setState:F,view:J,setView:ue,container:H,setContainer:Z}}var m9=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],QA=N.forwardRef((t,e)=>{var{className:i,value:n="",selection:r,extensions:o=[],onChange:a,onStatistics:c,onCreateEditor:h,onUpdate:d,autoFocus:p,theme:g="light",height:x,minHeight:b,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:T,placeholder:D,indentWithTab:j,editable:B,readOnly:P,root:H,initialState:Z}=t,J=F4(t,m9),ue=N.useRef(null),{state:oe,view:F,container:ee,setContainer:fe}=p9({root:H,value:n,autoFocus:p,theme:g,height:x,minHeight:b,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:T,placeholder:D,indentWithTab:j,editable:B,readOnly:P,selection:r,onChange:a,onStatistics:c,onCreateEditor:h,onUpdate:d,extensions:o,initialState:Z});N.useImperativeHandle(e,()=>({editor:ue.current,state:oe,view:F}),[ue,ee,oe,F]);var de=N.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 q=typeof g=="string"?"cm-theme-"+g:"cm-theme";return v.jsx("div",Tm({ref:de,className:""+q+(i?" "+i:"")},J))});QA.displayName="CodeMirror";var a2={};class Eh{constructor(e,i,n,r,o,a,c,h,d,p=0,g){this.p=e,this.stack=i,this.state=n,this.reducePos=r,this.pos=o,this.score=a,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 u2(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:o}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=o.dynamicPrecedence(r);if(c&&(this.score+=c),n==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,a?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<o.minRepeatTerm||e&131072){let b=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,b,x+4,!0)}if(e&262144)this.state=this.stack[h];else{let b=this.stack[h-3];this.state=o.getGoto(b,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,i,n,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,c=this.buffer.length;if(c==0&&a.parent&&(c=a.bufferBase-a.parent.bufferBase,a=a.parent),c>0&&a.buffer[c-4]==0&&a.buffer[c-1]>-1){if(i==n)return;if(a.buffer[c-2]>=i){a.buffer[c-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,i,n,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let c=!1;for(let h=a;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){c=!0;break}if(c)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=e,this.buffer[a+1]=i,this.buffer[a+2]=n,this.buffer[a+3]=r}}shift(e,i,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=r;let c=a.stateFlag(o,1);!c&&(r>n||i<=a.maxNode)&&(this.reducePos=r),this.pushState(o,c?n:Math.min(n,this.reducePos)),this.shiftContext(i,n),i<=a.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 g9(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 o=0,a;o<i.length;o+=2)(a=i[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&r.push(i[o],a);if(this.stack.length<120)for(let o=0;r.length<8&&o<i.length;o+=2){let a=i[o+1];r.some((c,h)=>h&1&&c==a)||r.push(i[o],a)}i=r}let n=[];for(let r=0;r<i.length&&n.length<4;r+=2){let o=i[r+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(i[r],this.pos),a.reducePos=this.pos,a.score-=200,n.push(a)}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,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],r,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;i=a}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,o)=>{if(!i.includes(r))return i.push(r),e.allActions(r,a=>{if(!(a&393216))if(a&65536){let c=(a>>19)-o;if(c>1){let h=a&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(a,o+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 u2(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 u2{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class g9{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 Dc(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let n=0,r=0;n<t.length;){let o=0;for(;;){let a=t.charCodeAt(n++),c=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let h=a-32;if(h>=46&&(h-=46,c=!0),o+=h,c)break;o*=46}i?i[r++]=o:i=new e(o)}return i}class Ic{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const c2=new Ic;class y9{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=c2,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,o=this.pos+e;for(;o<n.from;){if(!r)return null;let a=this.ranges[--r];o-=n.from-a.to,n=a}for(;i<0?o>n.to:o>=n.to;){if(r==this.ranges.length-1)return null;let a=this.ranges[++r];o+=a.from-n.to,n=a}return o}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 o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let a=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++a];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=c2,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 Tl{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;x9(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}Tl.prototype.contextual=Tl.prototype.fallback=Tl.prototype.extend=!1;Tl.prototype.fallback=Tl.prototype.extend=!1;function x9(t,e,i,n,r,o){let a=0,c=1<<n,{dialect:h}=i.p.parser;e:for(;(c&t[a])!=0;){let d=t[a+1];for(let b=a+3;b<d;b+=2)if((t[b+1]&c)>0){let w=t[b];if(h.allows(w)&&(e.token.value==-1||e.token.value==w||b9(w,e.token.value,r,o))){e.acceptToken(w);break}}let p=e.next,g=0,x=t[a+2];if(e.next<0&&x>g&&t[d+x*3-3]==65535){a=t[d+x*3-1];continue e}for(;g<x;){let b=g+x>>1,w=d+b+(b<<1),k=t[w],C=t[w+1]||65536;if(p<k)x=b;else if(p>=C)g=b+1;else{a=t[w+2],e.advance();continue e}}break}}function h2(t,e,i){for(let n=e,r;(r=t[n])!=65535;n++)if(r==i)return n-e;return-1}function b9(t,e,i,n){let r=h2(i,n,e);return r<0||h2(i,n,t)<r}const Ci=typeof process<"u"&&a2&&/\bparse\b/.test(a2.LOG);let om=null;function f2(t,e,i){let n=t.cursor(ot.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 v9{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?f2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?f2(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 o=n.children[r],a=this.start[i]+n.positions[r];if(a>e)return this.nextStart=a,null;if(o instanceof dt){if(a==e){if(a<this.safeFrom)return null;let c=a+o.length;if(c<=this.safeTo){let h=o.prop(Te.lookAhead);if(!h||c+h<this.fragment.to)return o}}this.index[i]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[i]++,this.nextStart=a+o.length}}}class S9{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Ic)}getActions(e){let i=0,n=null,{parser:r}=e.p,{tokenizers:o}=r,a=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<o.length;d++){if((1<<d&a)==0)continue;let p=o[d],g=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=a||g.context!=c)&&(this.updateCachedToken(g,p,e),g.mask=a,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 Ic,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 Ic,{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:o}=n.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let c=o.specializers[a](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 o=0;o<r;o+=3)if(this.actions[o]==e)return r;return this.actions[r++]=e,this.actions[r++]=i,this.actions[r++]=n,r}addActions(e,i,n,r){let{state:o}=e,{parser:a}=e.p,{data:c}=a;for(let h=0;h<2;h++)for(let d=a.stateSlot(o,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 w9{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 y9(i,r),this.tokens=new S9(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[Eh.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new v9(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let c=e[a];for(;;){if(this.tokens.mainToken=null,c.pos>i)n.push(c);else{if(this.advanceStack(c,n,e))continue;{r||(r=[],o=[]),r.push(c);let h=this.tokens.getMainToken(c);o.push(h.value,h.end)}}break}}if(!n.length){let a=r&&C9(r);if(a)return Ci&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);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 a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,n);if(a)return Ci&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((c,h)=>h.score-c.score);n.length>a;)n.pop();n.some(c=>c.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let a=0;a<n.length-1;a++){let c=n[a];for(let h=a+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(a--,1);continue e}}}n.length>12&&(n.sort((a,c)=>c.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a<n.length;a++)n[a].pos<this.minStackPos&&(this.minStackPos=n[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let r=e.pos,{parser:o}=this,a=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?o.getGoto(e.state,g.type.id):-1;if(x>-1&&g.length&&(!d||(g.prop(Te.contextHash)||0)==p))return e.useNode(g,x),Ci&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(g.type.id)})`),!0;if(!(g instanceof dt)||g.children.length==0||g.positions[0]>0)break;let b=g.children[0];if(b instanceof dt&&g.positions[0]==0)g=b;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ci&&console.log(a+this.stackID(e)+` (via always-reduce ${o.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++],b=d==h.length||!n,w=b?e:e.split(),k=this.tokens.mainToken;if(w.apply(p,g,k?k.start:w.pos,x),Ci&&console.log(a+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${r}${w==e?"":", split"})`),b)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 d2(e,i),!0}}runRecovery(e,i,n){let r=null,o=!1;for(let a=0;a<e.length;a++){let c=e[a],h=i[a<<1],d=i[(a<<1)+1],p=Ci?this.stackID(c)+" -> ":"";if(c.deadEnd&&(o||(o=!0,c.restart(),Ci&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let g=c.split(),x=p;for(let b=0;b<10&&g.forceReduce()&&(Ci&&console.log(x+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,n));b++)Ci&&(x=this.stackID(g)+" -> ");for(let b of c.recoverByInsert(h))Ci&&console.log(p+this.stackID(b)+" (via recover-insert)"),this.advanceFully(b,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)})`),d2(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=(om||(om=new WeakMap)).get(e);return i||om.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function d2(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 k9{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 kC{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 o(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=Te[h]);for(let d=1;d<c.length;){let p=c[d++];if(p>=0)o(p,h,c[d++]);else{let g=c[d+-p];for(let x=-p;x>0;x--)o(c[d++],h,g);d++}}}this.nodeSet=new a0(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=bC;let a=Dc(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(p2),this.states=Dc(e.states,Uint32Array),this.data=Dc(e.stateData),this.goto=Dc(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new Tl(a,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 w9(this,e,i,n);for(let o of this.wrappers)r=o(r,e,i,n);return r}getGoto(e,i,n=!1){let r=this.goto;if(i>=r[0])return-1;for(let o=r[i+1];;){let a=r[o++],c=a&1,h=r[o++];if(c&&n)return h;for(let d=o+(a>>1);o<d;o++)if(r[o]==e)return h;if(c)return-1}}hasAction(e,i){let n=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),a;;o+=3){if((a=n[o])==65535)if(n[o+1]==1)a=n[o=Vn(n,o+2)];else{if(n[o+1]==2)return Vn(n,o+2);break}if(a==i||a==0)return Vn(n,o+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 o=this.stateSlot(e,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Vn(this.data,o+2);else break;r=i(Vn(this.data,o+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((o,a)=>a&1&&o==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(o=>o.from==n);return r?r.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,r)=>{let o=e.specializers.find(c=>c.from==n.external);if(!o)return n;let a=Object.assign(Object.assign({},n),{external:o.to});return i.specializers[r]=p2(a),a})),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 o of e.split(" ")){let a=i.indexOf(o);a>=0&&(n[a]=!0)}let r=null;for(let o=0;o<i.length;o++)if(!n[o])for(let a=this.dialects[i[o]],c;(c=this.data[a++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new k9(e,n,r)}static deserialize(e){return new Rh(e)}}function Vn(t,e){return t[e]|t[e+1]<<16}function C9(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 p2(t){if(t.external){let e=t.extend?1:0;return(i,n)=>t.external(i,n)<<1|e}return t.get}const A9=CC({String:I.string,Number:I.number,"True False":I.bool,PropertyName:I.propertyName,Null:I.null,", :":I.separator,"[ ]":I.squareBracket,"{ }":I.brace}),M9=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:[A9],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}),T9=gh.define({name:"json",parser:M9.configure({props:[OC.add({Object:CS({except:/^\s*\}/}),Array:CS({except:/^\s*\]/})}),NC.add({"Object Array":D6})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function O9(){return new v6(T9)}const am=[200,201,204,400,401,403,404,500,502,503],E9=["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"],N9=["application/json","text/plain","text/html","application/xml","application/octet-stream"],R9=[{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 um(t){return Object.entries(t).map(([e,i])=>({key:e,value:i}))}function D9(t){const e={};for(const{key:i,value:n}of t)i.trim()&&(e[i.trim().toLowerCase()]=n.trim());return e}function j9({mock:t,specResponses:e,onChange:i}){const[n,r]=N.useState(t.statusCode),[o,a]=N.useState(t.body),[c,h]=N.useState(()=>um(t.headers)),[d,p]=N.useState(am.includes(t.statusCode)?"preset":"manual"),[g,x]=N.useState(null);N.useEffect(()=>{r(t.statusCode),a(t.body),h(um(t.headers)),am.includes(t.statusCode)||p("manual")},[t.statusCode,t.body,t.headers]),N.useEffect(()=>{if(!o.trim()){x(null);return}try{JSON.parse(o),x(null)}catch(j){x(j instanceof SyntaxError?j.message:"Invalid JSON")}},[o]);const b=N.useCallback((j,B,P)=>{i({statusCode:B,headers:D9(j),body:P})},[i]),w=()=>{try{const j=JSON.stringify(JSON.parse(o),null,2);a(j),b(c,n,j)}catch{}},k=(j,B,P)=>{h(H=>H.map((Z,J)=>J===j?{...Z,[B]:P}:Z))},C=j=>{h(B=>{const P=B.filter((H,Z)=>Z!==j);return b(P,n,o),P})},M=()=>h(j=>[...j,{key:"",value:""}]),T=(j,B)=>{h(P=>{const H=P.findIndex(J=>J.key.toLowerCase()===j.toLowerCase()),Z=H>=0?P.map((J,ue)=>ue===H?{key:J.key,value:B}:J):[...P,{key:j,value:B}];return b(Z,n,o),Z})},D=j=>{const B=j.statusCode,P=j.headers??{"content-type":"application/json"},H=j.body??"";r(B),p("manual"),h(um(P)),a(H),i({statusCode:B,headers:P,body:H})};return v.jsxs("div",{className:"flex flex-col gap-6 p-2 bg-background",children:[e&&e.length>0&&v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[v.jsx(K2,{className:"w-3.5 h-3.5 text-primary"}),"Spec Defined Responses"]}),v.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:e.map((j,B)=>v.jsxs("button",{onClick:()=>D(j),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:[v.jsx("span",{className:Re("px-1.5 py-0.5 text-[10px] font-black font-mono rounded border shrink-0",j.statusCode<300?"text-emerald-400 border-emerald-400/30":j.statusCode<500?"text-amber-400 border-amber-400/30":"text-rose-400 border-rose-400/30"),children:j.statusCode}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("p",{className:"text-[11px] font-bold text-foreground truncate group-hover:text-primary transition-colors",children:j.name}),j.description&&j.description!==j.name&&v.jsx("p",{className:"text-[9px] text-muted-foreground line-clamp-1 mt-0.5",children:j.description})]})]},B))})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[v.jsx(Xc,{className:"w-3.5 h-3.5"}),"Status Code"]}),v.jsxs("div",{className:"flex flex-wrap gap-2",children:[am.map(j=>v.jsx("button",{onClick:()=>{r(j),p("preset"),b(c,j,o)},className:Re("px-2.5 py-1.5 text-xs font-mono font-bold rounded-lg border transition-colors duration-75",d==="preset"&&n===j?"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:j},j)),v.jsx("input",{type:"number",value:n,onChange:j=>{r(Number(j.target.value)),p("manual")},onFocus:()=>p("manual"),onBlur:()=>b(c,n,o),className:Re("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")})]})]}),v.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between px-1",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[v.jsx(Zc,{className:"w-3.5 h-3.5"}),"Headers"]}),v.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:[v.jsx(jg,{className:"w-3 h-3"}),"Add"]})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:R9.map(j=>v.jsx("button",{onClick:()=>T(j.key,j.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:j.label},`${j.key}:${j.value}`))}),v.jsx("datalist",{id:"header-names",children:E9.map(j=>v.jsx("option",{value:j},j))}),v.jsxs("div",{className:"space-y-1.5",children:[c.length===0&&v.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((j,B)=>v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("input",{type:"text",list:"header-names",value:j.key,onChange:P=>k(B,"key",P.target.value),onBlur:()=>b(c,n,o),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"}),v.jsx("span",{className:"text-muted-foreground/40 text-xs font-mono shrink-0",children:":"}),v.jsx("input",{type:"text",value:j.value,onChange:P=>k(B,"value",P.target.value),onBlur:()=>b(c,n,o),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"}),v.jsx("button",{onClick:()=>C(B),className:"p-1 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 rounded transition-all shrink-0","aria-label":"Remove header",children:v.jsx(El,{className:"w-3 h-3"})})]}),j.key.toLowerCase()==="content-type"&&v.jsx("div",{className:"flex flex-wrap gap-1 pl-1",children:N9.map(P=>v.jsx("button",{onClick:()=>{k(B,"value",P);const H=c.map((Z,J)=>J===B?{...Z,value:P}:Z);b(H,n,o)},className:Re("px-1.5 py-0.5 text-[9px] font-mono rounded border transition-all",j.value===P?"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:P},P))})]},B))]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between px-1",children:[v.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[v.jsx(Kc,{className:"w-3.5 h-3.5"}),"Body"]}),v.jsxs("button",{onClick:w,disabled:!!g||!o.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:[v.jsx(bN,{className:"w-3 h-3"}),"Format"]})]}),v.jsx("div",{className:Re("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:v.jsx(QA,{value:o,onChange:a,onBlur:()=>b(c,n,o),extensions:[O9()],height:"150px",theme:"dark",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"text-[11px] font-mono"})}),g&&v.jsxs("div",{className:"flex items-start gap-1.5 px-1",children:[v.jsx(X3,{className:"w-3 h-3 text-destructive shrink-0 mt-0.5"}),v.jsx("p",{"data-testid":"json-error",className:"text-[10px] text-destructive font-mono leading-tight",children:g})]})]})]})]})}const L9={passthrough:"border-mode-passthrough/20",delay:"border-mode-delay/20",mock:"border-mode-mock/20"},B9={passthrough:"bg-mode-passthrough",delay:"bg-mode-delay",mock:"bg-mode-mock"};function z9({endpoint:t,specName:e,showSpecBadge:i}){const[n,r]=N.useState(!1),o=_4(),a=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:"{}"}),o.mutate({id:t.id,config:h}),c!=="passthrough"&&r(!0)};return v.jsxs("div",{className:Re("group relative border sm:rounded-xl card-slab overflow-hidden mb-1 shadow-sm",L9[t.mode]),children:[v.jsx("div",{className:Re("absolute left-0 top-0 bottom-0 w-[2px] transition-all duration-75",B9[t.mode])}),v.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:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[v.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[v.jsx("button",{className:"text-muted-foreground/40 group-hover:text-primary transition-colors duration-75",children:n?v.jsx(La,{className:"w-4 h-4"}):v.jsx(Q2,{className:"w-4 h-4"})}),v.jsx(Fg,{method:t.method})]}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-sm font-black font-mono tracking-tight text-foreground/90 truncate",children:t.path}),i&&e&&v.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&&v.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-medium truncate mt-0.5",children:t.summary})]})]}),v.jsxs("div",{className:"flex items-center gap-4 shrink-0",onClick:c=>c.stopPropagation(),children:[v.jsxs("div",{className:"flex items-center gap-2",children:[t.mode==="delay"&&t.delay&&v.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&&v.jsx("span",{className:Re("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})]}),v.jsx(q4,{value:t.mode,onChange:a})]})]}),n&&v.jsx("div",{className:Re("px-5 pb-5 pt-0","border-t border-border/20 mx-4"),children:v.jsxs("div",{className:"pt-5 space-y-4",children:[t.mode==="delay"&&v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-delay uppercase tracking-widest px-1",children:[v.jsx(Xc,{className:"w-3 h-3"}),"Configuration"]}),v.jsx("div",{className:"bg-muted rounded-xl p-4 border border-border",children:v.jsx(P4,{delay:t.delay??{ms:1e3},onChange:c=>o.mutate({id:t.id,config:{delay:c}})})})]}),t.mode==="mock"&&v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-mock uppercase tracking-widest px-1",children:[v.jsx(Xc,{className:"w-3 h-3"}),"Mock Response"]}),v.jsx("div",{className:"bg-muted rounded-xl border border-border overflow-hidden",children:v.jsx(j9,{mock:t.mock??{statusCode:200,headers:{},body:"{}"},specResponses:t.responses,onChange:c=>o.mutate({id:t.id,config:{mock:c}})})})]}),t.mode==="passthrough"&&v.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center space-y-2",children:[v.jsx("div",{className:"w-10 h-10 rounded-full bg-mode-passthrough/5 flex items-center justify-center border border-border",children:v.jsx(vm,{className:"w-5 h-5 text-mode-passthrough opacity-40"})}),v.jsxs("div",{className:"max-w-[300px]",children:[v.jsx("p",{className:"text-xs font-semibold text-foreground/80",children:"Passthrough Mode Active"}),v.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 _9(){const{data:t,isLoading:e}=Kw(),{data:i,isLoading:n}=Qw(),r=Ww(),[o,a]=N.useState(""),[c,h]=N.useState(new Set),d=N.useMemo(()=>{const k=new Map;for(const C of i??[])k.set(C.id,C);return k},[i]),p=N.useMemo(()=>new Set(i?.filter(k=>k.active).map(k=>k.id)??[]),[i]),g=N.useMemo(()=>{if(!t)return new Map;let k=t.filter(M=>p.has(M.specId));if(o){const M=o.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,o,p]),x=k=>{h(C=>{const M=new Set(C);return M.has(k)?M.delete(k):M.add(k),M})},b=(k,C)=>{const M={};k.forEach(T=>{const D={mode:C};C==="delay"&&!T.delay&&(D.delay={ms:1e3}),C==="mock"&&!T.mock&&(D.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),M[T.id]=D}),r.mutate(M)};return e||n?v.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-4",children:[v.jsx(Jc,{className:"w-10 h-10 animate-spin text-primary/40"}),v.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Indexing endpoints..."})]}):!t?.length||p.size===0?v.jsxs("div",{className:"flex flex-col items-center justify-center h-80 text-center space-y-4 px-6",children:[v.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:v.jsx(Xc,{className:"w-8 h-8"})}),v.jsxs("div",{className:"max-w-xs",children:[v.jsx("h3",{className:"text-sm font-black text-foreground uppercase tracking-tight",children:p.size===0?"No Active Specifications":"No endpoints detected"}),v.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."})]})]}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"relative group",children:[v.jsx(hN,{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"}),v.jsx("input",{type:"text",placeholder:"Search by path, method, or operation...",value:o,onChange:k=>a(k.target.value),className:"w-full pl-10 pr-4 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"})]}),v.jsxs("div",{className:"space-y-8",children:[Array.from(g.entries()).map(([k,C])=>{const M=c.has(k);return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-3 w-full",children:[v.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?v.jsx(Q2,{className:"w-3.5 h-3.5"}):v.jsx(La,{className:"w-3.5 h-3.5"}),v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:k}),v.jsxs("span",{className:"text-[10px] font-black opacity-40 tabular-nums",children:["(",C.length,")"]})]}),v.jsxs("div",{className:"flex items-center gap-1 bg-muted/20 p-0.5 rounded-lg border border-border/10 shrink-0",children:[v.jsx("button",{onClick:()=>b(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"}),v.jsx("button",{onClick:()=>b(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"}),v.jsx("button",{onClick:()=>b(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"})]}),v.jsx("div",{className:"h-px flex-1 bg-border/20 opacity-40 group-hover:opacity-100 group-hover:bg-primary/20 transition-all"})]}),!M&&v.jsx("div",{className:"grid grid-cols-1 gap-1 px-1",children:C.map(T=>v.jsx(z9,{endpoint:T,specName:d.get(T.specId)?.name,showSpecBadge:p.size>1},T.id))})]},k)}),g.size===0&&o&&v.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[v.jsx(G2,{className:"w-10 h-10 text-muted-foreground opacity-20"}),v.jsxs("div",{className:"max-w-[240px]",children:[v.jsx("p",{className:"text-sm font-bold text-foreground/80",children:"No results found"}),v.jsxs("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:['The search term "',o,'" did not match any active endpoints.']})]})]})]})]})}function H9(){return jr({queryKey:["presets"],queryFn:Fe.presets.list})}function U9(){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 P9(){const t=pt();return Nt({mutationFn:Fe.presets.apply,onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const YA=[{name:"Slow",icon:xN,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:gN,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:Lg,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 F9(t,e){for(const[i,n]of Object.entries(e.endpoints)){const r=t.find(o=>o.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 V9(t,e){if(!t?.length)return null;for(const i of YA)if(i.match(t))return`builtin:${i.name}`;if(e){for(const i of e)if(F9(t,i))return`saved:${i.name}`}return null}function I9(){const{data:t}=H9(),{data:e}=Kw(),i=U9(),n=q9(),r=P9(),o=Ww(),a=N.useMemo(()=>V9(e,t),[e,t]),[c,h]=N.useState(!1),[d,p]=N.useState(!1),[g,x]=N.useState(""),b=N.useRef(null);N.useEffect(()=>{function C(M){b.current&&!b.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?v.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:[v.jsxs("div",{className:"flex items-center gap-1 bg-muted/40 rounded-lg p-0.5 border border-border/20 shadow-inner",children:[v.jsx("div",{className:"px-2 text-[9px] font-black text-muted-foreground uppercase tracking-widest hidden lg:block",children:"Presets"}),YA.map(({name:C,icon:M,apply:T})=>{const D=a===`builtin:${C}`;return v.jsxs("button",{onClick:()=>{e&&o.mutate(T(e))},className:Re("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",D?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-transparent text-muted-foreground hover:text-foreground hover:bg-white/5"),children:[v.jsx(M,{className:Re("w-3.5 h-3.5")}),v.jsx("span",{className:"hidden sm:inline",children:C}),D&&v.jsx(Wc,{className:"w-3 h-3 ml-0.5"})]},C)})]}),v.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 shrink-0"}),t&&t.length>0&&v.jsxs("div",{className:"relative",ref:b,children:[v.jsxs("button",{onClick:()=>h(!c),className:Re("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||a&&a.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:[v.jsx(K2,{className:"w-3.5 h-3.5"}),v.jsxs("span",{className:"hidden sm:inline",children:["Saved (",t.length,")"]}),v.jsx(La,{className:Re("w-3 h-3 text-muted-foreground transition-transform duration-75",c&&"rotate-180")})]}),c&&v.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:[v.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:v.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Saved Configurations"})}),v.jsx("div",{className:"max-h-[300px] overflow-y-auto px-1.5 ",children:t.map(C=>{const M=a===`saved:${C.name}`;return v.jsxs("div",{className:Re("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:[v.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer py-0.5",onClick:()=>r.mutate(C.name,{onSuccess:()=>h(!1)}),children:[v.jsx("p",{className:"font-bold truncate",children:C.name}),v.jsxs("p",{className:"text-[9px] opacity-60 font-medium",children:[Object.keys(C.endpoints).length," endpoints"]})]}),v.jsx("div",{className:"flex items-center gap-1 shrink-0",children:v.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:v.jsx(ca,{className:"w-3.5 h-3.5"})})})]},C.name)})})]})]}),d?v.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:[v.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"}),v.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"}),v.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:v.jsx(El,{className:"w-3.5 h-3.5"})})]}):v.jsxs("button",{onClick:()=>p(!0),disabled:a!==null,className:Re("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",a!==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:[v.jsx(cN,{className:"w-3.5 h-3.5"}),v.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]}):null}function Q9(){const[t,e]=N.useState([]),[i,n]=N.useState(!1),[r,o]=N.useState(!1),a=N.useRef(null),c=pt();N.useEffect(()=>{Fe.logs.get(500).then(({entries:d})=>{e(p=>{const g=new Set(p.map(b=>b.id)),x=[...p];for(const b of d)g.has(b.id)||x.push(b);return x.slice(0,500)}),o(!0)})},[]),N.useEffect(()=>{const d=new EventSource("/api/logs/stream");return a.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(),a.current=null}},[]);const h=N.useCallback(()=>{e([]),Fe.logs.clear().then(()=>{c.invalidateQueries({queryKey:["logs"]})})},[c]);return{entries:t,connected:i,clear:h,loaded:r}}function GA({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 v.jsx("span",{className:Re("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 Y9({entry:t,onClose:e}){return v.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[v.jsx("div",{className:"absolute inset-0 bg-background/60",onClick:e}),v.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:[v.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border bg-muted",children:[v.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Fg,{method:t.method}),v.jsx(GA,{status:t.statusCode}),v.jsx("span",{className:"text-[10px] font-black text-muted-foreground uppercase tracking-widest ml-2",children:t.mode})]}),v.jsx("h2",{className:"text-sm font-black font-mono text-foreground truncate break-all",children:t.path})]}),v.jsx("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:v.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:v.jsx(El,{className:"w-5 h-5"})})})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[v.jsx(Ol,{className:"w-3 h-3"})," Latency"]}),v.jsxs("div",{className:"text-sm font-black font-mono text-primary",children:[t.latencyMs,v.jsx("span",{className:"text-[10px] ml-0.5 opacity-60",children:"ms"})]})]}),v.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[v.jsx(Lg,{className:"w-3 h-3"})," Status"]}),v.jsx("div",{className:"text-sm font-black font-mono text-foreground",children:t.statusCode})]}),v.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[v.jsx(Ol,{className:"w-3 h-3"})," Timestamp"]}),v.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:new Date(t.timestamp).toLocaleTimeString()})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(bm,{className:"w-4 h-4 text-primary"}),v.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Request Details"})]}),t.requestHeaders&&v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[v.jsx(Zc,{className:"w-3 h-3"})," Headers"]}),v.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
+ `)})]})]}),v.jsxs("div",{className:"space-y-4 border-t border-border pt-8",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(bm,{className:"w-4 h-4 text-success rotate-180"}),v.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Response Details"})]}),t.responseHeaders&&v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[v.jsx(Zc,{className:"w-3 h-3"})," Headers"]}),v.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&&v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[v.jsx(Kc,{className:"w-3 h-3"})," Body"]}),v.jsx("div",{className:"rounded-xl border border-border bg-muted overflow-hidden shadow-inner",children:v.jsx("pre",{className:"text-[11px] font-mono font-medium p-4 overflow-auto max-h-80 leading-relaxed text-foreground/90",children:G9(t.responseBody)})})]})]})]}),v.jsx("div",{className:"p-4 border-t border-border bg-muted flex justify-end gap-3 px-6",children:v.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 G9(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function K9({isCompact:t}){const{entries:e,connected:i,clear:n,loaded:r}=Q9(),[o,a]=N.useState(null),[c,h]=N.useState(""),[d,p]=N.useState(""),[g,x]=N.useState(""),b=N.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 v.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[!t&&v.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/40 bg-card",children:[v.jsx("div",{className:"flex items-center gap-6",children:v.jsxs("div",{className:"flex items-center gap-2.5",children:[v.jsx("div",{className:"relative",children:v.jsx(aN,{className:Re("w-4 h-4",i?"text-success":"text-destructive")})}),v.jsxs("div",{className:"flex flex-col",children:[v.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-0.5",children:"Stream"}),v.jsxs("span",{className:"text-[11px] font-bold text-muted-foreground leading-none",children:[i?"Real-time":"Offline"," · ",e.length," entries"]})]})]})}),v.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:v.jsx(ca,{className:"w-4 h-4"})})]}),v.jsxs("div",{className:"px-4 py-2 flex items-center justify-between bg-muted border-b border-border/20",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[v.jsx(tN,{className:"w-3 h-3 text-muted-foreground/60"}),v.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:[v.jsx("option",{value:"",children:"Method"}),["GET","POST","PUT","PATCH","DELETE"].map(k=>v.jsx("option",{value:k,children:k},k))]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[v.jsx(xm,{className:"w-3 h-3 text-muted-foreground/60"}),v.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:[v.jsx("option",{value:"",children:"Status"}),v.jsx("option",{value:"2xx",children:"2xx"}),v.jsx("option",{value:"4xx",children:"4xx"}),v.jsx("option",{value:"5xx",children:"5xx"})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[v.jsx(Ol,{className:"w-3 h-3 text-muted-foreground/60"}),v.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:[v.jsx("option",{value:"",children:"Mode"}),v.jsx("option",{value:"passthrough",children:"Pass"}),v.jsx("option",{value:"delay",children:"Delay"}),v.jsx("option",{value:"mock",children:"Mock"})]})]})]}),t&&v.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:v.jsx(ca,{className:"w-3.5 h-3.5"})})]}),v.jsx("div",{className:"flex-1 overflow-y-auto relative bg-background",children:v.jsxs("div",{className:"min-w-full",children:[!t&&v.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:[v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 shrink-0",children:"Time"}),v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-[52px] shrink-0",children:"Method"}),v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 flex-1",children:"Request Path"}),v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-center",children:"Status"}),v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-right",children:"Latency"}),v.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 text-center",children:"Mode"})]}),v.jsx("div",{className:"divide-y divide-border/20",children:b.length===0?v.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[r?v.jsx(xm,{className:"w-12 h-12 text-muted-foreground/10"}):v.jsx(Jc,{className:"w-8 h-8 animate-spin text-primary opacity-40"}),v.jsx("div",{className:"max-w-[200px]",children:v.jsx("p",{className:"text-sm font-bold text-foreground/80",children:e.length===0?"No Traffic Recorded":"No Matches"})})]}):b.slice(0,200).map(k=>v.jsxs("button",{onClick:()=>a(k),className:Re("flex flex-col gap-2 px-4 py-3 w-full text-left transition-colors duration-75 group border-b border-border/10",o?.id===k.id?"bg-primary/5 shadow-inner":"hover:bg-accent/30"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Fg,{method:k.method}),v.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})})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex items-center gap-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground opacity-60",children:[v.jsx(Ol,{className:"w-2.5 h-2.5 opacity-40"}),v.jsxs("span",{className:"tabular-nums",children:[k.latencyMs,"ms"]})]}),v.jsx(GA,{status:k.statusCode})]})]}),v.jsxs("div",{className:"flex items-center justify-between gap-4",children:[v.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}),v.jsx("span",{className:Re("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))})]})}),o&&v.jsx(Y9,{entry:o,onClose:()=>a(null)})]})}function W9(){return v.jsxs("div",{className:"flex h-full overflow-hidden bg-background",children:[v.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-r border-border/60 bg-background",children:[v.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-border/60 bg-muted/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:v.jsx(Zc,{className:"w-4 h-4"})}),v.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Endpoints Registry"})]}),v.jsx(I9,{})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:v.jsx("div",{className:"max-w-5xl mx-auto space-y-6",children:v.jsx(_9,{})})})]}),v.jsxs("div",{className:"w-[400px] lg:w-[450px] xl:w-[500px] hidden lg:flex flex-col bg-muted/5 shrink-0",children:[v.jsxs("div",{className:"px-5 py-4 flex items-center gap-3 border-b border-border/60 bg-muted/30 shrink-0",children:[v.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:v.jsx(xm,{className:"w-4 h-4"})}),v.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Traffic Monitor"})]}),v.jsx("div",{className:"flex-1 overflow-hidden",children:v.jsx(K9,{isCompact:!0})})]})]})}const X9=new N3({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function Z9(){return v.jsx(R3,{client:X9,children:v.jsx(ZE,{children:v.jsx(TE,{children:v.jsxs(jc,{element:v.jsx(z4,{}),children:[v.jsx(jc,{path:"/",element:v.jsx(W9,{})}),v.jsx(jc,{path:"*",element:v.jsx(CE,{to:"/",replace:!0})})]})})})})}MO.createRoot(document.getElementById("root")).render(v.jsx(N.StrictMode,{children:v.jsx(Z9,{})}));