interceptr 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -128
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +2 -0
- package/dist/app.js.map +1 -1
- package/dist/config/store.d.ts +7 -2
- package/dist/config/store.d.ts.map +1 -1
- package/dist/config/store.js +30 -0
- package/dist/config/store.js.map +1 -1
- package/dist/openapi/parser.d.ts.map +1 -1
- package/dist/openapi/parser.js +14 -1
- package/dist/openapi/parser.js.map +1 -1
- package/dist/proxy/handler.d.ts.map +1 -1
- package/dist/proxy/handler.js +16 -3
- package/dist/proxy/handler.js.map +1 -1
- package/dist/public/assets/index-DQ6A5BqX.css +1 -0
- package/dist/public/assets/index-DVRnnAH1.js +55 -0
- package/dist/public/index.html +2 -2
- package/dist/routes/saved-responses.d.ts +4 -0
- package/dist/routes/saved-responses.d.ts.map +1 -0
- package/dist/routes/saved-responses.js +34 -0
- package/dist/routes/saved-responses.js.map +1 -0
- package/package.json +31 -5
- package/dist/public/assets/index-Bc5bv_7Y.css +0 -1
- package/dist/public/assets/index-CQ7WWZ3T.js +0 -55
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function i(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=i(r);fetch(r.href,a)}})();var Mp={exports:{}},Ia={};var z1;function zO(){if(z1)return Ia;z1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,r,a){var o=null;if(a!==void 0&&(o=""+a),r.key!==void 0&&(o=""+r.key),"key"in r){a={};for(var c in r)c!=="key"&&(a[c]=r[c])}else a=r;return r=a.ref,{$$typeof:t,type:n,key:o,ref:r!==void 0?r:null,props:a}}return Ia.Fragment=e,Ia.jsx=i,Ia.jsxs=i,Ia}var _1;function _O(){return _1||(_1=1,Mp.exports=zO()),Mp.exports}var b=_O(),Tp={exports:{}},Se={};var H1;function HO(){if(H1)return Se;H1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function M(T,F,Z){this.props=T,this.context=F,this.refs=C,this.updater=Z||w}M.prototype.isReactComponent={},M.prototype.setState=function(T,F){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,F,"setState")},M.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function E(){}E.prototype=M.prototype;function D(T,F,Z){this.props=T,this.context=F,this.refs=C,this.updater=Z||w}var G=D.prototype=new E;G.constructor=D,k(G,M.prototype),G.isPureReactComponent=!0;var L=Array.isArray;function I(){}var q={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function ee(T,F,Z){var ne=Z.ref;return{$$typeof:t,type:T,key:F,ref:ne!==void 0?ne:null,props:Z}}function fe(T,F){return ee(T.type,F,T.props)}function ce(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function P(T){var F={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Z){return F[Z]})}var ie=/\/+/g;function de(T,F){return typeof T=="object"&&T!==null&&T.key!=null?P(""+T.key):F.toString(36)}function ue(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(I,I):(T.status="pending",T.then(function(F){T.status==="pending"&&(T.status="fulfilled",T.value=F)},function(F){T.status==="pending"&&(T.status="rejected",T.reason=F)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function _(T,F,Z,ne,xe){var Ce=typeof T;(Ce==="undefined"||Ce==="boolean")&&(T=null);var He=!1;if(T===null)He=!0;else switch(Ce){case"bigint":case"string":case"number":He=!0;break;case"object":switch(T.$$typeof){case t:case e:He=!0;break;case p:return He=T._init,_(He(T._payload),F,Z,ne,xe)}}if(He)return xe=xe(T),He=ne===""?"."+de(T,0):ne,L(xe)?(Z="",He!=null&&(Z=He.replace(ie,"$&/")+"/"),_(xe,F,Z,"",function(Jl){return Jl})):xe!=null&&(ce(xe)&&(xe=fe(xe,Z+(xe.key==null||T&&T.key===xe.key?"":(""+xe.key).replace(ie,"$&/")+"/")+He)),F.push(xe)),1;He=0;var Kt=ne===""?".":ne+":";if(L(T))for(var ft=0;ft<T.length;ft++)ne=T[ft],Ce=Kt+de(ne,ft),He+=_(ne,F,Z,Ce,xe);else if(ft=v(T),typeof ft=="function")for(T=ft.call(T),ft=0;!(ne=T.next()).done;)ne=ne.value,Ce=Kt+de(ne,ft++),He+=_(ne,F,Z,Ce,xe);else if(Ce==="object"){if(typeof T.then=="function")return _(ue(T),F,Z,ne,xe);throw F=String(T),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return He}function J(T,F,Z){if(T==null)return T;var ne=[],xe=0;return _(T,ne,"","",function(Ce){return F.call(Z,Ce,xe++)}),ne}function se(T){if(T._status===-1){var F=T._result;F=F(),F.then(function(Z){(T._status===0||T._status===-1)&&(T._status=1,T._result=Z)},function(Z){(T._status===0||T._status===-1)&&(T._status=2,T._result=Z)}),T._status===-1&&(T._status=0,T._result=F)}if(T._status===1)return T._result.default;throw T._result}var H=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},te={map:J,forEach:function(T,F,Z){J(T,function(){F.apply(this,arguments)},Z)},count:function(T){var F=0;return J(T,function(){F++}),F},toArray:function(T){return J(T,function(F){return F})||[]},only:function(T){if(!ce(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Se.Activity=g,Se.Children=te,Se.Component=M,Se.Fragment=i,Se.Profiler=r,Se.PureComponent=D,Se.StrictMode=n,Se.Suspense=h,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,Se.__COMPILER_RUNTIME={__proto__:null,c:function(T){return q.H.useMemoCache(T)}},Se.cache=function(T){return function(){return T.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(T,F,Z){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ne=k({},T.props),xe=T.key;if(F!=null)for(Ce in F.key!==void 0&&(xe=""+F.key),F)!$.call(F,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&F.ref===void 0||(ne[Ce]=F[Ce]);var Ce=arguments.length-2;if(Ce===1)ne.children=Z;else if(1<Ce){for(var He=Array(Ce),Kt=0;Kt<Ce;Kt++)He[Kt]=arguments[Kt+2];ne.children=He}return ee(T.type,xe,ne)},Se.createContext=function(T){return T={$$typeof:o,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:a,_context:T},T},Se.createElement=function(T,F,Z){var ne,xe={},Ce=null;if(F!=null)for(ne in F.key!==void 0&&(Ce=""+F.key),F)$.call(F,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(xe[ne]=F[ne]);var He=arguments.length-2;if(He===1)xe.children=Z;else if(1<He){for(var Kt=Array(He),ft=0;ft<He;ft++)Kt[ft]=arguments[ft+2];xe.children=Kt}if(T&&T.defaultProps)for(ne in He=T.defaultProps,He)xe[ne]===void 0&&(xe[ne]=He[ne]);return ee(T,Ce,xe)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(T){return{$$typeof:c,render:T}},Se.isValidElement=ce,Se.lazy=function(T){return{$$typeof:p,_payload:{_status:-1,_result:T},_init:se}},Se.memo=function(T,F){return{$$typeof:d,type:T,compare:F===void 0?null:F}},Se.startTransition=function(T){var F=q.T,Z={};q.T=Z;try{var ne=T(),xe=q.S;xe!==null&&xe(Z,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(I,H)}catch(Ce){H(Ce)}finally{F!==null&&Z.types!==null&&(F.types=Z.types),q.T=F}},Se.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},Se.use=function(T){return q.H.use(T)},Se.useActionState=function(T,F,Z){return q.H.useActionState(T,F,Z)},Se.useCallback=function(T,F){return q.H.useCallback(T,F)},Se.useContext=function(T){return q.H.useContext(T)},Se.useDebugValue=function(){},Se.useDeferredValue=function(T,F){return q.H.useDeferredValue(T,F)},Se.useEffect=function(T,F){return q.H.useEffect(T,F)},Se.useEffectEvent=function(T){return q.H.useEffectEvent(T)},Se.useId=function(){return q.H.useId()},Se.useImperativeHandle=function(T,F,Z){return q.H.useImperativeHandle(T,F,Z)},Se.useInsertionEffect=function(T,F){return q.H.useInsertionEffect(T,F)},Se.useLayoutEffect=function(T,F){return q.H.useLayoutEffect(T,F)},Se.useMemo=function(T,F){return q.H.useMemo(T,F)},Se.useOptimistic=function(T,F){return q.H.useOptimistic(T,F)},Se.useReducer=function(T,F,Z){return q.H.useReducer(T,F,Z)},Se.useRef=function(T){return q.H.useRef(T)},Se.useState=function(T){return q.H.useState(T)},Se.useSyncExternalStore=function(T,F,Z){return q.H.useSyncExternalStore(T,F,Z)},Se.useTransition=function(){return q.H.useTransition()},Se.version="19.2.4",Se}var U1;function Rg(){return U1||(U1=1,Tp.exports=HO()),Tp.exports}var O=Rg(),Op={exports:{}},Qa={},Ep={exports:{}},Np={};var q1;function UO(){return q1||(q1=1,(function(t){function e(_,J){var se=_.length;_.push(J);e:for(;0<se;){var H=se-1>>>1,te=_[H];if(0<r(te,J))_[H]=J,_[se]=te,se=H;else break e}}function i(_){return _.length===0?null:_[0]}function n(_){if(_.length===0)return null;var J=_[0],se=_.pop();if(se!==J){_[0]=se;e:for(var H=0,te=_.length,T=te>>>1;H<T;){var F=2*(H+1)-1,Z=_[F],ne=F+1,xe=_[ne];if(0>r(Z,se))ne<te&&0>r(xe,Z)?(_[H]=xe,_[ne]=se,H=ne):(_[H]=Z,_[F]=se,H=F);else if(ne<te&&0>r(xe,se))_[H]=xe,_[ne]=se,H=ne;else break e}}return J}function r(_,J){var se=_.sortIndex-J.sortIndex;return se!==0?se:_.id-J.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var h=[],d=[],p=1,g=null,x=3,v=!1,w=!1,k=!1,C=!1,M=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function G(_){for(var J=i(d);J!==null;){if(J.callback===null)n(d);else if(J.startTime<=_)n(d),J.sortIndex=J.expirationTime,e(h,J);else break;J=i(d)}}function L(_){if(k=!1,G(_),!w)if(i(h)!==null)w=!0,I||(I=!0,P());else{var J=i(d);J!==null&&ue(L,J.startTime-_)}}var I=!1,q=-1,$=5,ee=-1;function fe(){return C?!0:!(t.unstable_now()-ee<$)}function ce(){if(C=!1,I){var _=t.unstable_now();ee=_;var J=!0;try{e:{w=!1,k&&(k=!1,E(q),q=-1),v=!0;var se=x;try{t:{for(G(_),g=i(h);g!==null&&!(g.expirationTime>_&&fe());){var H=g.callback;if(typeof H=="function"){g.callback=null,x=g.priorityLevel;var te=H(g.expirationTime<=_);if(_=t.unstable_now(),typeof te=="function"){g.callback=te,G(_),J=!0;break t}g===i(h)&&n(h),G(_)}else n(h);g=i(h)}if(g!==null)J=!0;else{var T=i(d);T!==null&&ue(L,T.startTime-_),J=!1}}break e}finally{g=null,x=se,v=!1}J=void 0}}finally{J?P():I=!1}}}var P;if(typeof D=="function")P=function(){D(ce)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,de=ie.port2;ie.port1.onmessage=ce,P=function(){de.postMessage(null)}}else P=function(){M(ce,0)};function ue(_,J){q=M(function(){_(t.unstable_now())},J)}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(_){_.callback=null},t.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(_){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var se=x;x=J;try{return _()}finally{x=se}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(_,J){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var se=x;x=_;try{return J()}finally{x=se}},t.unstable_scheduleCallback=function(_,J,se){var H=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?H+se:H):se=H,_){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=se+te,_={id:p++,callback:J,priorityLevel:_,startTime:se,expirationTime:te,sortIndex:-1},se>H?(_.sortIndex=se,e(d,_),i(h)===null&&_===i(d)&&(k?(E(q),q=-1):k=!0,ue(L,se-H))):(_.sortIndex=te,e(h,_),w||v||(w=!0,I||(I=!0,P()))),_},t.unstable_shouldYield=fe,t.unstable_wrapCallback=function(_){var J=x;return function(){var se=x;x=J;try{return _.apply(this,arguments)}finally{x=se}}}})(Np)),Np}var P1;function qO(){return P1||(P1=1,Ep.exports=UO()),Ep.exports}var Rp={exports:{}},Ft={};var F1;function PO(){if(F1)return Ft;F1=1;var t=Rg();function e(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(h,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:h,containerInfo:d,implementation:p}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ft.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ft.createPortal=function(h,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(h,d,null,p)},Ft.flushSync=function(h){var d=o.T,p=n.p;try{if(o.T=null,n.p=2,h)return h()}finally{o.T=d,n.p=p,n.d.f()}},Ft.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))},Ft.prefetchDNS=function(h){typeof h=="string"&&n.d.D(h)},Ft.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,g=c(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):p==="script"&&n.d.X(h,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ft.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)},Ft.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})}},Ft.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)},Ft.requestFormReset=function(h){n.d.r(h)},Ft.unstable_batchedUpdates=function(h,d){return h(d)},Ft.useFormState=function(h,d,p){return o.H.useFormState(h,d,p)},Ft.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ft.version="19.2.4",Ft}var V1;function FO(){if(V1)return Rp.exports;V1=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(),Rp.exports=PO(),Rp.exports}var I1;function VO(){if(I1)return Qa;I1=1;var t=qO(),e=Rg(),i=FO();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var l=s,u=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(u=l.return),s=l.return;while(s)}return l.tag===3?u:null}function o(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function h(s){if(a(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=a(s),l===null)throw Error(n(188));return l!==s?null:s}for(var u=s,f=l;;){var m=u.return;if(m===null)break;var y=m.alternate;if(y===null){if(f=m.return,f!==null){u=f;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===u)return h(m),s;if(y===f)return h(m),l;y=y.sibling}throw Error(n(188))}if(u.return!==f.return)u=m,f=y;else{for(var S=!1,A=m.child;A;){if(A===u){S=!0,u=m,f=y;break}if(A===f){S=!0,f=m,u=y;break}A=A.sibling}if(!S){for(A=y.child;A;){if(A===u){S=!0,u=y,f=m;break}if(A===f){S=!0,f=y,u=m;break}A=A.sibling}if(!S)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:l}function p(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=p(s),l!==null)return l;s=s.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),D=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=ce&&s[ce]||s["@@iterator"],typeof s=="function"?s:null)}var ie=Symbol.for("react.client.reference");function de(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ie?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 L:return"Suspense";case I:return"SuspenseList";case ee:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case D:return s.displayName||"Context";case E:return(s._context.displayName||"Context")+".Consumer";case G:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case q:return l=s.displayName||null,l!==null?l:de(s.type)||"Memo";case $:l=s._payload,s=s._init;try{return de(s(l))}catch{}}return null}var ue=Array.isArray,_=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},H=[],te=-1;function T(s){return{current:s}}function F(s){0>te||(s.current=H[te],H[te]=null,te--)}function Z(s,l){te++,H[te]=s.current,s.current=l}var ne=T(null),xe=T(null),Ce=T(null),He=T(null);function Kt(s,l){switch(Z(Ce,l),Z(xe,s),Z(ne,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?s1(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=s1(l),s=l1(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}F(ne),Z(ne,s)}function ft(){F(ne),F(xe),F(Ce)}function Jl(s){s.memoizedState!==null&&Z(He,s);var l=ne.current,u=l1(l,s.type);l!==u&&(Z(xe,s),Z(ne,u))}function Wo(s){xe.current===s&&(F(ne),F(xe)),He.current===s&&(F(He),qa._currentValue=se)}var of,B0;function Yr(s){if(of===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);of=l&&l[1]||"",B0=-1<u.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+of+s+B0}var uf=!1;function cf(s,l){if(!s||uf)return"";uf=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(l){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(V){var U=V}Reflect.construct(s,[],W)}else{try{W.call()}catch(V){U=V}s.call(W.prototype)}}else{try{throw Error()}catch(V){U=V}(W=s())&&typeof W.catch=="function"&&W.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 N=S.split(`
|
|
4
|
+
`),z=A.split(`
|
|
5
|
+
`);for(m=f=0;f<N.length&&!N[f].includes("DetermineComponentFrameRoot");)f++;for(;m<z.length&&!z[m].includes("DetermineComponentFrameRoot");)m++;if(f===N.length||m===z.length)for(f=N.length-1,m=z.length-1;1<=f&&0<=m&&N[f]!==z[m];)m--;for(;1<=f&&0<=m;f--,m--)if(N[f]!==z[m]){if(f!==1||m!==1)do if(f--,m--,0>m||N[f]!==z[m]){var Y=`
|
|
6
|
+
`+N[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{uf=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Yr(u):""}function dM(s,l){switch(s.tag){case 26:case 27:case 5:return Yr(s.type);case 16:return Yr("Lazy");case 13:return s.child!==l&&l!==null?Yr("Suspense Fallback"):Yr("Suspense");case 19:return Yr("SuspenseList");case 0:case 15:return cf(s.type,!1);case 11:return cf(s.type.render,!1);case 1:return cf(s.type,!0);case 31:return Yr("Activity");default:return""}}function z0(s){try{var l="",u=null;do l+=dM(s,u),u=s,s=s.return;while(s);return l}catch(f){return`
|
|
7
|
+
Error generating stack: `+f.message+`
|
|
8
|
+
`+f.stack}}var hf=Object.prototype.hasOwnProperty,ff=t.unstable_scheduleCallback,df=t.unstable_cancelCallback,pM=t.unstable_shouldYield,mM=t.unstable_requestPaint,mi=t.unstable_now,gM=t.unstable_getCurrentPriorityLevel,_0=t.unstable_ImmediatePriority,H0=t.unstable_UserBlockingPriority,Xo=t.unstable_NormalPriority,yM=t.unstable_LowPriority,U0=t.unstable_IdlePriority,xM=t.log,bM=t.unstable_setDisableYieldValue,Zl=null,gi=null;function ir(s){if(typeof xM=="function"&&bM(s),gi&&typeof gi.setStrictMode=="function")try{gi.setStrictMode(Zl,s)}catch{}}var yi=Math.clz32?Math.clz32:wM,vM=Math.log,SM=Math.LN2;function wM(s){return s>>>=0,s===0?32:31-(vM(s)/SM|0)|0}var Jo=256,Zo=262144,$o=4194304;function Kr(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 eu(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=Kr(f):(S&=A,S!==0?m=Kr(S):u||(u=A&~s,u!==0&&(m=Kr(u))))):(A=f&~y,A!==0?m=Kr(A):S!==0?m=Kr(S):u||(u=f&~s,u!==0&&(m=Kr(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 $l(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function kM(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 q0(){var s=$o;return $o<<=1,($o&62914560)===0&&($o=4194304),s}function pf(s){for(var l=[],u=0;31>u;u++)l.push(s);return l}function ea(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function CM(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,N=s.expirationTimes,z=s.hiddenUpdates;for(u=S&~u;0<u;){var Y=31-yi(u),W=1<<Y;A[Y]=0,N[Y]=-1;var U=z[Y];if(U!==null)for(z[Y]=null,Y=0;Y<U.length;Y++){var V=U[Y];V!==null&&(V.lane&=-536870913)}u&=~W}f!==0&&P0(s,f,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(S&~l))}function P0(s,l,u){s.pendingLanes|=l,s.suspendedLanes&=~l;var f=31-yi(l);s.entangledLanes|=l,s.entanglements[f]=s.entanglements[f]|1073741824|u&261930}function F0(s,l){var u=s.entangledLanes|=l;for(s=s.entanglements;u;){var f=31-yi(u),m=1<<f;m&l|s[f]&l&&(s[f]|=l),u&=~m}}function V0(s,l){var u=l&-l;return u=(u&42)!==0?1:mf(u),(u&(s.suspendedLanes|l))!==0?0:u}function mf(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 gf(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function I0(){var s=J.p;return s!==0?s:(s=window.event,s===void 0?32:E1(s.type))}function Q0(s,l){var u=J.p;try{return J.p=s,l()}finally{J.p=u}}var nr=Math.random().toString(36).slice(2),jt="__reactFiber$"+nr,ti="__reactProps$"+nr,Ns="__reactContainer$"+nr,yf="__reactEvents$"+nr,AM="__reactListeners$"+nr,MM="__reactHandles$"+nr,G0="__reactResources$"+nr,ta="__reactMarker$"+nr;function xf(s){delete s[jt],delete s[ti],delete s[yf],delete s[AM],delete s[MM]}function Rs(s){var l=s[jt];if(l)return l;for(var u=s.parentNode;u;){if(l=u[Ns]||u[jt]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(s=d1(s);s!==null;){if(u=s[jt])return u;s=d1(s)}return l}s=u,u=s.parentNode}return null}function Ds(s){if(s=s[jt]||s[Ns]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function ia(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function js(s){var l=s[G0];return l||(l=s[G0]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Et(s){s[ta]=!0}var Y0=new Set,K0={};function Wr(s,l){Ls(s,l),Ls(s+"Capture",l)}function Ls(s,l){for(K0[s]=l,s=0;s<l.length;s++)Y0.add(l[s])}var TM=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]*$"),W0={},X0={};function OM(s){return hf.call(X0,s)?!0:hf.call(W0,s)?!1:TM.test(s)?X0[s]=!0:(W0[s]=!0,!1)}function tu(s,l,u){if(OM(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 iu(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 Mn(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 Ni(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function J0(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function EM(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 bf(s){if(!s._valueTracker){var l=J0(s)?"checked":"value";s._valueTracker=EM(s,l,""+s[l])}}function Z0(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var u=l.getValue(),f="";return s&&(f=J0(s)?s.checked?"true":"false":s.value),s=f,s!==u?(l.setValue(s),!0):!1}function nu(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 NM=/[\n"\\]/g;function Ri(s){return s.replace(NM,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function vf(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=""+Ni(l)):s.value!==""+Ni(l)&&(s.value=""+Ni(l)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),l!=null?Sf(s,S,Ni(l)):u!=null?Sf(s,S,Ni(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=""+Ni(A):s.removeAttribute("name")}function $0(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)){bf(s);return}u=u!=null?""+Ni(u):"",l=l!=null?""+Ni(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),bf(s)}function Sf(s,l,u){l==="number"&&nu(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Bs(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=""+Ni(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 ey(s,l,u){if(l!=null&&(l=""+Ni(l),l!==s.value&&(s.value=l),u==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=u!=null?""+Ni(u):""}function ty(s,l,u,f){if(l==null){if(f!=null){if(u!=null)throw Error(n(92));if(ue(f)){if(1<f.length)throw Error(n(93));f=f[0]}u=f}u==null&&(u=""),l=u}u=Ni(l),s.defaultValue=u,f=s.textContent,f===u&&f!==""&&f!==null&&(s.value=f),bf(s)}function zs(s,l){if(l){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=l;return}}s.textContent=l}var RM=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 iy(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||RM.has(l)?l==="float"?s.cssFloat=u:s[l]=(""+u).trim():s[l]=u+"px"}function ny(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&&iy(s,m,f)}else for(var y in l)l.hasOwnProperty(y)&&iy(s,y,l[y])}function wf(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"]]),jM=/^[\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 ru(s){return jM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Tn(){}var kf=null;function Cf(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var _s=null,Hs=null;function ry(s){var l=Ds(s);if(l&&(s=l.stateNode)){var u=s[ti]||null;e:switch(s=l.stateNode,l.type){case"input":if(vf(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="'+Ri(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var f=u[l];if(f!==s&&f.form===s.form){var m=f[ti]||null;if(!m)throw Error(n(90));vf(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&&Z0(f)}break e;case"textarea":ey(s,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&Bs(s,!!u.multiple,l,!1)}}}var Af=!1;function sy(s,l,u){if(Af)return s(l,u);Af=!0;try{var f=s(l);return f}finally{if(Af=!1,(_s!==null||Hs!==null)&&(Qu(),_s&&(l=_s,s=Hs,Hs=_s=null,ry(l),s)))for(l=0;l<s.length;l++)ry(s[l])}}function na(s,l){var u=s.stateNode;if(u===null)return null;var f=u[ti]||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 On=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mf=!1;if(On)try{var ra={};Object.defineProperty(ra,"passive",{get:function(){Mf=!0}}),window.addEventListener("test",ra,ra),window.removeEventListener("test",ra,ra)}catch{Mf=!1}var rr=null,Tf=null,su=null;function ly(){if(su)return su;var s,l=Tf,u=l.length,f,m="value"in rr?rr.value:rr.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 su=m.slice(s,1<f?1-f:void 0)}function lu(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 au(){return!0}function ay(){return!1}function ii(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)?au:ay,this.isPropagationStopped=ay,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=au)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=au)},persist:function(){},isPersistent:au}),l}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ou=ii(Xr),sa=g({},Xr,{view:0,detail:0}),LM=ii(sa),Of,Ef,la,uu=g({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rf,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!==la&&(la&&s.type==="mousemove"?(Of=s.screenX-la.screenX,Ef=s.screenY-la.screenY):Ef=Of=0,la=s),Of)},movementY:function(s){return"movementY"in s?s.movementY:Ef}}),oy=ii(uu),BM=g({},uu,{dataTransfer:0}),zM=ii(BM),_M=g({},sa,{relatedTarget:0}),Nf=ii(_M),HM=g({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),UM=ii(HM),qM=g({},Xr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),PM=ii(qM),FM=g({},Xr,{data:0}),uy=ii(FM),VM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IM={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"},QM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GM(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=QM[s])?!!l[s]:!1}function Rf(){return GM}var YM=g({},sa,{key:function(s){if(s.key){var l=VM[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=lu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?IM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rf,charCode:function(s){return s.type==="keypress"?lu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?lu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),KM=ii(YM),WM=g({},uu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cy=ii(WM),XM=g({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rf}),JM=ii(XM),ZM=g({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),$M=ii(ZM),eT=g({},uu,{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}),tT=ii(eT),iT=g({},Xr,{newState:0,oldState:0}),nT=ii(iT),rT=[9,13,27,32],Df=On&&"CompositionEvent"in window,aa=null;On&&"documentMode"in document&&(aa=document.documentMode);var sT=On&&"TextEvent"in window&&!aa,hy=On&&(!Df||aa&&8<aa&&11>=aa),fy=" ",dy=!1;function py(s,l){switch(s){case"keyup":return rT.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function my(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Us=!1;function lT(s,l){switch(s){case"compositionend":return my(l);case"keypress":return l.which!==32?null:(dy=!0,fy);case"textInput":return s=l.data,s===fy&&dy?null:s;default:return null}}function aT(s,l){if(Us)return s==="compositionend"||!Df&&py(s,l)?(s=ly(),su=Tf=rr=null,Us=!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 hy&&l.locale!=="ko"?null:l.data;default:return null}}var oT={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 gy(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!oT[s.type]:l==="textarea"}function yy(s,l,u,f){_s?Hs?Hs.push(f):Hs=[f]:_s=f,l=Zu(l,"onChange"),0<l.length&&(u=new ou("onChange","change",null,u,f),s.push({event:u,listeners:l}))}var oa=null,ua=null;function uT(s){$b(s,0)}function cu(s){var l=ia(s);if(Z0(l))return s}function xy(s,l){if(s==="change")return l}var by=!1;if(On){var jf;if(On){var Lf="oninput"in document;if(!Lf){var vy=document.createElement("div");vy.setAttribute("oninput","return;"),Lf=typeof vy.oninput=="function"}jf=Lf}else jf=!1;by=jf&&(!document.documentMode||9<document.documentMode)}function Sy(){oa&&(oa.detachEvent("onpropertychange",wy),ua=oa=null)}function wy(s){if(s.propertyName==="value"&&cu(ua)){var l=[];yy(l,ua,s,Cf(s)),sy(uT,l)}}function cT(s,l,u){s==="focusin"?(Sy(),oa=l,ua=u,oa.attachEvent("onpropertychange",wy)):s==="focusout"&&Sy()}function hT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return cu(ua)}function fT(s,l){if(s==="click")return cu(l)}function dT(s,l){if(s==="input"||s==="change")return cu(l)}function pT(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var xi=typeof Object.is=="function"?Object.is:pT;function ca(s,l){if(xi(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(!hf.call(l,m)||!xi(s[m],l[m]))return!1}return!0}function ky(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Cy(s,l){var u=ky(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=ky(u)}}function Ay(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?Ay(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function My(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=nu(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=nu(s.document)}return l}function Bf(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 mT=On&&"documentMode"in document&&11>=document.documentMode,qs=null,zf=null,ha=null,_f=!1;function Ty(s,l,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;_f||qs==null||qs!==nu(f)||(f=qs,"selectionStart"in f&&Bf(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}),ha&&ca(ha,f)||(ha=f,f=Zu(zf,"onSelect"),0<f.length&&(l=new ou("onSelect","select",null,l,u),s.push({event:l,listeners:f}),l.target=qs)))}function Jr(s,l){var u={};return u[s.toLowerCase()]=l.toLowerCase(),u["Webkit"+s]="webkit"+l,u["Moz"+s]="moz"+l,u}var Ps={animationend:Jr("Animation","AnimationEnd"),animationiteration:Jr("Animation","AnimationIteration"),animationstart:Jr("Animation","AnimationStart"),transitionrun:Jr("Transition","TransitionRun"),transitionstart:Jr("Transition","TransitionStart"),transitioncancel:Jr("Transition","TransitionCancel"),transitionend:Jr("Transition","TransitionEnd")},Hf={},Oy={};On&&(Oy=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function Zr(s){if(Hf[s])return Hf[s];if(!Ps[s])return s;var l=Ps[s],u;for(u in l)if(l.hasOwnProperty(u)&&u in Oy)return Hf[s]=l[u];return s}var Ey=Zr("animationend"),Ny=Zr("animationiteration"),Ry=Zr("animationstart"),gT=Zr("transitionrun"),yT=Zr("transitionstart"),xT=Zr("transitioncancel"),Dy=Zr("transitionend"),jy=new Map,Uf="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(" ");Uf.push("scrollEnd");function Ki(s,l){jy.set(s,l),Wr(l,[s])}var hu=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)},Di=[],Fs=0,qf=0;function fu(){for(var s=Fs,l=qf=Fs=0;l<s;){var u=Di[l];Di[l++]=null;var f=Di[l];Di[l++]=null;var m=Di[l];Di[l++]=null;var y=Di[l];if(Di[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&&Ly(u,m,y)}}function du(s,l,u,f){Di[Fs++]=s,Di[Fs++]=l,Di[Fs++]=u,Di[Fs++]=f,qf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Pf(s,l,u,f){return du(s,l,u,f),pu(s)}function $r(s,l){return du(s,null,null,l),pu(s)}function Ly(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-yi(u),s=y.hiddenUpdates,f=s[m],f===null?s[m]=[l]:f.push(l),l.lane=u|536870912),y):null}function pu(s){if(50<ja)throw ja=0,Xd=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Vs={};function bT(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 bi(s,l,u,f){return new bT(s,l,u,f)}function Ff(s){return s=s.prototype,!(!s||!s.isReactComponent)}function En(s,l){var u=s.alternate;return u===null?(u=bi(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 By(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 mu(s,l,u,f,m,y){var S=0;if(f=s,typeof s=="function")Ff(s)&&(S=1);else if(typeof s=="string")S=CO(s,u,ne.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case ee:return s=bi(31,u,l,m),s.elementType=ee,s.lanes=y,s;case k:return es(u.children,m,y,l);case C:S=8,m|=24;break;case M:return s=bi(12,u,l,m|2),s.elementType=M,s.lanes=y,s;case L:return s=bi(13,u,l,m),s.elementType=L,s.lanes=y,s;case I:return s=bi(19,u,l,m),s.elementType=I,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case D:S=10;break e;case E:S=9;break e;case G:S=11;break e;case q:S=14;break e;case $:S=16,f=null;break e}S=29,u=Error(n(130,s===null?"null":typeof s,"")),f=null}return l=bi(S,u,l,m),l.elementType=s,l.type=f,l.lanes=y,l}function es(s,l,u,f){return s=bi(7,s,f,l),s.lanes=u,s}function Vf(s,l,u){return s=bi(6,s,null,l),s.lanes=u,s}function zy(s){var l=bi(18,null,null,0);return l.stateNode=s,l}function If(s,l,u){return l=bi(4,s.children!==null?s.children:[],s.key,l),l.lanes=u,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var _y=new WeakMap;function ji(s,l){if(typeof s=="object"&&s!==null){var u=_y.get(s);return u!==void 0?u:(l={value:s,source:l,stack:z0(l)},_y.set(s,l),l)}return{value:s,source:l,stack:z0(l)}}var Is=[],Qs=0,gu=null,fa=0,Li=[],Bi=0,sr=null,ln=1,an="";function Nn(s,l){Is[Qs++]=fa,Is[Qs++]=gu,gu=s,fa=l}function Hy(s,l,u){Li[Bi++]=ln,Li[Bi++]=an,Li[Bi++]=sr,sr=s;var f=ln;s=an;var m=32-yi(f)-1;f&=~(1<<m),u+=1;var y=32-yi(l)+m;if(30<y){var S=m-m%5;y=(f&(1<<S)-1).toString(32),f>>=S,m-=S,ln=1<<32-yi(l)+m|u<<m|f,an=y+s}else ln=1<<y|u<<m|f,an=s}function Qf(s){s.return!==null&&(Nn(s,1),Hy(s,1,0))}function Gf(s){for(;s===gu;)gu=Is[--Qs],Is[Qs]=null,fa=Is[--Qs],Is[Qs]=null;for(;s===sr;)sr=Li[--Bi],Li[Bi]=null,an=Li[--Bi],Li[Bi]=null,ln=Li[--Bi],Li[Bi]=null}function Uy(s,l){Li[Bi++]=ln,Li[Bi++]=an,Li[Bi++]=sr,ln=l.id,an=l.overflow,sr=s}var Lt=null,et=null,Le=!1,lr=null,zi=!1,Yf=Error(n(519));function ar(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw da(ji(l,s)),Yf}function qy(s){var l=s.stateNode,u=s.type,f=s.memoizedProps;switch(l[jt]=s,l[ti]=f,u){case"dialog":Ne("cancel",l),Ne("close",l);break;case"iframe":case"object":case"embed":Ne("load",l);break;case"video":case"audio":for(u=0;u<Ba.length;u++)Ne(Ba[u],l);break;case"source":Ne("error",l);break;case"img":case"image":case"link":Ne("error",l),Ne("load",l);break;case"details":Ne("toggle",l);break;case"input":Ne("invalid",l),$0(l,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ne("invalid",l);break;case"textarea":Ne("invalid",l),ty(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||n1(l.textContent,u)?(f.popover!=null&&(Ne("beforetoggle",l),Ne("toggle",l)),f.onScroll!=null&&Ne("scroll",l),f.onScrollEnd!=null&&Ne("scrollend",l),f.onClick!=null&&(l.onclick=Tn),l=!0):l=!1,l||ar(s,!0)}function Py(s){for(Lt=s.return;Lt;)switch(Lt.tag){case 5:case 31:case 13:zi=!1;return;case 27:case 3:zi=!0;return;default:Lt=Lt.return}}function Gs(s){if(s!==Lt)return!1;if(!Le)return Py(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")||hp(s.type,s.memoizedProps)),u=!u),u&&et&&ar(s),Py(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));et=f1(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));et=f1(s)}else l===27?(l=et,Sr(s.type)?(s=gp,gp=null,et=s):et=l):et=Lt?Hi(s.stateNode.nextSibling):null;return!0}function ts(){et=Lt=null,Le=!1}function Kf(){var s=lr;return s!==null&&(li===null?li=s:li.push.apply(li,s),lr=null),s}function da(s){lr===null?lr=[s]:lr.push(s)}var Wf=T(null),is=null,Rn=null;function or(s,l,u){Z(Wf,l._currentValue),l._currentValue=u}function Dn(s){s._currentValue=Wf.current,F(Wf)}function Xf(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 Jf(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 N=0;N<l.length;N++)if(A.context===l[N]){y.lanes|=u,A=y.alternate,A!==null&&(A.lanes|=u),Xf(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),Xf(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 Ys(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;xi(m.pendingProps.value,S.value)||(s!==null?s.push(A):s=[A])}}else if(m===He.current){if(S=m.alternate,S===null)throw Error(n(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(qa):s=[qa])}m=m.return}s!==null&&Jf(l,s,u,f),l.flags|=262144}function yu(s){for(s=s.firstContext;s!==null;){if(!xi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ns(s){is=s,Rn=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Bt(s){return Fy(is,s)}function xu(s,l){return is===null&&ns(s),Fy(s,l)}function Fy(s,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},Rn===null){if(s===null)throw Error(n(308));Rn=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else Rn=Rn.next=l;return u}var vT=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()})}},ST=t.unstable_scheduleCallback,wT=t.unstable_NormalPriority,xt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zf(){return{controller:new vT,data:new Map,refCount:0}}function pa(s){s.refCount--,s.refCount===0&&ST(wT,function(){s.controller.abort()})}var ma=null,$f=0,Ks=0,Ws=null;function kT(s,l){if(ma===null){var u=ma=[];$f=0,Ks=ip(),Ws={status:"pending",value:void 0,then:function(f){u.push(f)}}}return $f++,l.then(Vy,Vy),l}function Vy(){if(--$f===0&&ma!==null){Ws!==null&&(Ws.status="fulfilled");var s=ma;ma=null,Ks=0,Ws=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function CT(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 Iy=_.S;_.S=function(s,l){Tb=mi(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&kT(s,l),Iy!==null&&Iy(s,l)};var rs=T(null);function ed(){var s=rs.current;return s!==null?s:We.pooledCache}function bu(s,l){l===null?Z(rs,rs.current):Z(rs,l.pool)}function Qy(){var s=ed();return s===null?null:{parent:xt._currentValue,pool:s}}var Xs=Error(n(460)),td=Error(n(474)),vu=Error(n(542)),Su={then:function(){}};function Gy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Yy(s,l,u){switch(u=s[u],u===void 0?s.push(l):u!==l&&(l.then(Tn,Tn),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,Wy(s),s;default:if(typeof l.status=="string")l.then(Tn,Tn);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,Wy(s),s}throw ls=l,Xs}}function ss(s){try{var l=s._init;return l(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(ls=u,Xs):u}}var ls=null;function Ky(){if(ls===null)throw Error(n(459));var s=ls;return ls=null,s}function Wy(s){if(s===Xs||s===vu)throw Error(n(483))}var Js=null,ga=0;function wu(s){var l=ga;return ga+=1,Js===null&&(Js=[]),Yy(Js,s,l)}function ya(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function ku(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 Xy(s){function l(j,R){if(s){var B=j.deletions;B===null?(j.deletions=[R],j.flags|=16):B.push(R)}}function u(j,R){if(!s)return null;for(;R!==null;)l(j,R),R=R.sibling;return null}function f(j){for(var R=new Map;j!==null;)j.key!==null?R.set(j.key,j):R.set(j.index,j),j=j.sibling;return R}function m(j,R){return j=En(j,R),j.index=0,j.sibling=null,j}function y(j,R,B){return j.index=B,s?(B=j.alternate,B!==null?(B=B.index,B<R?(j.flags|=67108866,R):B):(j.flags|=67108866,R)):(j.flags|=1048576,R)}function S(j){return s&&j.alternate===null&&(j.flags|=67108866),j}function A(j,R,B,K){return R===null||R.tag!==6?(R=Vf(B,j.mode,K),R.return=j,R):(R=m(R,B),R.return=j,R)}function N(j,R,B,K){var ge=B.type;return ge===k?Y(j,R,B.props.children,K,B.key):R!==null&&(R.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===$&&ss(ge)===R.type)?(R=m(R,B.props),ya(R,B),R.return=j,R):(R=mu(B.type,B.key,B.props,null,j.mode,K),ya(R,B),R.return=j,R)}function z(j,R,B,K){return R===null||R.tag!==4||R.stateNode.containerInfo!==B.containerInfo||R.stateNode.implementation!==B.implementation?(R=If(B,j.mode,K),R.return=j,R):(R=m(R,B.children||[]),R.return=j,R)}function Y(j,R,B,K,ge){return R===null||R.tag!==7?(R=es(B,j.mode,K,ge),R.return=j,R):(R=m(R,B),R.return=j,R)}function W(j,R,B){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Vf(""+R,j.mode,B),R.return=j,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return B=mu(R.type,R.key,R.props,null,j.mode,B),ya(B,R),B.return=j,B;case w:return R=If(R,j.mode,B),R.return=j,R;case $:return R=ss(R),W(j,R,B)}if(ue(R)||P(R))return R=es(R,j.mode,B,null),R.return=j,R;if(typeof R.then=="function")return W(j,wu(R),B);if(R.$$typeof===D)return W(j,xu(j,R),B);ku(j,R)}return null}function U(j,R,B,K){var ge=R!==null?R.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return ge!==null?null:A(j,R,""+B,K);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return B.key===ge?N(j,R,B,K):null;case w:return B.key===ge?z(j,R,B,K):null;case $:return B=ss(B),U(j,R,B,K)}if(ue(B)||P(B))return ge!==null?null:Y(j,R,B,K,null);if(typeof B.then=="function")return U(j,R,wu(B),K);if(B.$$typeof===D)return U(j,R,xu(j,B),K);ku(j,B)}return null}function V(j,R,B,K,ge){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return j=j.get(B)||null,A(R,j,""+K,ge);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case v:return j=j.get(K.key===null?B:K.key)||null,N(R,j,K,ge);case w:return j=j.get(K.key===null?B:K.key)||null,z(R,j,K,ge);case $:return K=ss(K),V(j,R,B,K,ge)}if(ue(K)||P(K))return j=j.get(B)||null,Y(R,j,K,ge,null);if(typeof K.then=="function")return V(j,R,B,wu(K),ge);if(K.$$typeof===D)return V(j,R,B,xu(R,K),ge);ku(R,K)}return null}function he(j,R,B,K){for(var ge=null,Ue=null,pe=R,Me=R=0,je=null;pe!==null&&Me<B.length;Me++){pe.index>Me?(je=pe,pe=null):je=pe.sibling;var qe=U(j,pe,B[Me],K);if(qe===null){pe===null&&(pe=je);break}s&&pe&&qe.alternate===null&&l(j,pe),R=y(qe,R,Me),Ue===null?ge=qe:Ue.sibling=qe,Ue=qe,pe=je}if(Me===B.length)return u(j,pe),Le&&Nn(j,Me),ge;if(pe===null){for(;Me<B.length;Me++)pe=W(j,B[Me],K),pe!==null&&(R=y(pe,R,Me),Ue===null?ge=pe:Ue.sibling=pe,Ue=pe);return Le&&Nn(j,Me),ge}for(pe=f(pe);Me<B.length;Me++)je=V(pe,j,Me,B[Me],K),je!==null&&(s&&je.alternate!==null&&pe.delete(je.key===null?Me:je.key),R=y(je,R,Me),Ue===null?ge=je:Ue.sibling=je,Ue=je);return s&&pe.forEach(function(Mr){return l(j,Mr)}),Le&&Nn(j,Me),ge}function be(j,R,B,K){if(B==null)throw Error(n(151));for(var ge=null,Ue=null,pe=R,Me=R=0,je=null,qe=B.next();pe!==null&&!qe.done;Me++,qe=B.next()){pe.index>Me?(je=pe,pe=null):je=pe.sibling;var Mr=U(j,pe,qe.value,K);if(Mr===null){pe===null&&(pe=je);break}s&&pe&&Mr.alternate===null&&l(j,pe),R=y(Mr,R,Me),Ue===null?ge=Mr:Ue.sibling=Mr,Ue=Mr,pe=je}if(qe.done)return u(j,pe),Le&&Nn(j,Me),ge;if(pe===null){for(;!qe.done;Me++,qe=B.next())qe=W(j,qe.value,K),qe!==null&&(R=y(qe,R,Me),Ue===null?ge=qe:Ue.sibling=qe,Ue=qe);return Le&&Nn(j,Me),ge}for(pe=f(pe);!qe.done;Me++,qe=B.next())qe=V(pe,j,Me,qe.value,K),qe!==null&&(s&&qe.alternate!==null&&pe.delete(qe.key===null?Me:qe.key),R=y(qe,R,Me),Ue===null?ge=qe:Ue.sibling=qe,Ue=qe);return s&&pe.forEach(function(BO){return l(j,BO)}),Le&&Nn(j,Me),ge}function Ye(j,R,B,K){if(typeof B=="object"&&B!==null&&B.type===k&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case v:e:{for(var ge=B.key;R!==null;){if(R.key===ge){if(ge=B.type,ge===k){if(R.tag===7){u(j,R.sibling),K=m(R,B.props.children),K.return=j,j=K;break e}}else if(R.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===$&&ss(ge)===R.type){u(j,R.sibling),K=m(R,B.props),ya(K,B),K.return=j,j=K;break e}u(j,R);break}else l(j,R);R=R.sibling}B.type===k?(K=es(B.props.children,j.mode,K,B.key),K.return=j,j=K):(K=mu(B.type,B.key,B.props,null,j.mode,K),ya(K,B),K.return=j,j=K)}return S(j);case w:e:{for(ge=B.key;R!==null;){if(R.key===ge)if(R.tag===4&&R.stateNode.containerInfo===B.containerInfo&&R.stateNode.implementation===B.implementation){u(j,R.sibling),K=m(R,B.children||[]),K.return=j,j=K;break e}else{u(j,R);break}else l(j,R);R=R.sibling}K=If(B,j.mode,K),K.return=j,j=K}return S(j);case $:return B=ss(B),Ye(j,R,B,K)}if(ue(B))return he(j,R,B,K);if(P(B)){if(ge=P(B),typeof ge!="function")throw Error(n(150));return B=ge.call(B),be(j,R,B,K)}if(typeof B.then=="function")return Ye(j,R,wu(B),K);if(B.$$typeof===D)return Ye(j,R,xu(j,B),K);ku(j,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,R!==null&&R.tag===6?(u(j,R.sibling),K=m(R,B),K.return=j,j=K):(u(j,R),K=Vf(B,j.mode,K),K.return=j,j=K),S(j)):u(j,R)}return function(j,R,B,K){try{ga=0;var ge=Ye(j,R,B,K);return Js=null,ge}catch(pe){if(pe===Xs||pe===vu)throw pe;var Ue=bi(29,pe,null,j.mode);return Ue.lanes=K,Ue.return=j,Ue}}}var as=Xy(!0),Jy=Xy(!1),ur=!1;function id(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nd(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 cr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function hr(s,l,u){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Fe&2)!==0){var m=f.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),f.pending=l,l=pu(s),Ly(s,null,u),l}return du(s,f,l,u),pu(s)}function xa(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,F0(s,u)}}function rd(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 sd=!1;function ba(){if(sd){var s=Ws;if(s!==null)throw s}}function va(s,l,u,f){sd=!1;var m=s.updateQueue;ur=!1;var y=m.firstBaseUpdate,S=m.lastBaseUpdate,A=m.shared.pending;if(A!==null){m.shared.pending=null;var N=A,z=N.next;N.next=null,S===null?y=z:S.next=z,S=N;var Y=s.alternate;Y!==null&&(Y=Y.updateQueue,A=Y.lastBaseUpdate,A!==S&&(A===null?Y.firstBaseUpdate=z:A.next=z,Y.lastBaseUpdate=N))}if(y!==null){var W=m.baseState;S=0,Y=z=N=null,A=y;do{var U=A.lane&-536870913,V=U!==A.lane;if(V?(De&U)===U:(f&U)===U){U!==0&&U===Ks&&(sd=!0),Y!==null&&(Y=Y.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var he=s,be=A;U=l;var Ye=u;switch(be.tag){case 1:if(he=be.payload,typeof he=="function"){W=he.call(Ye,W,U);break e}W=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=be.payload,U=typeof he=="function"?he.call(Ye,W,U):he,U==null)break e;W=g({},W,U);break e;case 2:ur=!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?(z=Y=V,N=W):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&&(N=W),m.baseState=N,m.firstBaseUpdate=z,m.lastBaseUpdate=Y,y===null&&(m.shared.lanes=0),gr|=S,s.lanes=S,s.memoizedState=W}}function Zy(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function $y(s,l){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Zy(u[s],l)}var Zs=T(null),Cu=T(0);function ex(s,l){s=Pn,Z(Cu,s),Z(Zs,l),Pn=s|l.baseLanes}function ld(){Z(Cu,Pn),Z(Zs,Zs.current)}function ad(){Pn=Cu.current,F(Zs),F(Cu)}var vi=T(null),_i=null;function fr(s){var l=s.alternate;Z(dt,dt.current&1),Z(vi,s),_i===null&&(l===null||Zs.current!==null||l.memoizedState!==null)&&(_i=s)}function od(s){Z(dt,dt.current),Z(vi,s),_i===null&&(_i=s)}function tx(s){s.tag===22?(Z(dt,dt.current),Z(vi,s),_i===null&&(_i=s)):dr()}function dr(){Z(dt,dt.current),Z(vi,vi.current)}function Si(s){F(vi),_i===s&&(_i=null),F(dt)}var dt=T(0);function Au(s){for(var l=s;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||pp(u)||mp(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 jn=0,Ae=null,Qe=null,bt=null,Mu=!1,$s=!1,os=!1,Tu=0,Sa=0,el=null,AT=0;function ot(){throw Error(n(321))}function ud(s,l){if(l===null)return!1;for(var u=0;u<l.length&&u<s.length;u++)if(!xi(s[u],l[u]))return!1;return!0}function cd(s,l,u,f,m,y){return jn=y,Ae=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,_.H=s===null||s.memoizedState===null?Hx:Ad,os=!1,y=u(f,m),os=!1,$s&&(y=nx(l,u,f,m)),ix(s),y}function ix(s){_.H=Ca;var l=Qe!==null&&Qe.next!==null;if(jn=0,bt=Qe=Ae=null,Mu=!1,Sa=0,el=null,l)throw Error(n(300));s===null||vt||(s=s.dependencies,s!==null&&yu(s)&&(vt=!0))}function nx(s,l,u,f){Ae=s;var m=0;do{if($s&&(el=null),Sa=0,$s=!1,25<=m)throw Error(n(301));if(m+=1,bt=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)}_.H=Ux,y=l(u,f)}while($s);return y}function MT(){var s=_.H,l=s.useState()[0];return l=typeof l.then=="function"?wa(l):l,s=s.useState()[0],(Qe!==null?Qe.memoizedState:null)!==s&&(Ae.flags|=1024),l}function hd(){var s=Tu!==0;return Tu=0,s}function fd(s,l,u){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~u}function dd(s){if(Mu){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Mu=!1}jn=0,bt=Qe=Ae=null,$s=!1,Sa=Tu=0,el=null}function Wt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ae.memoizedState=bt=s:bt=bt.next=s,bt}function pt(){if(Qe===null){var s=Ae.alternate;s=s!==null?s.memoizedState:null}else s=Qe.next;var l=bt===null?Ae.memoizedState:bt.next;if(l!==null)bt=l,Qe=s;else{if(s===null)throw Ae.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},bt===null?Ae.memoizedState=bt=s:bt=bt.next=s}return bt}function Ou(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wa(s){var l=Sa;return Sa+=1,el===null&&(el=[]),s=Yy(el,s,l),l=Ae,(bt===null?l.memoizedState:bt.next)===null&&(l=l.alternate,_.H=l===null||l.memoizedState===null?Hx:Ad),s}function Eu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return wa(s);if(s.$$typeof===D)return Bt(s)}throw Error(n(438,String(s)))}function pd(s){var l=null,u=Ae.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var f=Ae.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=Ou(),Ae.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]=fe;return l.index++,u}function Ln(s,l){return typeof l=="function"?l(s):l}function Nu(s){var l=pt();return md(l,Qe,s)}function md(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,N=null,z=l,Y=!1;do{var W=z.lane&-536870913;if(W!==z.lane?(De&W)===W:(jn&W)===W){var U=z.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),W===Ks&&(Y=!0);else if((jn&U)===U){z=z.next,U===Ks&&(Y=!0);continue}else W={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(A=N=W,S=y):N=N.next=W,Ae.lanes|=U,gr|=U;W=z.action,os&&u(y,W),y=z.hasEagerState?z.eagerState:u(y,W)}else U={lane:W,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(A=N=U,S=y):N=N.next=U,Ae.lanes|=W,gr|=W;z=z.next}while(z!==null&&z!==l);if(N===null?S=y:N.next=A,!xi(y,s.memoizedState)&&(vt=!0,Y&&(u=Ws,u!==null)))throw u;s.memoizedState=y,s.baseState=S,s.baseQueue=N,f.lastRenderedState=y}return m===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function gd(s){var l=pt(),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);xi(y,l.memoizedState)||(vt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),u.lastRenderedState=y}return[y,f]}function rx(s,l,u){var f=Ae,m=pt(),y=Le;if(y){if(u===void 0)throw Error(n(407));u=u()}else u=l();var S=!xi((Qe||m).memoizedState,u);if(S&&(m.memoizedState=u,vt=!0),m=m.queue,bd(ax.bind(null,f,m,s),[s]),m.getSnapshot!==l||S||bt!==null&&bt.memoizedState.tag&1){if(f.flags|=2048,tl(9,{destroy:void 0},lx.bind(null,f,m,u,l),null),We===null)throw Error(n(349));y||(jn&127)!==0||sx(f,l,u)}return u}function sx(s,l,u){s.flags|=16384,s={getSnapshot:l,value:u},l=Ae.updateQueue,l===null?(l=Ou(),Ae.updateQueue=l,l.stores=[s]):(u=l.stores,u===null?l.stores=[s]:u.push(s))}function lx(s,l,u,f){l.value=u,l.getSnapshot=f,ox(l)&&ux(s)}function ax(s,l,u){return u(function(){ox(l)&&ux(s)})}function ox(s){var l=s.getSnapshot;s=s.value;try{var u=l();return!xi(s,u)}catch{return!0}}function ux(s){var l=$r(s,2);l!==null&&ai(l,s,2)}function yd(s){var l=Wt();if(typeof s=="function"){var u=s;if(s=u(),os){ir(!0);try{u()}finally{ir(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:s},l}function cx(s,l,u,f){return s.baseState=u,md(s,Qe,typeof f=="function"?f:Ln)}function TT(s,l,u,f,m){if(ju(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)}};_.T!==null?u(!0):y.isTransition=!1,f(y),u=l.pending,u===null?(y.next=l.pending=y,hx(l,y)):(y.next=u.next,l.pending=u.next=y)}}function hx(s,l){var u=l.action,f=l.payload,m=s.state;if(l.isTransition){var y=_.T,S={};_.T=S;try{var A=u(m,f),N=_.S;N!==null&&N(S,A),fx(s,l,A)}catch(z){xd(s,l,z)}finally{y!==null&&S.types!==null&&(y.types=S.types),_.T=y}}else try{y=u(m,f),fx(s,l,y)}catch(z){xd(s,l,z)}}function fx(s,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){dx(s,l,f)},function(f){return xd(s,l,f)}):dx(s,l,u)}function dx(s,l,u){l.status="fulfilled",l.value=u,px(l),s.state=u,l=s.pending,l!==null&&(u=l.next,u===l?s.pending=null:(u=u.next,l.next=u,hx(s,u)))}function xd(s,l,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do l.status="rejected",l.reason=u,px(l),l=l.next;while(l!==f)}s.action=null}function px(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function mx(s,l){return l}function gx(s,l){if(Le){var u=We.formState;if(u!==null){e:{var f=Ae;if(Le){if(et){t:{for(var m=et,y=zi;m.nodeType!==8;){if(!y){m=null;break t}if(m=Hi(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){et=Hi(m.nextSibling),f=m.data==="F!";break e}}ar(f)}f=!1}f&&(l=u[0])}}return u=Wt(),u.memoizedState=u.baseState=l,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mx,lastRenderedState:l},u.queue=f,u=Bx.bind(null,Ae,f),f.dispatch=u,f=yd(!1),y=Cd.bind(null,Ae,!1,f.queue),f=Wt(),m={state:l,dispatch:null,action:s,pending:null},f.queue=m,u=TT.bind(null,Ae,m,y,u),m.dispatch=u,f.memoizedState=s,[l,u,!1]}function yx(s){var l=pt();return xx(l,Qe,s)}function xx(s,l,u){if(l=md(s,l,mx)[0],s=Nu(Ln)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var f=wa(l)}catch(S){throw S===Xs?vu:S}else f=l;l=pt();var m=l.queue,y=m.dispatch;return u!==l.memoizedState&&(Ae.flags|=2048,tl(9,{destroy:void 0},OT.bind(null,m,u),null)),[f,y,s]}function OT(s,l){s.action=l}function bx(s){var l=pt(),u=Qe;if(u!==null)return xx(l,u,s);pt(),l=l.memoizedState,u=pt();var f=u.queue.dispatch;return u.memoizedState=s,[l,f,!1]}function tl(s,l,u,f){return s={tag:s,create:u,deps:f,inst:l,next:null},l=Ae.updateQueue,l===null&&(l=Ou(),Ae.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 vx(){return pt().memoizedState}function Ru(s,l,u,f){var m=Wt();Ae.flags|=s,m.memoizedState=tl(1|l,{destroy:void 0},u,f===void 0?null:f)}function Du(s,l,u,f){var m=pt();f=f===void 0?null:f;var y=m.memoizedState.inst;Qe!==null&&f!==null&&ud(f,Qe.memoizedState.deps)?m.memoizedState=tl(l,y,u,f):(Ae.flags|=s,m.memoizedState=tl(1|l,y,u,f))}function Sx(s,l){Ru(8390656,8,s,l)}function bd(s,l){Du(2048,8,s,l)}function ET(s){Ae.flags|=4;var l=Ae.updateQueue;if(l===null)l=Ou(),Ae.updateQueue=l,l.events=[s];else{var u=l.events;u===null?l.events=[s]:u.push(s)}}function wx(s){var l=pt().memoizedState;return ET({ref:l,nextImpl:s}),function(){if((Fe&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function kx(s,l){return Du(4,2,s,l)}function Cx(s,l){return Du(4,4,s,l)}function Ax(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 Mx(s,l,u){u=u!=null?u.concat([s]):null,Du(4,4,Ax.bind(null,l,s),u)}function vd(){}function Tx(s,l){var u=pt();l=l===void 0?null:l;var f=u.memoizedState;return l!==null&&ud(l,f[1])?f[0]:(u.memoizedState=[s,l],s)}function Ox(s,l){var u=pt();l=l===void 0?null:l;var f=u.memoizedState;if(l!==null&&ud(l,f[1]))return f[0];if(f=s(),os){ir(!0);try{s()}finally{ir(!1)}}return u.memoizedState=[f,l],f}function Sd(s,l,u){return u===void 0||(jn&1073741824)!==0&&(De&261930)===0?s.memoizedState=l:(s.memoizedState=u,s=Eb(),Ae.lanes|=s,gr|=s,u)}function Ex(s,l,u,f){return xi(u,l)?u:Zs.current!==null?(s=Sd(s,u,f),xi(s,l)||(vt=!0),s):(jn&42)===0||(jn&1073741824)!==0&&(De&261930)===0?(vt=!0,s.memoizedState=u):(s=Eb(),Ae.lanes|=s,gr|=s,l)}function Nx(s,l,u,f,m){var y=J.p;J.p=y!==0&&8>y?y:8;var S=_.T,A={};_.T=A,Cd(s,!1,l,u);try{var N=m(),z=_.S;if(z!==null&&z(A,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var Y=CT(N,f);ka(s,l,Y,Ci(s))}else ka(s,l,f,Ci(s))}catch(W){ka(s,l,{then:function(){},status:"rejected",reason:W},Ci())}finally{J.p=y,S!==null&&A.types!==null&&(S.types=A.types),_.T=S}}function NT(){}function wd(s,l,u,f){if(s.tag!==5)throw Error(n(476));var m=Rx(s).queue;Nx(s,m,l,se,u===null?NT:function(){return Dx(s),u(f)})}function Rx(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:se},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:u},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function Dx(s){var l=Rx(s);l.next===null&&(l=s.alternate.memoizedState),ka(s,l.next.queue,{},Ci())}function kd(){return Bt(qa)}function jx(){return pt().memoizedState}function Lx(){return pt().memoizedState}function RT(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var u=Ci();s=cr(u);var f=hr(l,s,u);f!==null&&(ai(f,l,u),xa(f,l,u)),l={cache:Zf()},s.payload=l;return}l=l.return}}function DT(s,l,u){var f=Ci();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},ju(s)?zx(l,u):(u=Pf(s,l,u,f),u!==null&&(ai(u,s,f),_x(u,l,f)))}function Bx(s,l,u){var f=Ci();ka(s,l,u,f)}function ka(s,l,u,f){var m={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(ju(s))zx(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,xi(A,S))return du(s,l,m,0),We===null&&fu(),!1}catch{}if(u=Pf(s,l,m,f),u!==null)return ai(u,s,f),_x(u,l,f),!0}return!1}function Cd(s,l,u,f){if(f={lane:2,revertLane:ip(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},ju(s)){if(l)throw Error(n(479))}else l=Pf(s,u,f,2),l!==null&&ai(l,s,2)}function ju(s){var l=s.alternate;return s===Ae||l!==null&&l===Ae}function zx(s,l){$s=Mu=!0;var u=s.pending;u===null?l.next=l:(l.next=u.next,u.next=l),s.pending=l}function _x(s,l,u){if((u&4194048)!==0){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,F0(s,u)}}var Ca={readContext:Bt,use:Eu,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};Ca.useEffectEvent=ot;var Hx={readContext:Bt,use:Eu,useCallback:function(s,l){return Wt().memoizedState=[s,l===void 0?null:l],s},useContext:Bt,useEffect:Sx,useImperativeHandle:function(s,l,u){u=u!=null?u.concat([s]):null,Ru(4194308,4,Ax.bind(null,l,s),u)},useLayoutEffect:function(s,l){return Ru(4194308,4,s,l)},useInsertionEffect:function(s,l){Ru(4,2,s,l)},useMemo:function(s,l){var u=Wt();l=l===void 0?null:l;var f=s();if(os){ir(!0);try{s()}finally{ir(!1)}}return u.memoizedState=[f,l],f},useReducer:function(s,l,u){var f=Wt();if(u!==void 0){var m=u(l);if(os){ir(!0);try{u(l)}finally{ir(!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,Ae,s),[f.memoizedState,s]},useRef:function(s){var l=Wt();return s={current:s},l.memoizedState=s},useState:function(s){s=yd(s);var l=s.queue,u=Bx.bind(null,Ae,l);return l.dispatch=u,[s.memoizedState,u]},useDebugValue:vd,useDeferredValue:function(s,l){var u=Wt();return Sd(u,s,l)},useTransition:function(){var s=yd(!1);return s=Nx.bind(null,Ae,s.queue,!0,!1),Wt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,u){var f=Ae,m=Wt();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||sx(f,l,u)}m.memoizedState=u;var y={value:u,getSnapshot:l};return m.queue=y,Sx(ax.bind(null,f,y,s),[s]),f.flags|=2048,tl(9,{destroy:void 0},lx.bind(null,f,y,u,l),null),u},useId:function(){var s=Wt(),l=We.identifierPrefix;if(Le){var u=an,f=ln;u=(f&~(1<<32-yi(f)-1)).toString(32)+u,l="_"+l+"R_"+u,u=Tu++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=AT++,l="_"+l+"r_"+u.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:kd,useFormState:gx,useActionState:gx,useOptimistic:function(s){var l=Wt();l.memoizedState=l.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=Cd.bind(null,Ae,!0,u),u.dispatch=l,[s,l]},useMemoCache:pd,useCacheRefresh:function(){return Wt().memoizedState=RT.bind(null,Ae)},useEffectEvent:function(s){var l=Wt(),u={impl:s};return l.memoizedState=u,function(){if((Fe&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},Ad={readContext:Bt,use:Eu,useCallback:Tx,useContext:Bt,useEffect:bd,useImperativeHandle:Mx,useInsertionEffect:kx,useLayoutEffect:Cx,useMemo:Ox,useReducer:Nu,useRef:vx,useState:function(){return Nu(Ln)},useDebugValue:vd,useDeferredValue:function(s,l){var u=pt();return Ex(u,Qe.memoizedState,s,l)},useTransition:function(){var s=Nu(Ln)[0],l=pt().memoizedState;return[typeof s=="boolean"?s:wa(s),l]},useSyncExternalStore:rx,useId:jx,useHostTransitionStatus:kd,useFormState:yx,useActionState:yx,useOptimistic:function(s,l){var u=pt();return cx(u,Qe,s,l)},useMemoCache:pd,useCacheRefresh:Lx};Ad.useEffectEvent=wx;var Ux={readContext:Bt,use:Eu,useCallback:Tx,useContext:Bt,useEffect:bd,useImperativeHandle:Mx,useInsertionEffect:kx,useLayoutEffect:Cx,useMemo:Ox,useReducer:gd,useRef:vx,useState:function(){return gd(Ln)},useDebugValue:vd,useDeferredValue:function(s,l){var u=pt();return Qe===null?Sd(u,s,l):Ex(u,Qe.memoizedState,s,l)},useTransition:function(){var s=gd(Ln)[0],l=pt().memoizedState;return[typeof s=="boolean"?s:wa(s),l]},useSyncExternalStore:rx,useId:jx,useHostTransitionStatus:kd,useFormState:bx,useActionState:bx,useOptimistic:function(s,l){var u=pt();return Qe!==null?cx(u,Qe,s,l):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:pd,useCacheRefresh:Lx};Ux.useEffectEvent=wx;function Md(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 Td={enqueueSetState:function(s,l,u){s=s._reactInternals;var f=Ci(),m=cr(f);m.payload=l,u!=null&&(m.callback=u),l=hr(s,m,f),l!==null&&(ai(l,s,f),xa(l,s,f))},enqueueReplaceState:function(s,l,u){s=s._reactInternals;var f=Ci(),m=cr(f);m.tag=1,m.payload=l,u!=null&&(m.callback=u),l=hr(s,m,f),l!==null&&(ai(l,s,f),xa(l,s,f))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var u=Ci(),f=cr(u);f.tag=2,l!=null&&(f.callback=l),l=hr(s,f,u),l!==null&&(ai(l,s,u),xa(l,s,u))}};function qx(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?!ca(u,f)||!ca(m,y):!0}function Px(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&&Td.enqueueReplaceState(l,l.state,null)}function us(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 Fx(s){hu(s)}function Vx(s){console.error(s)}function Ix(s){hu(s)}function Lu(s,l){try{var u=s.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(f){setTimeout(function(){throw f})}}function Qx(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 Od(s,l,u){return u=cr(u),u.tag=3,u.payload={element:null},u.callback=function(){Lu(s,l)},u}function Gx(s){return s=cr(s),s.tag=3,s}function Yx(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(){Qx(l,u,f)}}var S=u.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){Qx(l,u,f),typeof m!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function jT(s,l,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(l=u.alternate,l!==null&&Ys(l,u,m,!0),u=vi.current,u!==null){switch(u.tag){case 31:case 13:return _i===null?Gu():u.alternate===null&&ut===0&&(ut=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===Su?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([f]):l.add(f),$d(s,f,m)),!1;case 22:return u.flags|=65536,f===Su?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)),$d(s,f,m)),!1}throw Error(n(435,u.tag))}return $d(s,f,m),Gu(),!1}if(Le)return l=vi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,f!==Yf&&(s=Error(n(422),{cause:f}),da(ji(s,u)))):(f!==Yf&&(l=Error(n(423),{cause:f}),da(ji(l,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=ji(f,u),m=Od(s.stateNode,f,m),rd(s,m),ut!==4&&(ut=2)),!1;var y=Error(n(520),{cause:f});if(y=ji(y,u),Da===null?Da=[y]:Da.push(y),ut!==4&&(ut=2),l===null)return!0;f=ji(f,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,s=m&-m,u.lanes|=s,s=Od(u.stateNode,f,s),rd(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"&&(yr===null||!yr.has(y))))return u.flags|=65536,m&=-m,u.lanes|=m,m=Gx(m),Yx(m,s,u,f),rd(u,m),!1}u=u.return}while(u!==null);return!1}var Ed=Error(n(461)),vt=!1;function zt(s,l,u,f){l.child=s===null?Jy(l,null,u,f):as(l,s.child,u,f)}function Kx(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 ns(l),f=cd(s,l,u,S,y,m),A=hd(),s!==null&&!vt?(fd(s,l,m),Bn(s,l,m)):(Le&&A&&Qf(l),l.flags|=1,zt(s,l,f,m),l.child)}function Wx(s,l,u,f,m){if(s===null){var y=u.type;return typeof y=="function"&&!Ff(y)&&y.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=y,Xx(s,l,y,f,m)):(s=mu(u.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,!_d(s,m)){var S=y.memoizedProps;if(u=u.compare,u=u!==null?u:ca,u(S,f)&&s.ref===l.ref)return Bn(s,l,m)}return l.flags|=1,s=En(y,f),s.ref=l.ref,s.return=l,l.child=s}function Xx(s,l,u,f,m){if(s!==null){var y=s.memoizedProps;if(ca(y,f)&&s.ref===l.ref)if(vt=!1,l.pendingProps=f=y,_d(s,m))(s.flags&131072)!==0&&(vt=!0);else return l.lanes=s.lanes,Bn(s,l,m)}return Nd(s,l,u,f,m)}function Jx(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 Zx(s,l,y,u,f)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&bu(l,y!==null?y.cachePool:null),y!==null?ex(l,y):ld(),tx(l);else return f=l.lanes=536870912,Zx(s,l,y!==null?y.baseLanes|u:u,u,f)}else y!==null?(bu(l,y.cachePool),ex(l,y),dr(),l.memoizedState=null):(s!==null&&bu(l,null),ld(),dr());return zt(s,l,m,u),l.child}function Aa(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Zx(s,l,u,f,m){var y=ed();return y=y===null?null:{parent:xt._currentValue,pool:y},l.memoizedState={baseLanes:u,cachePool:y},s!==null&&bu(l,null),ld(),tx(l),s!==null&&Ys(s,l,f,!0),l.childLanes=m,null}function Bu(s,l){return l=_u({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function $x(s,l,u){return as(l,s.child,null,u),s=Bu(l,l.pendingProps),s.flags|=2,Si(l),l.memoizedState=null,s}function LT(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=Bu(l,f),l.lanes=536870912,Aa(null,s);if(od(l),(s=et)?(s=h1(s,zi),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sr!==null?{id:ln,overflow:an}:null,retryLane:536870912,hydrationErrors:null},u=zy(s),u.return=l,l.child=u,Lt=l,et=null)):s=null,s===null)throw ar(l);return l.lanes=536870912,null}return Bu(l,f)}var y=s.memoizedState;if(y!==null){var S=y.dehydrated;if(od(l),m)if(l.flags&256)l.flags&=-257,l=$x(s,l,u);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if(vt||Ys(s,l,u,!1),m=(u&s.childLanes)!==0,vt||m){if(f=We,f!==null&&(S=V0(f,u),S!==0&&S!==y.retryLane))throw y.retryLane=S,$r(s,S),ai(f,s,S),Ed;Gu(),l=$x(s,l,u)}else s=y.treeContext,et=Hi(S.nextSibling),Lt=l,Le=!0,lr=null,zi=!1,s!==null&&Uy(l,s),l=Bu(l,f),l.flags|=4096;return l}return s=En(s.child,{mode:f.mode,children:f.children}),s.ref=l.ref,l.child=s,s.return=l,s}function zu(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 Nd(s,l,u,f,m){return ns(l),u=cd(s,l,u,f,void 0,m),f=hd(),s!==null&&!vt?(fd(s,l,m),Bn(s,l,m)):(Le&&f&&Qf(l),l.flags|=1,zt(s,l,u,m),l.child)}function eb(s,l,u,f,m,y){return ns(l),l.updateQueue=null,u=nx(l,f,u,m),ix(s),f=hd(),s!==null&&!vt?(fd(s,l,y),Bn(s,l,y)):(Le&&f&&Qf(l),l.flags|=1,zt(s,l,u,y),l.child)}function tb(s,l,u,f,m){if(ns(l),l.stateNode===null){var y=Vs,S=u.contextType;typeof S=="object"&&S!==null&&(y=Bt(S)),y=new u(f,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Td,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=f,y.state=l.memoizedState,y.refs={},id(l),S=u.contextType,y.context=typeof S=="object"&&S!==null?Bt(S):Vs,y.state=l.memoizedState,S=u.getDerivedStateFromProps,typeof S=="function"&&(Md(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&&Td.enqueueReplaceState(y,y.state,null),va(l,f,y,m),ba(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),f=!0}else if(s===null){y=l.stateNode;var A=l.memoizedProps,N=us(u,A);y.props=N;var z=y.context,Y=u.contextType;S=Vs,typeof Y=="object"&&Y!==null&&(S=Bt(Y));var W=u.getDerivedStateFromProps;Y=typeof W=="function"||typeof y.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,Y||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A||z!==S)&&Px(l,y,f,S),ur=!1;var U=l.memoizedState;y.state=U,va(l,f,y,m),ba(),z=l.memoizedState,A||U!==z||ur?(typeof W=="function"&&(Md(l,u,W,f),z=l.memoizedState),(N=ur||qx(l,u,N,f,U,z,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=z),y.props=f,y.state=z,y.context=S,f=N):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),f=!1)}else{y=l.stateNode,nd(s,l),S=l.memoizedProps,Y=us(u,S),y.props=Y,W=l.pendingProps,U=y.context,z=u.contextType,N=Vs,typeof z=="object"&&z!==null&&(N=Bt(z)),A=u.getDerivedStateFromProps,(z=typeof A=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==W||U!==N)&&Px(l,y,f,N),ur=!1,U=l.memoizedState,y.state=U,va(l,f,y,m),ba();var V=l.memoizedState;S!==W||U!==V||ur||s!==null&&s.dependencies!==null&&yu(s.dependencies)?(typeof A=="function"&&(Md(l,u,A,f),V=l.memoizedState),(Y=ur||qx(l,u,Y,f,U,V,N)||s!==null&&s.dependencies!==null&&yu(s.dependencies))?(z||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,V,N),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,V,N)),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=N,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,zu(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=as(l,s.child,null,m),l.child=as(l,null,u,m)):zt(s,l,u,m),l.memoizedState=y.state,s=l.child):s=Bn(s,l,m),s}function ib(s,l,u,f){return ts(),l.flags|=256,zt(s,l,u,f),l.child}var Rd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dd(s){return{baseLanes:s,cachePool:Qy()}}function jd(s,l,u){return s=s!==null?s.childLanes&~u:0,l&&(s|=ki),s}function nb(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:(dt.current&2)!==0),S&&(m=!0,l.flags&=-129),S=(l.flags&32)!==0,l.flags&=-33,s===null){if(Le){if(m?fr(l):dr(),(s=et)?(s=h1(s,zi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sr!==null?{id:ln,overflow:an}:null,retryLane:536870912,hydrationErrors:null},u=zy(s),u.return=l,l.child=u,Lt=l,et=null)):s=null,s===null)throw ar(l);return mp(s)?l.lanes=32:l.lanes=536870912,null}var A=f.children;return f=f.fallback,m?(dr(),m=l.mode,A=_u({mode:"hidden",children:A},m),f=es(f,m,u,null),A.return=l,f.return=l,A.sibling=f,l.child=A,f=l.child,f.memoizedState=Dd(u),f.childLanes=jd(s,S,u),l.memoizedState=Rd,Aa(null,f)):(fr(l),Ld(l,A))}var N=s.memoizedState;if(N!==null&&(A=N.dehydrated,A!==null)){if(y)l.flags&256?(fr(l),l.flags&=-257,l=Bd(s,l,u)):l.memoizedState!==null?(dr(),l.child=s.child,l.flags|=128,l=null):(dr(),A=f.fallback,m=l.mode,f=_u({mode:"visible",children:f.children},m),A=es(A,m,u,null),A.flags|=2,f.return=l,A.return=l,f.sibling=A,l.child=f,as(l,s.child,null,u),f=l.child,f.memoizedState=Dd(u),f.childLanes=jd(s,S,u),l.memoizedState=Rd,l=Aa(null,f));else if(fr(l),mp(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var z=S.dgst;S=z,f=Error(n(419)),f.stack="",f.digest=S,da({value:f,source:null,stack:null}),l=Bd(s,l,u)}else if(vt||Ys(s,l,u,!1),S=(u&s.childLanes)!==0,vt||S){if(S=We,S!==null&&(f=V0(S,u),f!==0&&f!==N.retryLane))throw N.retryLane=f,$r(s,f),ai(S,s,f),Ed;pp(A)||Gu(),l=Bd(s,l,u)}else pp(A)?(l.flags|=192,l.child=s.child,l=null):(s=N.treeContext,et=Hi(A.nextSibling),Lt=l,Le=!0,lr=null,zi=!1,s!==null&&Uy(l,s),l=Ld(l,f.children),l.flags|=4096);return l}return m?(dr(),A=f.fallback,m=l.mode,N=s.child,z=N.sibling,f=En(N,{mode:"hidden",children:f.children}),f.subtreeFlags=N.subtreeFlags&65011712,z!==null?A=En(z,A):(A=es(A,m,u,null),A.flags|=2),A.return=l,f.return=l,f.sibling=A,l.child=f,Aa(null,f),f=l.child,A=s.child.memoizedState,A===null?A=Dd(u):(m=A.cachePool,m!==null?(N=xt._currentValue,m=m.parent!==N?{parent:N,pool:N}:m):m=Qy(),A={baseLanes:A.baseLanes|u,cachePool:m}),f.memoizedState=A,f.childLanes=jd(s,S,u),l.memoizedState=Rd,Aa(s.child,f)):(fr(l),u=s.child,s=u.sibling,u=En(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 Ld(s,l){return l=_u({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function _u(s,l){return s=bi(22,s,null,l),s.lanes=0,s}function Bd(s,l,u){return as(l,s.child,null,u),s=Ld(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function rb(s,l,u){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),Xf(s.return,l,u)}function zd(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 sb(s,l,u){var f=l.pendingProps,m=f.revealOrder,y=f.tail;f=f.children;var S=dt.current,A=(S&2)!==0;if(A?(S=S&1|2,l.flags|=128):S&=1,Z(dt,S),zt(s,l,f,u),f=Le?fa:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&rb(s,u,l);else if(s.tag===19)rb(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&&Au(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=l.child,l.child=null):(m=u.sibling,u.sibling=null),zd(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&&Au(s)===null){l.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}zd(l,!0,u,null,y,f);break;case"together":zd(l,!1,null,null,void 0,f);break;default:l.memoizedState=null}return l.child}function Bn(s,l,u){if(s!==null&&(l.dependencies=s.dependencies),gr|=l.lanes,(u&l.childLanes)===0)if(s!==null){if(Ys(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=En(s,s.pendingProps),l.child=u,u.return=l;s.sibling!==null;)s=s.sibling,u=u.sibling=En(s,s.pendingProps),u.return=l;u.sibling=null}return l.child}function _d(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&yu(s)))}function BT(s,l,u){switch(l.tag){case 3:Kt(l,l.stateNode.containerInfo),or(l,xt,s.memoizedState.cache),ts();break;case 27:case 5:Jl(l);break;case 4:Kt(l,l.stateNode.containerInfo);break;case 10:or(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,od(l),null;break;case 13:var f=l.memoizedState;if(f!==null)return f.dehydrated!==null?(fr(l),l.flags|=128,null):(u&l.child.childLanes)!==0?nb(s,l,u):(fr(l),s=Bn(s,l,u),s!==null?s.sibling:null);fr(l);break;case 19:var m=(s.flags&128)!==0;if(f=(u&l.childLanes)!==0,f||(Ys(s,l,u,!1),f=(u&l.childLanes)!==0),m){if(f)return sb(s,l,u);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Z(dt,dt.current),f)break;return null;case 22:return l.lanes=0,Jx(s,l,u,l.pendingProps);case 24:or(l,xt,s.memoizedState.cache)}return Bn(s,l,u)}function lb(s,l,u){if(s!==null)if(s.memoizedProps!==l.pendingProps)vt=!0;else{if(!_d(s,u)&&(l.flags&128)===0)return vt=!1,BT(s,l,u);vt=(s.flags&131072)!==0}else vt=!1,Le&&(l.flags&1048576)!==0&&Hy(l,fa,l.index);switch(l.lanes=0,l.tag){case 16:e:{var f=l.pendingProps;if(s=ss(l.elementType),l.type=s,typeof s=="function")Ff(s)?(f=us(s,f),l.tag=1,l=tb(null,l,s,f,u)):(l.tag=0,l=Nd(null,l,s,f,u));else{if(s!=null){var m=s.$$typeof;if(m===G){l.tag=11,l=Kx(null,l,s,f,u);break e}else if(m===q){l.tag=14,l=Wx(null,l,s,f,u);break e}}throw l=de(s)||s,Error(n(306,l,""))}}return l;case 0:return Nd(s,l,l.type,l.pendingProps,u);case 1:return f=l.type,m=us(f,l.pendingProps),tb(s,l,f,m,u);case 3:e:{if(Kt(l,l.stateNode.containerInfo),s===null)throw Error(n(387));f=l.pendingProps;var y=l.memoizedState;m=y.element,nd(s,l),va(l,f,null,u);var S=l.memoizedState;if(f=S.cache,or(l,xt,f),f!==y.cache&&Jf(l,[xt],u,!0),ba(),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=ib(s,l,f,u);break e}else if(f!==m){m=ji(Error(n(424)),l),da(m),l=ib(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,et=Hi(s.firstChild),Lt=l,Le=!0,lr=null,zi=!0,u=Jy(l,null,f,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ts(),f===m){l=Bn(s,l,u);break e}zt(s,l,f,u)}l=l.child}return l;case 26:return zu(s,l),s===null?(u=y1(l.type,null,l.pendingProps,null))?l.memoizedState=u:Le||(u=l.type,s=l.pendingProps,f=$u(Ce.current).createElement(u),f[jt]=l,f[ti]=s,_t(f,u,s),Et(f),l.stateNode=f):l.memoizedState=y1(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return Jl(l),s===null&&Le&&(f=l.stateNode=p1(l.type,l.pendingProps,Ce.current),Lt=l,zi=!0,m=et,Sr(l.type)?(gp=m,et=Hi(f.firstChild)):et=m),zt(s,l,l.pendingProps.children,u),zu(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Le&&((m=f=et)&&(f=hO(f,l.type,l.pendingProps,zi),f!==null?(l.stateNode=f,Lt=l,et=Hi(f.firstChild),zi=!1,m=!0):m=!1),m||ar(l)),Jl(l),m=l.type,y=l.pendingProps,S=s!==null?s.memoizedProps:null,f=y.children,hp(m,y)?f=null:S!==null&&hp(m,S)&&(l.flags|=32),l.memoizedState!==null&&(m=cd(s,l,MT,null,null,u),qa._currentValue=m),zu(s,l),zt(s,l,f,u),l.child;case 6:return s===null&&Le&&((s=u=et)&&(u=fO(u,l.pendingProps,zi),u!==null?(l.stateNode=u,Lt=l,et=null,s=!0):s=!1),s||ar(l)),null;case 13:return nb(s,l,u);case 4:return Kt(l,l.stateNode.containerInfo),f=l.pendingProps,s===null?l.child=as(l,null,f,u):zt(s,l,f,u),l.child;case 11:return Kx(s,l,l.type,l.pendingProps,u);case 7:return zt(s,l,l.pendingProps,u),l.child;case 8:return zt(s,l,l.pendingProps.children,u),l.child;case 12:return zt(s,l,l.pendingProps.children,u),l.child;case 10:return f=l.pendingProps,or(l,l.type,f.value),zt(s,l,f.children,u),l.child;case 9:return m=l.type._context,f=l.pendingProps.children,ns(l),m=Bt(m),f=f(m),l.flags|=1,zt(s,l,f,u),l.child;case 14:return Wx(s,l,l.type,l.pendingProps,u);case 15:return Xx(s,l,l.type,l.pendingProps,u);case 19:return sb(s,l,u);case 31:return LT(s,l,u);case 22:return Jx(s,l,u,l.pendingProps);case 24:return ns(l),f=Bt(xt),s===null?(m=ed(),m===null&&(m=We,y=Zf(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=u),m=y),l.memoizedState={parent:f,cache:m},id(l),or(l,xt,m)):((s.lanes&u)!==0&&(nd(s,l),va(l,null,null,u),ba()),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),or(l,xt,f)):(f=y.cache,or(l,xt,f),f!==m.cache&&Jf(l,[xt],u,!0))),zt(s,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function zn(s){s.flags|=4}function Hd(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(jb())s.flags|=8192;else throw ls=Su,td}else s.flags&=-16777217}function ab(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!w1(l))if(jb())s.flags|=8192;else throw ls=Su,td}function Hu(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?q0():536870912,s.lanes|=l,sl|=l)}function Ma(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 tt(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 zT(s,l,u){var f=l.pendingProps;switch(Gf(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(l),null;case 1:return tt(l),null;case 3:return u=l.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Dn(xt),ft(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Gs(l)?zn(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Kf())),tt(l),null;case 26:var m=l.type,y=l.memoizedState;return s===null?(zn(l),y!==null?(tt(l),ab(l,y)):(tt(l),Hd(l,m,null,f,u))):y?y!==s.memoizedState?(zn(l),tt(l),ab(l,y)):(tt(l),l.flags&=-16777217):(s=s.memoizedProps,s!==f&&zn(l),tt(l),Hd(l,m,s,f,u)),null;case 27:if(Wo(l),u=Ce.current,m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&zn(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return tt(l),null}s=ne.current,Gs(l)?qy(l):(s=p1(m,f,u),l.stateNode=s,zn(l))}return tt(l),null;case 5:if(Wo(l),m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&zn(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return tt(l),null}if(y=ne.current,Gs(l))qy(l);else{var S=$u(Ce.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[jt]=l,y[ti]=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(_t(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&&zn(l)}}return tt(l),Hd(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,u),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==f&&zn(l);else{if(typeof f!="string"&&l.stateNode===null)throw Error(n(166));if(s=Ce.current,Gs(l)){if(s=l.stateNode,u=l.memoizedProps,f=null,m=Lt,m!==null)switch(m.tag){case 27:case 5:f=m.memoizedProps}s[jt]=l,s=!!(s.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||n1(s.nodeValue,u)),s||ar(l,!0)}else s=$u(s).createTextNode(f),s[jt]=l,l.stateNode=s}return tt(l),null;case 31:if(u=l.memoizedState,s===null||s.memoizedState!==null){if(f=Gs(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[jt]=l}else ts(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;tt(l),s=!1}else u=Kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return l.flags&256?(Si(l),l):(Si(l),null);if((l.flags&128)!==0)throw Error(n(558))}return tt(l),null;case 13:if(f=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Gs(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[jt]=l}else ts(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;tt(l),m=!1}else m=Kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Si(l),l):(Si(l),null)}return Si(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),Hu(l,l.updateQueue),tt(l),null);case 4:return ft(),s===null&&lp(l.stateNode.containerInfo),tt(l),null;case 10:return Dn(l.type),tt(l),null;case 19:if(F(dt),f=l.memoizedState,f===null)return tt(l),null;if(m=(l.flags&128)!==0,y=f.rendering,y===null)if(m)Ma(f,!1);else{if(ut!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(y=Au(s),y!==null){for(l.flags|=128,Ma(f,!1),s=y.updateQueue,l.updateQueue=s,Hu(l,s),l.subtreeFlags=0,s=u,u=l.child;u!==null;)By(u,s),u=u.sibling;return Z(dt,dt.current&1|2),Le&&Nn(l,f.treeForkCount),l.child}s=s.sibling}f.tail!==null&&mi()>Vu&&(l.flags|=128,m=!0,Ma(f,!1),l.lanes=4194304)}else{if(!m)if(s=Au(y),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,Hu(l,s),Ma(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Le)return tt(l),null}else 2*mi()-f.renderingStartTime>Vu&&u!==536870912&&(l.flags|=128,m=!0,Ma(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=mi(),s.sibling=null,u=dt.current,Z(dt,m?u&1|2:u&1),Le&&Nn(l,f.treeForkCount),s):(tt(l),null);case 22:case 23:return Si(l),ad(),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&&(tt(l),l.subtreeFlags&6&&(l.flags|=8192)):tt(l),u=l.updateQueue,u!==null&&Hu(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&&F(rs),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),Dn(xt),tt(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function _T(s,l){switch(Gf(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Dn(xt),ft(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return Wo(l),null;case 31:if(l.memoizedState!==null){if(Si(l),l.alternate===null)throw Error(n(340));ts()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Si(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));ts()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return F(dt),null;case 4:return ft(),null;case 10:return Dn(l.type),null;case 22:case 23:return Si(l),ad(),s!==null&&F(rs),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Dn(xt),null;case 25:return null;default:return null}}function ob(s,l){switch(Gf(l),l.tag){case 3:Dn(xt),ft();break;case 26:case 27:case 5:Wo(l);break;case 4:ft();break;case 31:l.memoizedState!==null&&Si(l);break;case 13:Si(l);break;case 19:F(dt);break;case 10:Dn(l.type);break;case 22:case 23:Si(l),ad(),s!==null&&F(rs);break;case 24:Dn(xt)}}function Ta(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 pr(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 N=u,z=A;try{z()}catch(Y){Ie(m,N,Y)}}}f=f.next}while(f!==y)}}catch(Y){Ie(l,l.return,Y)}}function ub(s){var l=s.updateQueue;if(l!==null){var u=s.stateNode;try{$y(l,u)}catch(f){Ie(s,s.return,f)}}}function cb(s,l,u){u.props=us(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){Ie(s,l,f)}}function Oa(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 on(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 hb(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 Ud(s,l,u){try{var f=s.stateNode;sO(f,s.type,u,l),f[ti]=l}catch(m){Ie(s,s.return,m)}}function fb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Sr(s.type)||s.tag===4}function qd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||fb(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&&Sr(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 Pd(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=Tn));else if(f!==4&&(f===27&&Sr(s.type)&&(u=s.stateNode,l=null),s=s.child,s!==null))for(Pd(s,l,u),s=s.sibling;s!==null;)Pd(s,l,u),s=s.sibling}function Uu(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&&Sr(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Uu(s,l,u),s=s.sibling;s!==null;)Uu(s,l,u),s=s.sibling}function db(s){var l=s.stateNode,u=s.memoizedProps;try{for(var f=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);_t(l,f,u),l[jt]=s,l[ti]=u}catch(y){Ie(s,s.return,y)}}var _n=!1,St=!1,Fd=!1,pb=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function HT(s,l){if(s=s.containerInfo,up=lc,s=My(s),Bf(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,N=-1,z=0,Y=0,W=s,U=null;t:for(;;){for(var V;W!==u||m!==0&&W.nodeType!==3||(A=S+m),W!==y||f!==0&&W.nodeType!==3||(N=S+f),W.nodeType===3&&(S+=W.nodeValue.length),(V=W.firstChild)!==null;)U=W,W=V;for(;;){if(W===s)break t;if(U===u&&++z===m&&(A=S),U===y&&++Y===f&&(N=S),(V=W.nextSibling)!==null)break;W=U,U=W.parentNode}W=V}u=A===-1||N===-1?null:{start:A,end:N}}else u=null}u=u||{start:0,end:0}}else u=null;for(cp={focusedElem:s,selectionRange:u},lc=!1,Nt=l;Nt!==null;)if(l=Nt,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Nt=s;else for(;Nt!==null;){switch(l=Nt,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 he=us(u.type,m);s=f.getSnapshotBeforeUpdate(he,y),f.__reactInternalSnapshotBeforeUpdate=s}catch(be){Ie(u,u.return,be)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,u=s.nodeType,u===9)dp(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":dp(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,Nt=s;break}Nt=l.return}}function mb(s,l,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Un(s,u),f&4&&Ta(5,u);break;case 1:if(Un(s,u),f&4)if(s=u.stateNode,l===null)try{s.componentDidMount()}catch(S){Ie(u,u.return,S)}else{var m=us(u.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Ie(u,u.return,S)}}f&64&&ub(u),f&512&&Oa(u,u.return);break;case 3:if(Un(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{$y(s,l)}catch(S){Ie(u,u.return,S)}}break;case 27:l===null&&f&4&&db(u);case 26:case 5:Un(s,u),l===null&&f&4&&hb(u),f&512&&Oa(u,u.return);break;case 12:Un(s,u);break;case 31:Un(s,u),f&4&&xb(s,u);break;case 13:Un(s,u),f&4&&bb(s,u),f&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=YT.bind(null,u),dO(s,u))));break;case 22:if(f=u.memoizedState!==null||_n,!f){l=l!==null&&l.memoizedState!==null||St,m=_n;var y=St;_n=f,(St=l)&&!y?qn(s,u,(u.subtreeFlags&8772)!==0):Un(s,u),_n=m,St=y}break;case 30:break;default:Un(s,u)}}function gb(s){var l=s.alternate;l!==null&&(s.alternate=null,gb(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&xf(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 nt=null,ni=!1;function Hn(s,l,u){for(u=u.child;u!==null;)yb(s,l,u),u=u.sibling}function yb(s,l,u){if(gi&&typeof gi.onCommitFiberUnmount=="function")try{gi.onCommitFiberUnmount(Zl,u)}catch{}switch(u.tag){case 26:St||on(u,l),Hn(s,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:St||on(u,l);var f=nt,m=ni;Sr(u.type)&&(nt=u.stateNode,ni=!1),Hn(s,l,u),_a(u.stateNode),nt=f,ni=m;break;case 5:St||on(u,l);case 6:if(f=nt,m=ni,nt=null,Hn(s,l,u),nt=f,ni=m,nt!==null)if(ni)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(u.stateNode)}catch(y){Ie(u,l,y)}else try{nt.removeChild(u.stateNode)}catch(y){Ie(u,l,y)}break;case 18:nt!==null&&(ni?(s=nt,u1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),dl(s)):u1(nt,u.stateNode));break;case 4:f=nt,m=ni,nt=u.stateNode.containerInfo,ni=!0,Hn(s,l,u),nt=f,ni=m;break;case 0:case 11:case 14:case 15:pr(2,u,l),St||pr(4,u,l),Hn(s,l,u);break;case 1:St||(on(u,l),f=u.stateNode,typeof f.componentWillUnmount=="function"&&cb(u,l,f)),Hn(s,l,u);break;case 21:Hn(s,l,u);break;case 22:St=(f=St)||u.memoizedState!==null,Hn(s,l,u),St=f;break;default:Hn(s,l,u)}}function xb(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{dl(s)}catch(u){Ie(l,l.return,u)}}}function bb(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{dl(s)}catch(u){Ie(l,l.return,u)}}function UT(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new pb),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new pb),l;default:throw Error(n(435,s.tag))}}function qu(s,l){var u=UT(s);l.forEach(function(f){if(!u.has(f)){u.add(f);var m=KT.bind(null,s,f);f.then(m,m)}})}function ri(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(Sr(A.type)){nt=A.stateNode,ni=!1;break e}break;case 5:nt=A.stateNode,ni=!1;break e;case 3:case 4:nt=A.stateNode.containerInfo,ni=!0;break e}A=A.return}if(nt===null)throw Error(n(160));yb(y,S,m),nt=null,ni=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)vb(l,s),l=l.sibling}var Wi=null;function vb(s,l){var u=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ri(l,s),si(s),f&4&&(pr(3,s,s.return),Ta(3,s),pr(5,s,s.return));break;case 1:ri(l,s),si(s),f&512&&(St||u===null||on(u,u.return)),f&64&&_n&&(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=Wi;if(ri(l,s),si(s),f&512&&(St||u===null||on(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[ta]||y[jt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(f),m.head.insertBefore(y,m.querySelector("head > title"))),_t(y,f,u),y[jt]=s,Et(y),f=y;break e;case"link":var S=v1("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),_t(y,f,u),m.head.appendChild(y);break;case"meta":if(S=v1("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),_t(y,f,u),m.head.appendChild(y);break;default:throw Error(n(468,f))}y[jt]=s,Et(y),f=y}s.stateNode=f}else S1(m,s.type,s.stateNode);else s.stateNode=b1(m,f,s.memoizedProps);else y!==f?(y===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):y.count--,f===null?S1(m,s.type,s.stateNode):b1(m,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Ud(s,s.memoizedProps,u.memoizedProps)}break;case 27:ri(l,s),si(s),f&512&&(St||u===null||on(u,u.return)),u!==null&&f&4&&Ud(s,s.memoizedProps,u.memoizedProps);break;case 5:if(ri(l,s),si(s),f&512&&(St||u===null||on(u,u.return)),s.flags&32){m=s.stateNode;try{zs(m,"")}catch(he){Ie(s,s.return,he)}}f&4&&s.stateNode!=null&&(m=s.memoizedProps,Ud(s,m,u!==null?u.memoizedProps:m)),f&1024&&(Fd=!0);break;case 6:if(ri(l,s),si(s),f&4){if(s.stateNode===null)throw Error(n(162));f=s.memoizedProps,u=s.stateNode;try{u.nodeValue=f}catch(he){Ie(s,s.return,he)}}break;case 3:if(ic=null,m=Wi,Wi=ec(l.containerInfo),ri(l,s),Wi=m,si(s),f&4&&u!==null&&u.memoizedState.isDehydrated)try{dl(l.containerInfo)}catch(he){Ie(s,s.return,he)}Fd&&(Fd=!1,Sb(s));break;case 4:f=Wi,Wi=ec(s.stateNode.containerInfo),ri(l,s),si(s),Wi=f;break;case 12:ri(l,s),si(s);break;case 31:ri(l,s),si(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,qu(s,f)));break;case 13:ri(l,s),si(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Fu=mi()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,qu(s,f)));break;case 22:m=s.memoizedState!==null;var N=u!==null&&u.memoizedState!==null,z=_n,Y=St;if(_n=z||m,St=Y||N,ri(l,s),St=Y,_n=z,si(s),f&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(u===null||N||_n||St||cs(s)),u=null,l=s;;){if(l.tag===5||l.tag===26){if(u===null){N=u=l;try{if(y=N.stateNode,m)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=N.stateNode;var W=N.memoizedProps.style,U=W!=null&&W.hasOwnProperty("display")?W.display:null;A.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(he){Ie(N,N.return,he)}}}else if(l.tag===6){if(u===null){N=l;try{N.stateNode.nodeValue=m?"":N.memoizedProps}catch(he){Ie(N,N.return,he)}}}else if(l.tag===18){if(u===null){N=l;try{var V=N.stateNode;m?c1(V,!0):c1(N.stateNode,!1)}catch(he){Ie(N,N.return,he)}}}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,qu(s,u))));break;case 19:ri(l,s),si(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,qu(s,f)));break;case 30:break;case 21:break;default:ri(l,s),si(s)}}function si(s){var l=s.flags;if(l&2){try{for(var u,f=s.return;f!==null;){if(fb(f)){u=f;break}f=f.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var m=u.stateNode,y=qd(s);Uu(s,y,m);break;case 5:var S=u.stateNode;u.flags&32&&(zs(S,""),u.flags&=-33);var A=qd(s);Uu(s,A,S);break;case 3:case 4:var N=u.stateNode.containerInfo,z=qd(s);Pd(s,z,N);break;default:throw Error(n(161))}}catch(Y){Ie(s,s.return,Y)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function Sb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;Sb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Un(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)mb(s,l.alternate,l),l=l.sibling}function cs(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:pr(4,l,l.return),cs(l);break;case 1:on(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&cb(l,l.return,u),cs(l);break;case 27:_a(l.stateNode);case 26:case 5:on(l,l.return),cs(l);break;case 22:l.memoizedState===null&&cs(l);break;case 30:cs(l);break;default:cs(l)}s=s.sibling}}function qn(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:qn(m,y,u),Ta(4,y);break;case 1:if(qn(m,y,u),f=y,m=f.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(z){Ie(f,f.return,z)}if(f=y,m=f.updateQueue,m!==null){var A=f.stateNode;try{var N=m.shared.hiddenCallbacks;if(N!==null)for(m.shared.hiddenCallbacks=null,m=0;m<N.length;m++)Zy(N[m],A)}catch(z){Ie(f,f.return,z)}}u&&S&64&&ub(y),Oa(y,y.return);break;case 27:db(y);case 26:case 5:qn(m,y,u),u&&f===null&&S&4&&hb(y),Oa(y,y.return);break;case 12:qn(m,y,u);break;case 31:qn(m,y,u),u&&S&4&&xb(m,y);break;case 13:qn(m,y,u),u&&S&4&&bb(m,y);break;case 22:y.memoizedState===null&&qn(m,y,u),Oa(y,y.return);break;case 30:break;default:qn(m,y,u)}l=l.sibling}}function Vd(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&&pa(u))}function Id(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&pa(s))}function Xi(s,l,u,f){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)wb(s,l,u,f),l=l.sibling}function wb(s,l,u,f){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Xi(s,l,u,f),m&2048&&Ta(9,l);break;case 1:Xi(s,l,u,f);break;case 3:Xi(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&&pa(s)));break;case 12:if(m&2048){Xi(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(N){Ie(l,l.return,N)}}else Xi(s,l,u,f);break;case 31:Xi(s,l,u,f);break;case 13:Xi(s,l,u,f);break;case 23:break;case 22:y=l.stateNode,S=l.alternate,l.memoizedState!==null?y._visibility&2?Xi(s,l,u,f):Ea(s,l):y._visibility&2?Xi(s,l,u,f):(y._visibility|=2,il(s,l,u,f,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Vd(S,l);break;case 24:Xi(s,l,u,f),m&2048&&Id(l.alternate,l);break;default:Xi(s,l,u,f)}}function il(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,N=f,z=S.flags;switch(S.tag){case 0:case 11:case 15:il(y,S,A,N,m),Ta(8,S);break;case 23:break;case 22:var Y=S.stateNode;S.memoizedState!==null?Y._visibility&2?il(y,S,A,N,m):Ea(y,S):(Y._visibility|=2,il(y,S,A,N,m)),m&&z&2048&&Vd(S.alternate,S);break;case 24:il(y,S,A,N,m),m&&z&2048&&Id(S.alternate,S);break;default:il(y,S,A,N,m)}l=l.sibling}}function Ea(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:Ea(u,f),m&2048&&Vd(f.alternate,f);break;case 24:Ea(u,f),m&2048&&Id(f.alternate,f);break;default:Ea(u,f)}l=l.sibling}}var Na=8192;function nl(s,l,u){if(s.subtreeFlags&Na)for(s=s.child;s!==null;)kb(s,l,u),s=s.sibling}function kb(s,l,u){switch(s.tag){case 26:nl(s,l,u),s.flags&Na&&s.memoizedState!==null&&AO(u,Wi,s.memoizedState,s.memoizedProps);break;case 5:nl(s,l,u);break;case 3:case 4:var f=Wi;Wi=ec(s.stateNode.containerInfo),nl(s,l,u),Wi=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Na,Na=16777216,nl(s,l,u),Na=f):nl(s,l,u));break;default:nl(s,l,u)}}function Cb(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 Ra(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];Nt=f,Mb(f,s)}Cb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ab(s),s=s.sibling}function Ab(s){switch(s.tag){case 0:case 11:case 15:Ra(s),s.flags&2048&&pr(9,s,s.return);break;case 3:Ra(s);break;case 12:Ra(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Pu(s)):Ra(s);break;default:Ra(s)}}function Pu(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];Nt=f,Mb(f,s)}Cb(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:pr(8,l,l.return),Pu(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,Pu(l));break;default:Pu(l)}s=s.sibling}}function Mb(s,l){for(;Nt!==null;){var u=Nt;switch(u.tag){case 0:case 11:case 15:pr(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:pa(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Nt=f;else e:for(u=s;Nt!==null;){f=Nt;var m=f.sibling,y=f.return;if(gb(f),f===u){Nt=null;break e}if(m!==null){m.return=y,Nt=m;break e}Nt=y}}}var qT={getCacheForType:function(s){var l=Bt(xt),u=l.data.get(s);return u===void 0&&(u=s(),l.data.set(s,u)),u},cacheSignal:function(){return Bt(xt).controller.signal}},PT=typeof WeakMap=="function"?WeakMap:Map,Fe=0,We=null,Ee=null,De=0,Ve=0,wi=null,mr=!1,rl=!1,Qd=!1,Pn=0,ut=0,gr=0,hs=0,Gd=0,ki=0,sl=0,Da=null,li=null,Yd=!1,Fu=0,Tb=0,Vu=1/0,Iu=null,yr=null,Ct=0,xr=null,ll=null,Fn=0,Kd=0,Wd=null,Ob=null,ja=0,Xd=null;function Ci(){return(Fe&2)!==0&&De!==0?De&-De:_.T!==null?ip():I0()}function Eb(){if(ki===0)if((De&536870912)===0||Le){var s=Zo;Zo<<=1,(Zo&3932160)===0&&(Zo=262144),ki=s}else ki=536870912;return s=vi.current,s!==null&&(s.flags|=32),ki}function ai(s,l,u){(s===We&&(Ve===2||Ve===9)||s.cancelPendingCommit!==null)&&(al(s,0),br(s,De,ki,!1)),ea(s,u),((Fe&2)===0||s!==We)&&(s===We&&((Fe&2)===0&&(hs|=u),ut===4&&br(s,De,ki,!1)),un(s))}function Nb(s,l,u){if((Fe&6)!==0)throw Error(n(327));var f=!u&&(l&127)===0&&(l&s.expiredLanes)===0||$l(s,l),m=f?IT(s,l):Zd(s,l,!0),y=f;do{if(m===0){rl&&!f&&br(s,l,0,!1);break}else{if(u=s.current.alternate,y&&!FT(u)){m=Zd(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=Da;var N=A.current.memoizedState.isDehydrated;if(N&&(al(A,S).flags|=256),S=Zd(A,S,!1),S!==2){if(Qd&&!N){A.errorRecoveryDisabledLanes|=y,hs|=y,m=4;break e}y=li,li=m,y!==null&&(li===null?li=y:li.push.apply(li,y))}m=S}if(y=!1,m!==2)continue}}if(m===1){al(s,0),br(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:br(f,l,ki,!mr);break e;case 2:li=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(m=Fu+300-mi(),10<m)){if(br(f,l,ki,!mr),eu(f,0,!0)!==0)break e;Fn=l,f.timeoutHandle=a1(Rb.bind(null,f,u,li,Iu,Yd,l,ki,hs,sl,mr,y,"Throttled",-0,0),m);break e}Rb(f,u,li,Iu,Yd,l,ki,hs,sl,mr,y,null,-0,0)}}break}while(!0);un(s)}function Rb(s,l,u,f,m,y,S,A,N,z,Y,W,U,V){if(s.timeoutHandle=-1,W=l.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},kb(l,y,W);var he=(y&62914560)===y?Fu-mi():(y&4194048)===y?Tb-mi():0;if(he=MO(W,he),he!==null){Fn=y,s.cancelPendingCommit=he(Ub.bind(null,s,l,y,u,f,m,S,A,N,Y,W,null,U,V)),br(s,y,S,!z);return}}Ub(s,l,y,u,f,m,S,A,N)}function FT(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(!xi(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 br(s,l,u,f){l&=~Gd,l&=~hs,s.suspendedLanes|=l,s.pingedLanes&=~l,f&&(s.warmLanes|=l),f=s.expirationTimes;for(var m=l;0<m;){var y=31-yi(m),S=1<<y;f[y]=-1,m&=~S}u!==0&&P0(s,u,l)}function Qu(){return(Fe&6)===0?(La(0),!1):!0}function Jd(){if(Ee!==null){if(Ve===0)var s=Ee.return;else s=Ee,Rn=is=null,dd(s),Js=null,ga=0,s=Ee;for(;s!==null;)ob(s.alternate,s),s=s.return;Ee=null}}function al(s,l){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,oO(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),Fn=0,Jd(),We=s,Ee=u=En(s.current,null),De=l,Ve=0,wi=null,mr=!1,rl=$l(s,l),Qd=!1,sl=ki=Gd=hs=gr=ut=0,li=Da=null,Yd=!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-yi(f),y=1<<m;l|=s[m],f&=~y}return Pn=l,fu(),u}function Db(s,l){Ae=null,_.H=Ca,l===Xs||l===vu?(l=Ky(),Ve=3):l===td?(l=Ky(),Ve=4):Ve=l===Ed?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,wi=l,Ee===null&&(ut=1,Lu(s,ji(l,s.current)))}function jb(){var s=vi.current;return s===null?!0:(De&4194048)===De?_i===null:(De&62914560)===De||(De&536870912)!==0?s===_i:!1}function Lb(){var s=_.H;return _.H=Ca,s===null?Ca:s}function Bb(){var s=_.A;return _.A=qT,s}function Gu(){ut=4,mr||(De&4194048)!==De&&vi.current!==null||(rl=!0),(gr&134217727)===0&&(hs&134217727)===0||We===null||br(We,De,ki,!1)}function Zd(s,l,u){var f=Fe;Fe|=2;var m=Lb(),y=Bb();(We!==s||De!==l)&&(Iu=null,al(s,l)),l=!1;var S=ut;e:do try{if(Ve!==0&&Ee!==null){var A=Ee,N=wi;switch(Ve){case 8:Jd(),S=6;break e;case 3:case 2:case 9:case 6:vi.current===null&&(l=!0);var z=Ve;if(Ve=0,wi=null,ol(s,A,N,z),u&&rl){S=0;break e}break;default:z=Ve,Ve=0,wi=null,ol(s,A,N,z)}}VT(),S=ut;break}catch(Y){Db(s,Y)}while(!0);return l&&s.shellSuspendCounter++,Rn=is=null,Fe=f,_.H=m,_.A=y,Ee===null&&(We=null,De=0,fu()),S}function VT(){for(;Ee!==null;)zb(Ee)}function IT(s,l){var u=Fe;Fe|=2;var f=Lb(),m=Bb();We!==s||De!==l?(Iu=null,Vu=mi()+500,al(s,l)):rl=$l(s,l);e:do try{if(Ve!==0&&Ee!==null){l=Ee;var y=wi;t:switch(Ve){case 1:Ve=0,wi=null,ol(s,l,y,1);break;case 2:case 9:if(Gy(y)){Ve=0,wi=null,_b(l);break}l=function(){Ve!==2&&Ve!==9||We!==s||(Ve=7),un(s)},y.then(l,l);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:Gy(y)?(Ve=0,wi=null,_b(l)):(Ve=0,wi=null,ol(s,l,y,7));break;case 5:var S=null;switch(Ee.tag){case 26:S=Ee.memoizedState;case 5:case 27:var A=Ee;if(S?w1(S):A.stateNode.complete){Ve=0,wi=null;var N=A.sibling;if(N!==null)Ee=N;else{var z=A.return;z!==null?(Ee=z,Yu(z)):Ee=null}break t}}Ve=0,wi=null,ol(s,l,y,5);break;case 6:Ve=0,wi=null,ol(s,l,y,6);break;case 8:Jd(),ut=6;break e;default:throw Error(n(462))}}QT();break}catch(Y){Db(s,Y)}while(!0);return Rn=is=null,_.H=f,_.A=m,Fe=u,Ee!==null?0:(We=null,De=0,fu(),ut)}function QT(){for(;Ee!==null&&!pM();)zb(Ee)}function zb(s){var l=lb(s.alternate,s,Pn);s.memoizedProps=s.pendingProps,l===null?Yu(s):Ee=l}function _b(s){var l=s,u=l.alternate;switch(l.tag){case 15:case 0:l=eb(u,l,l.pendingProps,l.type,void 0,De);break;case 11:l=eb(u,l,l.pendingProps,l.type.render,l.ref,De);break;case 5:dd(l);default:ob(u,l),l=Ee=By(l,Pn),l=lb(u,l,Pn)}s.memoizedProps=s.pendingProps,l===null?Yu(s):Ee=l}function ol(s,l,u,f){Rn=is=null,dd(l),Js=null,ga=0;var m=l.return;try{if(jT(s,m,l,u,De)){ut=1,Lu(s,ji(u,s.current)),Ee=null;return}}catch(y){if(m!==null)throw Ee=m,y;ut=1,Lu(s,ji(u,s.current)),Ee=null;return}l.flags&32768?(Le||f===1?s=!0:rl||(De&536870912)!==0?s=!1:(mr=s=!0,(f===2||f===9||f===3||f===6)&&(f=vi.current,f!==null&&f.tag===13&&(f.flags|=16384))),Hb(l,s)):Yu(l)}function Yu(s){var l=s;do{if((l.flags&32768)!==0){Hb(l,mr);return}s=l.return;var u=zT(l.alternate,l,Pn);if(u!==null){Ee=u;return}if(l=l.sibling,l!==null){Ee=l;return}Ee=l=s}while(l!==null);ut===0&&(ut=5)}function Hb(s,l){do{var u=_T(s.alternate,s);if(u!==null){u.flags&=32767,Ee=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(s=s.sibling,s!==null)){Ee=s;return}Ee=s=u}while(s!==null);ut=6,Ee=null}function Ub(s,l,u,f,m,y,S,A,N){s.cancelPendingCommit=null;do Ku();while(Ct!==0);if((Fe&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(y=l.lanes|l.childLanes,y|=qf,CM(s,u,y,S,A,N),s===We&&(Ee=We=null,De=0),ll=l,xr=s,Fn=u,Kd=y,Wd=m,Ob=f,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,WT(Xo,function(){return Ib(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||f){f=_.T,_.T=null,m=J.p,J.p=2,S=Fe,Fe|=4;try{HT(s,l,u)}finally{Fe=S,J.p=m,_.T=f}}Ct=1,qb(),Pb(),Fb()}}function qb(){if(Ct===1){Ct=0;var s=xr,l=ll,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=_.T,_.T=null;var f=J.p;J.p=2;var m=Fe;Fe|=4;try{vb(l,s);var y=cp,S=My(s.containerInfo),A=y.focusedElem,N=y.selectionRange;if(S!==A&&A&&A.ownerDocument&&Ay(A.ownerDocument.documentElement,A)){if(N!==null&&Bf(A)){var z=N.start,Y=N.end;if(Y===void 0&&(Y=z),"selectionStart"in A)A.selectionStart=z,A.selectionEnd=Math.min(Y,A.value.length);else{var W=A.ownerDocument||document,U=W&&W.defaultView||window;if(U.getSelection){var V=U.getSelection(),he=A.textContent.length,be=Math.min(N.start,he),Ye=N.end===void 0?be:Math.min(N.end,he);!V.extend&&be>Ye&&(S=Ye,Ye=be,be=S);var j=Cy(A,be),R=Cy(A,Ye);if(j&&R&&(V.rangeCount!==1||V.anchorNode!==j.node||V.anchorOffset!==j.offset||V.focusNode!==R.node||V.focusOffset!==R.offset)){var B=W.createRange();B.setStart(j.node,j.offset),V.removeAllRanges(),be>Ye?(V.addRange(B),V.extend(R.node,R.offset)):(B.setEnd(R.node,R.offset),V.addRange(B))}}}}for(W=[],V=A;V=V.parentNode;)V.nodeType===1&&W.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<W.length;A++){var K=W[A];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}lc=!!up,cp=up=null}finally{Fe=m,J.p=f,_.T=u}}s.current=l,Ct=2}}function Pb(){if(Ct===2){Ct=0;var s=xr,l=ll,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=_.T,_.T=null;var f=J.p;J.p=2;var m=Fe;Fe|=4;try{mb(s,l.alternate,l)}finally{Fe=m,J.p=f,_.T=u}}Ct=3}}function Fb(){if(Ct===4||Ct===3){Ct=0,mM();var s=xr,l=ll,u=Fn,f=Ob;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Ct=5:(Ct=0,ll=xr=null,Vb(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(yr=null),gf(u),l=l.stateNode,gi&&typeof gi.onCommitFiberRoot=="function")try{gi.onCommitFiberRoot(Zl,l,void 0,(l.current.flags&128)===128)}catch{}if(f!==null){l=_.T,m=J.p,J.p=2,_.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{_.T=l,J.p=m}}(Fn&3)!==0&&Ku(),un(s),m=s.pendingLanes,(u&261930)!==0&&(m&42)!==0?s===Xd?ja++:(ja=0,Xd=s):ja=0,La(0)}}function Vb(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,pa(l)))}function Ku(){return qb(),Pb(),Fb(),Ib()}function Ib(){if(Ct!==5)return!1;var s=xr,l=Kd;Kd=0;var u=gf(Fn),f=_.T,m=J.p;try{J.p=32>u?32:u,_.T=null,u=Wd,Wd=null;var y=xr,S=Fn;if(Ct=0,ll=xr=null,Fn=0,(Fe&6)!==0)throw Error(n(331));var A=Fe;if(Fe|=4,Ab(y.current),wb(y,y.current,S,u),Fe=A,La(0,!1),gi&&typeof gi.onPostCommitFiberRoot=="function")try{gi.onPostCommitFiberRoot(Zl,y)}catch{}return!0}finally{J.p=m,_.T=f,Vb(s,l)}}function Qb(s,l,u){l=ji(u,l),l=Od(s.stateNode,l,2),s=hr(s,l,2),s!==null&&(ea(s,2),un(s))}function Ie(s,l,u){if(s.tag===3)Qb(s,s,u);else for(;l!==null;){if(l.tag===3){Qb(l,s,u);break}else if(l.tag===1){var f=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(yr===null||!yr.has(f))){s=ji(u,s),u=Gx(2),f=hr(l,u,2),f!==null&&(Yx(u,f,l,s),ea(f,2),un(f));break}}l=l.return}}function $d(s,l,u){var f=s.pingCache;if(f===null){f=s.pingCache=new PT;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)||(Qd=!0,m.add(u),s=GT.bind(null,s,l,u),l.then(s,s))}function GT(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&&(ut===4||ut===3&&(De&62914560)===De&&300>mi()-Fu?(Fe&2)===0&&al(s,0):Gd|=u,sl===De&&(sl=0)),un(s)}function Gb(s,l){l===0&&(l=q0()),s=$r(s,l),s!==null&&(ea(s,l),un(s))}function YT(s){var l=s.memoizedState,u=0;l!==null&&(u=l.retryLane),Gb(s,u)}function KT(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),Gb(s,u)}function WT(s,l){return ff(s,l)}var Wu=null,ul=null,ep=!1,Xu=!1,tp=!1,vr=0;function un(s){s!==ul&&s.next===null&&(ul===null?Wu=ul=s:ul=ul.next=s),Xu=!0,ep||(ep=!0,JT())}function La(s,l){if(!tp&&Xu){tp=!0;do for(var u=!1,f=Wu;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-yi(42|s)+1)-1,y&=m&~(S&~A),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(u=!0,Xb(f,y))}else y=De,y=eu(f,f===We?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||$l(f,y)||(u=!0,Xb(f,y));f=f.next}while(u);tp=!1}}function XT(){Yb()}function Yb(){Xu=ep=!1;var s=0;vr!==0&&aO()&&(s=vr);for(var l=mi(),u=null,f=Wu;f!==null;){var m=f.next,y=Kb(f,l);y===0?(f.next=null,u===null?Wu=m:u.next=m,m===null&&(ul=u)):(u=f,(s!==0||(y&3)!==0)&&(Xu=!0)),f=m}Ct!==0&&Ct!==5||La(s),vr!==0&&(vr=0)}function Kb(s,l){for(var u=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var S=31-yi(y),A=1<<S,N=m[S];N===-1?((A&u)===0||(A&f)!==0)&&(m[S]=kM(A,l)):N<=l&&(s.expiredLanes|=A),y&=~A}if(l=We,u=De,u=eu(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&&df(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||$l(s,u)){if(l=u&-u,l===s.callbackPriority)return l;switch(f!==null&&df(f),gf(u)){case 2:case 8:u=H0;break;case 32:u=Xo;break;case 268435456:u=U0;break;default:u=Xo}return f=Wb.bind(null,s),u=ff(u,f),s.callbackPriority=l,s.callbackNode=u,l}return f!==null&&f!==null&&df(f),s.callbackPriority=2,s.callbackNode=null,2}function Wb(s,l){if(Ct!==0&&Ct!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Ku()&&s.callbackNode!==u)return null;var f=De;return f=eu(s,s===We?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(Nb(s,f,l),Kb(s,mi()),s.callbackNode!=null&&s.callbackNode===u?Wb.bind(null,s):null)}function Xb(s,l){if(Ku())return null;Nb(s,l,!0)}function JT(){uO(function(){(Fe&6)!==0?ff(_0,XT):Yb()})}function ip(){if(vr===0){var s=Ks;s===0&&(s=Jo,Jo<<=1,(Jo&261888)===0&&(Jo=256)),vr=s}return vr}function Jb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:ru(""+s)}function Zb(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 ZT(s,l,u,f,m){if(l==="submit"&&u&&u.stateNode===m){var y=Jb((m[ti]||null).action),S=f.submitter;S&&(l=(l=S[ti]||null)?Jb(l.formAction):S.getAttribute("formAction"),l!==null&&(y=l,S=null));var A=new ou("action","action",null,f,m);s.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(vr!==0){var N=S?Zb(m,S):new FormData(m);wd(u,{pending:!0,data:N,method:m.method,action:y},null,N)}}else typeof y=="function"&&(A.preventDefault(),N=S?Zb(m,S):new FormData(m),wd(u,{pending:!0,data:N,method:m.method,action:y},y,N))},currentTarget:m}]})}}for(var np=0;np<Uf.length;np++){var rp=Uf[np],$T=rp.toLowerCase(),eO=rp[0].toUpperCase()+rp.slice(1);Ki($T,"on"+eO)}Ki(Ey,"onAnimationEnd"),Ki(Ny,"onAnimationIteration"),Ki(Ry,"onAnimationStart"),Ki("dblclick","onDoubleClick"),Ki("focusin","onFocus"),Ki("focusout","onBlur"),Ki(gT,"onTransitionRun"),Ki(yT,"onTransitionStart"),Ki(xT,"onTransitionCancel"),Ki(Dy,"onTransitionEnd"),Ls("onMouseEnter",["mouseout","mouseover"]),Ls("onMouseLeave",["mouseout","mouseover"]),Ls("onPointerEnter",["pointerout","pointerover"]),Ls("onPointerLeave",["pointerout","pointerover"]),Wr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Wr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Wr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Wr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Wr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Wr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ba="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(" "),tO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ba));function $b(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],N=A.instance,z=A.currentTarget;if(A=A.listener,N!==y&&m.isPropagationStopped())break e;y=A,m.currentTarget=z;try{y(m)}catch(Y){hu(Y)}m.currentTarget=null,y=N}else for(S=0;S<f.length;S++){if(A=f[S],N=A.instance,z=A.currentTarget,A=A.listener,N!==y&&m.isPropagationStopped())break e;y=A,m.currentTarget=z;try{y(m)}catch(Y){hu(Y)}m.currentTarget=null,y=N}}}}function Ne(s,l){var u=l[yf];u===void 0&&(u=l[yf]=new Set);var f=s+"__bubble";u.has(f)||(e1(l,s,2,!1),u.add(f))}function sp(s,l,u){var f=0;l&&(f|=4),e1(u,s,f,l)}var Ju="_reactListening"+Math.random().toString(36).slice(2);function lp(s){if(!s[Ju]){s[Ju]=!0,Y0.forEach(function(u){u!=="selectionchange"&&(tO.has(u)||sp(u,!1,s),sp(u,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Ju]||(l[Ju]=!0,sp("selectionchange",!1,l))}}function e1(s,l,u,f){switch(E1(l)){case 2:var m=EO;break;case 8:m=NO;break;default:m=Sp}u=m.bind(null,l,u,s),m=void 0,!Mf||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 ap(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 N=S.tag;if((N===3||N===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;A!==null;){if(S=Rs(A),S===null)return;if(N=S.tag,N===5||N===6||N===26||N===27){f=y=S;continue e}A=A.parentNode}}f=f.return}sy(function(){var z=y,Y=Cf(u),W=[];e:{var U=jy.get(s);if(U!==void 0){var V=ou,he=s;switch(s){case"keypress":if(lu(u)===0)break e;case"keydown":case"keyup":V=KM;break;case"focusin":he="focus",V=Nf;break;case"focusout":he="blur",V=Nf;break;case"beforeblur":case"afterblur":V=Nf;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=oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=zM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=JM;break;case Ey:case Ny:case Ry:V=UM;break;case Dy:V=$M;break;case"scroll":case"scrollend":V=LM;break;case"wheel":V=tT;break;case"copy":case"cut":case"paste":V=PM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=cy;break;case"toggle":case"beforetoggle":V=nT}var be=(l&4)!==0,Ye=!be&&(s==="scroll"||s==="scrollend"),j=be?U!==null?U+"Capture":null:U;be=[];for(var R=z,B;R!==null;){var K=R;if(B=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||B===null||j===null||(K=na(R,j),K!=null&&be.push(za(R,K,B))),Ye)break;R=R.return}0<be.length&&(U=new V(U,he,null,u,Y),W.push({event:U,listeners:be}))}}if((l&7)===0){e:{if(U=s==="mouseover"||s==="pointerover",V=s==="mouseout"||s==="pointerout",U&&u!==kf&&(he=u.relatedTarget||u.fromElement)&&(Rs(he)||he[Ns]))break e;if((V||U)&&(U=Y.window===Y?Y:(U=Y.ownerDocument)?U.defaultView||U.parentWindow:window,V?(he=u.relatedTarget||u.toElement,V=z,he=he?Rs(he):null,he!==null&&(Ye=a(he),be=he.tag,he!==Ye||be!==5&&be!==27&&be!==6)&&(he=null)):(V=null,he=z),V!==he)){if(be=oy,K="onMouseLeave",j="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(be=cy,K="onPointerLeave",j="onPointerEnter",R="pointer"),Ye=V==null?U:ia(V),B=he==null?U:ia(he),U=new be(K,R+"leave",V,u,Y),U.target=Ye,U.relatedTarget=B,K=null,Rs(Y)===z&&(be=new be(j,R+"enter",he,u,Y),be.target=B,be.relatedTarget=Ye,K=be),Ye=K,V&&he)t:{for(be=iO,j=V,R=he,B=0,K=j;K;K=be(K))B++;K=0;for(var ge=R;ge;ge=be(ge))K++;for(;0<B-K;)j=be(j),B--;for(;0<K-B;)R=be(R),K--;for(;B--;){if(j===R||R!==null&&j===R.alternate){be=j;break t}j=be(j),R=be(R)}be=null}else be=null;V!==null&&t1(W,U,V,be,!1),he!==null&&Ye!==null&&t1(W,Ye,he,be,!0)}}e:{if(U=z?ia(z):window,V=U.nodeName&&U.nodeName.toLowerCase(),V==="select"||V==="input"&&U.type==="file")var Ue=xy;else if(gy(U))if(by)Ue=dT;else{Ue=hT;var pe=cT}else V=U.nodeName,!V||V.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&wf(z.elementType)&&(Ue=xy):Ue=fT;if(Ue&&(Ue=Ue(s,z))){yy(W,Ue,u,Y);break e}pe&&pe(s,U,z),s==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&Sf(U,"number",U.value)}switch(pe=z?ia(z):window,s){case"focusin":(gy(pe)||pe.contentEditable==="true")&&(qs=pe,zf=z,ha=null);break;case"focusout":ha=zf=qs=null;break;case"mousedown":_f=!0;break;case"contextmenu":case"mouseup":case"dragend":_f=!1,Ty(W,u,Y);break;case"selectionchange":if(mT)break;case"keydown":case"keyup":Ty(W,u,Y)}var Me;if(Df)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 Us?py(s,u)&&(je="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(je="onCompositionStart");je&&(hy&&u.locale!=="ko"&&(Us||je!=="onCompositionStart"?je==="onCompositionEnd"&&Us&&(Me=ly()):(rr=Y,Tf="value"in rr?rr.value:rr.textContent,Us=!0)),pe=Zu(z,je),0<pe.length&&(je=new uy(je,s,null,u,Y),W.push({event:je,listeners:pe}),Me?je.data=Me:(Me=my(u),Me!==null&&(je.data=Me)))),(Me=sT?lT(s,u):aT(s,u))&&(je=Zu(z,"onBeforeInput"),0<je.length&&(pe=new uy("onBeforeInput","beforeinput",null,u,Y),W.push({event:pe,listeners:je}),pe.data=Me)),ZT(W,s,z,u,Y)}$b(W,l)})}function za(s,l,u){return{instance:s,listener:l,currentTarget:u}}function Zu(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=na(s,u),m!=null&&f.unshift(za(s,m,y)),m=na(s,l),m!=null&&f.push(za(s,m,y))),s.tag===3)return f;s=s.return}return[]}function iO(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function t1(s,l,u,f,m){for(var y=l._reactName,S=[];u!==null&&u!==f;){var A=u,N=A.alternate,z=A.stateNode;if(A=A.tag,N!==null&&N===f)break;A!==5&&A!==26&&A!==27||z===null||(N=z,m?(z=na(u,y),z!=null&&S.unshift(za(u,z,N))):m||(z=na(u,y),z!=null&&S.push(za(u,z,N)))),u=u.return}S.length!==0&&s.push({event:l,listeners:S})}var nO=/\r\n?/g,rO=/\u0000|\uFFFD/g;function i1(s){return(typeof s=="string"?s:""+s).replace(nO,`
|
|
9
|
+
`).replace(rO,"")}function n1(s,l){return l=i1(l),i1(s)===l}function Ge(s,l,u,f,m,y){switch(u){case"children":typeof f=="string"?l==="body"||l==="textarea"&&f===""||zs(s,f):(typeof f=="number"||typeof f=="bigint")&&l!=="body"&&zs(s,""+f);break;case"className":iu(s,"class",f);break;case"tabIndex":iu(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":iu(s,u,f);break;case"style":ny(s,f,y);break;case"data":if(l!=="object"){iu(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=ru(""+f),s.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(u==="formAction"?(l!=="input"&&Ge(s,l,"name",m.name,m,null),Ge(s,l,"formEncType",m.formEncType,m,null),Ge(s,l,"formMethod",m.formMethod,m,null),Ge(s,l,"formTarget",m.formTarget,m,null)):(Ge(s,l,"encType",m.encType,m,null),Ge(s,l,"method",m.method,m,null),Ge(s,l,"target",m.target,m,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=ru(""+f),s.setAttribute(u,f);break;case"onClick":f!=null&&(s.onclick=Tn);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}u=ru(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""+f):s.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":f===!0?s.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,f):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(u,f):s.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(u):s.setAttribute(u,f);break;case"popover":Ne("beforetoggle",s),Ne("toggle",s),tu(s,"popover",f);break;case"xlinkActuate":Mn(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Mn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Mn(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Mn(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Mn(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Mn(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Mn(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Mn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Mn(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":tu(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,tu(s,u,f))}}function op(s,l,u,f,m,y){switch(u){case"style":ny(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"?zs(s,f):(typeof f=="number"||typeof f=="bigint")&&zs(s,""+f);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"onClick":f!=null&&(s.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!K0.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[ti]||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,""):tu(s,u,f)}}}function _t(s,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",s),Ne("load",s);var f=!1,m=!1,y;for(y in u)if(u.hasOwnProperty(y)){var S=u[y];if(S!=null)switch(y){case"src":f=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,y,S,u,null)}}m&&Ge(s,l,"srcSet",u.srcSet,u,null),f&&Ge(s,l,"src",u.src,u,null);return;case"input":Ne("invalid",s);var A=y=S=m=null,N=null,z=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":N=Y;break;case"defaultChecked":z=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:Ge(s,l,f,Y,u,null)}}$0(s,y,A,N,z,S,m,!1);return;case"select":Ne("invalid",s),f=S=y=null;for(m in u)if(u.hasOwnProperty(m)&&(A=u[m],A!=null))switch(m){case"value":y=A;break;case"defaultValue":S=A;break;case"multiple":f=A;default:Ge(s,l,m,A,u,null)}l=y,u=S,s.multiple=!!f,l!=null?Bs(s,!!f,l,!1):u!=null&&Bs(s,!!f,u,!0);return;case"textarea":Ne("invalid",s),y=m=f=null;for(S in u)if(u.hasOwnProperty(S)&&(A=u[S],A!=null))switch(S){case"value":f=A;break;case"defaultValue":m=A;break;case"children":y=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:Ge(s,l,S,A,u,null)}ty(s,f,m,y);return;case"option":for(N in u)u.hasOwnProperty(N)&&(f=u[N],f!=null)&&(N==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":Ge(s,l,N,f,u,null));return;case"dialog":Ne("beforetoggle",s),Ne("toggle",s),Ne("cancel",s),Ne("close",s);break;case"iframe":case"object":Ne("load",s);break;case"video":case"audio":for(f=0;f<Ba.length;f++)Ne(Ba[f],s);break;case"image":Ne("error",s),Ne("load",s);break;case"details":Ne("toggle",s);break;case"embed":case"source":case"link":Ne("error",s),Ne("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in u)if(u.hasOwnProperty(z)&&(f=u[z],f!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,z,f,u,null)}return;default:if(wf(l)){for(Y in u)u.hasOwnProperty(Y)&&(f=u[Y],f!==void 0&&op(s,l,Y,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Ge(s,l,A,f,u,null))}function sO(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,N=null,z=null,Y=null;for(V in u){var W=u[V];if(u.hasOwnProperty(V)&&W!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":N=W;default:f.hasOwnProperty(V)||Ge(s,l,V,null,f,W)}}for(var U in f){var V=f[U];if(W=u[U],f.hasOwnProperty(U)&&(V!=null||W!=null))switch(U){case"type":y=V;break;case"name":m=V;break;case"checked":z=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!==W&&Ge(s,l,U,V,f,W)}}vf(s,S,A,N,z,Y,y,m);return;case"select":V=S=A=U=null;for(y in u)if(N=u[y],u.hasOwnProperty(y)&&N!=null)switch(y){case"value":break;case"multiple":V=N;default:f.hasOwnProperty(y)||Ge(s,l,y,null,f,N)}for(m in f)if(y=f[m],N=u[m],f.hasOwnProperty(m)&&(y!=null||N!=null))switch(m){case"value":U=y;break;case"defaultValue":A=y;break;case"multiple":S=y;default:y!==N&&Ge(s,l,m,y,f,N)}l=A,u=S,f=V,U!=null?Bs(s,!!u,U,!1):!!f!=!!u&&(l!=null?Bs(s,!!u,l,!0):Bs(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:Ge(s,l,A,null,f,m)}for(S in f)if(m=f[S],y=u[S],f.hasOwnProperty(S)&&(m!=null||y!=null))switch(S){case"value":U=m;break;case"defaultValue":V=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==y&&Ge(s,l,S,m,f,y)}ey(s,U,V);return;case"option":for(var he in u)U=u[he],u.hasOwnProperty(he)&&U!=null&&!f.hasOwnProperty(he)&&(he==="selected"?s.selected=!1:Ge(s,l,he,null,f,U));for(N in f)U=f[N],V=u[N],f.hasOwnProperty(N)&&U!==V&&(U!=null||V!=null)&&(N==="selected"?s.selected=U&&typeof U!="function"&&typeof U!="symbol":Ge(s,l,N,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 be in u)U=u[be],u.hasOwnProperty(be)&&U!=null&&!f.hasOwnProperty(be)&&Ge(s,l,be,null,f,U);for(z in f)if(U=f[z],V=u[z],f.hasOwnProperty(z)&&U!==V&&(U!=null||V!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(137,l));break;default:Ge(s,l,z,U,f,V)}return;default:if(wf(l)){for(var Ye in u)U=u[Ye],u.hasOwnProperty(Ye)&&U!==void 0&&!f.hasOwnProperty(Ye)&&op(s,l,Ye,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||op(s,l,Y,U,f,V);return}}for(var j in u)U=u[j],u.hasOwnProperty(j)&&U!=null&&!f.hasOwnProperty(j)&&Ge(s,l,j,null,f,U);for(W in f)U=f[W],V=u[W],!f.hasOwnProperty(W)||U===V||U==null&&V==null||Ge(s,l,W,U,f,V)}function r1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lO(){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&&r1(S)){for(S=0,A=m.responseEnd,f+=1;f<u.length;f++){var N=u[f],z=N.startTime;if(z>A)break;var Y=N.transferSize,W=N.initiatorType;Y&&r1(W)&&(N=N.responseEnd,S+=Y*(N<A?1:(A-z)/(N-z)))}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 up=null,cp=null;function $u(s){return s.nodeType===9?s:s.ownerDocument}function s1(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 l1(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 hp(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 fp=null;function aO(){var s=window.event;return s&&s.type==="popstate"?s===fp?!1:(fp=s,!0):(fp=null,!1)}var a1=typeof setTimeout=="function"?setTimeout:void 0,oO=typeof clearTimeout=="function"?clearTimeout:void 0,o1=typeof Promise=="function"?Promise:void 0,uO=typeof queueMicrotask=="function"?queueMicrotask:typeof o1<"u"?function(s){return o1.resolve(null).then(s).catch(cO)}:a1;function cO(s){setTimeout(function(){throw s})}function Sr(s){return s==="head"}function u1(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),dl(l);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")_a(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,_a(u);for(var y=u.firstChild;y;){var S=y.nextSibling,A=y.nodeName;y[ta]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&y.rel.toLowerCase()==="stylesheet"||u.removeChild(y),y=S}}else u==="body"&&_a(s.ownerDocument.body);u=m}while(u);dl(l)}function c1(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 dp(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":dp(u),xf(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function hO(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[ta])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=Hi(s.nextSibling),s===null)break}return null}function fO(s,l,u){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=Hi(s.nextSibling),s===null))return null;return s}function h1(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Hi(s.nextSibling),s===null))return null;return s}function pp(s){return s.data==="$?"||s.data==="$~"}function mp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function dO(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 Hi(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 gp=null;function f1(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(l===0)return Hi(s.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}s=s.nextSibling}return null}function d1(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 p1(s,l,u){switch(l=$u(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 _a(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);xf(s)}var Ui=new Map,m1=new Set;function ec(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Vn=J.d;J.d={f:pO,r:mO,D:gO,C:yO,L:xO,m:bO,X:SO,S:vO,M:wO};function pO(){var s=Vn.f(),l=Qu();return s||l}function mO(s){var l=Ds(s);l!==null&&l.tag===5&&l.type==="form"?Dx(l):Vn.r(s)}var cl=typeof document>"u"?null:document;function g1(s,l,u){var f=cl;if(f&&typeof l=="string"&&l){var m=Ri(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),m1.has(m)||(m1.add(m),s={rel:s,crossOrigin:u,href:l},f.querySelector(m)===null&&(l=f.createElement("link"),_t(l,"link",s),Et(l),f.head.appendChild(l)))}}function gO(s){Vn.D(s),g1("dns-prefetch",s,null)}function yO(s,l){Vn.C(s,l),g1("preconnect",s,l)}function xO(s,l,u){Vn.L(s,l,u);var f=cl;if(f&&s&&l){var m='link[rel="preload"][as="'+Ri(l)+'"]';l==="image"&&u&&u.imageSrcSet?(m+='[imagesrcset="'+Ri(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(m+='[imagesizes="'+Ri(u.imageSizes)+'"]')):m+='[href="'+Ri(s)+'"]';var y=m;switch(l){case"style":y=hl(s);break;case"script":y=fl(s)}Ui.has(y)||(s=g({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:s,as:l},u),Ui.set(y,s),f.querySelector(m)!==null||l==="style"&&f.querySelector(Ha(y))||l==="script"&&f.querySelector(Ua(y))||(l=f.createElement("link"),_t(l,"link",s),Et(l),f.head.appendChild(l)))}}function bO(s,l){Vn.m(s,l);var u=cl;if(u&&s){var f=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+Ri(f)+'"][href="'+Ri(s)+'"]',y=m;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=fl(s)}if(!Ui.has(y)&&(s=g({rel:"modulepreload",href:s},l),Ui.set(y,s),u.querySelector(m)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Ua(y)))return}f=u.createElement("link"),_t(f,"link",s),Et(f),u.head.appendChild(f)}}}function vO(s,l,u){Vn.S(s,l,u);var f=cl;if(f&&s){var m=js(f).hoistableStyles,y=hl(s);l=l||"default";var S=m.get(y);if(!S){var A={loading:0,preload:null};if(S=f.querySelector(Ha(y)))A.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":l},u),(u=Ui.get(y))&&yp(s,u);var N=S=f.createElement("link");Et(N),_t(N,"link",s),N._p=new Promise(function(z,Y){N.onload=z,N.onerror=Y}),N.addEventListener("load",function(){A.loading|=1}),N.addEventListener("error",function(){A.loading|=2}),A.loading|=4,tc(S,l,f)}S={type:"stylesheet",instance:S,count:1,state:A},m.set(y,S)}}}function SO(s,l){Vn.X(s,l);var u=cl;if(u&&s){var f=js(u).hoistableScripts,m=fl(s),y=f.get(m);y||(y=u.querySelector(Ua(m)),y||(s=g({src:s,async:!0},l),(l=Ui.get(m))&&xp(s,l),y=u.createElement("script"),Et(y),_t(y,"link",s),u.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(m,y))}}function wO(s,l){Vn.M(s,l);var u=cl;if(u&&s){var f=js(u).hoistableScripts,m=fl(s),y=f.get(m);y||(y=u.querySelector(Ua(m)),y||(s=g({src:s,async:!0,type:"module"},l),(l=Ui.get(m))&&xp(s,l),y=u.createElement("script"),Et(y),_t(y,"link",s),u.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(m,y))}}function y1(s,l,u,f){var m=(m=Ce.current)?ec(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=hl(u.href),u=js(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=hl(u.href);var y=js(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(Ha(s)))&&!y._p&&(S.instance=y,S.state.loading=5),Ui.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},Ui.set(s,u),y||kO(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=fl(u),u=js(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 hl(s){return'href="'+Ri(s)+'"'}function Ha(s){return'link[rel="stylesheet"]['+s+"]"}function x1(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function kO(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}),_t(l,"link",u),Et(l),s.head.appendChild(l))}function fl(s){return'[src="'+Ri(s)+'"]'}function Ua(s){return"script[async]"+s}function b1(s,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var f=s.querySelector('style[data-href~="'+Ri(u.href)+'"]');if(f)return l.instance=f,Et(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"),Et(f),_t(f,"style",m),tc(f,u.precedence,s),l.instance=f;case"stylesheet":m=hl(u.href);var y=s.querySelector(Ha(m));if(y)return l.state.loading|=4,l.instance=y,Et(y),y;f=x1(u),(m=Ui.get(m))&&yp(f,m),y=(s.ownerDocument||s).createElement("link"),Et(y);var S=y;return S._p=new Promise(function(A,N){S.onload=A,S.onerror=N}),_t(y,"link",f),l.state.loading|=4,tc(y,u.precedence,s),l.instance=y;case"script":return y=fl(u.src),(m=s.querySelector(Ua(y)))?(l.instance=m,Et(m),m):(f=u,(m=Ui.get(y))&&(f=g({},u),xp(f,m)),s=s.ownerDocument||s,m=s.createElement("script"),Et(m),_t(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,tc(f,u.precedence,s));return l.instance}function tc(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 yp(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function xp(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var ic=null;function v1(s,l,u){if(ic===null){var f=new Map,m=ic=new Map;m.set(u,f)}else m=ic,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[ta]||y[jt]||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 S1(s,l,u){s=s.ownerDocument||s,s.head.insertBefore(u,l==="title"?s.querySelector("head > title"):null)}function CO(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 w1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function AO(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=hl(f.href),y=l.querySelector(Ha(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=nc.bind(s),l.then(s,s)),u.state.loading|=4,u.instance=y,Et(y);return}y=l.ownerDocument||l,f=x1(f),(m=Ui.get(m))&&yp(f,m),y=y.createElement("link"),Et(y);var S=y;S._p=new Promise(function(A,N){S.onload=A,S.onerror=N}),_t(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=nc.bind(s),l.addEventListener("load",u),l.addEventListener("error",u))}}var bp=0;function MO(s,l){return s.stylesheets&&s.count===0&&sc(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var f=setTimeout(function(){if(s.stylesheets&&sc(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+l);0<s.imgBytes&&bp===0&&(bp=62500*lO());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&sc(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>bp?50:800)+l);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(m)}}:null}function nc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var rc=null;function sc(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,rc=new Map,l.forEach(TO,s),rc=null,nc.call(s))}function TO(s,l){if(!(l.state.loading&4)){var u=rc.get(s);if(u)var f=u.get(null);else{u=new Map,rc.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=nc.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 qa={$$typeof:D,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function OO(s,l,u,f,m,y,S,A,N){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=pf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pf(0),this.hiddenUpdates=pf(null),this.identifierPrefix=f,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function k1(s,l,u,f,m,y,S,A,N,z,Y,W){return s=new OO(s,l,u,S,N,z,Y,W,A),l=1,y===!0&&(l|=24),y=bi(3,null,null,l),s.current=y,y.stateNode=s,l=Zf(),l.refCount++,s.pooledCache=l,l.refCount++,y.memoizedState={element:f,isDehydrated:u,cache:l},id(y),s}function C1(s){return s?(s=Vs,s):Vs}function A1(s,l,u,f,m,y){m=C1(m),f.context===null?f.context=m:f.pendingContext=m,f=cr(l),f.payload={element:u},y=y===void 0?null:y,y!==null&&(f.callback=y),u=hr(s,f,l),u!==null&&(ai(u,s,l),xa(u,s,l))}function M1(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<l?u:l}}function vp(s,l){M1(s,l),(s=s.alternate)&&M1(s,l)}function T1(s){if(s.tag===13||s.tag===31){var l=$r(s,67108864);l!==null&&ai(l,s,67108864),vp(s,67108864)}}function O1(s){if(s.tag===13||s.tag===31){var l=Ci();l=mf(l);var u=$r(s,l);u!==null&&ai(u,s,l),vp(s,l)}}var lc=!0;function EO(s,l,u,f){var m=_.T;_.T=null;var y=J.p;try{J.p=2,Sp(s,l,u,f)}finally{J.p=y,_.T=m}}function NO(s,l,u,f){var m=_.T;_.T=null;var y=J.p;try{J.p=8,Sp(s,l,u,f)}finally{J.p=y,_.T=m}}function Sp(s,l,u,f){if(lc){var m=wp(f);if(m===null)ap(s,l,f,ac,u),N1(s,f);else if(DO(m,s,l,u,f))f.stopPropagation();else if(N1(s,f),l&4&&-1<RO.indexOf(s)){for(;m!==null;){var y=Ds(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=Kr(y.pendingLanes);if(S!==0){var A=y;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var N=1<<31-yi(S);A.entanglements[1]|=N,S&=~N}un(y),(Fe&6)===0&&(Vu=mi()+500,La(0))}}break;case 31:case 13:A=$r(y,2),A!==null&&ai(A,y,2),Qu(),vp(y,2)}if(y=wp(f),y===null&&ap(s,l,f,ac,u),y===m)break;m=y}m!==null&&f.stopPropagation()}else ap(s,l,f,null,u)}}function wp(s){return s=Cf(s),kp(s)}var ac=null;function kp(s){if(ac=null,s=Rs(s),s!==null){var l=a(s);if(l===null)s=null;else{var u=l.tag;if(u===13){if(s=o(l),s!==null)return s;s=null}else if(u===31){if(s=c(l),s!==null)return s;s=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return ac=s,null}function E1(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(gM()){case _0:return 2;case H0:return 8;case Xo:case yM:return 32;case U0:return 268435456;default:return 32}default:return 32}}var Cp=!1,wr=null,kr=null,Cr=null,Pa=new Map,Fa=new Map,Ar=[],RO="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 N1(s,l){switch(s){case"focusin":case"focusout":wr=null;break;case"dragenter":case"dragleave":kr=null;break;case"mouseover":case"mouseout":Cr=null;break;case"pointerover":case"pointerout":Pa.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fa.delete(l.pointerId)}}function Va(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=Ds(l),l!==null&&T1(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 wr=Va(wr,s,l,u,f,m),!0;case"dragenter":return kr=Va(kr,s,l,u,f,m),!0;case"mouseover":return Cr=Va(Cr,s,l,u,f,m),!0;case"pointerover":var y=m.pointerId;return Pa.set(y,Va(Pa.get(y)||null,s,l,u,f,m)),!0;case"gotpointercapture":return y=m.pointerId,Fa.set(y,Va(Fa.get(y)||null,s,l,u,f,m)),!0}return!1}function R1(s){var l=Rs(s.target);if(l!==null){var u=a(l);if(u!==null){if(l=u.tag,l===13){if(l=o(u),l!==null){s.blockedOn=l,Q0(s.priority,function(){O1(u)});return}}else if(l===31){if(l=c(u),l!==null){s.blockedOn=l,Q0(s.priority,function(){O1(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 oc(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var u=wp(s.nativeEvent);if(u===null){u=s.nativeEvent;var f=new u.constructor(u.type,u);kf=f,u.target.dispatchEvent(f),kf=null}else return l=Ds(u),l!==null&&T1(l),s.blockedOn=u,!1;l.shift()}return!0}function D1(s,l,u){oc(s)&&u.delete(l)}function jO(){Cp=!1,wr!==null&&oc(wr)&&(wr=null),kr!==null&&oc(kr)&&(kr=null),Cr!==null&&oc(Cr)&&(Cr=null),Pa.forEach(D1),Fa.forEach(D1)}function uc(s,l){s.blockedOn===l&&(s.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jO)))}var cc=null;function j1(s){cc!==s&&(cc=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){cc===s&&(cc=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(kp(f||u)===null)continue;break}var y=Ds(u);y!==null&&(s.splice(l,3),l-=3,wd(y,{pending:!0,data:m,method:u.method,action:f},f,m))}}))}function dl(s){function l(N){return uc(N,s)}wr!==null&&uc(wr,s),kr!==null&&uc(kr,s),Cr!==null&&uc(Cr,s),Pa.forEach(l),Fa.forEach(l);for(var u=0;u<Ar.length;u++){var f=Ar[u];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Ar.length&&(u=Ar[0],u.blockedOn===null);)R1(u),u.blockedOn===null&&Ar.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[ti]||null;if(typeof y=="function")S||j1(u);else if(S){var A=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[ti]||null)A=S.formAction;else if(kp(m)!==null)continue}else A=S.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),j1(u)}}}function L1(){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 Ap(s){this._internalRoot=s}hc.prototype.render=Ap.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,f=Ci();A1(u,f,s,l,null,null)},hc.prototype.unmount=Ap.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;A1(s.current,2,null,s,null,null),Qu(),l[Ns]=null}};function hc(s){this._internalRoot=s}hc.prototype.unstable_scheduleHydration=function(s){if(s){var l=I0();s={blockedOn:null,target:s,priority:l};for(var u=0;u<Ar.length&&l!==0&&l<Ar[u].priority;u++);Ar.splice(u,0,s),u===0&&R1(s)}};var B1=e.version;if(B1!=="19.2.4")throw Error(n(527,B1,"19.2.4"));J.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 LO={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fc.isDisabled&&fc.supportsFiber)try{Zl=fc.inject(LO),gi=fc}catch{}}return Qa.createRoot=function(s,l){if(!r(s))throw Error(n(299));var u=!1,f="",m=Fx,y=Vx,S=Ix;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=k1(s,1,!1,null,null,u,f,null,m,y,S,L1),s[Ns]=l.current,lp(s),new Ap(l)},Qa.hydrateRoot=function(s,l,u){if(!r(s))throw Error(n(299));var f=!1,m="",y=Fx,S=Vx,A=Ix,N=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&&(N=u.formState)),l=k1(s,1,!0,l,u??null,f,m,N,y,S,A,L1),l.context=C1(null),u=l.current,f=Ci(),f=mf(f),m=cr(f),m.callback=null,hr(u,m,f),u=f,l.current.lanes=u,ea(l,u),un(l),s[Ns]=l.current,lp(s),new hc(l)},Qa.version="19.2.4",Qa}var Q1;function IO(){if(Q1)return Op.exports;Q1=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(),Op.exports=VO(),Op.exports}var QO=IO();var G1="popstate";function Y1(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function GO(t={}){function e(n,r){let a=r.state?.masked,{pathname:o,search:c,hash:h}=a||n.location;return xm("",{pathname:o,search:c,hash:h},r.state&&r.state.usr||null,r.state&&r.state.key||"default",a?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function i(n,r){return typeof r=="string"?r:mo(r)}return KO(e,i,null,t)}function st(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function en(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function YO(){return Math.random().toString(36).substring(2,10)}function K1(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 xm(t,e,i=null,n,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Vl(e):e,state:i,key:e&&e.key||n||YO(),unstable_mask:r}}function mo({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 Vl(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 KO(t,e,i,n={}){let{window:r=document.defaultView,v5Compat:a=!1}=n,o=r.history,c="POP",h=null,d=p();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function p(){return(o.state||{idx:null}).idx}function g(){c="POP";let C=p(),M=C==null?null:C-d;d=C,h&&h({action:c,location:k.location,delta:M})}function x(C,M){c="PUSH";let E=Y1(C)?C:xm(k.location,C,M);d=p()+1;let D=K1(E,d),G=k.createHref(E.unstable_mask||E);try{o.pushState(D,"",G)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;r.location.assign(G)}a&&h&&h({action:c,location:k.location,delta:1})}function v(C,M){c="REPLACE";let E=Y1(C)?C:xm(k.location,C,M);d=p();let D=K1(E,d),G=k.createHref(E.unstable_mask||E);o.replaceState(D,"",G),a&&h&&h({action:c,location:k.location,delta:0})}function w(C){return WO(C)}let k={get action(){return c},get location(){return t(r,o)},listen(C){if(h)throw new Error("A history only accepts one active listener");return r.addEventListener(G1,g),h=C,()=>{r.removeEventListener(G1,g),h=null}},createHref(C){return e(r,C)},createURL:w,encodeLocation(C){let M=w(C);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(C){return o.go(C)}};return k}function WO(t,e=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),st(i,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:mo(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=i+n),new URL(n,i)}function O2(t,e,i="/"){return XO(t,e,i,!1)}function XO(t,e,i,n){let r=typeof e=="string"?Vl(e):e,a=Kn(r.pathname||"/",i);if(a==null)return null;let o=E2(t);JO(o);let c=null;for(let h=0;c==null&&h<o.length;++h){let d=oE(a);c=lE(o[h],d,n)}return c}function E2(t,e=[],i=[],n="",r=!1){let a=(o,c,h=r,d)=>{let p={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&h)return;st(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=vn([n,p.relativePath]),x=i.concat(p);o.children&&o.children.length>0&&(st(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),E2(o.children,e,x,g,h)),!(o.path==null&&!o.index)&&e.push({path:g,score:rE(g,o.index),routesMeta:x})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))a(o,c);else for(let h of N2(o.path))a(o,c,!0,h)}),e}function N2(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),a=i.replace(/\?$/,"");if(n.length===0)return r?[a,""]:[a];let o=N2(n.join("/")),c=[];return c.push(...o.map(h=>h===""?a:[a,h].join("/"))),r&&c.push(...o),c.map(h=>t.startsWith("/")&&h===""?"/":h)}function JO(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:sE(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}var ZO=/^:[\w-]+$/,$O=3,eE=2,tE=1,iE=10,nE=-2,W1=t=>t==="*";function rE(t,e){let i=t.split("/"),n=i.length;return i.some(W1)&&(n+=nE),e&&(n+=eE),i.filter(r=>!W1(r)).reduce((r,a)=>r+(ZO.test(a)?$O:a===""?tE:iE),n)}function sE(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 lE(t,e,i=!1){let{routesMeta:n}=t,r={},a="/",o=[];for(let c=0;c<n.length;++c){let h=n[c],d=c===n.length-1,p=a==="/"?e:e.slice(a.length)||"/",g=eh({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),x=h.route;if(!g&&d&&i&&!n[n.length-1].route.index&&(g=eh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!g)return null;Object.assign(r,g.params),o.push({params:r,pathname:vn([a,g.pathname]),pathnameBase:fE(vn([a,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(a=vn([a,g.pathnameBase]))}return o}function eh(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,n]=aE(t.path,t.caseSensitive,t.end),r=e.match(i);if(!r)return null;let a=r[0],o=a.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((d,{paramName:p,isOptional:g},x)=>{if(p==="*"){let w=c[x]||"";o=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[x];return g&&!v?d[p]=void 0:d[p]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:t}}function aE(t,e=!1,i=!0){en(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,h,d,p)=>{if(n.push({paramName:c,isOptional:h!=null}),h){let g=p.charAt(d+o.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function oE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return en(!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 Kn(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 uE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function cE(t,e="/"){let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?Vl(t):t,a;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?a=X1(i.substring(1),"/"):a=X1(i,e)):a=e,{pathname:a,search:dE(n),hash:pE(r)}}function X1(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 Dp(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 hE(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function Dg(t){let e=hE(t);return e.map((i,n)=>n===e.length-1?i.pathname:i.pathnameBase)}function Uh(t,e,i,n=!1){let r;typeof t=="string"?r=Vl(t):(r={...t},st(!r.pathname||!r.pathname.includes("?"),Dp("?","pathname","search",r)),st(!r.pathname||!r.pathname.includes("#"),Dp("#","pathname","hash",r)),st(!r.search||!r.search.includes("#"),Dp("#","search","hash",r)));let a=t===""||r.pathname==="",o=a?"/":r.pathname,c;if(o==null)c=i;else{let g=e.length-1;if(!n&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),g-=1;r.pathname=x.join("/")}c=g>=0?e[g]:"/"}let h=cE(r,c),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var vn=t=>t.join("/").replace(/\/\/+/g,"/"),fE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),dE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,pE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,mE=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 gE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function yE(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var R2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function D2(t,e){let i=t;if(typeof i!="string"||!uE.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let n=i,r=!1;if(R2)try{let a=new URL(window.location.href),o=i.startsWith("//")?new URL(a.protocol+i):new URL(i),c=Kn(o.pathname,e);o.origin===a.origin&&c!=null?i=c+o.search+o.hash:r=!0}catch{en(!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 j2=["POST","PUT","PATCH","DELETE"];new Set(j2);var xE=["GET",...j2];new Set(xE);var Il=O.createContext(null);Il.displayName="DataRouter";var qh=O.createContext(null);qh.displayName="DataRouterState";var bE=O.createContext(!1),L2=O.createContext({isTransitioning:!1});L2.displayName="ViewTransition";var vE=O.createContext(new Map);vE.displayName="Fetchers";var SE=O.createContext(null);SE.displayName="Await";var Ei=O.createContext(null);Ei.displayName="Navigation";var Ho=O.createContext(null);Ho.displayName="Location";var nn=O.createContext({outlet:null,matches:[],isDataRoute:!1});nn.displayName="Route";var jg=O.createContext(null);jg.displayName="RouteError";var B2="REACT_ROUTER_ERROR",wE="REDIRECT",kE="ROUTE_ERROR_RESPONSE";function CE(t){if(t.startsWith(`${B2}:${wE}:{`))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 AE(t){if(t.startsWith(`${B2}:${kE}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new mE(e.status,e.statusText,e.data)}catch{}}function ME(t,{relative:e}={}){st(Ql(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:n}=O.useContext(Ei),{hash:r,pathname:a,search:o}=Uo(t,{relative:e}),c=a;return i!=="/"&&(c=a==="/"?i:vn([i,a])),n.createHref({pathname:c,search:o,hash:r})}function Ql(){return O.useContext(Ho)!=null}function tr(){return st(Ql(),"useLocation() may be used only in the context of a <Router> component."),O.useContext(Ho).location}var z2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _2(t){O.useContext(Ei).static||O.useLayoutEffect(t)}function H2(){let{isDataRoute:t}=O.useContext(nn);return t?PE():TE()}function TE(){st(Ql(),"useNavigate() may be used only in the context of a <Router> component.");let t=O.useContext(Il),{basename:e,navigator:i}=O.useContext(Ei),{matches:n}=O.useContext(nn),{pathname:r}=tr(),a=JSON.stringify(Dg(n)),o=O.useRef(!1);return _2(()=>{o.current=!0}),O.useCallback((h,d={})=>{if(en(o.current,z2),!o.current)return;if(typeof h=="number"){i.go(h);return}let p=Uh(h,JSON.parse(a),r,d.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:vn([e,p.pathname])),(d.replace?i.replace:i.push)(p,d.state,d)},[e,i,a,r,t])}var OE=O.createContext(null);function EE(t){let e=O.useContext(nn).outlet;return O.useMemo(()=>e&&O.createElement(OE.Provider,{value:t},e),[e,t])}function Uo(t,{relative:e}={}){let{matches:i}=O.useContext(nn),{pathname:n}=tr(),r=JSON.stringify(Dg(i));return O.useMemo(()=>Uh(t,JSON.parse(r),n,e==="path"),[t,r,n,e])}function NE(t,e){return U2(t,e)}function U2(t,e,i){st(Ql(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=O.useContext(Ei),{matches:r}=O.useContext(nn),a=r[r.length-1],o=a?a.params:{},c=a?a.pathname:"/",h=a?a.pathnameBase:"/",d=a&&a.route;{let C=d&&d.path||"";P2(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=tr(),g;if(e){let C=typeof e=="string"?Vl(e):e;st(h==="/"||C.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",v=x;if(h!=="/"){let C=h.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=O2(t,{pathname:v});en(d||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),en(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=BE(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},o,C.params),pathname:vn([h,n.encodeLocation?n.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:vn([h,n.encodeLocation?n.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,i);return e&&k?O.createElement(Ho.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function RE(){let t=qE(),e=gE(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=O.createElement(O.Fragment,null,O.createElement("p",null,"💿 Hey developer 👋"),O.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",O.createElement("code",{style:a},"ErrorBoundary")," or"," ",O.createElement("code",{style:a},"errorElement")," prop on your route.")),O.createElement(O.Fragment,null,O.createElement("h2",null,"Unexpected Application Error!"),O.createElement("h3",{style:{fontStyle:"italic"}},e),i?O.createElement("pre",{style:r},i):null,o)}var DE=O.createElement(RE,null),q2=class extends O.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=AE(t.digest);i&&(t=i)}let e=t!==void 0?O.createElement(nn.Provider,{value:this.props.routeContext},O.createElement(jg.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?O.createElement(jE,{error:t},e):e}};q2.contextType=bE;var jp=new WeakMap;function jE({children:t,error:e}){let{basename:i}=O.useContext(Ei);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=CE(e.digest);if(n){let r=jp.get(e);if(r)throw r;let a=D2(n.location,i);if(R2&&!jp.get(e))if(a.isExternal||n.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:n.replace}));throw jp.set(e,o),o}return O.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return t}function LE({routeContext:t,match:e,children:i}){let n=O.useContext(Il);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),O.createElement(nn.Provider,{value:t},i)}function BE(t,e=[],i){let n=i?.state;if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let r=t,a=n?.errors;if(a!=null){let p=r.findIndex(g=>g.route.id&&a?.[g.route.id]!==void 0);st(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),r=r.slice(0,Math.min(r.length,p+1))}let o=!1,c=-1;if(i&&n){o=n.renderFallback;for(let p=0;p<r.length;p++){let g=r[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=p),g.route.id){let{loaderData:x,errors:v}=n,w=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||w){i.isStatic&&(o=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let h=i?.onError,d=n&&h?(p,g)=>{h(p,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:yE(n.matches),errorInfo:g})}:void 0;return r.reduceRight((p,g,x)=>{let v,w=!1,k=null,C=null;n&&(v=a&&g.route.id?a[g.route.id]:void 0,k=g.route.errorElement||DE,o&&(c<0&&x===0?(P2("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)),E=()=>{let D;return v?D=k:w?D=C:g.route.Component?D=O.createElement(g.route.Component,null):g.route.element?D=g.route.element:D=p,O.createElement(LE,{match:g,routeContext:{outlet:p,matches:M,isDataRoute:n!=null},children:D})};return n&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?O.createElement(q2,{location:n.location,revalidation:n.revalidation,component:k,error:v,children:E(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):E()},null)}function Lg(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zE(t){let e=O.useContext(Il);return st(e,Lg(t)),e}function _E(t){let e=O.useContext(qh);return st(e,Lg(t)),e}function HE(t){let e=O.useContext(nn);return st(e,Lg(t)),e}function Bg(t){let e=HE(t),i=e.matches[e.matches.length-1];return st(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function UE(){return Bg("useRouteId")}function qE(){let t=O.useContext(jg),e=_E("useRouteError"),i=Bg("useRouteError");return t!==void 0?t:e.errors?.[i]}function PE(){let{router:t}=zE("useNavigate"),e=Bg("useNavigate"),i=O.useRef(!1);return _2(()=>{i.current=!0}),O.useCallback(async(r,a={})=>{en(i.current,z2),i.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...a}))},[t,e])}var J1={};function P2(t,e,i){!e&&!J1[t]&&(J1[t]=!0,en(!1,i))}O.memo(FE);function FE({routes:t,future:e,state:i,isStatic:n,onError:r}){return U2(t,void 0,{state:i,isStatic:n,onError:r})}function VE({to:t,replace:e,state:i,relative:n}){st(Ql(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=O.useContext(Ei);en(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=O.useContext(nn),{pathname:o}=tr(),c=H2(),h=Uh(t,Dg(a),o,n==="path"),d=JSON.stringify(h);return O.useEffect(()=>{c(JSON.parse(d),{replace:e,state:i,relative:n})},[c,d,n,e,i]),null}function IE(t){return EE(t.context)}function Pc(t){st(!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 QE({basename:t="/",children:e=null,location:i,navigationType:n="POP",navigator:r,static:a=!1,unstable_useTransitions:o}){st(!Ql(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=t.replace(/^\/*/,"/"),h=O.useMemo(()=>({basename:c,navigator:r,static:a,unstable_useTransitions:o,future:{}}),[c,r,a,o]);typeof i=="string"&&(i=Vl(i));let{pathname:d="/",search:p="",hash:g="",state:x=null,key:v="default",unstable_mask:w}=i,k=O.useMemo(()=>{let C=Kn(d,c);return C==null?null:{location:{pathname:C,search:p,hash:g,state:x,key:v,unstable_mask:w},navigationType:n}},[c,d,p,g,x,v,n,w]);return en(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:O.createElement(Ei.Provider,{value:h},O.createElement(Ho.Provider,{children:e,value:k}))}function GE({children:t,location:e}){return NE(bm(t),e)}function bm(t,e=[]){let i=[];return O.Children.forEach(t,(n,r)=>{if(!O.isValidElement(n))return;let a=[...e,r];if(n.type===O.Fragment){i.push.apply(i,bm(n.props.children,a));return}st(n.type===Pc,`[${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>`),st(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=bm(n.props.children,a)),i.push(o)}),i}var Fc="get",Vc="application/x-www-form-urlencoded";function Ph(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function YE(t){return Ph(t)&&t.tagName.toLowerCase()==="button"}function KE(t){return Ph(t)&&t.tagName.toLowerCase()==="form"}function WE(t){return Ph(t)&&t.tagName.toLowerCase()==="input"}function XE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function JE(t,e){return t.button===0&&(!e||e==="_self")&&!XE(t)}var dc=null;function ZE(){if(dc===null)try{new FormData(document.createElement("form"),0),dc=!1}catch{dc=!0}return dc}var $E=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Lp(t){return t!=null&&!$E.has(t)?(en(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vc}"`),null):t}function eN(t,e){let i,n,r,a,o;if(KE(t)){let c=t.getAttribute("action");n=c?Kn(c,e):null,i=t.getAttribute("method")||Fc,r=Lp(t.getAttribute("enctype"))||Vc,a=new FormData(t)}else if(YE(t)||WE(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?Kn(h,e):null,i=t.getAttribute("formmethod")||c.getAttribute("method")||Fc,r=Lp(t.getAttribute("formenctype"))||Lp(c.getAttribute("enctype"))||Vc,a=new FormData(c,t),!ZE()){let{name:d,type:p,value:g}=t;if(p==="image"){let x=d?`${d}.`:"";a.append(`${x}x`,"0"),a.append(`${x}y`,"0")}else d&&a.append(d,g)}}else{if(Ph(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Fc,n=null,r=Vc,o=t}return a&&r==="text/plain"&&(o=a,a=void 0),{action:n,method:i.toLowerCase(),encType:r,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function zg(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function tN(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&&Kn(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function iN(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 nN(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 rN(t,e,i){let n=await Promise.all(t.map(async r=>{let a=e.routes[r.route.id];if(a){let o=await iN(a,i);return o.links?o.links():[]}return[]}));return oN(n.flat(1).filter(nN).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function Z1(t,e,i,n,r,a){let o=(h,d)=>i[d]?h.route.id!==i[d].route.id:!0,c=(h,d)=>i[d].pathname!==h.pathname||i[d].route.path?.endsWith("*")&&i[d].params["*"]!==h.params["*"];return a==="assets"?e.filter((h,d)=>o(h,d)||c(h,d)):a==="data"?e.filter((h,d)=>{let p=n.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(o(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let g=h.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function sN(t,e,{includeHydrateFallback:i}={}){return lN(t.map(n=>{let r=e.routes[n.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),i&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))}function lN(t){return[...new Set(t)]}function aN(t){let e={},i=Object.keys(t).sort();for(let n of i)e[n]=t[n];return e}function oN(t,e){let i=new Set;return new Set(e),t.reduce((n,r)=>{let a=JSON.stringify(aN(r));return i.has(a)||(i.add(a),n.push({key:a,link:r})),n},[])}function F2(){let t=O.useContext(Il);return zg(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function uN(){let t=O.useContext(qh);return zg(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _g=O.createContext(void 0);_g.displayName="FrameworkContext";function V2(){let t=O.useContext(_g);return zg(t,"You must render this element inside a <HydratedRouter> element"),t}function cN(t,e){let i=O.useContext(_g),[n,r]=O.useState(!1),[a,o]=O.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:g}=e,x=O.useRef(null);O.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let k=M=>{M.forEach(E=>{o(E.isIntersecting)})},C=new IntersectionObserver(k,{threshold:.5});return x.current&&C.observe(x.current),()=>{C.disconnect()}}},[t]),O.useEffect(()=>{if(n){let k=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(k)}}},[n]);let v=()=>{r(!0)},w=()=>{r(!1),o(!1)};return i?t!=="intent"?[a,x,{}]:[a,x,{onFocus:Ga(c,v),onBlur:Ga(h,w),onMouseEnter:Ga(d,v),onMouseLeave:Ga(p,w),onTouchStart:Ga(g,v)}]:[!1,x,{}]}function Ga(t,e){return i=>{t&&t(i),i.defaultPrevented||e(i)}}function hN({page:t,...e}){let{router:i}=F2(),n=O.useMemo(()=>O2(i.routes,t,i.basename),[i.routes,t,i.basename]);return n?O.createElement(dN,{page:t,matches:n,...e}):null}function fN(t){let{manifest:e,routeModules:i}=V2(),[n,r]=O.useState([]);return O.useEffect(()=>{let a=!1;return rN(t,e,i).then(o=>{a||r(o)}),()=>{a=!0}},[t,e,i]),n}function dN({page:t,matches:e,...i}){let n=tr(),{future:r,manifest:a,routeModules:o}=V2(),{basename:c}=F2(),{loaderData:h,matches:d}=uN(),p=O.useMemo(()=>Z1(t,e,d,a,n,"data"),[t,e,d,a,n]),g=O.useMemo(()=>Z1(t,e,d,a,n,"assets"),[t,e,d,a,n]),x=O.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let k=new Set,C=!1;if(e.forEach(E=>{let D=a.routes[E.route.id];!D||!D.hasLoader||(!p.some(G=>G.route.id===E.route.id)&&E.route.id in h&&o[E.route.id]?.shouldRevalidate||D.hasClientLoader?C=!0:k.add(E.route.id))}),k.size===0)return[];let M=tN(t,c,r.unstable_trailingSlashAwareDataRequests,"data");return C&&k.size>0&&M.searchParams.set("_routes",e.filter(E=>k.has(E.route.id)).map(E=>E.route.id).join(",")),[M.pathname+M.search]},[c,r.unstable_trailingSlashAwareDataRequests,h,n,a,p,e,t,o]),v=O.useMemo(()=>sN(g,a),[g,a]),w=fN(g);return O.createElement(O.Fragment,null,x.map(k=>O.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...i})),v.map(k=>O.createElement("link",{key:k,rel:"modulepreload",href:k,...i})),w.map(({key:k,link:C})=>O.createElement("link",{key:k,nonce:i.nonce,...C,crossOrigin:C.crossOrigin??i.crossOrigin})))}function pN(...t){return e=>{t.forEach(i=>{typeof i=="function"?i(e):i!=null&&(i.current=e)})}}var mN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mN&&(window.__reactRouterVersion="7.13.1")}catch{}function gN({basename:t,children:e,unstable_useTransitions:i,window:n}){let r=O.useRef();r.current==null&&(r.current=GO({window:n,v5Compat:!0}));let a=r.current,[o,c]=O.useState({action:a.action,location:a.location}),h=O.useCallback(d=>{i===!1?c(d):O.startTransition(()=>c(d))},[i]);return O.useLayoutEffect(()=>a.listen(h),[a,h]),O.createElement(QE,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:i})}var I2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Q2=O.forwardRef(function({onClick:e,discover:i="render",prefetch:n="none",relative:r,reloadDocument:a,replace:o,unstable_mask:c,state:h,target:d,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...w},k){let{basename:C,navigator:M,unstable_useTransitions:E}=O.useContext(Ei),D=typeof p=="string"&&I2.test(p),G=D2(p,C);p=G.to;let L=ME(p,{relative:r}),I=tr(),q=null;if(c){let ue=Uh(c,[],I.unstable_mask?I.unstable_mask.pathname:"/",!0);C!=="/"&&(ue.pathname=ue.pathname==="/"?C:vn([C,ue.pathname])),q=M.createHref(ue)}let[$,ee,fe]=cN(n,w),ce=vN(p,{replace:o,unstable_mask:c,state:h,target:d,preventScrollReset:g,relative:r,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:E});function P(ue){e&&e(ue),ue.defaultPrevented||ce(ue)}let ie=!(G.isExternal||a),de=O.createElement("a",{...w,...fe,href:(ie?q:void 0)||G.absoluteURL||L,onClick:ie?P:e,ref:pN(k,ee),target:d,"data-discover":!D&&i==="render"?"true":void 0});return $&&!D?O.createElement(O.Fragment,null,de,O.createElement(hN,{page:L})):de});Q2.displayName="Link";var yN=O.forwardRef(function({"aria-current":e="page",caseSensitive:i=!1,className:n="",end:r=!1,style:a,to:o,viewTransition:c,children:h,...d},p){let g=Uo(o,{relative:d.relative}),x=tr(),v=O.useContext(qh),{navigator:w,basename:k}=O.useContext(Ei),C=v!=null&&AN(g)&&c===!0,M=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,E=x.pathname,D=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;i||(E=E.toLowerCase(),D=D?D.toLowerCase():null,M=M.toLowerCase()),D&&k&&(D=Kn(D,k)||D);const G=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let L=E===M||!r&&E.startsWith(M)&&E.charAt(G)==="/",I=D!=null&&(D===M||!r&&D.startsWith(M)&&D.charAt(M.length)==="/"),q={isActive:L,isPending:I,isTransitioning:C},$=L?e:void 0,ee;typeof n=="function"?ee=n(q):ee=[n,L?"active":null,I?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let fe=typeof a=="function"?a(q):a;return O.createElement(Q2,{...d,"aria-current":$,className:ee,ref:p,style:fe,to:o,viewTransition:c},typeof h=="function"?h(q):h)});yN.displayName="NavLink";var xN=O.forwardRef(({discover:t="render",fetcherKey:e,navigate:i,reloadDocument:n,replace:r,state:a,method:o=Fc,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},w)=>{let{unstable_useTransitions:k}=O.useContext(Ei),C=kN(),M=CN(c,{relative:d}),E=o.toLowerCase()==="get"?"get":"post",D=typeof c=="string"&&I2.test(c),G=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let I=L.nativeEvent.submitter,q=I?.getAttribute("formmethod")||o,$=()=>C(I||L.currentTarget,{fetcherKey:e,method:q,navigate:i,replace:r,state:a,relative:d,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&i!==!1?O.startTransition(()=>$()):$()};return O.createElement("form",{ref:w,method:E,action:M,onSubmit:n?h:G,...v,"data-discover":!D&&t==="render"?"true":void 0})});xN.displayName="Form";function bN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function G2(t){let e=O.useContext(Il);return st(e,bN(t)),e}function vN(t,{target:e,replace:i,unstable_mask:n,state:r,preventScrollReset:a,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let p=H2(),g=tr(),x=Uo(t,{relative:o});return O.useCallback(v=>{if(JE(v,e)){v.preventDefault();let w=i!==void 0?i:mo(g)===mo(x),k=()=>p(t,{replace:w,unstable_mask:n,state:r,preventScrollReset:a,relative:o,viewTransition:c,unstable_defaultShouldRevalidate:h});d?O.startTransition(()=>k()):k()}},[g,p,x,i,n,r,e,t,a,o,c,h,d])}var SN=0,wN=()=>`__${String(++SN)}__`;function kN(){let{router:t}=G2("useSubmit"),{basename:e}=O.useContext(Ei),i=UE(),n=t.fetch,r=t.navigate;return O.useCallback(async(a,o={})=>{let{action:c,method:h,encType:d,formData:p,body:g}=eN(a,e);if(o.navigate===!1){let x=o.fetcherKey||wN();await n(x,i,o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:g,formMethod:o.method||h,formEncType:o.encType||d,flushSync:o.flushSync})}else await r(o.action||c,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:g,formMethod:o.method||h,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:i,flushSync:o.flushSync,viewTransition:o.viewTransition})},[n,r,e,i])}function CN(t,{relative:e}={}){let{basename:i}=O.useContext(Ei),n=O.useContext(nn);st(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),a={...Uo(t||".",{relative:e})},o=tr();if(t==null){a.search=o.search;let c=new URLSearchParams(a.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(g=>g).forEach(g=>c.append("index",g));let p=c.toString();a.search=p?`?${p}`:""}}return(!t||t===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(a.pathname=a.pathname==="/"?i:vn([i,a.pathname])),mo(a)}function AN(t,{relative:e}={}){let i=O.useContext(L2);st(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=G2("useViewTransitionState"),r=Uo(t,{relative:e});if(!i.isTransitioning)return!1;let a=Kn(i.currentLocation.pathname,n)||i.currentLocation.pathname,o=Kn(i.nextLocation.pathname,n)||i.nextLocation.pathname;return eh(r.pathname,o)!=null||eh(r.pathname,a)!=null}var Gl=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(){}},MN={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},TN=class{#e=MN;#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)}},gs=new TN;function ON(t){setTimeout(t,0)}var ks=typeof window>"u"||"Deno"in globalThis;function Xt(){}function EN(t,e){return typeof t=="function"?t(e):t}function vm(t){return typeof t=="number"&&t>=0&&t!==1/0}function Y2(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Lr(t,e){return typeof t=="function"?t(e):t}function qi(t,e){return typeof t=="function"?t(e):t}function $1(t,e){const{type:i="all",exact:n,fetchStatus:r,predicate:a,queryKey:o,stale:c}=t;if(o){if(n){if(e.queryHash!==Hg(o,e.options))return!1}else if(!go(e.queryKey,o))return!1}if(i!=="all"){const h=e.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||r&&r!==e.state.fetchStatus||a&&!a(e))}function ev(t,e){const{exact:i,status:n,predicate:r,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(i){if(Cs(e.options.mutationKey)!==Cs(a))return!1}else if(!go(e.options.mutationKey,a))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Hg(t,e){return(e?.queryKeyHashFn||Cs)(t)}function Cs(t){return JSON.stringify(t,(e,i)=>Sm(i)?Object.keys(i).sort().reduce((n,r)=>(n[r]=i[r],n),{}):i)}function go(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(i=>go(t[i],e[i])):!1}var NN=Object.prototype.hasOwnProperty;function K2(t,e,i=0){if(t===e)return t;if(i>500)return e;const n=tv(t)&&tv(e);if(!n&&!(Sm(t)&&Sm(e)))return e;const a=(n?t:Object.keys(t)).length,o=n?e:Object.keys(e),c=o.length,h=n?new Array(c):{};let d=0;for(let p=0;p<c;p++){const g=n?p:o[p],x=t[g],v=e[g];if(x===v){h[g]=x,(n?p<a:NN.call(t,g))&&d++;continue}if(x===null||v===null||typeof x!="object"||typeof v!="object"){h[g]=v;continue}const w=K2(x,v,i+1);h[g]=w,w===x&&d++}return a===c&&d===a?t:h}function th(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 tv(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Sm(t){if(!iv(t))return!1;const e=t.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!iv(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function iv(t){return Object.prototype.toString.call(t)==="[object Object]"}function RN(t){return new Promise(e=>{gs.setTimeout(e,t)})}function wm(t,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(t,e):i.structuralSharing!==!1?K2(t,e):e}function DN(t,e,i=0){const n=[...t,e];return i&&n.length>i?n.slice(1):n}function jN(t,e,i=0){const n=[e,...t];return i&&n.length>i?n.slice(0,-1):n}var Ug=Symbol();function W2(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Ug?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function qg(t,e){return typeof t=="function"?t(...e):!!t}function LN(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 BN=class extends Gl{#e;#t;#i;constructor(){super(),this.#i=t=>{if(!ks&&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"}},Pg=new BN;function km(){let t,e;const i=new Promise((r,a)=>{t=r,e=a});i.status="pending",i.catch(()=>{});function n(r){Object.assign(i,r),delete i.resolve,delete i.reject}return i.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},i.reject=r=>{n({status:"rejected",reason:r}),e(r)},i}var zN=ON;function _N(){let t=[],e=0,i=c=>{c()},n=c=>{c()},r=zN;const a=c=>{e?t.push(c):r(()=>{i(c)})},o=()=>{const c=t;t=[],c.length&&r(()=>{n(()=>{c.forEach(h=>{i(h)})})})};return{batch:c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},batchCalls:c=>(...h)=>{a(()=>{c(...h)})},schedule:a,setNotifyFunction:c=>{i=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{r=c}}}var Mt=_N(),HN=class extends Gl{#e=!0;#t;#i;constructor(){super(),this.#i=t=>{if(!ks&&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}},ih=new HN;function UN(t){return Math.min(1e3*2**t,3e4)}function X2(t){return(t??"online")==="online"?ih.isOnline():!0}var Cm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function J2(t){let e=!1,i=0,n;const r=km(),a=()=>r.status!=="pending",o=k=>{if(!a()){const C=new Cm(k);x(C),t.onCancel?.(C)}},c=()=>{e=!0},h=()=>{e=!1},d=()=>Pg.isFocused()&&(t.networkMode==="always"||ih.isOnline())&&t.canRun(),p=()=>X2(t.networkMode)&&t.canRun(),g=k=>{a()||(n?.(),r.resolve(k))},x=k=>{a()||(n?.(),r.reject(k))},v=()=>new Promise(k=>{n=C=>{(a()||d())&&k(C)},t.onPause?.()}).then(()=>{n=void 0,a()||t.onContinue?.()}),w=()=>{if(a())return;let k;const C=i===0?t.initialPromise:void 0;try{k=C??t.fn()}catch(M){k=Promise.reject(M)}Promise.resolve(k).then(g).catch(M=>{if(a())return;const E=t.retry??(ks?0:3),D=t.retryDelay??UN,G=typeof D=="function"?D(i,M):D,L=E===!0||typeof E=="number"&&i<E||typeof E=="function"&&E(i,M);if(e||!L){x(M);return}i++,t.onFail?.(i,M),RN(G).then(()=>d()?void 0:v()).then(()=>{e?x(M):w()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(n?.(),r),cancelRetry:c,continueRetry:h,canStart:p,start:()=>(p()?w():v().then(w),r)}}var Z2=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vm(this.gcTime)&&(this.#e=gs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ks?1/0:300*1e3))}clearGcTimeout(){this.#e&&(gs.clearTimeout(this.#e),this.#e=void 0)}},qN=class extends Z2{#e;#t;#i;#r;#n;#l;#a;constructor(t){super(),this.#a=!1,this.#l=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#i=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=rv(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=rv(this.options);e.data!==void 0&&(this.setState(nv(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(t,e){const i=wm(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(Xt).catch(Xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>qi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ug||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Lr(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:!Y2(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(h=>h.options.queryFn);c&&this.setOptions(c.options)}const i=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#a=!0,i.signal)})},r=()=>{const c=W2(this.options,e),d=(()=>{const p={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(p),p})();return this.#a=!1,this.options.persister?this.options.persister(c,d,this):c(d)},o=(()=>{const c={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return n(c),c})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#s({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=J2({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof Cm&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),i.abort()},onFail:(c,h)=>{this.#s({type:"failed",failureCount:c,error:h})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const c=await this.#n.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#i.config.onSuccess?.(c,this),this.#i.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof Cm){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,...$2(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...nv(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),Mt.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:t})})}};function $2(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X2(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function nv(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function rv(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 PN=class extends Gl{constructor(t,e){super(),this.options=e,this.#e=t,this.#s=null,this.#a=km(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#r=void 0;#n;#l;#a;#s;#m;#f;#d;#u;#c;#o;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),sv(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Am(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Am(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 qi(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&&!th(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const n=this.hasListeners();n&&lv(this.#t,i,this.options,e)&&this.#h(),this.updateResult(),n&&(this.#t!==i||qi(this.options.enabled,this.#t)!==qi(e.enabled,this.#t)||Lr(this.options.staleTime,this.#t)!==Lr(e.staleTime,this.#t))&&this.#g();const r=this.#y();n&&(this.#t!==i||qi(this.options.enabled,this.#t)!==qi(e.enabled,this.#t)||r!==this.#o)&&this.#x(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),i=this.createResult(e,t);return VN(this,i)&&(this.#r=i,this.#l=this.options,this.#n=this.#t.state),i}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),e?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),i=this.#e.getQueryCache().build(this.#e,e);return i.fetch().then(()=>this.createResult(i,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#w();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Xt)),e}#g(){this.#v();const t=Lr(this.options.staleTime,this.#t);if(ks||this.#r.isStale||!vm(t))return;const i=Y2(this.#r.dataUpdatedAt,t)+1;this.#u=gs.setTimeout(()=>{this.#r.isStale||this.updateResult()},i)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#x(t){this.#S(),this.#o=t,!(ks||qi(this.options.enabled,this.#t)===!1||!vm(this.#o)||this.#o===0)&&(this.#c=gs.setInterval(()=>{(this.options.refetchIntervalInBackground||Pg.isFocused())&&this.#h()},this.#o))}#b(){this.#g(),this.#x(this.#y())}#v(){this.#u&&(gs.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#c&&(gs.clearInterval(this.#c),this.#c=void 0)}createResult(t,e){const i=this.#t,n=this.options,r=this.#r,a=this.#n,o=this.#l,h=t!==i?t.state:this.#i,{state:d}=t;let p={...d},g=!1,x;if(e._optimisticResults){const $=this.hasListeners(),ee=!$&&sv(t,e),fe=$&&lv(t,i,e,n);(ee||fe)&&(p={...p,...$2(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:w,status:k}=p;x=p.data;let C=!1;if(e.placeholderData!==void 0&&x===void 0&&k==="pending"){let $;r?.isPlaceholderData&&e.placeholderData===o?.placeholderData?($=r.data,C=!0):$=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,$!==void 0&&(k="success",x=wm(r?.data,$,e),g=!0)}if(e.select&&x!==void 0&&!C)if(r&&x===a?.data&&e.select===this.#m)x=this.#f;else try{this.#m=e.select,x=e.select(x),x=wm(r?.data,x,e),this.#f=x,this.#s=null}catch($){this.#s=$}this.#s&&(v=this.#s,x=this.#f,w=Date.now(),k="error");const M=p.fetchStatus==="fetching",E=k==="pending",D=k==="error",G=E&&M,L=x!==void 0,q={status:k,fetchStatus:p.fetchStatus,isPending:E,isSuccess:k==="success",isError:D,isInitialLoading:G,isLoading:G,data:x,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:M,isRefetching:M&&!E,isLoadingError:D&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:D&&L,isStale:Fg(t,e),refetch:this.refetch,promise:this.#a,isEnabled:qi(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=q.data!==void 0,ee=q.status==="error"&&!$,fe=ie=>{ee?ie.reject(q.error):$&&ie.resolve(q.data)},ce=()=>{const ie=this.#a=q.promise=km();fe(ie)},P=this.#a;switch(P.status){case"pending":t.queryHash===i.queryHash&&fe(P);break;case"fulfilled":(ee||q.data!==P.value)&&ce();break;case"rejected":(!ee||q.error!==P.reason)&&ce();break}}return q}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),th(e,t))return;this.#r=e;const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!this.#p.size)return!0;const a=new Set(r??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#r).some(o=>{const c=o;return this.#r[c]!==t[c]&&a.has(c)})};this.#k({listeners:i()})}#w(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#i=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){Mt.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function FN(t,e){return qi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function sv(t,e){return FN(t,e)||t.state.data!==void 0&&Am(t,e,e.refetchOnMount)}function Am(t,e,i){if(qi(e.enabled,t)!==!1&&Lr(e.staleTime,t)!=="static"){const n=typeof i=="function"?i(t):i;return n==="always"||n!==!1&&Fg(t,e)}return!1}function lv(t,e,i,n){return(t!==e||qi(n.enabled,t)===!1)&&(!i.suspense||t.state.status!=="error")&&Fg(t,i)}function Fg(t,e){return qi(e.enabled,t)!==!1&&t.isStaleByTime(Lr(e.staleTime,t))}function VN(t,e){return!th(t.getCurrentResult(),e)}function av(t){return{onFetch:(e,i)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let p=!1;const g=w=>{LN(w,()=>e.signal,()=>p=!0)},x=W2(e.options,e.fetchOptions),v=async(w,k,C)=>{if(p)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const E=(()=>{const I={client:e.client,queryKey:e.queryKey,pageParam:k,direction:C?"backward":"forward",meta:e.options.meta};return g(I),I})(),D=await x(E),{maxPages:G}=e.options,L=C?jN:DN;return{pages:L(w.pages,D,G),pageParams:L(w.pageParams,k,G)}};if(r&&a.length){const w=r==="backward",k=w?IN:ov,C={pages:a,pageParams:o},M=k(n,C);c=await v(C,M,w)}else{const w=t??a.length;do{const k=h===0?o[0]??n.initialPageParam:ov(n,c);if(h>0&&k==null)break;c=await v(c,k),h++}while(h<w)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i):e.fetchFn=d}}}function ov(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 IN(t,{pages:e,pageParams:i}){return e.length>0?t.getPreviousPageParam?.(e[0],e,i[0],i):void 0}var QN=class extends Z2{#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||ew(),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=J2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#n({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#i.canRun(this)});const n=this.state.status==="pending",r=!this.#r.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:r}),this.#i.config.onMutate&&await this.#i.config.onMutate(t,this,i);const o=await this.options.onMutate?.(t,i);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:r})}const a=await this.#r.start();return await this.#i.config.onSuccess?.(a,t,this.state.context,this,i),await this.options.onSuccess?.(a,t,this.state.context,i),await this.#i.config.onSettled?.(a,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(a,null,t,this.state.context,i),this.#n({type:"success",data:a}),a}catch(a){try{await this.#i.config.onError?.(a,t,this.state.context,this,i)}catch(o){Promise.reject(o)}try{await this.options.onError?.(a,t,this.state.context,i)}catch(o){Promise.reject(o)}try{await this.#i.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,i)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,a,t,this.state.context,i)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:a}),a}finally{this.#i.runNext(this)}}#n(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Mt.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(t)}),this.#i.notify({mutation:this,type:"updated",action:t})})}};function ew(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var GN=class extends Gl{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 QN({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=pc(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=pc(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=pc(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=pc(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Mt.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=>ev(e,i))}findAll(t={}){return this.getAll().filter(e=>ev(t,e))}notify(t){Mt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Mt.batch(()=>Promise.all(t.map(e=>e.continue().catch(Xt))))}};function pc(t){return t.options.scope?.id}var YN=class extends Gl{#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),th(this.options,i)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),i?.mutationKey&&this.options.mutationKey&&Cs(i.mutationKey)!==Cs(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??ew();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){Mt.batch(()=>{if(this.#r&&this.hasListeners()){const i=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,i,n,r)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(e.data,null,i,n,r)}catch(a){Promise.reject(a)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,i,n,r)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(void 0,e.error,i,n,r)}catch(a){Promise.reject(a)}}}this.listeners.forEach(i=>{i(this.#t)})})}},KN=class extends Gl{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,i){const n=e.queryKey,r=e.queryHash??Hg(n,e);let a=this.get(r);return a||(a=new qN({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(a)),a}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Mt.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=>$1(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>$1(t,i)):e}notify(t){Mt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Mt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Mt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},WN=class{#e;#t;#i;#r;#n;#l;#a;#s;constructor(t={}){this.#e=t.queryCache||new KN,this.#t=t.mutationCache||new GN,this.#i=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#l=0}mount(){this.#l++,this.#l===1&&(this.#a=Pg.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ih.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#l--,this.#l===0&&(this.#a?.(),this.#a=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),i=this.#e.build(this,e),n=i.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&i.isStaleByTime(Lr(e.staleTime,i))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),a=this.#e.get(n.queryHash)?.state.data,o=EN(e,a);if(o!==void 0)return this.#e.build(this,n).setData(o,{...i,manual:!0})}setQueriesData(t,e,i){return Mt.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;Mt.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=this.#e;return Mt.batch(()=>(i.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const i={revert:!0,...e},n=Mt.batch(()=>this.#e.findAll(t).map(r=>r.cancel(i)));return Promise.all(n).then(Xt).catch(Xt)}invalidateQueries(t,e={}){return Mt.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=Mt.batch(()=>this.#e.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let a=r.fetch(void 0,i);return i.throwOnError||(a=a.catch(Xt)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Xt)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=this.#e.build(this,e);return i.isStaleByTime(Lr(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Xt).catch(Xt)}fetchInfiniteQuery(t){return t.behavior=av(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Xt).catch(Xt)}ensureInfiniteQueryData(t){return t.behavior=av(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ih.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(Cs(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],i={};return e.forEach(n=>{go(t,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(t,e){this.#n.set(Cs(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],i={};return e.forEach(n=>{go(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=Hg(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===Ug&&(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()}},tw=O.createContext(void 0),lt=t=>{const e=O.useContext(tw);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},XN=({client:t,children:e})=>(O.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),b.jsx(tw.Provider,{value:t,children:e})),iw=O.createContext(!1),JN=()=>O.useContext(iw);iw.Provider;function ZN(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var $N=O.createContext(ZN()),e3=()=>O.useContext($N),t3=(t,e,i)=>{const n=i?.state.error&&typeof t.throwOnError=="function"?qg(t.throwOnError,[i.state.error,i]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},i3=t=>{O.useEffect(()=>{t.clearReset()},[t])},n3=({result:t,errorResetBoundary:e,throwOnError:i,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||qg(i,[t.error,n])),r3=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))}},s3=(t,e)=>t.isLoading&&t.isFetching&&!e,l3=(t,e)=>t?.suspense&&e.isPending,uv=(t,e,i)=>e.fetchOptimistic(t).catch(()=>{i.clearReset()});function a3(t,e,i){const n=JN(),r=e3(),a=lt(),o=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const c=a.getQueryCache().get(o.queryHash);o._optimisticResults=n?"isRestoring":"optimistic",r3(o),t3(o,r,c),i3(r);const h=!a.getQueryCache().get(o.queryHash),[d]=O.useState(()=>new e(a,o)),p=d.getOptimisticResult(o),g=!n&&t.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(x=>{const v=g?d.subscribe(Mt.batchCalls(x)):Xt;return d.updateResult(),v},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),O.useEffect(()=>{d.setOptions(o)},[o,d]),l3(o,p))throw uv(o,d,r);if(n3({result:p,errorResetBoundary:r,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw p.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,p),o.experimental_prefetchInRender&&!ks&&s3(p,n)&&(h?uv(o,d,r):c?.promise)?.catch(Xt).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?p:d.trackResult(p)}function Wn(t,e){return a3(t,PN)}function yt(t,e){const i=lt(),[n]=O.useState(()=>new YN(i,t));O.useEffect(()=>{n.setOptions(t)},[n,t]);const r=O.useSyncExternalStore(O.useCallback(o=>n.subscribe(Mt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=O.useCallback((o,c)=>{n.mutate(o,c).catch(Xt)},[n]);if(r.error&&qg(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const o3="/api";async function ze(t,e){const i=await fetch(`${o3}${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 _e={health:()=>ze("/health"),projects:{list:()=>ze("/projects"),create:t=>ze("/projects",{method:"POST",body:JSON.stringify({name:t})}),getActive:()=>ze("/projects/active"),switchActive:t=>ze("/projects/active",{method:"PUT",body:JSON.stringify({projectId:t})}),rename:(t,e)=>ze(`/projects/${t}`,{method:"PUT",body:JSON.stringify({name:e})}),delete:t=>ze(`/projects/${t}`,{method:"DELETE"})},specs:{list:()=>ze("/specs"),upload:(t,e,i)=>ze("/specs",{method:"POST",body:JSON.stringify({spec:t,name:e,upstreamUrl:i})}),uploadFromUrl:(t,e)=>ze("/specs/url",{method:"POST",body:JSON.stringify({url:t,name:e})}),update:(t,e)=>ze(`/specs/${t}`,{method:"PUT",body:JSON.stringify(e)}),toggle:t=>ze(`/specs/${t}/toggle`,{method:"PUT"}),delete:t=>ze(`/specs/${t}`,{method:"DELETE"}),reimport:(t,e)=>ze(`/specs/${t}/reimport`,{method:"POST",body:e?JSON.stringify({spec:e}):"{}"})},endpoints:{list:()=>ze("/endpoints"),update:(t,e)=>ze(`/endpoints/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(e)}),bulkUpdate:t=>ze("/endpoints/bulk",{method:"PUT",body:JSON.stringify(t)})},config:{get:()=>ze("/config"),update:t=>ze("/config",{method:"PUT",body:JSON.stringify(t)}),export:()=>ze("/config/export"),import:t=>ze("/config/import",{method:"POST",body:JSON.stringify(t)})},logs:{get:(t=100)=>ze(`/logs?limit=${t}`),clear:()=>ze("/logs",{method:"DELETE"})},proxy:{status:()=>ze("/proxy/status"),start:()=>ze("/proxy/start",{method:"POST"}),stop:()=>ze("/proxy/stop",{method:"POST"})},savedResponses:{list:()=>ze("/saved-responses"),create:t=>ze("/saved-responses",{method:"POST",body:JSON.stringify(t)}),update:(t,e)=>ze(`/saved-responses/${t}`,{method:"PUT",body:JSON.stringify(e)}),delete:t=>ze(`/saved-responses/${t}`,{method:"DELETE"})},presets:{list:()=>ze("/presets"),create:t=>ze("/presets",{method:"POST",body:JSON.stringify(t)}),delete:t=>ze(`/presets/${encodeURIComponent(t)}`,{method:"DELETE"}),apply:t=>ze(`/presets/${encodeURIComponent(t)}/apply`,{method:"POST"})}};function u3(){return Wn({queryKey:["proxyStatus"],queryFn:_e.proxy.status,refetchInterval:5e3})}function c3(){const t=lt();return yt({mutationFn:_e.proxy.start,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}function h3(){const t=lt();return yt({mutationFn:_e.proxy.stop,onSuccess:()=>{t.invalidateQueries({queryKey:["proxyStatus"]})}})}const f3=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nw=(...t)=>t.filter((e,i,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===i).join(" ").trim();var d3={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 p3=O.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...c},h)=>O.createElement("svg",{ref:h,...d3,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:nw("lucide",r),...c},[...o.map(([d,p])=>O.createElement(d,p)),...Array.isArray(a)?a:[a]]));const we=(t,e)=>{const i=O.forwardRef(({className:n,...r},a)=>O.createElement(p3,{ref:a,iconNode:e,className:nw(`lucide-${f3(t)}`,n),...r}));return i.displayName=`${t}`,i};const Mm=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 Tm=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const rw=we("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const nh=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 Br=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const qo=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const sw=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const m3=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 Dl=we("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const g3=we("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const y3=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 x3=we("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);const b3=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 Om=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 v3=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 S3=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 w3=we("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const k3=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 lw=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 rh=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 aw=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 jl=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 C3=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 A3=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 sh=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const M3=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Ll=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const T3=we("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);const O3=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 E3=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 N3=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 R3=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const D3=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 ow=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 j3=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 uw=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 L3=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 Bl=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 cw=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 hw=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 B3=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 z3=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 Xn=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Vg=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 fw(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=fw(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function _3(){for(var t,e,i=0,n="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=fw(t))&&(n&&(n+=" "),n+=e);return n}const Ig="-",H3=t=>{const e=q3(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const c=o.split(Ig);return c[0]===""&&c.length!==1&&c.shift(),dw(c,e)||U3(o)},getConflictingClassGroupIds:(o,c)=>{const h=i[o]||[];return c&&n[o]?[...h,...n[o]]:h}}},dw=(t,e)=>{if(t.length===0)return e.classGroupId;const i=t[0],n=e.nextPart.get(i),r=n?dw(t.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const a=t.join(Ig);return e.validators.find(({validator:o})=>o(a))?.classGroupId},cv=/^\[(.+)\]$/,U3=t=>{if(cv.test(t)){const e=cv.exec(t)[1],i=e?.substring(0,e.indexOf(":"));if(i)return"arbitrary.."+i}},q3=t=>{const{theme:e,prefix:i}=t,n={nextPart:new Map,validators:[]};return F3(Object.entries(t.classGroups),i).forEach(([a,o])=>{Em(o,n,a,e)}),n},Em=(t,e,i,n)=>{t.forEach(r=>{if(typeof r=="string"){const a=r===""?e:hv(e,r);a.classGroupId=i;return}if(typeof r=="function"){if(P3(r)){Em(r(n),e,i,n);return}e.validators.push({validator:r,classGroupId:i});return}Object.entries(r).forEach(([a,o])=>{Em(o,hv(e,a),i,n)})})},hv=(t,e)=>{let i=t;return e.split(Ig).forEach(n=>{i.nextPart.has(n)||i.nextPart.set(n,{nextPart:new Map,validators:[]}),i=i.nextPart.get(n)}),i},P3=t=>t.isThemeGetter,F3=(t,e)=>e?t.map(([i,n])=>{const r=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,c])=>[e+o,c])):a);return[i,r]}):t,V3=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=new Map,n=new Map;const r=(a,o)=>{i.set(a,o),e++,e>t&&(e=0,n=i,i=new Map)};return{get(a){let o=i.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return r(a,o),o},set(a,o){i.has(a)?i.set(a,o):r(a,o)}}},pw="!",I3=t=>{const{separator:e,experimentalParseClassName:i}=t,n=e.length===1,r=e[0],a=e.length,o=c=>{const h=[];let d=0,p=0,g;for(let C=0;C<c.length;C++){let M=c[C];if(d===0){if(M===r&&(n||c.slice(C,C+a)===e)){h.push(c.slice(p,C)),p=C+a;continue}if(M==="/"){g=C;continue}}M==="["?d++:M==="]"&&d--}const x=h.length===0?c:c.substring(p),v=x.startsWith(pw),w=v?x.substring(1):x,k=g&&g>p?g-p:void 0;return{modifiers:h,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:k}};return i?c=>i({className:c,parseClassName:o}):o},Q3=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},G3=t=>({cache:V3(t.cacheSize),parseClassName:I3(t),...H3(t)}),Y3=/\s+/,K3=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:r}=e,a=[],o=t.trim().split(Y3);let c="";for(let h=o.length-1;h>=0;h-=1){const d=o[h],{modifiers:p,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:v}=i(d);let w=!!v,k=n(w?x.substring(0,v):x);if(!k){if(!w){c=d+(c.length>0?" "+c:c);continue}if(k=n(x),!k){c=d+(c.length>0?" "+c:c);continue}w=!1}const C=Q3(p).join(":"),M=g?C+pw:C,E=M+k;if(a.includes(E))continue;a.push(E);const D=r(k,w);for(let G=0;G<D.length;++G){const L=D[G];a.push(M+L)}c=d+(c.length>0?" "+c:c)}return c};function W3(){let t=0,e,i,n="";for(;t<arguments.length;)(e=arguments[t++])&&(i=mw(e))&&(n&&(n+=" "),n+=i);return n}const mw=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=mw(t[n]))&&(i&&(i+=" "),i+=e);return i};function X3(t,...e){let i,n,r,a=o;function o(h){const d=e.reduce((p,g)=>g(p),t());return i=G3(d),n=i.cache.get,r=i.cache.set,a=c,c(h)}function c(h){const d=n(h);if(d)return d;const p=K3(h,i);return r(h,p),p}return function(){return a(W3.apply(null,arguments))}}const it=t=>{const e=i=>i[t]||[];return e.isThemeGetter=!0,e},gw=/^\[(?:([a-z-]+):)?(.+)\]$/i,J3=/^\d+\/\d+$/,Z3=new Set(["px","full","screen"]),$3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eR=/\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$/,tR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,iR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,In=t=>Cl(t)||Z3.has(t)||J3.test(t),Tr=t=>Yl(t,"length",hR),Cl=t=>!!t&&!Number.isNaN(Number(t)),Bp=t=>Yl(t,"number",Cl),Ya=t=>!!t&&Number.isInteger(Number(t)),rR=t=>t.endsWith("%")&&Cl(t.slice(0,-1)),Te=t=>gw.test(t),Or=t=>$3.test(t),sR=new Set(["length","size","percentage"]),lR=t=>Yl(t,sR,yw),aR=t=>Yl(t,"position",yw),oR=new Set(["image","url"]),uR=t=>Yl(t,oR,dR),cR=t=>Yl(t,"",fR),Ka=()=>!0,Yl=(t,e,i)=>{const n=gw.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):i(n[2]):!1},hR=t=>eR.test(t)&&!tR.test(t),yw=()=>!1,fR=t=>iR.test(t),dR=t=>nR.test(t),pR=()=>{const t=it("colors"),e=it("spacing"),i=it("blur"),n=it("brightness"),r=it("borderColor"),a=it("borderRadius"),o=it("borderSpacing"),c=it("borderWidth"),h=it("contrast"),d=it("grayscale"),p=it("hueRotate"),g=it("invert"),x=it("gap"),v=it("gradientColorStops"),w=it("gradientColorStopPositions"),k=it("inset"),C=it("margin"),M=it("opacity"),E=it("padding"),D=it("saturate"),G=it("scale"),L=it("sepia"),I=it("skew"),q=it("space"),$=it("translate"),ee=()=>["auto","contain","none"],fe=()=>["auto","hidden","clip","visible","scroll"],ce=()=>["auto",Te,e],P=()=>[Te,e],ie=()=>["",In,Tr],de=()=>["auto",Cl,Te],ue=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",Te],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>[Cl,Te];return{cacheSize:500,separator:":",theme:{colors:[Ka],spacing:[In,Tr],blur:["none","",Or,Te],brightness:T(),borderColor:[t],borderRadius:["none","","full",Or,Te],borderSpacing:P(),borderWidth:ie(),contrast:T(),grayscale:H(),hueRotate:T(),invert:H(),gap:P(),gradientColorStops:[t],gradientColorStopPositions:[rR,Tr],inset:ce(),margin:ce(),opacity:T(),padding:P(),saturate:T(),scale:T(),sepia:H(),skew:T(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Or]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"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:[...ue(),Te]}],overflow:[{overflow:fe()}],"overflow-x":[{"overflow-x":fe()}],"overflow-y":[{"overflow-y":fe()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],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",Ya,Te]}],basis:[{basis:ce()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",Ya,Te]}],"grid-cols":[{"grid-cols":[Ka]}],"col-start-end":[{col:["auto",{span:["full",Ya,Te]},Te]}],"col-start":[{"col-start":de()}],"col-end":[{"col-end":de()}],"grid-rows":[{"grid-rows":[Ka]}],"row-start-end":[{row:["auto",{span:[Ya,Te]},Te]}],"row-start":[{"row-start":de()}],"row-end":[{"row-end":de()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...se()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...se(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...se(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],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":[q]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[q]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,e]}],"min-w":[{"min-w":[Te,e,"min","max","fit"]}],"max-w":[{"max-w":[Te,e,"none","full","min","max","fit","prose",{screen:[Or]},Or]}],h:[{h:[Te,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Or,Tr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bp]}],"font-family":[{font:[Ka]}],"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",Te]}],"line-clamp":[{"line-clamp":["none",Cl,Bp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",In,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"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:[..._(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",In,Tr]}],"underline-offset":[{"underline-offset":["auto",In,Te]}],"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:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],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",Te]}],"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:[...ue(),aR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",lR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},uR]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[..._(),"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:_()}],"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:["",..._()]}],"outline-offset":[{"outline-offset":[In,Te]}],"outline-w":[{outline:[In,Tr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[In,Tr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Or,cR]}],"shadow-color":[{shadow:[Ka]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...J(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[n]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Or,Te]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[g]}],saturate:[{saturate:[D]}],sepia:[{sepia:[L]}],"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":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[G]}],"scale-x":[{"scale-x":[G]}],"scale-y":[{"scale-y":[G]}],rotate:[{rotate:[Ya,Te]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],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",Te]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",Te]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[In,Tr,Bp]}],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"]}}},mR=X3(pR);function ve(...t){return mR(_3(t))}function gR(){return Wn({queryKey:["projects"],queryFn:_e.projects.list})}function yR(){return Wn({queryKey:["activeProject"],queryFn:_e.projects.getActive,retry:!1})}function xR(){const t=lt();return yt({mutationFn:e=>_e.projects.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function bR(){const t=lt();return yt({mutationFn:e=>_e.projects.switchActive(e),onSuccess:()=>{t.invalidateQueries()}})}function vR(){const t=lt();return yt({mutationFn:({id:e,name:i})=>_e.projects.rename(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]}),t.invalidateQueries({queryKey:["activeProject"]})}})}function SR(){const t=lt();return yt({mutationFn:e=>_e.projects.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function wR(){const{data:t}=gR(),{data:e}=yR(),i=xR(),n=bR(),r=SR(),a=vR(),[o,c]=O.useState(!1),[h,d]=O.useState(!1),[p,g]=O.useState(""),[x,v]=O.useState(null),[w,k]=O.useState(""),C=O.useRef(null),M=(L,I)=>{v(L),k(I),d(!1)},E=L=>{w.trim()&&a.mutate({id:L,name:w.trim()},{onSuccess:()=>v(null)})},D=(L,I)=>{confirm(`Delete project "${I}"?`)&&r.mutate(L)};O.useEffect(()=>{function L(I){C.current&&!C.current.contains(I.target)&&(c(!1),d(!1),v(null))}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);const G=()=>{p.trim()&&i.mutate(p.trim(),{onSuccess:()=>{g(""),d(!1)}})};return b.jsxs("div",{className:"relative",ref:C,children:[b.jsxs("button",{onClick:()=>c(!o),className:ve("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",o?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[b.jsx(C3,{className:"w-3.5 h-3.5 text-primary opacity-70"}),b.jsx("span",{className:"font-bold truncate max-w-[120px]",children:e?.name??"Select Project"}),b.jsx(qo,{className:ve("w-3 h-3 text-muted-foreground transition-transform",o&&"rotate-180")})]}),o&&b.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[260px] animate-in fade-in zoom-in-95 duration-200",children:[b.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Switch Project"})}),b.jsx("div",{className:"max-h-[420px] overflow-y-auto px-1.5",children:t?.map(L=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:ve("group flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-all",L.id===e?.id?"bg-primary/10 text-primary font-bold shadow-sm":"text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"),children:[b.jsxs("button",{className:"flex-1 text-left truncate flex items-center gap-2",onClick:()=>{L.id!==e?.id&&(n.mutate(L.id),c(!1))},children:[b.jsx(k3,{className:"w-3.5 h-3.5 opacity-40 shrink-0"}),L.name]}),b.jsx("button",{onClick:I=>{I.stopPropagation(),x===L.id?v(null):M(L.id,L.name)},className:ve("p-1 rounded-md transition-all opacity-0 group-hover:opacity-100",x===L.id?"opacity-100 text-primary bg-primary/10":"text-muted-foreground hover:text-primary hover:bg-primary/10"),title:"Edit project",children:b.jsx(ow,{className:"w-3 h-3"})})]}),x===L.id&&b.jsxs("div",{className:"mx-2 p-3 rounded-xl bg-muted/40 border border-border/40 space-y-3 animate-in slide-in-from-top-2 duration-200 shadow-inner",children:[b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Name"}),b.jsxs("div",{className:"flex gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",value:w,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&E(L.id),I.key==="Escape"&&v(null)},className:"flex-1 px-2.5 py-1.5 text-xs font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>E(L.id),disabled:!w.trim(),className:"p-1.5 bg-primary/10 text-primary rounded-lg hover:bg-primary hover:text-primary-foreground transition-all disabled:opacity-40","aria-label":"Confirm rename",children:b.jsx(Br,{className:"w-3.5 h-3.5"})})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Project ID"}),b.jsx("p",{className:"px-1 text-[10px] font-mono text-muted-foreground/60 truncate",children:L.id})]}),b.jsxs("div",{className:"flex items-center justify-between pt-1",children:[b.jsxs("button",{onClick:()=>{v(null),D(L.id,L.name)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[9px] font-black uppercase tracking-widest text-destructive hover:bg-destructive/10 rounded-lg transition-all border border-transparent hover:border-destructive/20",children:[b.jsx(Bl,{className:"w-3 h-3"}),"Delete"]}),b.jsx("button",{onClick:()=>v(null),className:"px-3 py-1.5 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]})]},L.id))}),b.jsx("div",{className:"border-t border-border mt-1.5 pt-1.5 px-1.5",children:h?b.jsxs("div",{className:"px-1 py-1 flex gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:p,onChange:L=>g(L.target.value),onKeyDown:L=>{L.key==="Enter"&&G(),L.key==="Escape"&&d(!1)},className:"flex-1 px-2.5 py-1.5 text-xs rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:G,disabled:!p.trim(),className:"px-3 py-1.5 text-xs font-bold rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 shadow-sm",children:"Add"})]}):b.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-primary hover:bg-primary/5 rounded-lg transition-all font-bold",children:[b.jsx(Ll,{className:"w-3.5 h-3.5"}),"New Project"]})})]})]})}function xw(t){return typeof t>"u"||t===null}function kR(t){return typeof t=="object"&&t!==null}function CR(t){return Array.isArray(t)?t:xw(t)?[]:[t]}function AR(t,e){var i,n,r,a;if(e)for(a=Object.keys(e),i=0,n=a.length;i<n;i+=1)r=a[i],t[r]=e[r];return t}function MR(t,e){var i="",n;for(n=0;n<e;n+=1)i+=t;return i}function TR(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}var OR=xw,ER=kR,NR=CR,RR=MR,DR=TR,jR=AR,Tt={isNothing:OR,isObject:ER,toArray:NR,repeat:RR,isNegativeZero:DR,extend:jR};function bw(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 yo(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=bw(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}yo.prototype=Object.create(Error.prototype);yo.prototype.constructor=yo;yo.prototype.toString=function(e){return this.name+": "+bw(this,e)};var Zt=yo;function zp(t,e,i,n,r){var a="",o="",c=Math.floor(r/2)-1;return n-e>c&&(a=" ... ",e=n-c+a.length),i-n>c&&(o=" ...",i=n+c-o.length),{str:a+t.slice(e,i).replace(/\t/g,"→")+o,pos:n-e+a.length}}function _p(t,e){return Tt.repeat(" ",e-t.length)+t}function LR(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var i=/\r?\n|\r|\0/g,n=[0],r=[],a,o=-1;a=i.exec(t.buffer);)r.push(a.index),n.push(a.index+a[0].length),t.position<=a.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var c="",h,d,p=Math.min(t.line+e.linesAfter,r.length).toString().length,g=e.maxLength-(e.indent+p+3);for(h=1;h<=e.linesBefore&&!(o-h<0);h++)d=zp(t.buffer,n[o-h],r[o-h],t.position-(n[o]-n[o-h]),g),c=Tt.repeat(" ",e.indent)+_p((t.line-h+1).toString(),p)+" | "+d.str+`
|
|
14
|
+
`+c;for(d=zp(t.buffer,n[o],r[o],t.position,g),c+=Tt.repeat(" ",e.indent)+_p((t.line+1).toString(),p)+" | "+d.str+`
|
|
15
|
+
`,c+=Tt.repeat("-",e.indent+p+3+d.pos)+`^
|
|
16
|
+
`,h=1;h<=e.linesAfter&&!(o+h>=r.length);h++)d=zp(t.buffer,n[o+h],r[o+h],t.position-(n[o]-n[o+h]),g),c+=Tt.repeat(" ",e.indent)+_p((t.line+h+1).toString(),p)+" | "+d.str+`
|
|
17
|
+
`;return c.replace(/\n$/,"")}var BR=LR,zR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],_R=["scalar","sequence","mapping"];function HR(t){var e={};return t!==null&&Object.keys(t).forEach(function(i){t[i].forEach(function(n){e[String(n)]=i})}),e}function UR(t,e){if(e=e||{},Object.keys(e).forEach(function(i){if(zR.indexOf(i)===-1)throw new Zt('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=HR(e.styleAliases||null),_R.indexOf(this.kind)===-1)throw new Zt('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}var qt=UR;function fv(t,e){var i=[];return t[e].forEach(function(n){var r=i.length;i.forEach(function(a,o){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(r=o)}),i[r]=n}),i}function qR(){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 Nm(t){return this.extend(t)}Nm.prototype.extend=function(e){var i=[],n=[];if(e instanceof qt)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 Zt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(a){if(!(a instanceof qt))throw new Zt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Zt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Zt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof qt))throw new Zt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Nm.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=fv(r,"implicit"),r.compiledExplicit=fv(r,"explicit"),r.compiledTypeMap=qR(r.compiledImplicit,r.compiledExplicit),r};var vw=Nm,Sw=new qt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),ww=new qt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),kw=new qt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),Cw=new vw({explicit:[Sw,ww,kw]});function PR(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function FR(){return null}function VR(t){return t===null}var Aw=new qt("tag:yaml.org,2002:null",{kind:"scalar",resolve:PR,construct:FR,predicate:VR,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function IR(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 QR(t){return t==="true"||t==="True"||t==="TRUE"}function GR(t){return Object.prototype.toString.call(t)==="[object Boolean]"}var Mw=new qt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:IR,construct:QR,predicate:GR,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 YR(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function KR(t){return 48<=t&&t<=55}function WR(t){return 48<=t&&t<=57}function XR(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(!YR(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}if(r==="o"){for(i++;i<e;i++)if(r=t[i],r!=="_"){if(!KR(t.charCodeAt(i)))return!1;n=!0}return n&&r!=="_"}}if(r==="_")return!1;for(;i<e;i++)if(r=t[i],r!=="_"){if(!WR(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 ZR(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Tt.isNegativeZero(t)}var Tw=new qt("tag:yaml.org,2002:int",{kind:"scalar",resolve:XR,construct:JR,predicate:ZR,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"]}}),$R=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function e5(t){return!(t===null||!$R.test(t)||t[t.length-1]==="_")}function t5(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 i5=/^[-+]?[0-9]+e/;function n5(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(Tt.isNegativeZero(t))return"-0.0";return i=t.toString(10),i5.test(i)?i.replace("e",".e"):i}function r5(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Tt.isNegativeZero(t))}var Ow=new qt("tag:yaml.org,2002:float",{kind:"scalar",resolve:e5,construct:t5,predicate:r5,represent:n5,defaultStyle:"lowercase"}),Ew=Cw.extend({implicit:[Aw,Mw,Tw,Ow]}),Nw=Ew,Rw=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Dw=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 s5(t){return t===null?!1:Rw.exec(t)!==null||Dw.exec(t)!==null}function l5(t){var e,i,n,r,a,o,c,h=0,d=null,p,g,x;if(e=Rw.exec(t),e===null&&(e=Dw.exec(t)),e===null)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,r=+e[3],!e[4])return new Date(Date.UTC(i,n,r));if(a=+e[4],o=+e[5],c=+e[6],e[7]){for(h=e[7].slice(0,3);h.length<3;)h+="0";h=+h}return e[9]&&(p=+e[10],g=+(e[11]||0),d=(p*60+g)*6e4,e[9]==="-"&&(d=-d)),x=new Date(Date.UTC(i,n,r,a,o,c,h)),d&&x.setTime(x.getTime()-d),x}function a5(t){return t.toISOString()}var jw=new qt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:s5,construct:l5,instanceOf:Date,represent:a5});function o5(t){return t==="<<"||t===null}var Lw=new qt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:o5}),Qg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
18
|
+
\r`;function u5(t){if(t===null)return!1;var e,i,n=0,r=t.length,a=Qg;for(i=0;i<r;i++)if(e=a.indexOf(t.charAt(i)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function c5(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,a=Qg,o=0,c=[];for(e=0;e<r;e++)e%4===0&&e&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|a.indexOf(n.charAt(e));return i=r%4*6,i===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):i===18?(c.push(o>>10&255),c.push(o>>2&255)):i===12&&c.push(o>>4&255),new Uint8Array(c)}function h5(t){var e="",i=0,n,r,a=t.length,o=Qg;for(n=0;n<a;n++)n%3===0&&n&&(e+=o[i>>18&63],e+=o[i>>12&63],e+=o[i>>6&63],e+=o[i&63]),i=(i<<8)+t[n];return r=a%3,r===0?(e+=o[i>>18&63],e+=o[i>>12&63],e+=o[i>>6&63],e+=o[i&63]):r===2?(e+=o[i>>10&63],e+=o[i>>4&63],e+=o[i<<2&63],e+=o[64]):r===1&&(e+=o[i>>2&63],e+=o[i<<4&63],e+=o[64],e+=o[64]),e}function f5(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var Bw=new qt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:u5,construct:c5,predicate:f5,represent:h5}),d5=Object.prototype.hasOwnProperty,p5=Object.prototype.toString;function m5(t){if(t===null)return!0;var e=[],i,n,r,a,o,c=t;for(i=0,n=c.length;i<n;i+=1){if(r=c[i],o=!1,p5.call(r)!=="[object Object]")return!1;for(a in r)if(d5.call(r,a))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(a)===-1)e.push(a);else return!1}return!0}function g5(t){return t!==null?t:[]}var zw=new qt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:m5,construct:g5}),y5=Object.prototype.toString;function x5(t){if(t===null)return!0;var e,i,n,r,a,o=t;for(a=new Array(o.length),e=0,i=o.length;e<i;e+=1){if(n=o[e],y5.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;a[e]=[r[0],n[r[0]]]}return!0}function b5(t){if(t===null)return[];var e,i,n,r,a,o=t;for(a=new Array(o.length),e=0,i=o.length;e<i;e+=1)n=o[e],r=Object.keys(n),a[e]=[r[0],n[r[0]]];return a}var _w=new qt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:x5,construct:b5}),v5=Object.prototype.hasOwnProperty;function S5(t){if(t===null)return!0;var e,i=t;for(e in i)if(v5.call(i,e)&&i[e]!==null)return!1;return!0}function w5(t){return t!==null?t:{}}var Hw=new qt("tag:yaml.org,2002:set",{kind:"mapping",resolve:S5,construct:w5}),Gg=Nw.extend({implicit:[jw,Lw],explicit:[Bw,zw,_w,Hw]}),Hr=Object.prototype.hasOwnProperty,lh=1,Uw=2,qw=3,ah=4,Hp=1,k5=2,dv=3,C5=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,A5=/[\x85\u2028\u2029]/,M5=/[,\[\]\{\}]/,Pw=/^(?:!|!!|![a-z\-]+!)$/i,Fw=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function pv(t){return Object.prototype.toString.call(t)}function Sn(t){return t===10||t===13}function vs(t){return t===9||t===32}function hi(t){return t===9||t===32||t===10||t===13}function xl(t){return t===44||t===91||t===93||t===123||t===125}function T5(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function O5(t){return t===120?2:t===117?4:t===85?8:0}function E5(t){return 48<=t&&t<=57?t-48:-1}function mv(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 N5(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function Vw(t,e,i){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[e]=i}var Iw=new Array(256),Qw=new Array(256);for(var pl=0;pl<256;pl++)Iw[pl]=mv(pl)?1:0,Qw[pl]=mv(pl);function R5(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Gg,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 Gw(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=BR(i),new Zt(e,i)}function me(t,e){throw Gw(t,e)}function oh(t,e){t.onWarning&&t.onWarning.call(null,Gw(t,e))}var gv={YAML:function(e,i,n){var r,a,o;e.version!==null&&me(e,"duplication of %YAML directive"),n.length!==1&&me(e,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&me(e,"ill-formed argument of the YAML directive"),a=parseInt(r[1],10),o=parseInt(r[2],10),a!==1&&me(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&oh(e,"unsupported YAML version of the document")},TAG:function(e,i,n){var r,a;n.length!==2&&me(e,"TAG directive accepts exactly two arguments"),r=n[0],a=n[1],Pw.test(r)||me(e,"ill-formed tag handle (first argument) of the TAG directive"),Hr.call(e.tagMap,r)&&me(e,'there is a previously declared suffix for "'+r+'" tag handle'),Fw.test(a)||me(e,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{me(e,"tag prefix is malformed: "+a)}e.tagMap[r]=a}};function zr(t,e,i,n){var r,a,o,c;if(e<i){if(c=t.input.slice(e,i),n)for(r=0,a=c.length;r<a;r+=1)o=c.charCodeAt(r),o===9||32<=o&&o<=1114111||me(t,"expected valid JSON character");else C5.test(c)&&me(t,"the stream contains non-printable characters");t.result+=c}}function yv(t,e,i,n){var r,a,o,c;for(Tt.isObject(i)||me(t,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),o=0,c=r.length;o<c;o+=1)a=r[o],Hr.call(e,a)||(Vw(e,a,i[a]),n[a]=!0)}function bl(t,e,i,n,r,a,o,c,h){var d,p;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),d=0,p=r.length;d<p;d+=1)Array.isArray(r[d])&&me(t,"nested arrays are not supported inside keys"),typeof r=="object"&&pv(r[d])==="[object Object]"&&(r[d]="[object Object]");if(typeof r=="object"&&pv(r)==="[object Object]"&&(r="[object Object]"),r=String(r),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(d=0,p=a.length;d<p;d+=1)yv(t,e,a[d],i);else yv(t,e,a,i);else!t.json&&!Hr.call(i,r)&&Hr.call(e,r)&&(t.line=o||t.line,t.lineStart=c||t.lineStart,t.position=h||t.position,me(t,"duplicated mapping key")),Vw(e,r,a),delete i[r];return e}function Yg(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++):me(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function wt(t,e,i){for(var n=0,r=t.input.charCodeAt(t.position);r!==0;){for(;vs(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(Sn(r))for(Yg(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&&oh(t,"deficient indentation"),n}function Fh(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||hi(i)))}function Kg(t,e){e===1?t.result+=" ":e>1&&(t.result+=Tt.repeat(`
|
|
20
|
+
`,e-1))}function D5(t,e,i){var n,r,a,o,c,h,d,p,g=t.kind,x=t.result,v;if(v=t.input.charCodeAt(t.position),hi(v)||xl(v)||v===35||v===38||v===42||v===33||v===124||v===62||v===39||v===34||v===37||v===64||v===96||(v===63||v===45)&&(r=t.input.charCodeAt(t.position+1),hi(r)||i&&xl(r)))return!1;for(t.kind="scalar",t.result="",a=o=t.position,c=!1;v!==0;){if(v===58){if(r=t.input.charCodeAt(t.position+1),hi(r)||i&&xl(r))break}else if(v===35){if(n=t.input.charCodeAt(t.position-1),hi(n))break}else{if(t.position===t.lineStart&&Fh(t)||i&&xl(v))break;if(Sn(v))if(h=t.line,d=t.lineStart,p=t.lineIndent,wt(t,!1,-1),t.lineIndent>=e){c=!0,v=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=h,t.lineStart=d,t.lineIndent=p;break}}c&&(zr(t,a,o,!1),Kg(t,t.line-h),a=o=t.position,c=!1),vs(v)||(o=t.position+1),v=t.input.charCodeAt(++t.position)}return zr(t,a,o,!1),t.result?!0:(t.kind=g,t.result=x,!1)}function j5(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(zr(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 Sn(i)?(zr(t,n,r,!0),Kg(t,wt(t,!1,e)),n=r=t.position):t.position===t.lineStart&&Fh(t)?me(t,"unexpected end of the document within a single quoted scalar"):(t.position++,r=t.position);me(t,"unexpected end of the stream within a single quoted scalar")}function L5(t,e){var i,n,r,a,o,c;if(c=t.input.charCodeAt(t.position),c!==34)return!1;for(t.kind="scalar",t.result="",t.position++,i=n=t.position;(c=t.input.charCodeAt(t.position))!==0;){if(c===34)return zr(t,i,t.position,!0),t.position++,!0;if(c===92){if(zr(t,i,t.position,!0),c=t.input.charCodeAt(++t.position),Sn(c))wt(t,!1,e);else if(c<256&&Iw[c])t.result+=Qw[c],t.position++;else if((o=O5(c))>0){for(r=o,a=0;r>0;r--)c=t.input.charCodeAt(++t.position),(o=T5(c))>=0?a=(a<<4)+o:me(t,"expected hexadecimal character");t.result+=N5(a),t.position++}else me(t,"unknown escape sequence");i=n=t.position}else Sn(c)?(zr(t,i,n,!0),Kg(t,wt(t,!1,e)),i=n=t.position):t.position===t.lineStart&&Fh(t)?me(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}me(t,"unexpected end of the stream within a double quoted scalar")}function B5(t,e){var i=!0,n,r,a,o=t.tag,c,h=t.anchor,d,p,g,x,v,w=Object.create(null),k,C,M,E;if(E=t.input.charCodeAt(t.position),E===91)p=93,v=!1,c=[];else if(E===123)p=125,v=!0,c={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=c),E=t.input.charCodeAt(++t.position);E!==0;){if(wt(t,!0,e),E=t.input.charCodeAt(t.position),E===p)return t.position++,t.tag=o,t.anchor=h,t.kind=v?"mapping":"sequence",t.result=c,!0;i?E===44&&me(t,"expected the node content, but found ','"):me(t,"missed comma between flow collection entries"),C=k=M=null,g=x=!1,E===63&&(d=t.input.charCodeAt(t.position+1),hi(d)&&(g=x=!0,t.position++,wt(t,!0,e))),n=t.line,r=t.lineStart,a=t.position,zl(t,e,lh,!1,!0),C=t.tag,k=t.result,wt(t,!0,e),E=t.input.charCodeAt(t.position),(x||t.line===n)&&E===58&&(g=!0,E=t.input.charCodeAt(++t.position),wt(t,!0,e),zl(t,e,lh,!1,!0),M=t.result),v?bl(t,c,w,C,k,M,n,r,a):g?c.push(bl(t,null,w,C,k,M,n,r,a)):c.push(k),wt(t,!0,e),E=t.input.charCodeAt(t.position),E===44?(i=!0,E=t.input.charCodeAt(++t.position)):i=!1}me(t,"unexpected end of the stream within a flow collection")}function z5(t,e){var i,n,r=Hp,a=!1,o=!1,c=e,h=0,d=!1,p,g;if(g=t.input.charCodeAt(t.position),g===124)n=!1;else if(g===62)n=!0;else return!1;for(t.kind="scalar",t.result="";g!==0;)if(g=t.input.charCodeAt(++t.position),g===43||g===45)Hp===r?r=g===43?dv:k5:me(t,"repeat of a chomping mode identifier");else if((p=E5(g))>=0)p===0?me(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?me(t,"repeat of an indentation width identifier"):(c=e+p-1,o=!0);else break;if(vs(g)){do g=t.input.charCodeAt(++t.position);while(vs(g));if(g===35)do g=t.input.charCodeAt(++t.position);while(!Sn(g)&&g!==0)}for(;g!==0;){for(Yg(t),t.lineIndent=0,g=t.input.charCodeAt(t.position);(!o||t.lineIndent<c)&&g===32;)t.lineIndent++,g=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>c&&(c=t.lineIndent),Sn(g)){h++;continue}if(t.lineIndent<c){r===dv?t.result+=Tt.repeat(`
|
|
21
|
+
`,a?1+h:h):r===Hp&&a&&(t.result+=`
|
|
22
|
+
`);break}for(n?vs(g)?(d=!0,t.result+=Tt.repeat(`
|
|
23
|
+
`,a?1+h:h)):d?(d=!1,t.result+=Tt.repeat(`
|
|
24
|
+
`,h+1)):h===0?a&&(t.result+=" "):t.result+=Tt.repeat(`
|
|
25
|
+
`,h):t.result+=Tt.repeat(`
|
|
26
|
+
`,a?1+h:h),a=!0,o=!0,h=0,i=t.position;!Sn(g)&&g!==0;)g=t.input.charCodeAt(++t.position);zr(t,i,t.position,!1)}return!0}function xv(t,e){var i,n=t.tag,r=t.anchor,a=[],o,c=!1,h;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),h=t.input.charCodeAt(t.position);h!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,me(t,"tab characters must not be used in indentation")),!(h!==45||(o=t.input.charCodeAt(t.position+1),!hi(o))));){if(c=!0,t.position++,wt(t,!0,-1)&&t.lineIndent<=e){a.push(null),h=t.input.charCodeAt(t.position);continue}if(i=t.line,zl(t,e,qw,!1,!0),a.push(t.result),wt(t,!0,-1),h=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&h!==0)me(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return c?(t.tag=n,t.anchor=r,t.kind="sequence",t.result=a,!0):!1}function _5(t,e,i){var n,r,a,o,c,h,d=t.tag,p=t.anchor,g={},x=Object.create(null),v=null,w=null,k=null,C=!1,M=!1,E;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=g),E=t.input.charCodeAt(t.position);E!==0;){if(!C&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,me(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),a=t.line,(E===63||E===58)&&hi(n))E===63?(C&&(bl(t,g,x,v,w,null,o,c,h),v=w=k=null),M=!0,C=!0,r=!0):C?(C=!1,r=!0):me(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,E=n;else{if(o=t.line,c=t.lineStart,h=t.position,!zl(t,i,Uw,!1,!0))break;if(t.line===a){for(E=t.input.charCodeAt(t.position);vs(E);)E=t.input.charCodeAt(++t.position);if(E===58)E=t.input.charCodeAt(++t.position),hi(E)||me(t,"a whitespace character is expected after the key-value separator within a block mapping"),C&&(bl(t,g,x,v,w,null,o,c,h),v=w=k=null),M=!0,C=!1,r=!1,v=t.tag,w=t.result;else if(M)me(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=d,t.anchor=p,!0}else if(M)me(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=d,t.anchor=p,!0}if((t.line===a||t.lineIndent>e)&&(C&&(o=t.line,c=t.lineStart,h=t.position),zl(t,e,ah,!0,r)&&(C?w=t.result:k=t.result),C||(bl(t,g,x,v,w,k,o,c,h),v=w=k=null),wt(t,!0,-1),E=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&E!==0)me(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return C&&bl(t,g,x,v,w,null,o,c,h),M&&(t.tag=d,t.anchor=p,t.kind="mapping",t.result=g),M}function H5(t){var e,i=!1,n=!1,r,a,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&me(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(i=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,r="!!",o=t.input.charCodeAt(++t.position)):r="!",e=t.position,i){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(a=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):me(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!hi(o);)o===33&&(n?me(t,"tag suffix cannot contain exclamation marks"):(r=t.input.slice(e-1,t.position+1),Pw.test(r)||me(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);a=t.input.slice(e,t.position),M5.test(a)&&me(t,"tag suffix cannot contain flow indicator characters")}a&&!Fw.test(a)&&me(t,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{me(t,"tag name is malformed: "+a)}return i?t.tag=a:Hr.call(t.tagMap,r)?t.tag=t.tagMap[r]+a:r==="!"?t.tag="!"+a:r==="!!"?t.tag="tag:yaml.org,2002:"+a:me(t,'undeclared tag handle "'+r+'"'),!0}function U5(t){var e,i;if(i=t.input.charCodeAt(t.position),i!==38)return!1;for(t.anchor!==null&&me(t,"duplication of an anchor property"),i=t.input.charCodeAt(++t.position),e=t.position;i!==0&&!hi(i)&&!xl(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&me(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function q5(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&&!hi(n)&&!xl(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&me(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),Hr.call(t.anchorMap,i)||me(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],wt(t,!0,-1),!0}function zl(t,e,i,n,r){var a,o,c,h=1,d=!1,p=!1,g,x,v,w,k,C;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=o=c=ah===i||qw===i,n&&wt(t,!0,-1)&&(d=!0,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)),h===1)for(;H5(t)||U5(t);)wt(t,!0,-1)?(d=!0,c=a,t.lineIndent>e?h=1:t.lineIndent===e?h=0:t.lineIndent<e&&(h=-1)):c=!1;if(c&&(c=d||r),(h===1||ah===i)&&(lh===i||Uw===i?k=e:k=e+1,C=t.position-t.lineStart,h===1?c&&(xv(t,C)||_5(t,C,k))||B5(t,k)?p=!0:(o&&z5(t,k)||j5(t,k)||L5(t,k)?p=!0:q5(t)?(p=!0,(t.tag!==null||t.anchor!==null)&&me(t,"alias node should not have any properties")):D5(t,k,lh===i)&&(p=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):h===0&&(p=c&&xv(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"&&me(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(Hr.call(t.typeMap[t.kind||"fallback"],t.tag))w=t.typeMap[t.kind||"fallback"][t.tag];else for(w=null,v=t.typeMap.multi[t.kind||"fallback"],g=0,x=v.length;g<x;g+=1)if(t.tag.slice(0,v[g].tag.length)===v[g].tag){w=v[g];break}w||me(t,"unknown tag !<"+t.tag+">"),t.result!==null&&w.kind!==t.kind&&me(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)):me(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 P5(t){var e=t.position,i,n,r,a=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(wt(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(a=!0,o=t.input.charCodeAt(++t.position),i=t.position;o!==0&&!hi(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(i,t.position),r=[],n.length<1&&me(t,"directive name must not be less than one character in length");o!==0;){for(;vs(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Sn(o));break}if(Sn(o))break;for(i=t.position;o!==0&&!hi(o);)o=t.input.charCodeAt(++t.position);r.push(t.input.slice(i,t.position))}o!==0&&Yg(t),Hr.call(gv,n)?gv[n](t,n,r):oh(t,'unknown document directive "'+n+'"')}if(wt(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,wt(t,!0,-1)):a&&me(t,"directives end mark is expected"),zl(t,t.lineIndent-1,ah,!1,!0),wt(t,!0,-1),t.checkLineBreaks&&A5.test(t.input.slice(e,t.position))&&oh(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Fh(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,wt(t,!0,-1));return}if(t.position<t.length-1)me(t,"end of the stream or a document separator is expected");else return}function Yw(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 R5(t,e),n=t.indexOf("\0");for(n!==-1&&(i.position=n,me(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;)P5(i);return i.documents}function F5(t,e,i){e!==null&&typeof e=="object"&&typeof i>"u"&&(i=e,e=null);var n=Yw(t,i);if(typeof e!="function")return n;for(var r=0,a=n.length;r<a;r+=1)e(n[r])}function V5(t,e){var i=Yw(t,e);if(i.length!==0){if(i.length===1)return i[0];throw new Zt("expected a single document in the stream, but found more")}}var I5=F5,Q5=V5,Kw={loadAll:I5,load:Q5},Ww=Object.prototype.toString,Xw=Object.prototype.hasOwnProperty,Wg=65279,G5=9,xo=10,Y5=13,K5=32,W5=33,X5=34,Rm=35,J5=37,Z5=38,$5=39,eD=42,Jw=44,tD=45,uh=58,iD=61,nD=62,rD=63,sD=64,Zw=91,$w=93,lD=96,ek=123,aD=124,tk=125,Qt={};Qt[0]="\\0";Qt[7]="\\a";Qt[8]="\\b";Qt[9]="\\t";Qt[10]="\\n";Qt[11]="\\v";Qt[12]="\\f";Qt[13]="\\r";Qt[27]="\\e";Qt[34]='\\"';Qt[92]="\\\\";Qt[133]="\\N";Qt[160]="\\_";Qt[8232]="\\L";Qt[8233]="\\P";var oD=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],uD=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function cD(t,e){var i,n,r,a,o,c,h;if(e===null)return{};for(i={},n=Object.keys(e),r=0,a=n.length;r<a;r+=1)o=n[r],c=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),h=t.compiledTypeMap.fallback[o],h&&Xw.call(h.styleAliases,c)&&(c=h.styleAliases[c]),i[o]=c;return i}function hD(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 Zt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+Tt.repeat("0",n-e.length)+e}var fD=1,bo=2;function dD(t){this.schema=t.schema||Gg,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Tt.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=cD(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==='"'?bo:fD,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 bv(t,e){for(var i=Tt.repeat(" ",e),n=0,r=-1,a="",o,c=t.length;n<c;)r=t.indexOf(`
|
|
28
|
+
`,n),r===-1?(o=t.slice(n),n=c):(o=t.slice(n,r+1),n=r+1),o.length&&o!==`
|
|
29
|
+
`&&(a+=i),a+=o;return a}function Dm(t,e){return`
|
|
30
|
+
`+Tt.repeat(" ",t.indent*e)}function pD(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 ch(t){return t===K5||t===G5}function vo(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Wg||65536<=t&&t<=1114111}function vv(t){return vo(t)&&t!==Wg&&t!==Y5&&t!==xo}function Sv(t,e,i){var n=vv(t),r=n&&!ch(t);return(i?n:n&&t!==Jw&&t!==Zw&&t!==$w&&t!==ek&&t!==tk)&&t!==Rm&&!(e===uh&&!r)||vv(e)&&!ch(e)&&t===Rm||e===uh&&r}function mD(t){return vo(t)&&t!==Wg&&!ch(t)&&t!==tD&&t!==rD&&t!==uh&&t!==Jw&&t!==Zw&&t!==$w&&t!==ek&&t!==tk&&t!==Rm&&t!==Z5&&t!==eD&&t!==W5&&t!==aD&&t!==iD&&t!==nD&&t!==$5&&t!==X5&&t!==J5&&t!==sD&&t!==lD}function gD(t){return!ch(t)&&t!==uh}function eo(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 ik(t){var e=/^\n* /;return e.test(t)}var nk=1,jm=2,rk=3,sk=4,ml=5;function yD(t,e,i,n,r,a,o,c){var h,d=0,p=null,g=!1,x=!1,v=n!==-1,w=-1,k=mD(eo(t,0))&&gD(eo(t,t.length-1));if(e||o)for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=eo(t,h),!vo(d))return ml;k=k&&Sv(d,p,c),p=d}else{for(h=0;h<t.length;d>=65536?h+=2:h++){if(d=eo(t,h),d===xo)g=!0,v&&(x=x||h-w-1>n&&t[w+1]!==" ",w=h);else if(!vo(d))return ml;k=k&&Sv(d,p,c),p=d}x=x||v&&h-w-1>n&&t[w+1]!==" "}return!g&&!x?k&&!o&&!r(t)?nk:a===bo?ml:jm:i>9&&ik(t)?ml:o?a===bo?ml:jm:x?sk:rk}function xD(t,e,i,n,r){t.dump=(function(){if(e.length===0)return t.quotingType===bo?'""':"''";if(!t.noCompatMode&&(oD.indexOf(e)!==-1||uD.test(e)))return t.quotingType===bo?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,i),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=n||t.flowLevel>-1&&i>=t.flowLevel;function h(d){return pD(t,d)}switch(yD(e,c,t.indent,o,h,t.quotingType,t.forceQuotes&&!n,r)){case nk:return e;case jm:return"'"+e.replace(/'/g,"''")+"'";case rk:return"|"+wv(e,t.indent)+kv(bv(e,a));case sk:return">"+wv(e,t.indent)+kv(bv(bD(e,o),a));case ml:return'"'+vD(e)+'"';default:throw new Zt("impossible error: invalid scalar style")}})()}function wv(t,e){var i=ik(t)?String(e):"",n=t[t.length-1]===`
|
|
31
|
+
`,r=n&&(t[t.length-2]===`
|
|
32
|
+
`||t===`
|
|
33
|
+
`),a=r?"+":n?"":"-";return i+a+`
|
|
34
|
+
`}function kv(t){return t[t.length-1]===`
|
|
35
|
+
`?t.slice(0,-1):t}function bD(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,Cv(t.slice(0,d),e)})(),r=t[0]===`
|
|
37
|
+
`||t[0]===" ",a,o;o=i.exec(t);){var c=o[1],h=o[2];a=h[0]===" ",n+=c+(!r&&!a&&h!==""?`
|
|
38
|
+
`:"")+Cv(h,e),r=a}return n}function Cv(t,e){if(t===""||t[0]===" ")return t;for(var i=/ [^ ]/g,n,r=0,a,o=0,c=0,h="";n=i.exec(t);)c=n.index,c-r>e&&(a=o>r?o:c,h+=`
|
|
39
|
+
`+t.slice(r,a),r=a+1),o=c;return h+=`
|
|
40
|
+
`,t.length-r>e&&o>r?h+=t.slice(r,o)+`
|
|
41
|
+
`+t.slice(o+1):h+=t.slice(r),h.slice(1)}function vD(t){for(var e="",i=0,n,r=0;r<t.length;i>=65536?r+=2:r++)i=eo(t,r),n=Qt[i],!n&&vo(i)?(e+=t[r],i>=65536&&(e+=t[r+1])):e+=n||hD(i);return e}function SD(t,e,i){var n="",r=t.tag,a,o,c;for(a=0,o=i.length;a<o;a+=1)c=i[a],t.replacer&&(c=t.replacer.call(i,String(a),c)),(Jn(t,e,c,!1,!1)||typeof c>"u"&&Jn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=r,t.dump="["+n+"]"}function Av(t,e,i,n){var r="",a=t.tag,o,c,h;for(o=0,c=i.length;o<c;o+=1)h=i[o],t.replacer&&(h=t.replacer.call(i,String(o),h)),(Jn(t,e+1,h,!0,!0,!1,!0)||typeof h>"u"&&Jn(t,e+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=Dm(t,e)),t.dump&&xo===t.dump.charCodeAt(0)?r+="-":r+="- ",r+=t.dump);t.tag=a,t.dump=r||"[]"}function wD(t,e,i){var n="",r=t.tag,a=Object.keys(i),o,c,h,d,p;for(o=0,c=a.length;o<c;o+=1)p="",n!==""&&(p+=", "),t.condenseFlow&&(p+='"'),h=a[o],d=i[h],t.replacer&&(d=t.replacer.call(i,h,d)),Jn(t,e,h,!1,!1)&&(t.dump.length>1024&&(p+="? "),p+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Jn(t,e,d,!1,!1)&&(p+=t.dump,n+=p));t.tag=r,t.dump="{"+n+"}"}function kD(t,e,i,n){var r="",a=t.tag,o=Object.keys(i),c,h,d,p,g,x;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new Zt("sortKeys must be a boolean or a function");for(c=0,h=o.length;c<h;c+=1)x="",(!n||r!=="")&&(x+=Dm(t,e)),d=o[c],p=i[d],t.replacer&&(p=t.replacer.call(i,d,p)),Jn(t,e+1,d,!0,!0,!0)&&(g=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,g&&(t.dump&&xo===t.dump.charCodeAt(0)?x+="?":x+="? "),x+=t.dump,g&&(x+=Dm(t,e)),Jn(t,e+1,p,!0,g)&&(t.dump&&xo===t.dump.charCodeAt(0)?x+=":":x+=": ",x+=t.dump,r+=x));t.tag=a,t.dump=r||"{}"}function Mv(t,e,i){var n,r,a,o,c,h;for(r=i?t.explicitTypes:t.implicitTypes,a=0,o=r.length;a<o;a+=1)if(c=r[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(i?c.multi&&c.representName?t.tag=c.representName(e):t.tag=c.tag:t.tag="?",c.represent){if(h=t.styleMap[c.tag]||c.defaultStyle,Ww.call(c.represent)==="[object Function]")n=c.represent(e,h);else if(Xw.call(c.represent,h))n=c.represent[h](e,h);else throw new Zt("!<"+c.tag+'> tag resolver accepts not "'+h+'" style');t.dump=n}return!0}return!1}function Jn(t,e,i,n,r,a,o){t.tag=null,t.dump=i,Mv(t,i,!1)||Mv(t,i,!0);var c=Ww.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?(kD(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(wD(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Av(t,e-1,t.dump,r):Av(t,e,t.dump,r),x&&(t.dump="&ref_"+g+t.dump)):(SD(t,e,t.dump),x&&(t.dump="&ref_"+g+" "+t.dump));else if(c==="[object String]")t.tag!=="?"&&xD(t,t.dump,e,a,h);else{if(c==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new Zt("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 CD(t,e){var i=[],n=[],r,a;for(Lm(t,i,n),r=0,a=n.length;r<a;r+=1)e.duplicates.push(i[n[r]]);e.usedDuplicates=new Array(a)}function Lm(t,e,i){var n,r,a;if(t!==null&&typeof t=="object")if(r=e.indexOf(t),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(e.push(t),Array.isArray(t))for(r=0,a=t.length;r<a;r+=1)Lm(t[r],e,i);else for(n=Object.keys(t),r=0,a=n.length;r<a;r+=1)Lm(t[n[r]],e,i)}function AD(t,e){e=e||{};var i=new dD(e);i.noRefs||CD(t,i);var n=t;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Jn(i,0,n,!0,!0)?i.dump+`
|
|
42
|
+
`:""}var MD=AD,TD={dump:MD};function Xg(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 OD=qt,ED=vw,ND=Cw,RD=Ew,DD=Nw,jD=Gg,LD=Kw.load,BD=Kw.loadAll,zD=TD.dump,_D=Zt,HD={binary:Bw,float:Ow,map:kw,null:Aw,pairs:_w,set:Hw,timestamp:jw,bool:Mw,int:Tw,merge:Lw,omap:zw,seq:ww,str:Sw},UD=Xg("safeLoad","load"),qD=Xg("safeLoadAll","loadAll"),PD=Xg("safeDump","dump"),Tv={Type:OD,Schema:ED,FAILSAFE_SCHEMA:ND,JSON_SCHEMA:RD,CORE_SCHEMA:DD,DEFAULT_SCHEMA:jD,load:LD,loadAll:BD,dump:zD,YAMLException:_D,types:HD,safeLoad:UD,safeLoadAll:qD,safeDump:PD};function Vh(){return Wn({queryKey:["specs"],queryFn:_e.specs.list})}function FD(){const t=lt();return yt({mutationFn:({spec:e,name:i,upstreamUrl:n})=>_e.specs.upload(e,i,n),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function VD(){const t=lt();return yt({mutationFn:({url:e,name:i})=>_e.specs.uploadFromUrl(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function lk(){const t=lt();return yt({mutationFn:({specId:e,data:i})=>_e.specs.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function ID(){const t=lt();return yt({mutationFn:e=>_e.specs.toggle(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function QD(){const t=lt();return yt({mutationFn:({specId:e,spec:i})=>_e.specs.reimport(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function GD(){const t=lt();return yt({mutationFn:e=>_e.specs.delete(e),onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]}),t.invalidateQueries({queryKey:["endpoints"]})}})}function YD(){const{data:t}=Vh(),e=ID(),i=GD(),n=FD(),r=VD(),a=lk(),o=QD(),[c,h]=O.useState(!1),[d,p]=O.useState(!1),[g,x]=O.useState(null),[v,w]=O.useState("url"),[k,C]=O.useState(""),[M,E]=O.useState(""),[D,G]=O.useState(""),L=O.useRef(null);O.useEffect(()=>{function P(ie){L.current&&!L.current.contains(ie.target)&&(h(!1),p(!1),x(null))}return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);const I=O.useCallback(async P=>{if(!k.trim())return alert("Enter a spec name");try{const ie=await P.text(),ue=/\.ya?ml$/i.test(P.name)?Tv.load(ie):JSON.parse(ie);n.mutate({spec:ue,name:k.trim()},{onSuccess:()=>{C(""),p(!1),h(!1)}})}catch{alert("Invalid file")}},[n,k]),q=()=>{!M.trim()||!k.trim()||r.mutate({url:M.trim(),name:k.trim()},{onSuccess:()=>{E(""),C(""),p(!1),h(!1)}})},$=P=>{if(P.metadata.sourceUrl)o.mutate({specId:P.id});else{const ie=document.createElement("input");ie.type="file",ie.accept=".json,.yaml,.yml",ie.onchange=async de=>{const ue=de.target.files?.[0];if(ue)try{const _=await ue.text(),se=/\.ya?ml$/i.test(ue.name)?Tv.load(_):JSON.parse(_);o.mutate({specId:P.id,spec:se})}catch{alert("Invalid file")}},ie.click()}},ee=P=>{a.mutate({specId:P,data:{upstreamUrl:D.trim()}},{onSuccess:()=>x(null)})},fe=t?.filter(P=>P.active)??[],ce=fe.length===1?fe[0].name:fe.length>1?`${fe.length} Specs`:"Select Spec";return b.jsxs("div",{className:"relative",ref:L,children:[b.jsxs("button",{onClick:()=>h(!c),className:ve("flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-all border shrink-0",c?"bg-accent border-primary/20":"bg-muted/30 border-border/40 hover:bg-accent/40 hover:border-border/60"),children:[b.jsx(nh,{className:"w-3.5 h-3.5 text-mode-mock opacity-70"}),b.jsx("span",{className:"font-bold truncate max-w-[150px]",children:ce}),b.jsx(qo,{className:ve("w-3 h-3 text-muted-foreground transition-transform",c&&"rotate-180")})]}),c&&b.jsxs("div",{className:"absolute left-0 top-full mt-2 z-50 bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[340px] animate-in fade-in zoom-in-95 duration-200",children:[b.jsxs("div",{className:"px-3 py-1 mb-1 border-b border-border/40 flex items-center justify-between",children:[b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"API Specifications"}),b.jsx("button",{onClick:()=>{p(!d),x(null),C(""),E("")},className:"p-1 hover:bg-primary/10 text-primary rounded-md transition-all",children:d?b.jsx(Xn,{className:"w-3.5 h-3.5"}):b.jsx(Ll,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"max-h-[450px] overflow-y-auto px-1.5 py-1 ",children:d?b.jsxs("div",{className:"p-3 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Spec Identifier"}),b.jsx("input",{autoFocus:!0,type:"text",placeholder:"e.g. staging-api",value:k,onChange:P=>C(P.target.value),className:"w-full px-3 py-2 text-xs font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),b.jsxs("div",{className:"flex p-0.5 bg-muted rounded-lg border border-border/40",children:[b.jsxs("button",{onClick:()=>w("url"),className:ve("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",v==="url"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[b.jsx(lw,{className:"w-3 h-3"})," URL"]}),b.jsxs("button",{onClick:()=>w("file"),className:ve("flex-1 flex items-center justify-center gap-1.5 py-1 text-[9px] font-black uppercase tracking-wider rounded-md transition-all",v==="file"?"bg-background shadow-sm text-primary":"text-muted-foreground"),children:[b.jsx(hw,{className:"w-3 h-3"})," File"]})]}),v==="url"?b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"relative group",children:[b.jsx(A3,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),b.jsx("input",{type:"url",placeholder:"https://api.example.com/spec.json",value:M,onChange:P=>E(P.target.value),className:"w-full pl-9 pr-3 py-2 text-xs font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"})]}),b.jsxs("button",{onClick:q,disabled:!M.trim()||!k.trim()||r.isPending,className:"w-full py-2 bg-primary text-primary-foreground text-[10px] font-black uppercase tracking-widest rounded-lg hover:bg-primary/90 transition-all flex items-center justify-center gap-2",children:[r.isPending?b.jsx(sh,{className:"w-3.5 h-3.5 animate-spin"}):b.jsx(Br,{className:"w-3.5 h-3.5"}),"Import from URL"]})]}):b.jsxs("label",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed border-border/60 rounded-xl hover:border-primary/40 hover:bg-primary/5 transition-all cursor-pointer group",children:[b.jsx(S3,{className:"w-8 h-8 text-muted-foreground/40 group-hover:text-primary transition-colors mb-2"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground group-hover:text-primary",children:"Click to select file"}),b.jsx("input",{type:"file",accept:".json,.yaml,.yml",className:"hidden",onChange:P=>{const ie=P.target.files?.[0];ie&&I(ie)}})]})]}):b.jsxs("div",{className:"space-y-1",children:[t?.length===0&&b.jsxs("div",{className:"py-10 text-center px-6 space-y-2",children:[b.jsx(nh,{className:"w-8 h-8 mx-auto text-muted-foreground opacity-20"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground/60 leading-tight",children:"No specifications yet. Import one to start intercepting."})]}),t?.map(P=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:ve("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",P.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(P.id),children:[b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:ve("font-black truncate text-xs uppercase tracking-tight",P.active?"text-foreground":"text-muted-foreground"),children:P.name}),P.active&&b.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--color-primary),0.5)]"})]}),b.jsxs("p",{className:"text-[10px] font-bold opacity-40 truncate leading-none mt-1",children:[P.metadata.title," (v",P.metadata.version,")"]})]}),b.jsxs("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[b.jsx("button",{onClick:ie=>{ie.stopPropagation(),x(g===P.id?null:P.id),G(P.upstreamUrl)},className:"p-1.5 text-muted-foreground hover:text-primary rounded-md hover:bg-primary/10 transition-all",title:"Configure",children:b.jsx(ow,{className:"w-3.5 h-3.5"})}),b.jsx("button",{onClick:ie=>{ie.stopPropagation(),confirm(`Delete spec "${P.name}"?`)&&i.mutate(P.id)},className:"p-1.5 text-muted-foreground hover:text-destructive rounded-md hover:bg-destructive/10 transition-all",title:"Delete",children:b.jsx(Bl,{className:"w-3.5 h-3.5"})})]})]}),g===P.id&&b.jsxs("div",{className:"mx-2 p-3 rounded-xl bg-muted/40 border border-border/40 space-y-3 animate-in slide-in-from-top-2 duration-200 shadow-inner",children:[b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("label",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-widest px-1",children:"Upstream URL"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx("input",{autoFocus:!0,type:"url",value:D,onChange:ie=>G(ie.target.value),className:"flex-1 px-3 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>ee(P.id),className:"p-1.5 bg-primary/10 text-primary rounded-lg hover:bg-primary hover:text-primary-foreground transition-all",children:b.jsx(Br,{className:"w-4 h-4"})})]})]}),b.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[b.jsxs("button",{onClick:()=>$(P),disabled:o.isPending,className:"flex-1 flex items-center justify-center gap-2 py-1.5 bg-muted border border-border/60 text-[9px] font-black uppercase tracking-widest rounded-lg hover:bg-accent transition-all",children:[o.isPending?b.jsx(sh,{className:"w-3 h-3 animate-spin"}):b.jsx(E3,{className:"w-3 h-3"}),"Reimport"]}),b.jsx("button",{onClick:()=>x(null),className:"px-3 py-1.5 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]})]},P.id))]})}),b.jsx("div",{className:"border-t border-border mt-1.5 pt-2 px-3 pb-1",children:b.jsxs("div",{className:"flex items-center justify-between text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.2em]",children:[b.jsxs("span",{children:["Total: ",t?.length??0]}),b.jsxs("span",{className:"text-primary/60",children:[fe.length," Active"]})]})})]})]})}const ak=O.createContext(void 0);function KD(){const t=O.useContext(ak);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const ok="/assets/logo-full-DJtzE5xc.png",WD="#181717",XD=O.forwardRef(function({title:e="GitHub",color:i="currentColor",size:n=24,...r},a){return i==="default"&&(i=WD),b.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,fill:i,viewBox:"0 0 24 24",ref:a,...r,children:[b.jsx("title",{children:e}),b.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})});function JD({open:t,onClose:e}){const i=lt(),{data:n}=Wn({queryKey:["config"],queryFn:_e.config.get}),{data:r}=Wn({queryKey:["health"],queryFn:_e.health}),[a,o]=O.useState("config"),[c,h]=O.useState(4e3);O.useEffect(()=>{n&&h(n.proxyPort)},[n]);const d=yt({mutationFn:()=>_e.config.update({proxyPort:c}),onSuccess:()=>{i.invalidateQueries({queryKey:["config"]}),e()}}),p=async()=>{const x=await _e.config.export(),v=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),w=URL.createObjectURL(v),k=document.createElement("a");k.href=w,k.download=`interceptr-config-${new Date().toISOString().slice(0,10)}.json`,k.click(),URL.revokeObjectURL(w)},g=async x=>{const v=await x.text(),w=JSON.parse(v);await _e.config.import(w),i.invalidateQueries()};return t?b.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[b.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md",onClick:e}),b.jsxs("div",{className:"relative w-full max-w-xl bg-card border border-border/60 shadow-2xl rounded-3xl overflow-hidden flex flex-col max-h-[90vh]",children:[b.jsxs("div",{className:"px-6 py-4 border-b border-border/40 bg-muted flex items-center justify-between shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(D3,{className:"w-4 h-4 text-primary"}),b.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-foreground/80",children:"System Control"})]}),b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:b.jsx(Xn,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"flex border-b border-border/20 bg-muted/30 shrink-0 px-4",children:[b.jsx("button",{onClick:()=>o("config"),className:ve("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",a==="config"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Configuration"}),b.jsx("button",{onClick:()=>o("about"),className:ve("px-4 py-3 text-[10px] font-black uppercase tracking-widest border-b-2 transition-all duration-75",a==="about"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"About"})]}),b.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:a==="config"?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(lw,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Network Environment"})]}),b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex-1 space-y-1",children:[b.jsx("p",{className:"text-xs font-black text-foreground uppercase tracking-tight leading-none mb-1",children:"Proxy Port"}),b.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-medium",children:"Internal server interface listener port."})]}),b.jsx("input",{type:"number",value:c,onChange:x=>h(Number(x.target.value)),className:"w-32 px-4 py-2 text-sm font-mono font-black rounded-xl border border-border/60 bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner text-right"})]})]}),b.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/40",children:[b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(y3,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Data Sovereignty"})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm group",children:[b.jsx(b3,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Backup"]}),b.jsxs("label",{className:"flex items-center justify-center gap-2.5 px-4 py-3 text-[10px] font-black uppercase tracking-widest rounded-xl border border-border/60 bg-card/40 hover:bg-accent/40 hover:border-primary/20 transition-all shadow-sm cursor-pointer group",children:[b.jsx(hw,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"}),"Restore",b.jsx("input",{type:"file",accept:".json",className:"hidden",onChange:x=>{const v=x.target.files?.[0];v&&g(v)}})]})]})]})]}):b.jsxs("div",{className:"flex flex-col items-center text-center space-y-8 py-4",children:[b.jsx("div",{className:"max-w-[300px] p-4",children:b.jsx("img",{src:ok,alt:"Interceptr Full Logo",className:"w-full h-auto object-contain"})}),b.jsxs("div",{className:"space-y-2",children:[b.jsx("h3",{className:"text-xl font-black tracking-tighter uppercase",children:"Interceptr"}),b.jsxs("p",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest",children:["Version ",r?.version??"—"]})]}),b.jsx("div",{className:"max-w-md",children:b.jsx("p",{className:"text-sm font-medium text-muted-foreground leading-relaxed",children:"A professional-grade HTTP interception proxy and mocking tool designed specifically for modern engineering workflows."})}),b.jsxs("div",{className:"w-full grid grid-cols-1 gap-3 pt-4",children:[b.jsxs("a",{href:"https://github.com/pckhib/interceptr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:b.jsx(XD,{className:"w-4 h-4"})}),b.jsxs("div",{className:"text-left",children:[b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"GitHub Repository"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Contribute or report issues."})]})]}),b.jsx(Om,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]}),b.jsxs("a",{href:"https://github.com/pckhib",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-4 rounded-2xl border border-border/60 bg-muted/10 hover:bg-primary/5 hover:border-primary/20 transition-all group",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-background border border-border/40 flex items-center justify-center",children:b.jsx(aw,{className:"w-4 h-4 text-primary"})}),b.jsxs("div",{className:"text-left",children:[b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-1",children:"Developer"}),b.jsx("p",{className:"text-[11px] font-bold text-muted-foreground",children:"Patrick Hieber"})]})]}),b.jsx(Om,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-primary transition-colors"})]})]}),b.jsx("p",{className:"text-[9px] font-black text-muted-foreground/40 uppercase tracking-[0.3em] pt-4",children:"API Simulation Made Simple."})]})}),b.jsx("div",{className:"p-4 border-t border-border/40 bg-muted flex justify-end gap-3 px-6 shrink-0",children:a==="config"?b.jsxs(b.Fragment,{children:[b.jsx("button",{onClick:e,className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors duration-75",children:"Cancel"}),b.jsx("button",{onClick:()=>d.mutate(),className:"px-6 py-2.5 text-[10px] font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-xl hover:bg-primary/90 transition-all shadow-md active:scale-95",children:"Persist Settings"})]}):b.jsx("button",{onClick:e,className:"px-8 py-2.5 text-[10px] font-black uppercase tracking-widest bg-foreground text-background rounded-xl hover:opacity-90 transition-all shadow-md active:scale-95",children:"Close"})})]})]}):null}function ZD(){const{theme:t,toggleTheme:e}=KD(),{data:i}=u3(),n=c3(),r=h3(),[a,o]=O.useState(!1),c=i?.running??!1,h=n.isPending||r.isPending;return b.jsxs(b.Fragment,{children:[b.jsxs("header",{className:"h-14 border-b-2 border-border/60 bg-card header-gradient flex items-center justify-between px-4 shrink-0 z-50 relative",children:[b.jsx("div",{className:"absolute top-0 left-0 right-0 h-[1px] bg-white/5"}),b.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[b.jsx("div",{className:"flex items-center group cursor-pointer h-8",children:b.jsx("img",{src:ok,alt:"Interceptr",className:"h-7 w-auto object-contain transition-transform duration-75 group-hover:scale-105"})}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 hidden sm:block"}),b.jsx(wR,{}),b.jsx(YD,{})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs("div",{className:ve("hidden md:flex items-center gap-2 px-3 py-1.5 rounded-full border text-[10px] font-black uppercase tracking-widest transition-all duration-300",c?"bg-success/10 border-success/30 text-success shadow-[0_0_10px_-2px_rgba(34,197,94,0.3)]":"bg-muted border-border text-muted-foreground/60"),children:[b.jsx("div",{className:ve("w-2 h-2 rounded-full",c?"bg-success animate-pulse":"bg-muted-foreground/20")}),b.jsx("span",{children:c?`:${i?.port}`:"Offline"})]}),b.jsxs("button",{onClick:()=>c?r.mutate():n.mutate(),disabled:h,className:ve("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest transition-all shadow-sm border",c?"bg-destructive/10 border-destructive/20 text-destructive hover:bg-destructive hover:text-destructive-foreground":"bg-primary border-primary/20 text-primary-foreground hover:bg-primary/90",h&&"opacity-50 cursor-not-allowed"),children:[b.jsx(T3,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden lg:inline",children:c?"Stop":"Start"})]}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1"}),b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Toggle theme",children:t==="dark"?b.jsx(L3,{className:"w-4 h-4"}):b.jsx(M3,{className:"w-4 h-4"})}),b.jsx("button",{onClick:()=>o(!0),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-all",title:"Settings",children:b.jsx(j3,{className:"w-4 h-4"})})]})]})]}),b.jsx(JD,{open:a,onClose:()=>o(!1)})]})}function $D(){const[t,e]=O.useState(()=>typeof window<"u"&&localStorage.getItem("theme")||"dark");O.useEffect(()=>{const n=window.document.documentElement;n.classList.remove("light","dark"),n.classList.add(t),localStorage.setItem("theme",t)},[t]);const i=()=>e(n=>n==="light"?"dark":"light");return b.jsx(ak.Provider,{value:{theme:t,toggleTheme:i},children:b.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background text-foreground",children:[b.jsx(ZD,{}),b.jsx("main",{className:"flex-1 overflow-hidden relative",children:b.jsx(IE,{})})]})})}function uk(){return Wn({queryKey:["endpoints"],queryFn:_e.endpoints.list})}function e4(){const t=lt();return yt({mutationFn:({id:e,config:i})=>_e.endpoints.update(e,i),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}function ck(){const t=lt();return yt({mutationFn:e=>_e.endpoints.bulkUpdate(e),onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const t4={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 Jg({method:t}){return b.jsx("span",{className:ve("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",t4[t]??"text-muted-foreground bg-muted/20 border-border"),children:t})}const i4=[{value:"passthrough",label:"Pass",icon:Tm,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:Dl,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:v3,activeClass:"bg-mode-mock/20 text-mode-mock border-mode-mock/30 shadow-[0_0_8px_-2px_rgba(var(--mode-mock),0.3)]"}];function n4(t,e){return t==="passthrough"?e==="passthrough":t==="delay"?e==="delay"||e==="mock-delay":t==="mock"?e==="mock"||e==="mock-delay":!1}function r4({value:t,onChange:e}){return b.jsx("div",{className:"inline-flex rounded-lg border border-border/60 bg-muted/30 p-1 shadow-inner backdrop-blur-sm",children:i4.map(({value:i,label:n,icon:r,activeClass:a})=>{const o=n4(i,t);return b.jsxs("button",{onClick:()=>e(i),className:ve("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",o?ve("font-bold",a):"text-muted-foreground/60 hover:text-foreground hover:bg-white/5"),children:[b.jsx(r,{className:ve("w-3.5 h-3.5",o?"animate-in zoom-in-75 duration-300":"opacity-50")}),b.jsx("span",{className:"hidden sm:inline",children:n})]},i)})})}function s4({delay:t,onChange:e}){const[i,n]=O.useState(t.ms),[r,a]=O.useState(t.jitterMs??0);O.useEffect(()=>{n(t.ms),a(t.jitterMs??0)},[t.ms,t.jitterMs]);const o=()=>{e({ms:i,jitterMs:r||void 0})};return b.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 max-w-2xl py-2",children:[b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[b.jsx(Dl,{className:"w-3.5 h-3.5 text-mode-delay"}),"Base Delay"]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"number",value:i,onChange:c=>n(Number(c.target.value)),onBlur:o,className:"w-20 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay focus:border-mode-delay outline-none text-right"}),b.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),b.jsx("input",{type:"range",min:0,max:1e4,step:50,value:i,onChange:c=>n(Number(c.target.value)),onMouseUp:o,className:"w-full accent-mode-delay h-4 bg-transparent cursor-pointer"}),b.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[b.jsx("span",{children:"0ms"}),b.jsx("span",{children:"5,000ms"}),b.jsx("span",{children:"10,000ms"})]})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:[b.jsx(Vg,{className:"w-3.5 h-3.5 text-mode-delay/60"}),"Jitter (±)"]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"number",value:r,onChange:c=>a(Number(c.target.value)),onBlur:o,className:"w-16 px-2 py-1 text-xs font-mono font-bold bg-background border border-border/60 rounded-md focus:ring-1 focus:ring-mode-delay/40 focus:border-mode-delay/40 outline-none text-right"}),b.jsx("span",{className:"text-[10px] font-bold text-muted-foreground",children:"ms"})]})]}),b.jsx("input",{type:"range",min:0,max:2e3,step:10,value:r,onChange:c=>a(Number(c.target.value)),onMouseUp:o,className:"w-full accent-mode-delay/60 h-4 bg-transparent cursor-pointer"}),b.jsxs("div",{className:"flex justify-between text-[9px] font-bold text-muted-foreground/40 uppercase tracking-tighter",children:[b.jsx("span",{children:"0ms"}),b.jsx("span",{children:"1,000ms"}),b.jsx("span",{children:"2,000ms"})]})]})]})}function Bm(){return Bm=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},Bm.apply(null,arguments)}function l4(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 zm=[],hk=[];(()=>{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?hk:zm).push(i=i+t[e])})();function a4(t){if(t<768)return!1;for(let e=0,i=zm.length;;){let n=e+i>>1;if(t<zm[n])i=n;else if(t>=hk[n])e=n+1;else return!0;if(e==i)return!1}}function Ov(t){return t>=127462&&t<=127487}const Ev=8205;function o4(t,e,i=!0,n=!0){return(i?fk:u4)(t,e,n)}function fk(t,e,i){if(e==t.length)return e;e&&dk(t.charCodeAt(e))&&pk(t.charCodeAt(e-1))&&e--;let n=Up(t,e);for(e+=Nv(n);e<t.length;){let r=Up(t,e);if(n==Ev||r==Ev||i&&a4(r))e+=Nv(r),n=r;else if(Ov(r)){let a=0,o=e-2;for(;o>=0&&Ov(Up(t,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function u4(t,e,i){for(;e>0;){let n=fk(t,e-2,i);if(n<e)return n;e--}return 0}function Up(t,e){let i=t.charCodeAt(e);if(!pk(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return dk(n)?(i-55296<<10)+(n-56320)+65536:i}function dk(t){return t>=56320&&t<57344}function pk(t){return t>=55296&&t<56320}function Nv(t){return t<65536?1:2}class Pe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,n){[e,i]=_l(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),pn.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]=_l(this,e,i);let n=[];return this.decompose(e,i,n,0),pn.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 lo(this),a=new lo(e);for(let o=i,c=i;;){if(r.next(o),a.next(o),o=0,r.lineBreak!=a.lineBreak||r.done!=a.done||r.value!=a.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new lo(this,e)}iterRange(e,i=this.length){return new mk(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 gk(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Pe.empty:e.length<=32?new mt(e):pn.from(mt.split(e,[]))}}class mt extends Pe{constructor(e,i=c4(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,r){for(let a=0;;a++){let o=this.text[a],c=r+o.length;if((i?n:c)>=e)return new h4(r,c,n,o);r=c+1,n++}}decompose(e,i,n,r){let a=e<=0&&i>=this.length?this:new mt(Rv(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),c=Ic(a.text,o.text.slice(),0,a.length);if(c.length<=32)n.push(new mt(c,o.length+a.length));else{let h=c.length>>1;n.push(new mt(c.slice(0,h)),new mt(c.slice(h)))}}else n.push(a)}replace(e,i,n){if(!(n instanceof mt))return super.replace(e,i,n);[e,i]=_l(this,e,i);let r=Ic(this.text,Ic(n.text,Rv(this.text,0,e)),i),a=this.length+n.length-(i-e);return r.length<=32?new mt(r,a):pn.from(mt.split(r,[]),a)}sliceString(e,i=this.length,n=`
|
|
43
|
+
`){[e,i]=_l(this,e,i);let r="";for(let a=0,o=0;a<=i&&o<this.text.length;o++){let c=this.text[o],h=a+c.length;a>e&&o&&(r+=n),e<h&&i>a&&(r+=c.slice(Math.max(0,e-a),i-a)),a=h+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let a of e)n.push(a),r+=a.length+1,n.length==32&&(i.push(new mt(n,r)),n=[],r=-1);return r>-1&&i.push(new mt(n,r)),i}}class pn extends Pe{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let a=0;;a++){let o=this.children[a],c=r+o.length,h=n+o.lines-1;if((i?h:c)>=e)return o.lineInner(e,i,n,r);r=c+1,n=h+1}}decompose(e,i,n,r){for(let a=0,o=0;o<=i&&a<this.children.length;a++){let c=this.children[a],h=o+c.length;if(e<=h&&i>=o){let d=r&((o<=e?1:0)|(h>=i?2:0));o>=e&&h<=i&&!d?n.push(c):c.decompose(e-o,i-o,n,d)}o=h+1}}replace(e,i,n){if([e,i]=_l(this,e,i),n.lines<this.lines)for(let r=0,a=0;r<this.children.length;r++){let o=this.children[r],c=a+o.length;if(e>=a&&i<=c){let h=o.replace(e-a,i-a,n),d=this.lines-o.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[r]=h,new pn(p,this.length-(i-e)+n.length)}return super.replace(a,c,h)}a=c+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
|
|
44
|
+
`){[e,i]=_l(this,e,i);let r="";for(let a=0,o=0;a<this.children.length&&o<=i;a++){let c=this.children[a],h=o+c.length;o>e&&a&&(r+=n),e<h&&i>o&&(r+=c.sliceString(e-o,i-o,n)),o=h+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof pn))return 0;let n=0,[r,a,o,c]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,a+=i){if(r==o||a==c)return n;let h=this.children[r],d=e.children[a];if(h!=d)return n+h.scanIdentical(d,i);n+=h.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let v of e)n+=v.lines;if(n<32){let v=[];for(let w of e)w.flatten(v);return new mt(v,i)}let r=Math.max(32,n>>5),a=r<<1,o=r>>1,c=[],h=0,d=-1,p=[];function g(v){let w;if(v.lines>a&&v instanceof pn)for(let k of v.children)g(k);else v.lines>o&&(h>o||!h)?(x(),c.push(v)):v instanceof mt&&h&&(w=p[p.length-1])instanceof mt&&v.lines+w.lines<=32?(h+=v.lines,d+=v.length+1,p[p.length-1]=new mt(w.text.concat(v.text),w.length+1+v.length)):(h+v.lines>r&&x(),h+=v.lines,d+=v.length+1,p.push(v))}function x(){h!=0&&(c.push(p.length==1?p[0]:pn.from(p,d)),d=-1,h=p.length=0)}for(let v of e)g(v);return x(),c.length==1?c[0]:new pn(c,i)}}Pe.empty=new mt([""],0);function c4(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Ic(t,e,i=0,n=1e9){for(let r=0,a=0,o=!0;a<t.length&&r<=n;a++){let c=t[a],h=r+c.length;h>=i&&(h>n&&(c=c.slice(0,n-r)),r<i&&(c=c.slice(i-r)),o?(e[e.length-1]+=c,o=!1):e.push(c)),r=h+1}return e}function Rv(t,e,i){return Ic(t,[""],e,i)}class lo{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 mt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],a=this.offsets[n],o=a>>1,c=r instanceof mt?r.text.length:r.children.length;if(o==(i>0?c:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
|
|
45
|
+
`,this;e--}else if(r instanceof mt){let h=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,h.length>Math.max(0,e))return this.value=e==0?h:i>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=r.children[o+(i<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof mt?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 mk{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new lo(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 gk{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"&&(Pe.prototype[Symbol.iterator]=function(){return this.iter()},lo.prototype[Symbol.iterator]=mk.prototype[Symbol.iterator]=gk.prototype[Symbol.iterator]=function(){return this});class h4{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 _l(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Dt(t,e,i=!0,n=!0){return o4(t,e,i,n)}function f4(t){return t>=56320&&t<57344}function d4(t){return t>=55296&&t<56320}function oi(t,e){let i=t.charCodeAt(e);if(!d4(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return f4(n)?(i-55296<<10)+(n-56320)+65536:i}function Zg(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function mn(t){return t<65536?1:2}const _m=/\r\n?|\n/;var $t=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})($t||($t={}));class wn{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let a=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,a),r+=a):r+=o,n+=a}}iterChangedRanges(e,i=!1){Hm(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 wn(e)}composeDesc(e){return this.empty?e:e.empty?this:yk(this,e)}mapDesc(e,i=!1){return e.empty?this:Um(this,e,i)}mapPos(e,i=-1,n=$t.Simple){let r=0,a=0;for(let o=0;o<this.sections.length;){let c=this.sections[o++],h=this.sections[o++],d=r+c;if(h<0){if(d>e)return a+(e-r);a+=c}else{if(n!=$t.Simple&&d>=e&&(n==$t.TrackDel&&r<e&&d>e||n==$t.TrackBefore&&r<e||n==$t.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!c)return e==r||i<0?a:a+h;a+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return a}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let a=this.sections[n++],o=this.sections[n++],c=r+a;if(o>=0&&r<=i&&c>=e)return r<e&&c>i?"cover":!0;r=c}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new wn(e)}static create(e){return new wn(e)}}class At extends wn{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 Hm(this,(i,n,r,a,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return Um(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,a=0;r<i.length;r+=2){let o=i[r],c=i[r+1];if(c>=0){i[r]=c,i[r+1]=o;let h=r>>1;for(;n.length<h;)n.push(Pe.empty);n.push(o?e.slice(a,a+o):Pe.empty)}a+=o}return new At(i,n)}compose(e){return this.empty?e:e.empty?this:yk(this,e,!0)}map(e,i=!1){return e.empty?this:Um(this,e,i,!0)}iterChanges(e,i=!1){Hm(this,e,i)}get desc(){return wn.create(this.sections)}filter(e){let i=[],n=[],r=[],a=new So(this);e:for(let o=0,c=0;;){let h=o==e.length?1e9:e[o++];for(;c<h||c==h&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,h-c);Vt(r,p,-1);let g=a.ins==-1?-1:a.off==0?a.ins:0;Vt(i,p,g),g>0&&Dr(n,i,a.text),a.forward(p),c+=p}let d=e[o++];for(;c<d;){if(a.done)break e;let p=Math.min(a.len,d-c);Vt(i,p,-1),Vt(r,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),c+=p}}return{changes:new At(i,n),filtered:wn.create(r)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],r=this.sections[i+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let r=[],a=[],o=0,c=null;function h(p=!1){if(!p&&!r.length)return;o<i&&Vt(r,i-o,-1);let g=new At(r,a);c=c?c.compose(g.map(c)):g,r=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof At){if(p.length!=i)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${i})`);h(),c=c?c.compose(p.map(c)):p}else{let{from:g,to:x=g,insert:v}=p;if(g>x||g<0||x>i)throw new RangeError(`Invalid change range ${g} to ${x} (in doc of length ${i})`);let w=v?typeof v=="string"?Pe.of(v.split(n||_m)):v:Pe.empty,k=w.length;if(g==x&&k==0)return;g<o&&h(),g>o&&Vt(r,g-o,-1),Vt(r,x-g,k),Dr(a,r,w),o=x}}return d(e),h(!c),c}static empty(e){return new At(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;r<e.length;r++){let a=e[r];if(typeof a=="number")i.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,c)=>c&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)i.push(a[0],0);else{for(;n.length<r;)n.push(Pe.empty);n[r]=Pe.of(a.slice(1)),i.push(a[0],n[r].length)}}}return new At(i,n)}static createSet(e,i){return new At(e,i)}}function Vt(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 Dr(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(Pe.empty);t.push(i)}}function Hm(t,e,i){let n=t.inserted;for(let r=0,a=0,o=0;o<t.sections.length;){let c=t.sections[o++],h=t.sections[o++];if(h<0)r+=c,a+=c;else{let d=r,p=a,g=Pe.empty;for(;d+=c,p+=h,h&&n&&(g=g.append(n[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)c=t.sections[o++],h=t.sections[o++];e(r,d,a,p,g),r=d,a=p}}}function Um(t,e,i,n=!1){let r=[],a=n?[]:null,o=new So(t),c=new So(e);for(let h=-1;;){if(o.done&&c.len||c.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&c.ins==-1){let d=Math.min(o.len,c.len);Vt(r,d,-1),o.forward(d),c.forward(d)}else if(c.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(c.len<o.len||c.len==o.len&&!i))){let d=c.len;for(Vt(r,c.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&h<o.i&&o.len<=p&&(Vt(r,0,o.ins),a&&Dr(a,r,o.text),h=o.i),o.forward(p),d-=p}c.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(c.ins==-1){let g=Math.min(p,c.len);d+=g,p-=g,c.forward(g)}else if(c.ins==0&&c.len<p)p-=c.len,c.next();else break;Vt(r,d,h<o.i?o.ins:0),a&&h<o.i&&Dr(a,r,o.text),h=o.i,o.forward(o.len-p)}else{if(o.done&&c.done)return a?At.createSet(r,a):wn.create(r);throw new Error("Mismatched change set lengths")}}}function yk(t,e,i=!1){let n=[],r=i?[]:null,a=new So(t),o=new So(e);for(let c=!1;;){if(a.done&&o.done)return r?At.createSet(n,r):wn.create(n);if(a.ins==0)Vt(n,a.len,0,c),a.next();else if(o.len==0&&!o.done)Vt(n,0,o.ins,c),r&&Dr(r,n,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let h=Math.min(a.len2,o.len),d=n.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;Vt(n,h,p,c),r&&p&&Dr(r,n,o.text)}else o.ins==-1?(Vt(n,a.off?0:a.len,h,c),r&&Dr(r,n,a.textBit(h))):(Vt(n,a.off?0:a.len,o.off?0:o.ins,c),r&&!o.off&&Dr(r,n,o.text));c=(a.ins>h||o.ins>=0&&o.len>h)&&(c||n.length>d),a.forward2(h),o.forward(h)}}}}class So{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?Pe.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?Pe.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 ys{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 ys(n,r,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return X.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return X.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 X.range(e.anchor,e.head)}static create(e,i,n){return new ys(e,i,n)}}class X{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:X.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 X([this.main],0)}addRange(e,i=!0){return X.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,X.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 X(e.ranges.map(i=>ys.fromJSON(i)),e.main)}static single(e,i=e){return new X([X.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let a=e[r];if(a.empty?a.from<=n:a.from<n)return X.normalized(e.slice(),i);n=a.to}return new X(e,i)}static cursor(e,i=0,n,r){return ys.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,i,n,r){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return i<e?ys.create(i,e,48|a):ys.create(e,i,(i>e?8:0)|a)}static normalized(e,i=0){let n=e[i];e.sort((r,a)=>r.from-a.from),i=e.indexOf(n);for(let r=1;r<e.length;r++){let a=e[r],o=e[r-1];if(a.empty?a.from<=o.to:a.from<o.to){let c=o.from,h=Math.max(a.to,o.to);r<=i&&i--,e.splice(--r,2,a.anchor>a.head?X.range(h,c):X.range(c,h))}}return new X(e,i)}}function xk(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let $g=0;class oe{constructor(e,i,n,r,a){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=r,this.id=$g++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new oe(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:e0),!!e.static,e.enables)}of(e){return new Qc([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function e0(t,e){return t==e||t.length==e.length&&t.every((i,n)=>i===e[n])}class Qc{constructor(e,i,n,r){this.dependencies=e,this.facet=i,this.type=n,this.value=r,this.id=$g++}dynamicSlot(e){var i;let n=this.value,r=this.facet.compareInput,a=this.id,o=e[a]>>1,c=this.type==2,h=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?h=!0:g=="selection"?d=!0:(((i=e[g.id])!==null&&i!==void 0?i:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[o]=n(g),1},update(g,x){if(h&&x.docChanged||d&&(x.docChanged||x.selection)||qm(g,p)){let v=n(g);if(c?!Dv(v,g.values[o],r):!r(v,g.values[o]))return g.values[o]=v,1}return 0},reconfigure:(g,x)=>{let v,w=x.config.address[a];if(w!=null){let k=fh(x,w);if(this.dependencies.every(C=>C instanceof oe?x.facet(C)===g.facet(C):C instanceof Gt?x.field(C,!1)==g.field(C,!1):!0)||(c?Dv(v=n(g),k,r):r(v=n(g),k)))return g.values[o]=k,0}else v=n(g);return g.values[o]=v,1}}}}function Dv(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 qm(t,e){let i=!1;for(let n of e)ao(t,n)&1&&(i=!0);return i}function p4(t,e,i){let n=i.map(h=>t[h.id]),r=i.map(h=>h.type),a=n.filter(h=>!(h&1)),o=t[e.id]>>1;function c(h){let d=[];for(let p=0;p<n.length;p++){let g=fh(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)ao(h,d);return h.values[o]=c(h),1},update(h,d){if(!qm(h,a))return 0;let p=c(h);return e.compare(p,h.values[o])?0:(h.values[o]=p,1)},reconfigure(h,d){let p=qm(h,n),g=d.config.facets[e.id],x=d.facet(e);if(g&&!p&&e0(i,g))return h.values[o]=x,0;let v=c(h);return e.compare(v,x)?(h.values[o]=x,0):(h.values[o]=v,1)}}}const mc=oe.define({static:!0});class Gt{constructor(e,i,n,r,a){this.id=e,this.createF=i,this.updateF=n,this.compareF=r,this.spec=a,this.provides=void 0}static define(e){let i=new Gt($g++,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(mc).find(n=>n.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,r)=>{let a=n.values[i],o=this.updateF(a,r);return this.compareF(a,o)?0:(n.values[i]=o,1)},reconfigure:(n,r)=>{let a=n.facet(mc),o=r.facet(mc),c;return(c=a.find(h=>h.field==this))&&c!=o.find(h=>h.field==this)?(n.values[i]=c.create(n),1):r.config.address[this.id]!=null?(n.values[i]=r.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,mc.of({field:this,create:e})]}get extension(){return this}}const ps={lowest:4,low:3,default:2,high:1,highest:0};function Wa(t){return e=>new bk(e,t)}const Es={highest:Wa(ps.highest),high:Wa(ps.high),default:Wa(ps.default),low:Wa(ps.low),lowest:Wa(ps.lowest)};class bk{constructor(e,i){this.inner=e,this.prec=i}}class Ih{of(e){return new Pm(this,e)}reconfigure(e){return Ih.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Pm{constructor(e,i){this.compartment=e,this.inner=i}}class hh{constructor(e,i,n,r,a,o){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=r,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let r=[],a=Object.create(null),o=new Map;for(let x of m4(e,i,o))x instanceof Gt?r.push(x):(a[x.facet.id]||(a[x.facet.id]=[])).push(x);let c=Object.create(null),h=[],d=[];for(let x of r)c[x.id]=d.length<<1,d.push(v=>x.slot(v));let p=n?.config.facets;for(let x in a){let v=a[x],w=v[0].facet,k=p&&p[x]||[];if(v.every(C=>C.type==0))if(c[w.id]=h.length<<1|1,e0(k,v))h.push(n.facet(w));else{let C=w.combine(v.map(M=>M.value));h.push(n&&w.compare(C,n.facet(w))?n.facet(w):C)}else{for(let C of v)C.type==0?(c[C.id]=h.length<<1|1,h.push(C.value)):(c[C.id]=d.length<<1,d.push(M=>C.dynamicSlot(M)));c[w.id]=d.length<<1,d.push(C=>p4(C,w,v))}}let g=d.map(x=>x(c));return new hh(e,o,g,c,h,a)}}function m4(t,e,i){let n=[[],[],[],[],[]],r=new Map;function a(o,c){let h=r.get(o);if(h!=null){if(h<=c)return;let d=n[h].indexOf(o);d>-1&&n[h].splice(d,1),o instanceof Pm&&i.delete(o.compartment)}if(r.set(o,c),Array.isArray(o))for(let d of o)a(d,c);else if(o instanceof Pm){if(i.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;i.set(o.compartment,d),a(d,c)}else if(o instanceof bk)a(o.inner,o.prec);else if(o instanceof Gt)n[c].push(o),o.provides&&a(o.provides,c);else if(o instanceof Qc)n[c].push(o),o.facet.extensions&&a(o.facet.extensions,ps.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,c)}}return a(t,ps.default),n.reduce((o,c)=>o.concat(c))}function ao(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 fh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const vk=oe.define(),Fm=oe.define({combine:t=>t.some(e=>e),static:!0}),Sk=oe.define({combine:t=>t.length?t[0]:void 0,static:!0}),wk=oe.define(),kk=oe.define(),Ck=oe.define(),Ak=oe.define({combine:t=>t.length?t[0]:!1});class kn{constructor(e,i){this.type=e,this.value=i}static define(){return new g4}}class g4{of(e){return new kn(this,e)}}class y4{constructor(e){this.map=e}of(e){return new ke(this,e)}}class ke{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 ke(this.type,i)}is(e){return this.type==e}static define(e={}){return new y4(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let a=r.map(i);a&&n.push(a)}return n}}ke.reconfigure=ke.define();ke.appendConfig=ke.define();class Ot{constructor(e,i,n,r,a,o){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xk(n,i.newLength),a.some(c=>c.type==Ot.time)||(this.annotations=a.concat(Ot.time.of(Date.now())))}static create(e,i,n,r,a,o){return new Ot(e,i,n,r,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(Ot.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}Ot.time=kn.define();Ot.userEvent=kn.define();Ot.addToHistory=kn.define();Ot.remote=kn.define();function x4(t,e){let i=[];for(let n=0,r=0;;){let a,o;if(n<t.length&&(r==e.length||e[r]>=t[n]))a=t[n++],o=t[n++];else if(r<e.length)a=e[r++],o=e[r++];else return i;!i.length||i[i.length-1]<a?i.push(a,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function Mk(t,e,i){var n;let r,a,o;return i?(r=e.changes,a=At.empty(e.changes.length),o=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(a):(n=t.selection)===null||n===void 0?void 0:n.map(r),effects:ke.mapEffects(t.effects,r).concat(ke.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Vm(t,e,i){let n=e.selection,r=Al(e.annotations);return e.userEvent&&(r=r.concat(Ot.userEvent.of(e.userEvent))),{changes:e.changes instanceof At?e.changes:At.of(e.changes||[],i,t.facet(Sk)),selection:n&&(n instanceof X?n:X.single(n.anchor,n.head)),effects:Al(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Tk(t,e,i){let n=Vm(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(i=!1);let o=!!e[a].sequential;n=Mk(n,Vm(t,e[a],o?n.changes.newLength:t.doc.length),o)}let r=Ot.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return v4(i?b4(r):r)}function b4(t){let e=t.startState,i=!0;for(let r of e.facet(wk)){let a=r(t);if(a===!1){i=!1;break}Array.isArray(a)&&(i=i===!0?a:x4(i,a))}if(i!==!0){let r,a;if(i===!1)a=t.changes.invertedDesc,r=At.empty(e.doc.length);else{let o=t.changes.filter(i);r=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}t=Ot.create(e,r,t.selection&&t.selection.map(a),ke.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let n=e.facet(kk);for(let r=n.length-1;r>=0;r--){let a=n[r](t);a instanceof Ot?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Ot?t=a[0]:t=Tk(e,Al(a),!1)}return t}function v4(t){let e=t.startState,i=e.facet(Ck),n=t;for(let r=i.length-1;r>=0;r--){let a=i[r](t);a&&Object.keys(a).length&&(n=Mk(n,Vm(e,a,t.changes.newLength),!0))}return n==t?t:Ot.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const S4=[];function Al(t){return t==null?S4:Array.isArray(t)?t:[t]}var rt=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(rt||(rt={}));const w4=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Im;try{Im=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function k4(t){if(Im)return Im.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>""&&(i.toUpperCase()!=i.toLowerCase()||w4.test(i)))return!0}return!1}function C4(t){return e=>{if(!/\S/.test(e))return rt.Space;if(k4(e))return rt.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return rt.Word;return rt.Other}}class Be{constructor(e,i,n,r,a,o){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)ao(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 ao(this,n),fh(this,n)}update(...e){return Tk(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let c of e.effects)c.is(Ih.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(ke.reconfigure)?(i=null,n=c.value):c.is(ke.appendConfig)&&(i=null,n=Al(n).concat(c.value));let a;i?a=e.startState.values.slice():(i=hh.resolve(n,r,this),a=new Be(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let o=e.startState.facet(Fm)?e.newSelection:e.newSelection.asSingle();new Be(i,e.newDoc,o,a,(c,h)=>h.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:X.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),r=this.changes(n.changes),a=[n.range],o=Al(n.effects);for(let c=1;c<i.ranges.length;c++){let h=e(i.ranges[c]),d=this.changes(h.changes),p=d.map(r);for(let x=0;x<c;x++)a[x]=a[x].map(p);let g=r.mapDesc(d,!0);a.push(h.range.map(g)),r=r.compose(p),o=ke.mapEffects(o,p).concat(ke.mapEffects(Al(h.effects),g))}return{changes:r,selection:X.create(a,i.mainIndex),effects:o}}changes(e=[]){return e instanceof At?e:At.of(e,this.doc.length,this.facet(Be.lineSeparator))}toText(e){return Pe.of(e.split(this.facet(Be.lineSeparator)||_m))}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:(ao(this,i),fh(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 Gt&&this.config.address[r.id]!=null&&(i[n]=r.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(e,a)){let o=n[a],c=e[a];r.push(o.init(h=>o.spec.fromJSON(c,h)))}}return Be.create({doc:e.doc,selection:X.fromJSON(e.selection),extensions:i.extensions?r.concat([i.extensions]):r})}static create(e={}){let i=hh.resolve(e.extensions||[],new Map),n=e.doc instanceof Pe?e.doc:Pe.of((e.doc||"").split(i.staticFacet(Be.lineSeparator)||_m)),r=e.selection?e.selection instanceof X?e.selection:X.single(e.selection.anchor,e.selection.head):X.single(0);return xk(r,n.length),i.staticFacet(Fm)||(r=r.asSingle()),new Be(i,n,r,i.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Be.tabSize)}get lineBreak(){return this.facet(Be.lineSeparator)||`
|
|
46
|
+
`}get readOnly(){return this.facet(Ak)}phrase(e,...i){for(let n of this.facet(Be.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let a=+(r||1);return!a||a>i.length?n:i[a-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let a of this.facet(vk))for(let o of a(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return C4(i.length?i[0]:"")}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-n,c=e-n;for(;o>0;){let h=Dt(i,o,!1);if(a(i.slice(h,o))!=rt.Word)break;o=h}for(;c<r;){let h=Dt(i,c);if(a(i.slice(c,h))!=rt.Word)break;c=h}return o==c?null:X.range(o+n,c+n)}}Be.allowMultipleSelections=Fm;Be.tabSize=oe.define({combine:t=>t.length?t[0]:4});Be.lineSeparator=Sk;Be.readOnly=Ak;Be.phrases=oe.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=vk;Be.changeFilter=wk;Be.transactionFilter=kk;Be.transactionExtender=Ck;Ih.reconfigure=ke.define();function Cn(t,e,i={}){let n={};for(let r of t)for(let a of Object.keys(r)){let o=r[a],c=n[a];if(c===void 0)n[a]=o;else if(!(c===o||o===void 0))if(Object.hasOwnProperty.call(i,a))n[a]=i[a](c,o);else throw new Error("Config merge conflict for field "+a)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Ur{eq(e){return this==e}range(e,i=e){return Qm.create(e,i,this)}}Ur.prototype.startSide=Ur.prototype.endSide=0;Ur.prototype.point=!1;Ur.prototype.mapMode=$t.TrackDel;function t0(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Qm=class Ok{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new Ok(e,i,n)}};function Gm(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class i0{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let a=n?this.to:this.from;for(let o=r,c=a.length;;){if(o==c)return o;let h=o+c>>1,d=a[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-i;if(h==o)return d>=0?o:c;d>=0?c=h:o=h+1}}between(e,i,n,r){for(let a=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,a);a<o;a++)if(r(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,i){let n=[],r=[],a=[],o=-1,c=-1;for(let h=0;h<this.value.length;h++){let d=this.value[h],p=this.from[h]+e,g=this.to[h]+e,x,v;if(p==g){let w=i.mapPos(p,d.startSide,d.mapMode);if(w==null||(x=v=w,d.startSide!=d.endSide&&(v=i.mapPos(p,d.endSide),v<x)))continue}else if(x=i.mapPos(p,d.startSide),v=i.mapPos(g,d.endSide),x>v||x==v&&d.startSide>0&&d.endSide<=0)continue;(v-x||d.endSide-d.startSide)<0||(o<0&&(o=x),d.point&&(c=Math.max(c,v-x)),n.push(d),r.push(x-o),a.push(v-o))}return{mapped:n.length?new i0(r,a,n,c):null,pos:o}}}class Re{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new Re(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:a=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(Gm)),this.isEmpty)return i.length?Re.of(i):this;let c=new Ek(this,null,-1).goto(0),h=0,d=[],p=new Zn;for(;c.value||h<i.length;)if(h<i.length&&(c.from-i[h].from||c.startSide-i[h].value.startSide)>=0){let g=i[h++];p.addInner(g.from,g.to,g.value)||d.push(g)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(h==i.length||this.chunkEnd(c.chunkIndex)<i[h].from)&&(!o||r>this.chunkEnd(c.chunkIndex)||a<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!o||r>c.to||a<c.from||o(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(Qm.create(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Re.empty:this.nextLayer.update({add:d,filter:o,filterFrom:r,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let c=this.chunkPos[o],h=this.chunk[o],d=e.touchesRange(c,c+h.length);if(d===!1)r=Math.max(r,h.maxPoint),i.push(h),n.push(e.mapPos(c));else if(d===!0){let{mapped:p,pos:g}=h.map(c,e);p&&(r=Math.max(r,p.maxPoint),i.push(p),n.push(g))}}let a=this.nextLayer.map(e);return i.length==0?a:new Re(n,i,a||Re.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let a=this.chunkPos[r],o=this.chunk[r];if(i>=a&&e<=a+o.length&&o.between(a,e-a,i-a,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return wo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return wo.from(e).goto(i)}static compare(e,i,n,r,a=-1){let o=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=a),c=i.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=a),h=jv(o,c,n),d=new Xa(o,h,a),p=new Xa(c,h,a);n.iterGaps((g,x,v)=>Lv(d,g,p,x,v,r)),n.empty&&n.length==0&&Lv(d,0,p,0,0,r)}static eq(e,i,n=0,r){r==null&&(r=999999999);let a=e.filter(p=>!p.isEmpty&&i.indexOf(p)<0),o=i.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let c=jv(a,o),h=new Xa(a,c,0).goto(n),d=new Xa(o,c,0).goto(n);for(;;){if(h.to!=d.to||!Ym(h.active,d.active)||h.point&&(!d.point||!t0(h.point,d.point)))return!1;if(h.to>r)return!0;h.next(),d.next()}}static spans(e,i,n,r,a=-1){let o=new Xa(e,null,a).goto(i),c=i,h=o.openStart;for(;;){let d=Math.min(o.to,n);if(o.point){let p=o.activeForPoint(o.to),g=o.pointFrom<i?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,h);r.point(c,d,o.point,p,g,o.pointRank),h=Math.min(o.openEnd(d),p.length)}else d>c&&(r.span(c,d,o.active,h),h=o.openEnd(d));if(o.to>n)return h+(o.point&&o.to>n?1:0);c=o.to,o.next()}}static of(e,i=!1){let n=new Zn;for(let r of e instanceof Qm?[e]:i?A4(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Re.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Re.empty;r=r.nextLayer)i=new Re(r.chunkPos,r.chunk,i,Math.max(r.maxPoint,i.maxPoint));return i}}Re.empty=new Re([],[],null,-1);function A4(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let n=t[i];if(Gm(e,n)>0)return t.slice().sort(Gm);e=n}return t}Re.empty.nextLayer=Re.empty;class Zn{finishChunk(e){this.chunks.push(new i0(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 Zn)).add(e,i,n)}addInner(e,i,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=i,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let n=i.value.length-1;return this.last=i.value[n],this.lastFrom=i.from[n]+e,this.lastTo=i.to[n]+e,!0}finish(){return this.finishInner(Re.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=Re.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function jv(t,e,i){let n=new Map;for(let a of t)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&n.set(a.chunk[o],a.chunkPos[o]);let r=new Set;for(let a of e)for(let o=0;o<a.chunk.length;o++){let c=n.get(a.chunk[o]);c!=null&&(i?i.mapPos(c):c)==a.chunkPos[o]&&!i?.touchesRange(c,c+a.chunk[o].length)&&r.add(a.chunk[o])}return r}class Ek{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 wo{constructor(e){this.heap=e}static from(e,i=null,n=-1){let r=[];for(let a=0;a<e.length;a++)for(let o=e[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new Ek(o,i,n,a));return r.length==1?r[0]:new wo(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--)qp(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--)qp(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(),qp(this.heap,0)}}}function qp(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 Xa{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=wo.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){gc(this.active,e),gc(this.activeTo,e),gc(this.activeRank,e),this.minActive=Bv(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:r,rank:a}=this.cursor;for(;i<this.activeRank.length&&(a-this.activeRank[i]||r-this.activeTo[i])>0;)i++;yc(this.active,i,n),yc(this.activeTo,i,r),yc(this.activeRank,i,a),e&&yc(e,i,this.cursor.from),this.minActive=Bv(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&&gc(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(n),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&i.push(this.active[n]);return i.reverse()}openEnd(e){let i=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)i++;return i}}function Lv(t,e,i,n,r,a){t.goto(e),i.goto(n);let o=n+r,c=n,h=n-e,d=!!a.boundChange;for(let p=!1;;){let g=t.to+h-i.to,x=g||t.endSide-i.endSide,v=x<0?t.to+h:i.to,w=Math.min(v,o);if(t.point||i.point?(t.point&&i.point&&t0(t.point,i.point)&&Ym(t.activeForPoint(t.to),i.activeForPoint(i.to))||a.comparePoint(c,w,t.point,i.point),p=!1):(p&&a.boundChange(c),w>c&&!Ym(t.active,i.active)&&a.compareRange(c,w,t.active,i.active),d&&w<o&&(g||t.openEnd(v)!=i.openEnd(v))&&(p=!0)),v>o)break;c=v,x<=0&&t.next(),x>=0&&i.next()}}function Ym(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!t0(t[i],e[i]))return!1;return!0}function gc(t,e){for(let i=e,n=t.length-1;i<n;i++)t[i]=t[i+1];t.pop()}function yc(t,e,i){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=i}function Bv(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 Kl(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=Dt(t,r));return n}function Km(t,e,i,n){for(let r=0,a=0;;){if(a>=e)return r;if(r==t.length)break;a+=t.charCodeAt(r)==9?i-a%i:1,r=Dt(t,r)}return n===!0?-1:t.length}const Wm="ͼ",zv=typeof Symbol>"u"?"__"+Wm:Symbol.for(Wm),Xm=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),_v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class qr{constructor(e,i){this.rules=[];let{finish:n}=i||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,c,h,d){let p=[],g=/^@(\w+)\b/.exec(o[0]),x=g&&g[1]=="keyframes";if(g&&c==null)return h.push(o[0]+";");for(let v in c){let w=c[v];if(/&/.test(v))a(v.split(/,\s*/).map(k=>o.map(C=>k.replace(/&/,C))).reduce((k,C)=>k.concat(C)),w,h);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");a(r(v),w,p,x)}else w!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+w+";")}(p.length||x)&&h.push((n&&!g&&!d?o.map(n):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in e)a(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
47
|
+
`)}static newName(){let e=_v[zv]||1;return _v[zv]=e+1,Wm+e.toString(36)}static mount(e,i,n){let r=e[Xm],a=n&&n.nonce;r?a&&r.setNonce(a):r=new M4(e,a),r.mount(Array.isArray(i)?i:[i],e)}}let Hv=new Map;class M4{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let a=Hv.get(n);if(a)return e[Xm]=a;this.sheet=new r.CSSStyleSheet,Hv.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Xm]=this}mount(e,i){let n=this.sheet,r=0,a=0;for(let o=0;o<e.length;o++){let c=e[o],h=this.modules.indexOf(c);if(h<a&&h>-1&&(this.modules.splice(h,1),a--,h=-1),h==-1){if(this.modules.splice(a++,0,c),n)for(let d=0;d<c.rules.length;d++)n.insertRule(c.rules[d],r++)}else{for(;a<h;)r+=this.modules[a++].rules.length;r+=c.rules.length,a++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let h=0;h<this.modules.length;h++)o+=this.modules[h].getRules()+`
|
|
48
|
+
`;this.styleTag.textContent=o;let c=i.head||i;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Pr={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:"'"},ko={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},T4=typeof navigator<"u"&&/Mac/.test(navigator.platform),O4=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ut=0;Ut<10;Ut++)Pr[48+Ut]=Pr[96+Ut]=String(Ut);for(var Ut=1;Ut<=24;Ut++)Pr[Ut+111]="F"+Ut;for(var Ut=65;Ut<=90;Ut++)Pr[Ut]=String.fromCharCode(Ut+32),ko[Ut]=String.fromCharCode(Ut);for(var Pp in Pr)ko.hasOwnProperty(Pp)||(ko[Pp]=Pr[Pp]);function E4(t){var e=T4&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||O4&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?ko:Pr)[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++)Nk(t,arguments[e]);return t}function Nk(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++)Nk(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}let Jt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Jm=typeof document<"u"?document:{documentElement:{style:{}}};const Zm=/Edge\/(\d+)/.exec(Jt.userAgent),Rk=/MSIE \d/.test(Jt.userAgent),$m=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Jt.userAgent),Qh=!!(Rk||$m||Zm),Uv=!Qh&&/gecko\/(\d+)/i.test(Jt.userAgent),Fp=!Qh&&/Chrome\/(\d+)/.exec(Jt.userAgent),N4="webkitFontSmoothing"in Jm.documentElement.style,eg=!Qh&&/Apple Computer/.test(Jt.vendor),qv=eg&&(/Mobile\/\w+/.test(Jt.userAgent)||Jt.maxTouchPoints>2);var ae={mac:qv||/Mac/.test(Jt.platform),windows:/Win/.test(Jt.platform),linux:/Linux|X11/.test(Jt.platform),ie:Qh,ie_version:Rk?Jm.documentMode||6:$m?+$m[1]:Zm?+Zm[1]:0,gecko:Uv,gecko_version:Uv?+(/Firefox\/(\d+)/.exec(Jt.userAgent)||[0,0])[1]:0,chrome:!!Fp,chrome_version:Fp?+Fp[1]:0,ios:qv,android:/Android\b/.test(Jt.userAgent),webkit_version:N4?+(/\bAppleWebKit\/(\d+)/.exec(Jt.userAgent)||[0,0])[1]:0,safari:eg,safari_version:eg?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Jt.userAgent)||[0,0])[1]:0,tabSize:Jm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function n0(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 dh=Object.create(null);function r0(t,e,i){if(t==e)return!0;t||(t=dh),e||(e=dh);let n=Object.keys(t),r=Object.keys(e);if(n.length-0!=r.length-0)return!1;for(let a of n)if(a!=i&&(r.indexOf(a)==-1||t[a]!==e[a]))return!1;return!0}function R4(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 Pv(t,e,i){let n=!1;if(e)for(let r in e)i&&r in i||(n=!0,r=="style"?t.style.cssText="":t.removeAttribute(r));if(i)for(let r in i)e&&e[r]==i[r]||(n=!0,r=="style"?t.style.cssText=i[r]:t.setAttribute(r,i[r]));return n}function D4(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i];e[n.name]=n.value}return e}class An{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 Pt=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(Pt||(Pt={}));class ye extends Ur{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 Po(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 As(e,i,i,n,e.widget||null,!1)}static replace(e){let i=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:a,end:o}=Dk(e,i);n=(a?i?-3e8:-1:5e8)-1,r=(o?i?2e8:1:-6e8)+1}return new As(e,n,r,i,e.widget||null,!0)}static line(e){return new Fo(e)}static set(e,i=!1){return Re.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ye.none=Re.empty;class Po extends ye{constructor(e){let{start:i,end:n}=Dk(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?n0(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||dh}eq(e){return this==e||e instanceof Po&&this.tagName==e.tagName&&r0(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)}}Po.prototype.point=!1;class Fo extends ye{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Fo&&this.spec.class==e.spec.class&&r0(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)}}Fo.prototype.mapMode=$t.TrackBefore;Fo.prototype.point=!0;class As extends ye{constructor(e,i,n,r,a,o){super(i,n,a,e),this.block=r,this.isReplace=o,this.mapMode=r?i<=0?$t.TrackBefore:$t.TrackAfter:$t.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof As&&j4(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)}}As.prototype.point=!0;function Dk(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 j4(t,e){return t==e||!!(t&&e&&t.compare(e))}function Ml(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 Co extends Ur{constructor(e,i){super(),this.tagName=e,this.attributes=i}eq(e){return e==this||e instanceof Co&&this.tagName==e.tagName&&r0(this.attributes,e.attributes)}static create(e){return new Co(e.tagName,e.attributes||dh)}static set(e,i=!1){return Re.of(e,i)}}Co.prototype.startSide=Co.prototype.endSide=-1;function Ao(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function tg(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function oo(t,e){if(!e.anchorNode)return!1;try{return tg(t,e.anchorNode)}catch{return!1}}function uo(t){return t.nodeType==3?To(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function co(t,e,i,n){return i?Fv(t,e,i,n,-1)||Fv(t,e,i,n,1):!1}function Fr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function ph(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Fv(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:$n(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=Fr(t)+(r<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?$n(t):0}else return!1}}function $n(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Mo(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function L4(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 jk(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 B4(t,e,i,n,r,a,o,c){let h=t.ownerDocument,d=h.defaultView||window;for(let p=t,g=!1;p&&!g;)if(p.nodeType==1){let x,v=p==h.body,w=1,k=1;if(v)x=L4(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 E=p.getBoundingClientRect();({scaleX:w,scaleY:k}=jk(p,E)),x={left:E.left,right:E.left+p.clientWidth*w,top:E.top,bottom:E.top+p.clientHeight*k}}let C=0,M=0;if(r=="nearest")e.top<x.top?(M=e.top-(x.top+o),i>0&&e.bottom>x.bottom+M&&(M=e.bottom-x.bottom+o)):e.bottom>x.bottom&&(M=e.bottom-x.bottom+o,i<0&&e.top-M<x.top&&(M=e.top-(x.top+o)));else{let E=e.bottom-e.top,D=x.bottom-x.top;M=(r=="center"&&E<=D?e.top+E/2-D/2:r=="start"||r=="center"&&i<0?e.top-o:e.bottom-D+o)-x.top}if(n=="nearest"?e.left<x.left?(C=e.left-(x.left+a),i>0&&e.right>x.right+C&&(C=e.right-x.right+a)):e.right>x.right&&(C=e.right-x.right+a,i<0&&e.left<x.left+C&&(C=e.left-(x.left+a))):C=(n=="center"?e.left+(e.right-e.left)/2-(x.right-x.left)/2:n=="start"==c?e.left-a:e.right-(x.right-x.left)+a)-x.left,C||M)if(v)d.scrollBy(C,M);else{let E=0,D=0;if(M){let G=p.scrollTop;p.scrollTop+=M/k,D=(p.scrollTop-G)*k}if(C){let G=p.scrollLeft;p.scrollLeft+=C/w,E=(p.scrollLeft-G)*w}e={left:e.left-E,top:e.top-D,right:e.right-E,bottom:e.bottom-D},E&&Math.abs(E-C)<1&&(n="nearest"),D&&Math.abs(D-M)<1&&(r="nearest")}if(v)break;(e.top<x.top||e.bottom>x.bottom||e.left<x.left||e.right>x.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function z4(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 _4{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?$n(i):0),n,Math.min(e.focusOffset,n?$n(n):0))}set(e,i,n,r){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=r}}let ds=null;ae.safari&&ae.safari_version>=26&&(ds=!1);function Lk(t){if(t.setActive)return t.setActive();if(ds)return t.focus(ds);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(ds==null?{get preventScroll(){return ds={preventScroll:!0},!0}}:void 0),!ds){ds=!1;for(let i=0;i<e.length;){let n=e[i++],r=e[i++],a=e[i++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let Vv;function To(t,e,i=e){let n=Vv||(Vv=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function Tl(t,e,i,n){let r={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let a=new KeyboardEvent("keydown",r);a.synthetic=!0,t.dispatchEvent(a);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,t.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function H4(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function U4(t,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,$n(i));;)if(n){if(i.nodeType!=1)return!1;let r=i.childNodes[n-1];r.contentEditable=="false"?n--:(i=r,n=$n(i))}else{if(i==t)return!0;n=Fr(i),i=i.parentNode}}function Bk(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function zk(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=$n(i)}else if(i.parentNode&&!ph(i))n=Fr(i),i=i.parentNode;else return null}}function _k(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&&!ph(i))n=Fr(i)+1,i=i.parentNode;else return null}}class Zi{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new Zi(e.parentNode,Fr(e),i)}static after(e,i){return new Zi(e.parentNode,Fr(e)+1,i)}}var Je=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Je||(Je={}));const Ms=Je.LTR,s0=Je.RTL;function Hk(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const q4=Hk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),P4=Hk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ig=Object.create(null),cn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);ig[e]=i,ig[i]=-e}function Uk(t){return t<=247?q4[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?P4[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const F4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class yn{get dir(){return this.level%2?s0:Ms}constructor(e,i,n){this.from=e,this.to=i,this.level=n}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,n,r){let a=-1;for(let o=0;o<e.length;o++){let c=e[o];if(c.from<=i&&c.to>=i){if(c.level==n)return o;(a<0||(r!=0?r<0?c.from<i:c.to>i:e[a].level>c.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function qk(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||!qk(n.inner,r.inner))return!1}return!0}const Xe=[];function V4(t,e,i,n,r){for(let a=0;a<=n.length;a++){let o=a?n[a-1].to:e,c=a<n.length?n[a].from:i,h=a?256:r;for(let d=o,p=h,g=h;d<c;d++){let x=Uk(t.charCodeAt(d));x==512?x=p:x==8&&g==4&&(x=16),Xe[d]=x==4?2:x,x&7&&(g=x),p=x}for(let d=o,p=h,g=h;d<c;d++){let x=Xe[d];if(x==128)d<c-1&&p==Xe[d+1]&&p&24?x=Xe[d]=p:Xe[d]=256;else if(x==64){let v=d+1;for(;v<c&&Xe[v]==64;)v++;let w=d&&p==8||v<i&&Xe[v]==8?g==1?1:8:256;for(let k=d;k<v;k++)Xe[k]=w;d=v-1}else x==8&&g==1&&(Xe[d]=1);p=x,x&7&&(g=x)}}}function I4(t,e,i,n,r){let a=r==1?2:1;for(let o=0,c=0,h=0;o<=n.length;o++){let d=o?n[o-1].to:e,p=o<n.length?n[o].from:i;for(let g=d,x,v,w;g<p;g++)if(v=ig[x=t.charCodeAt(g)])if(v<0){for(let k=c-3;k>=0;k-=3)if(cn[k+1]==-v){let C=cn[k+2],M=C&2?r:C&4?C&1?a:r:0;M&&(Xe[g]=Xe[cn[k]]=M),c=k;break}}else{if(cn.length==189)break;cn[c++]=g,cn[c++]=x,cn[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=cn[C+2];if(M&2)break;if(k)cn[C+2]|=2;else{if(M&4)break;cn[C+2]|=4}}}}}function Q4(t,e,i,n){for(let r=0,a=n;r<=i.length;r++){let o=r?i[r-1].to:t,c=r<i.length?i[r].from:e;for(let h=o;h<c;){let d=Xe[h];if(d==256){let p=h+1;for(;;)if(p==c){if(r==i.length)break;p=i[r++].to,c=r<i.length?i[r].from:e}else if(Xe[p]==256)p++;else break;let g=a==1,x=(p<e?Xe[p]:n)==1,v=g==x?g?1:2:n;for(let w=p,k=r,C=k?i[k-1].to:t;w>h;)w==C&&(w=i[--k].from,C=k?i[k-1].to:t),Xe[--w]=v;h=p}else a=d,h++}}}function ng(t,e,i,n,r,a,o){let c=n%2?2:1;if(n%2==r%2)for(let h=e,d=0;h<i;){let p=!0,g=!1;if(d==a.length||h<a[d].from){let k=Xe[h];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d<a.length&&w==a[d].from){if(g)break e;let k=a[d];if(!p)for(let C=k.to,M=d+1;;){if(C==i)break e;if(M<a.length&&a[M].from==C)C=a[M++].to;else{if(Xe[C]==c)break e;break}}if(d++,x)x.push(k);else{k.from>h&&o.push(new yn(h,k.from,v));let C=k.direction==Ms!=!(v%2);rg(t,C?n+1:n,r,k.inner,k.from,k.to,o),h=k.to}w=k.to}else{if(w==i||(p?Xe[w]!=c:Xe[w]==c))break;w++}x?ng(t,h,w,n+1,r,x,o):h<w&&o.push(new yn(h,w,v)),h=w}else for(let h=i,d=a.length;h>e;){let p=!0,g=!1;if(!d||h>a[d-1].to){let k=Xe[h-1];k!=c&&(p=!1,g=k==16)}let x=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d&&w==a[d-1].to){if(g)break e;let k=a[--d];if(!p)for(let C=k.from,M=d;;){if(C==e)break e;if(M&&a[M-1].to==C)C=a[--M].from;else{if(Xe[C-1]==c)break e;break}}if(x)x.push(k);else{k.to<h&&o.push(new yn(k.to,h,v));let C=k.direction==Ms!=!(v%2);rg(t,C?n+1:n,r,k.inner,k.from,k.to,o),h=k.from}w=k.from}else{if(w==e||(p?Xe[w-1]!=c:Xe[w-1]==c))break;w--}x?ng(t,w,h,n+1,r,x,o):w<h&&o.push(new yn(w,h,v)),h=w}}function rg(t,e,i,n,r,a,o){let c=e%2?2:1;V4(t,r,a,n,c),I4(t,r,a,n,c),Q4(r,a,n,c),ng(t,r,a,e,i,n,o)}function G4(t,e,i){if(!t)return[new yn(0,0,e==s0?1:0)];if(e==Ms&&!i.length&&!F4.test(t))return Pk(t.length);if(i.length)for(;t.length>Xe.length;)Xe[Xe.length]=256;let n=[],r=e==Ms?0:1;return rg(t,r,r,i,0,t.length,n),n}function Pk(t){return[new yn(0,t,0)]}let Fk="";function Y4(t,e,i,n,r){var a;let o=n.head-t.from,c=yn.find(e,o,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),h=e[c],d=h.side(r,i);if(o==d){let x=c+=r?1:-1;if(x<0||x>=e.length)return null;h=e[c=x],o=h.side(!r,i),d=h.side(r,i)}let p=Dt(t.text,o,h.forward(r,i));(p<h.from||p>h.to)&&(p=d),Fk=t.text.slice(Math.min(o,p),Math.max(o,p));let g=c==(r?e.length-1:0)?null:e[c+(r?1:-1)];return g&&p==d&&g.level+(r?0:1)<h.level?X.cursor(g.side(!r,i)+t.from,g.forward(r,i)?1:-1,g.level):X.cursor(p+t.from,h.forward(r,i)?-1:1,h.level)}function K4(t,e,i){for(let n=e;n<i;n++){let r=Uk(t.charCodeAt(n));if(r==1)return Ms;if(r==2||r==4)return s0}return Ms}const Vk=oe.define(),Ik=oe.define(),Qk=oe.define(),Gk=oe.define(),sg=oe.define(),Yk=oe.define(),Kk=oe.define(),l0=oe.define(),a0=oe.define(),Wk=oe.define({combine:t=>t.some(e=>e)}),Xk=oe.define({combine:t=>t.some(e=>e)}),Jk=oe.define();class Ol{constructor(e,i="nearest",n="nearest",r=5,a=5,o=!1){this.range=e,this.y=i,this.x=n,this.yMargin=r,this.xMargin=a,this.isSnapshot=o}map(e){return e.empty?this:new Ol(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 Ol(X.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xc=ke.define({map:(t,e)=>t.map(e)}),Zk=ke.define();function fi(t,e,i){let n=t.facet(Gk);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 Gn=oe.define({combine:t=>t.length?t[0]:!0});let W4=0;const vl=oe.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 ht{constructor(e,i,n,r,a){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(vl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(vl.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:r,provide:a,decorations:o}=i||{};return new ht(W4++,e,n,r,c=>{let h=[];return o&&h.push(Gh.of(d=>{let p=d.plugin(c);return p?o(p):ye.none})),a&&h.push(a(c)),h})}static fromClass(e,i){return ht.define((n,r)=>new e(n,r),i)}}class Vp{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(fi(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){fi(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){fi(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const $k=oe.define(),o0=oe.define(),Gh=oe.define(),eC=oe.define(),u0=oe.define(),Vo=oe.define(),tC=oe.define();function Iv(t,e){let i=t.state.facet(tC);if(!i.length)return i;let n=i.map(a=>a instanceof Function?a(t):a),r=[];return Re.spans(n,e.from,e.to,{point(){},span(a,o,c,h){let d=a-e.from,p=o-e.from,g=r;for(let x=c.length-1;x>=0;x--,h--){let v=c[x].spec.bidiIsolate,w;if(v==null&&(v=K4(e.text,d,p)),h>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=p,g=w.inner;else{let k={from:d,to:p,direction:v,inner:[]};g.push(k),g=k.inner}}}}),r}const iC=oe.define();function c0(t){let e=0,i=0,n=0,r=0;for(let a of t.state.facet(iC)){let o=a(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(i=Math.max(i,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:i,top:n,bottom:r}}const to=oe.define();class Fi{constructor(e,i,n,r){this.fromA=e,this.toA=i,this.fromB=n,this.toB=r}join(e){return new Fi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,n=this;for(;i>0;i--){let r=e[i-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(i-1,1)}}return e.splice(i,0,n),e}static extendWithRanges(e,i){if(i.length==0)return e;let n=[];for(let r=0,a=0,o=0;;){let c=r<e.length?e[r].fromB:1e9,h=a<i.length?i[a]:1e9,d=Math.min(c,h);if(d==1e9)break;let p=d+o,g=d,x=p;for(;;)if(a<i.length&&i[a]<=g){let v=i[a+1];a+=2,g=Math.max(g,v);for(let w=r;w<e.length&&e[w].fromB<=g;w++)o=e[w].toA-e[w].toB;x=Math.max(x,v+o)}else if(r<e.length&&e[r].fromB<=g){let v=e[r++];g=Math.max(g,v.toB),x=Math.max(x,v.toA),o=v.toA-v.toB}else break;n.push(new Fi(p,x,d,g))}return n}}class mh{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=At.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let r=[];this.changes.iterChangedRanges((a,o,c,h)=>r.push(new Fi(a,o,c,h))),this.changedRanges=r}static create(e,i,n){return new mh(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 X4=[];class kt{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 X4}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&&R4(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=Fr(this.dom),r=this.length?e>0:i>0;return new Zi(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 Kh)return e;return null}static get(e){return e.cmTile}}class Yh extends kt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let i=this.dom,n=null,r,a=e?.node==i?e:null,o=0;for(let c of this.children){if(c.sync(e),o+=c.length+c.breakAfter,r=n?n.nextSibling:i.firstChild,a&&r!=c.dom&&(a.written=!0),c.dom.parentNode==i)for(;r&&r!=c.dom;)r=Qv(r);else i.insertBefore(c.dom,r);n=c.dom}for(r=n?n.nextSibling:i.firstChild,a&&r&&(a.written=!0);r;)r=Qv(r);this.length=o}}function Qv(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Kh extends Yh{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=kt.get(e);if(i&&this.owns(i))return i;e=e.parentNode}}blockTiles(e){for(let i=[],n=this,r=0,a=0;;)if(r==n.children.length){if(!i.length)return;n=n.parent,n.breakAfter&&a++,r=i.pop()}else{let o=n.children[r++];if(o instanceof Yn)i.push(r),n=o,r=0;else{let c=a+o.length,h=e(o,a);if(h!==void 0)return h;a=c+o.breakAfter}}}resolveBlock(e,i){let n,r=-1,a,o=-1;if(this.blockTiles((c,h)=>{let d=h+c.length;if(e>=h&&e<=d){if(c.isWidget()&&i>=-1&&i<=1){if(c.flags&32)return!0;c.flags&16&&(n=void 0)}(h<e||e==d&&(i<-1?c.length:c.covers(1)))&&(!n||!c.isWidget()&&n.isWidget())&&(n=c,r=e-h),(d>e||e==h&&(i>1?c.length:c.covers(-1)))&&(!a||!c.isWidget()&&a.isWidget())&&(a=c,o=e-h)}}),!n&&!a)throw new Error("No tile at position "+e);return n&&i<0||!a?{tile:n,offset:r}:{tile:a,offset:o}}}class Yn extends Yh{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 Yn(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class Hl extends Yh{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,n){let r=new Hl(i||document.createElement("div"),e);return(!i||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,i,n){let r=null,a=-1,o=null,c=-1;function h(p,g){for(let x=0,v=0;x<p.children.length&&v<=g;x++){let w=p.children[x],k=v+w.length;k>=g&&(w.isComposite()?h(w,g-v):(!o||o.isHidden&&(i>0||n&&Z4(o,w)))&&(k>g||w.flags&32)?(o=w,c=g-v):(v<g||w.flags&16&&!w.isHidden)&&(r=w,a=g-v)),v=k}}h(this,e);let d=(i<0?r:o)||r||o;return d?{tile:d,offset:d==r?a:c}:null}coordsIn(e,i){let n=this.resolveInline(e,i,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),i):J4(this)}domIn(e,i){let n=this.resolveInline(e,i);if(n){let{tile:r,offset:a}=n;if(this.dom.contains(r.dom))return r.isText()?new Zi(r.dom,Math.min(r.dom.nodeValue.length,a)):r.domPosFor(a,r.flags&16?1:r.flags&32?-1:i);let o=n.tile.parent,c=!1;for(let h of o.children){if(c)return new Zi(h.dom,0);h==n.tile&&(c=!0)}}return new Zi(this.dom,0)}}function J4(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=uo(e);return i[i.length-1]||null}function Z4(t,e){let i=t.coordsIn(0,1),n=e.coordsIn(0,1);return i&&n&&n.top<i.bottom}class ci extends Yh{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let n=new ci(i||document.createElement(e.tagName),e);return i||(n.flags|=4),n}}class xs extends kt{constructor(e,i){super(e,i.length),this.text=i}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,i){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,a=e,o=0;e==0&&i<0||e==n&&i>=0?ae.chrome||ae.gecko||(e?(r--,o=1):a<n&&(a++,o=-1)):i<0?r--:a<n&&a++;let c=To(this.dom,r,a).getClientRects();if(!c.length)return null;let h=c[(o?o<0:i>=0)?0:c.length-1];return ae.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(c,d=>d.width)||h),o?Mo(h,o<0):h||null}static of(e,i){let n=new xs(i||document.createTextNode(e),e);return i||(n.flags|=2),n}}class Ts extends kt{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 Mo(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=c?a.length-1:0;o=a[h],!(e>0?h==0:h==a.length-1||o.top<o.bottom);h+=c?-1:1);return Mo(o,!c)}}get overrideDOMText(){if(!this.length)return Pe.empty;let{root:e}=this;if(!e)return Pe.empty;let i=this.posAtStart;return e.view.state.doc.slice(i,i+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,n,r,a){return a||(a=e.toDOM(i),e.editable||(a.contentEditable="false")),new Ts(a,n,e,r)}}class gh extends kt{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 Pe.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class $4{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,n){let{tile:r,index:a,beforeBreak:o,parents:c}=this;for(;e||i>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(a==r.children.length){if(!e&&!c.length)break;n&&n.leave(r),o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++}else{let h=r.children[a],d=h.breakAfter;(i>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(o=!!d,a++,e-=h.length):(c.push({tile:r,index:a}),r=h,a=0,n&&h.isComposite()&&n.enter(h))}else if(a==r.length)o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++;else if(e){let h=Math.min(e,r.length-a);n&&n.skip(r,a,a+h),e-=h,a+=h}else break;return this.tile=r,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class ej{constructor(e,i,n,r){this.from=e,this.to=i,this.wrapper=n,this.rank=r}}class tj{constructor(e,i,n){this.cache=e,this.root=i,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,i,n,r){var a;this.flushBuffer();let o=this.ensureMarks(i,n),c=o.lastChild;if(c&&c.isText()&&!(c.flags&8)&&c.length+e.length<512){this.cache.reused.set(c,2);let h=o.children[o.children.length-1]=new xs(c.dom,c.text+e);h.parent=o}else o.append(r||xs.of(e,(a=this.cache.find(xs))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,i){let n=this.curLine;n.dom!=i.line.dom&&(n.setDOM(this.cache.reused.has(i.line)?Ip(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 ci&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(Ip(h.dom)),r=d;else{if(this.cache.reused.get(h)){let g=kt.get(h.dom);g&&g.setDOM(Ip(h.dom))}let p=ci.of(h.mark,h.dom);r.append(p),r=p}this.cache.reused.set(h,2)}let a=kt.get(e.text);a&&this.cache.reused.set(a,2);let o=new xs(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,i,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let a=this.ensureMarks(i,n);!r&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,i,n){this.flushBuffer(),this.ensureMarks(i,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let i=this.afterWidget||this.lastBlock;i.length+=e,this.pos+=e}addLineStart(e,i){var n;e||(e=nC);let r=Hl.start(e,i||((n=this.cache.find(Hl))===null||n===void 0?void 0:n.dom),!!i);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,i){var n;let r=this.curLine;for(let a=e.length-1;a>=0;a--){let o=e[a],c;if(i>0&&(c=r.lastChild)&&c instanceof ci&&c.mark.eq(o))r=c,i--;else{let h=ci.of(o,(n=this.cache.find(ci,d=>d.mark.eq(o)))===null||n===void 0?void 0:n.dom);r.append(h),r=h,i=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Gv(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ae.ios&&Gv(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Qp,0,32)||new Ts(Qp.toDOM(),0,Qp,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 ej(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 Yn&&r.wrapper.eq(n.wrapper))i=r;else{let a=Yn.of(n.wrapper,(e=this.cache.find(Yn,o=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);i.append(a),i=a}}return i}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let i=2|(e<0?16:32),n=this.cache.find(gh,void 0,1);return n&&(n.flags=i),n||new gh(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class ij{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let c=this.textOff=Math.min(e,r.length);return a?null:r.slice(0,c)}let i=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,i);return this.textOff=i,n}}const yh=[Ts,Hl,xs,ci,gh,Yn,Kh];for(let t=0;t<yh.length;t++)yh[t].bucket=t;class nj{constructor(e){this.view=e,this.buckets=yh.map(()=>[]),this.index=yh.map(()=>0),this.reused=new Map}add(e){let i=e.constructor.bucket,n=this.buckets[i];n.length<6?n.push(e):n[this.index[i]=(this.index[i]+1)%6]=e}find(e,i,n=2){let r=e.bucket,a=this.buckets[r],o=this.index[r];for(let c=a.length-1;c>=0;c--){let h=(c+o)%a.length,d=a[h];if((!i||i(d))&&!this.reused.has(d))return a.splice(h,1),h<o&&this.index[r]--,this.reused.set(d,n),d}return null}findWidget(e,i,n){let r=this.buckets[0];if(r.length)for(let a=0,o=0;;a++){if(a==r.length){if(o)return null;o=1,a=0}let c=r[a];if(!this.reused.has(c)&&(o==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return r.splice(a,1),a<this.index[0]&&this.index[0]--,c.widget==e&&c.length==i&&(c.flags&497)==n?(this.reused.set(c,1),c):(this.reused.set(c,2),new Ts(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 rj{constructor(e,i,n,r,a){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new nj(e),this.text=new ij(e.state.doc),this.builder=new tj(this.cache,new Kh(e,e.contentDOM),Re.iter(n)),this.cache.reused.set(i,2),this.old=new $4(i),this.reuseWalker={skip:(o,c,h)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,i){let n=i&&this.getCompositionContext(i.text);for(let r=0,a=0,o=0;;){let c=o<e.length?e[o++]:null,h=c?c.fromA:this.old.root.length;if(h>r){let d=h-r;this.preserve(d,!o,!c),r=h,a+=d}if(!c)break;i&&c.fromA<=i.range.fromA&&c.toA>=i.range.toA?(this.forward(c.fromA,i.range.fromA,i.range.fromA<i.range.toA?1:-1),this.emit(a,i.range.fromB),this.cache.clear(),this.builder.addComposition(i,n),this.text.skip(i.range.toB-i.range.fromB),this.forward(i.range.fromA,c.toA),this.emit(i.range.toB,c.toB)):(this.forward(c.fromA,c.toA),this.emit(a,c.toB)),a=c.toB,r=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,n){let r=aj(this.old),a=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,c,h)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(h-c);else{let d=h>0||c<o.length?Ts.of(o.widget,this.view,h-c,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,a),a=r.length)}else if(o.isText())this.builder.ensureLine(null),!c&&h==o.length?this.builder.addText(o.text,r,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(c,h),r,a)),a=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof gh)this.cache.add(o);else if(o instanceof ci)this.builder.ensureLine(null),this.builder.addMark(o,r,a),this.cache.reused.set(o,1),a=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ci&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=a=0):o instanceof ci&&(r.shift(),a=Math.min(a,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let n=null,r=this.builder,a=0,o=Re.spans(this.decorations,e,i,{point:(c,h,d,p,g,x)=>{if(d instanceof As){if(this.disallowBlockEffectsFor[x]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,g>p.length)r.continueWidget(h-c);else{let v=d.widget||(d.block?Ul.block:Ul.inline),w=sj(d),k=this.cache.findWidget(v,h-c,w)||Ts.of(v,this.view,h-c,w);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(k)):(r.ensureLine(n),r.addInlineWidget(k,p,g))}n=null}else n=lj(n,d);h>c&&this.text.skip(h-c)},span:(c,h,d,p)=>{for(let g=c;g<h;){let x=this.text.next(Math.min(512,h-g));x==null?(r.addLineStartIfNotCovered(n),r.addBreak(),g++):(r.ensureLine(n),r.addText(x,d,g==c?p:d.length),g+=x.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=o>a,this.openMarks=o}forward(e,i,n=1){i-e<=10?this.old.advance(i-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(i-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let i=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let a=kt.get(r);if(r==this.view.contentDOM)break;a instanceof ci?i.push(a):a?.isLine()?n=a:a instanceof Yn||(r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new Hl(r,nC):n||i.push(ci.of(new Po({tagName:r.nodeName.toLowerCase(),attributes:D4(r)}),r)))}return{line:n,marks:i}}}function Gv(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 sj(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 nC={class:"cm-line"};function lj(t,e){let i=e.spec.attributes,n=e.spec.class;return!i&&!n||(t||(t={class:"cm-line"}),i&&n0(i,t),n&&(t.class+=" "+n)),t}function aj(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 ci&&e.push(n.mark)}return e}function Ip(t){let e=kt.get(t);return e&&e.setDOM(t.cloneNode()),t}class Ul extends An{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}}Ul.inline=new Ul("span");Ul.block=new Ul("div");const Qp=new class extends An{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Yv{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ye.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 Kh(e,e.contentDOM),this.updateInner([new Fi(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:!gj(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let a=r>-1?uj(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;n=new Fi(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(ae.ie||ae.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,c=this.blockWrappers;this.updateDeco();let h=fj(o,this.decorations,e.changes);h.length&&(n=Fi.extendWithRanges(n,h));let d=pj(c,this.blockWrappers,e.changes);return d.length&&(n=Fi.extendWithRanges(n,d)),a&&!n.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(i||e.length){let o=this.tile,c=new rj(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,i),lg(o,c.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=ae.chrome||ae.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof Gp&&r.push(a.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let n of i.effects)n.is(Zk)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,a=r==n,o=!a&&!(this.view.state.facet(Gn)||n.tabIndex>-1)&&oo(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(a||i||o))return;let c=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,d,p;if(h.empty?p=d=this.inlineDOMNearPos(h.anchor,h.assoc||1):(p=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),d=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),ae.gecko&&h.empty&&!this.hasComposition&&oj(d)){let x=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(x,d.node.childNodes[d.offset]||null)),d=p=new Zi(x,0),c=!0}let g=this.view.observer.selectionRange;(c||!g.focusNode||(!co(d.node,d.offset,g.anchorNode,g.anchorOffset)||!co(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,h))&&(this.view.observer.ignore(()=>{ae.android&&ae.chrome&&n.contains(g.focusNode)&&mj(g.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let x=Ao(this.view.root);if(x)if(h.empty){if(ae.gecko){let v=cj(d.node,d.offset);if(v&&v!=3){let w=(v==1?zk:_k)(d.node,d.offset);w&&(d=new Zi(w.node,w.offset))}}x.collapse(d.node,d.offset),h.bidiLevel!=null&&x.caretBidiLevel!==void 0&&(x.caretBidiLevel=h.bidiLevel)}else if(x.extend){x.collapse(d.node,d.offset);try{x.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();h.anchor>h.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),x.removeAllRanges(),x.addRange(v)}o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Zi(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new Zi(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&co(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=Ao(e.root),{anchorNode:r,anchorOffset:a}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let o=this.lineAt(i.head,i.assoc);if(!o)return;let c=o.posAtStart;if(i.head==c||i.head==c+o.length)return;let h=this.coordsAt(i.head,-1),d=this.coordsAt(i.head,1);if(!h||!d||h.bottom>d.top)return;let p=this.domAtPos(i.head+i.assoc,i.assoc);n.collapse(p.node,p.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=i.from&&n.collapse(r,a)}posFromDOM(e,i){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let a;if(e==n.dom)a=n.dom.childNodes[i];else{let o=$n(e)==0?0:i==0?-1:1;for(;;){let c=e.parentNode;if(c==n.dom)break;o==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?o=-1:o=1),e=c}o<0?a=e:a=e.nextSibling}if(a==n.dom.firstChild)return r;for(;a&&!kt.get(a);)a=a.nextSibling;if(!a)return r+n.length;for(let o=0,c=r;;o++){let h=n.children[o];if(h.dom==a)return c;c+=h.length+h.breakAfter}}else return n.isText()?e==n.dom?r+i:r+(i?n.length:0):r}domAtPos(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.domPosFor(e,i):n.domIn(r,i)}inlineDOMNearPos(e,i){let n,r=-1,a=!1,o,c=-1,h=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(a=!0)}else{let g=p+d.length;if(p<=e&&(n=d,r=e-p,a=g<e),g>=e&&!o&&(o=d,c=e-p,h=p>e),p>e&&o)return!0}}),!n&&!o?this.domAtPos(e,i):(a&&o?n=null:h&&n&&(o=null),n&&i<0||!o?n.domIn(r,i):o.domIn(c,i))}coordsAt(e,i){let{tile:n,offset:r}=this.tile.resolveBlock(e,i);return n.isWidget()?n.widget instanceof Gp?null:n.coordsInWidget(r,i,!0):n.coordsIn(r,i)}lineAt(e,i){let{tile:n}=this.tile.resolveBlock(e,i);return n.isLine()?n:null}coordsForChar(e){let{tile:i,offset:n}=this.tile.resolveBlock(e,1);if(!i.isLine())return null;function r(a,o){if(a.isComposite())for(let c of a.children){if(c.length>=o){let h=r(c,o);if(h)return h}if(o-=c.length,o<0)break}else if(a.isText()&&o<a.length){let c=Dt(a.text,o);if(c==o)return null;let h=To(a.dom,o,c).getClientRects();for(let d=0;d<h.length;d++){let p=h[d];if(d==h.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(i,n)}measureVisibleLineHeights(e){let i=[],{from:n,to:r}=e,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==Je.LTR,d=0,p=(g,x,v)=>{for(let w=0;w<g.children.length&&!(x>r);w++){let k=g.children[w],C=x+k.length,M=k.dom.getBoundingClientRect(),{height:E}=M;if(v&&!w&&(d+=M.top-v.top),k instanceof Yn)C>n&&p(k,x,M);else if(x>=n&&(d>0&&i.push(-d),i.push(E+d),d=0,o)){let D=k.dom.lastChild,G=D?uo(D):[];if(G.length){let L=G[G.length-1],I=h?L.right-M.left:M.right-L.left;I>c&&(c=I,this.minWidth=a,this.minWidthFrom=x,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-M.bottom),x=C+k.breakAfter}};return p(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?Je.RTL:Je.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let c=0,h;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=uo(d.dom);if(p.length!=1)return;c+=p[0].width,h=p[0].height}if(c)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:c/o.length,textHeight:h}}});if(e)return e;let i=document.createElement("div"),n,r,a;return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let o=uo(i.firstChild)[0];n=i.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,a=o&&o.height?o.height:n,i.remove()}),{lineHeight:n,charWidth:r,textHeight:a}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,r=0;;r++){let a=r==i.viewports.length?null:i.viewports[r],o=a?a.from-1:this.view.state.doc.length;if(o>n){let c=(i.lineBlockAt(o).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(ye.replace({widget:new Gp(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!a)break;n=a.to+1}return ye.set(e)}updateDeco(){let e=1,i=this.view.state.facet(Gh).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),n=!1,r=this.view.state.facet(u0).map((a,o)=>{let c=typeof a=="function";return c&&(n=!0),c?a(this.view):a});for(r.length&&(this.dynamicDecorationMap[e++]=n,i.push(Re.join(r))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(eC).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(Jk))try{if(d(this.view,e.range,e))return!0}catch(p){fi(this.view.state,p,"scroll handler")}let{range:i}=e,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),r;if(!n)return;!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let a=c0(this.view),o={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:c,offsetHeight:h}=this.view.scrollDOM;if(B4(this.view.scrollDOM,o,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==Je.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(){lg(this.tile)}}function lg(t,e){let i=e?.get(t);if(i!=1){i==null&&t.destroy();for(let n of t.children)lg(n,e)}}function oj(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 rC(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=zk(i.focusNode,i.focusOffset),r=_k(i.focusNode,i.focusOffset),a=n||r;if(r&&n&&r.node!=n.node){let c=kt.get(r.node);if(!c||c.isText()&&c.text!=r.node.nodeValue)a=r;else if(t.docView.lastCompositionAfterCursor){let h=kt.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(a=r)}}if(t.docView.lastCompositionAfterCursor=a!=n,!a)return null;let o=e-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function uj(t,e,i){let n=rC(t,i);if(!n)return null;let{node:r,from:a,to:o}=n,c=r.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(n.from,n.to)!=c)return null;let h=e.invertedDesc;return{range:new Fi(h.mapPos(a),h.mapPos(o),a,o),text:r}}function cj(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 hj=class{constructor(){this.changes=[]}compareRange(e,i){Ml(e,i,this.changes)}comparePoint(e,i){Ml(e,i,this.changes)}boundChange(e){Ml(e,e,this.changes)}};function fj(t,e,i){let n=new hj;return Re.compare(t,e,i,n),n.changes}class dj{constructor(){this.changes=[]}compareRange(e,i){Ml(e,i,this.changes)}comparePoint(){}boundChange(e){Ml(e,e,this.changes)}}function pj(t,e,i){let n=new dj;return Re.compare(t,e,i,n),n.changes}function mj(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 gj(t,e){let i=!1;return e&&t.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(i=!0)}),i}class Gp extends An{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 yj(t,e,i=1){let n=t.charCategorizer(e),r=t.doc.lineAt(e),a=e-r.from;if(r.length==0)return X.cursor(e);a==0?i=1:a==r.length&&(i=-1);let o=a,c=a;i<0?o=Dt(r.text,a,!1):c=Dt(r.text,a);let h=n(r.text.slice(o,c));for(;o>0;){let d=Dt(r.text,o,!1);if(n(r.text.slice(d,o))!=h)break;o=d}for(;c<r.length;){let d=Dt(r.text,c);if(n(r.text.slice(c,d))!=h)break;c=d}return X.range(o+r.from,c+r.from)}function xj(t,e,i,n,r){let a=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,h=Math.floor((r-i.top-(t.defaultLineHeight-c)*.5)/c);a+=h*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+Km(o,a,t.state.tabSize)}function ag(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let a of n.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!r||a.type==Pt.Text&&(r.type!=a.type||(i<0?a.from<e:a.to>e)))&&(r=a)}}return r||n}return n}function bj(t,e,i,n){let r=ag(t,e.head,e.assoc||-1),a=!n||r.type!=Pt.Text||!(t.lineWrapping||r.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(a){let o=t.dom.getBoundingClientRect(),c=t.textDirectionAt(r.from),h=t.posAtCoords({x:i==(c==Je.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(h!=null)return X.cursor(h,i?-1:1)}return X.cursor(i?r.to:r.from,i?-1:1)}function Kv(t,e,i,n){let r=t.state.doc.lineAt(e.head),a=t.bidiSpans(r),o=t.textDirectionAt(r.from);for(let c=e,h=null;;){let d=Y4(r,a,o,c,i),p=Fk;if(!d){if(r.number==(i?t.state.doc.lines:1))return c;p=`
|
|
49
|
+
`,r=t.state.doc.line(r.number+(i?1:-1)),a=t.bidiSpans(r),d=t.visualLineSide(r,!i)}if(h){if(!h(p))return c}else{if(!n)return d;h=n(p)}c=d}}function vj(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return a=>{let o=n(a);return r==rt.Space&&(r=o),r==o}}function Sj(t,e,i,n){let r=e.head,a=i?1:-1;if(r==(i?t.state.doc.length:0))return X.cursor(r,e.assoc);let o=e.goalColumn,c,h=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(r,(e.empty?e.assoc:0)||(i?1:-1)),p=t.documentTop;if(d)o==null&&(o=d.left-h.left),c=a<0?d.top:d.bottom;else{let w=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-w.from))),c=(a<0?w.top:w.bottom)+p}let g=h.left+o,x=n??t.viewState.heightOracle.textHeight>>1,v=og(t,{x:g,y:c+x*a},!1,a);return X.cursor(v.pos,v.assoc,void 0,o)}function ho(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(a,o,c)=>{if(e>a&&e<o){let h=n||i||(e-a<o-e?-1:1);e=h<0?a:o,n=h}});if(!n)return e}}function sC(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],a=null;if(r.empty){let o=ho(t,r.from,0);o!=r.from&&(a=X.cursor(o,-1))}else{let o=ho(t,r.from,-1),c=ho(t,r.to,1);(o!=r.from||c!=r.to)&&(a=X.range(r.from==r.anchor?o:c,r.from==r.head?o:c))}a&&(i||(i=e.ranges.slice()),i[n]=a)}return i?X.create(i,e.mainIndex):e}function Yp(t,e,i){let n=ho(t.state.facet(Vo).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:X.cursor(n,n<i.from?1:-1)}class gn{constructor(e,i){this.pos=e,this.assoc=i}}function og(t,e,i,n){let r=t.contentDOM.getBoundingClientRect(),a=r.top+t.viewState.paddingTop,{x:o,y:c}=e,h=c-a,d;for(;;){if(h<0)return new gn(0,1);if(h>t.viewState.docHeight)return new gn(t.state.doc.length,-1);if(d=t.elementAtHeight(h),n==null)break;if(d.type==Pt.Text){if(n<0?d.to<t.viewport.from:d.from>t.viewport.to)break;let x=t.docView.coordsAt(n<0?d.from:d.to,n>0?-1:1);if(x&&(n<0?x.top<=h+a:x.bottom>=h+a))break}let g=t.viewState.heightOracle.textHeight/2;h=n>0?d.bottom+g:d.top-g}if(t.viewport.from>=d.to||t.viewport.to<=d.from){if(i)return null;if(d.type==Pt.Text){let g=xj(t,r,d,o,c);return new gn(g,g==d.from?1:-1)}}if(d.type!=Pt.Text)return h<(d.top+d.bottom)/2?new gn(d.from,1):new gn(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 wj(t,o,c,t.textDirectionAt(d.from)).scanTile(p,d.from)}class wj{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[yn.find(r,e-n.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:n,spans:r}=this.bidiSpansAt(e);return r[yn.find(r,e-n.from,-1,i)].dir}bidiIn(e,i){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<i)}scan(e,i){let n=0,r=e.length-1,a=new Set,o=this.bidiIn(e[0],e[r]),c,h,d=-1,p=1e9,g;e:for(;n<r;){let v=r-n,w=n+r>>1;t:if(a.has(w)){let C=n+Math.floor(Math.random()*v);for(let M=0;M<v;M++){if(!a.has(C)){w=C;break t}C++,C==r&&(C=n)}break e}a.add(w);let k=i(w);if(k)for(let C=0;C<k.length;C++){let M=k[C],E=0;if(M.bottom<this.y)(!c||c.bottom<M.bottom)&&(c=M),E=1;else if(M.top>this.y)(!h||h.top>M.top)&&(h=M),E=-1;else{let D=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,G=Math.abs(D);G<p&&(d=w,p=G,g=M),D&&(E=D<0==(this.baseDir==Je.LTR)?-1:1)}E==-1&&(!o||this.baseDirAt(e[w],1))?r=w:E==1&&(!o||this.baseDirAt(e[w+1],-1))&&(n=w+1)}}if(!g){let v=c&&(!h||this.y-c.bottom<h.top-this.y)?c:h;return this.y=(v.top+v.bottom)/2,this.scan(e,i)}let x=(o?this.dirAt(e[d],1):this.baseDir)==Je.LTR;return{i:d,after:this.x>(g.left+g.right)/2==x}}scanText(e,i){let n=[];for(let a=0;a<e.length;a=Dt(e.text,a))n.push(i+a);n.push(i+e.length);let r=this.scan(n,a=>{let o=n[a]-i,c=n[a+1]-i;return To(e.dom,o,c).getClientRects()});return r.after?new gn(n[r.i+1],-1):new gn(n[r.i],1)}scanTile(e,i){if(!e.length)return new gn(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:To(h.dom,0,h.length)).getClientRects()}),a=e.children[r.i],o=n[r.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):r.after?new gn(n[r.i+1],-1):new gn(o,1)}}const io="";class kj{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+=io}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let a=this.text.length;this.readNode(r);let o=kt.get(r),c=r.nextSibling;if(c==i){o?.breakAfter&&!c&&n!=this.view.contentDOM&&this.lineBreak();break}let h=kt.get(c);(o&&h?o.breakAfter:(o?o.breakAfter:ph(r))||ph(c)&&(r.nodeName!="BR"||o?.isWidget())&&this.text.length>a)&&!Aj(c,i)&&this.lineBreak(),r=c}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,c;if(this.lineSeparator?(a=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(c=r.exec(i))&&(a=c.index,o=c[0].length),this.append(i.slice(n,a<0?i.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);n=a+o}}readNode(e){let i=kt.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+(Cj(e,n.node,n.offset)?i:0))}}function Cj(t,e,i){for(;;){if(!e||i<$n(e))return!1;if(e==t)return!0;i=Fr(e)+1,e=e.parentNode}}function Aj(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=kt.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 Wv{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class Mj{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=lC(e.docView.tile,i,n,0))){let c=a||o?[]:Oj(e),h=new kj(c,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=Ej(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!tg(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!tg(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),p=e.viewport;if((ae.ios||ae.chrome)&&e.state.selection.main.empty&&h!=d&&(p.from>0||p.to<e.state.doc.length)){let g=Math.min(h,d),x=Math.max(h,d),v=p.from-g,w=p.to-x;(v==0||v==1||g==0)&&(w==0||w==-1||x==e.state.doc.length)&&(h=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(X.range(d,h)):this.newSel=X.single(d,h)}}}function lC(t,e,i,n){if(t.isComposite()){let r=-1,a=-1,o=-1,c=-1;for(let h=0,d=n,p=n;h<t.children.length;h++){let g=t.children[h],x=d+g.length;if(d<e&&x>i)return lC(g,e,i,d);if(x>=e&&r==-1&&(r=h,a=d),d>i&&g.dom.parentNode==t.dom){o=h,c=p;break}p=x,d=x+g.breakAfter}return{from:a,to:c<0?n+t.length:c,startDOM:(r?t.children[r-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:n,to:n+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function aC(t,e){let i,{newSel:n}=e,r=t.state.selection.main,a=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:c}=e.bounds,h=r.from,d=null;(a===8||ae.android&&e.text.length<c-o)&&(h=r.to,d="end");let p=oC(t.state.doc.sliceString(o,c,io),e.text,h-o,d);p&&(ae.chrome&&a==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==io+io&&p.toB--,i={from:o+p.from,to:o+p.toA,insert:Pe.of(e.text.slice(p.from,p.toB).split(io))})}else n&&(!t.hasFocus&&t.state.facet(Gn)||xh(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)}:(ae.mac||ae.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=X.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:Pe.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)}:ae.chrome&&i&&i.from==i.to&&i.from==r.head&&i.insert.toString()==`
|
|
50
|
+
`&&t.lineWrapping&&(n&&(n=X.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:Pe.of([" "])}),i)return h0(t,i,n,a);if(n&&!xh(n,r)){let o=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=sC(t.state.facet(Vo).map(h=>h(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:c}),!0}else return!1}function h0(t,e,i,n=-1){if(ae.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(ae.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&&Tl(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)&&Tl(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Tl(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,c=()=>o||(o=Tj(t,e,i));return t.state.facet(Yk).some(h=>h(t,e.from,e.to,a,c))||t.dispatch(c()),!0}function Tj(t,e,i){let n,r=t.state,a=r.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let h=e.from<a.from?-1:1,d=h<0?a.from:a.to,p=ho(r.facet(Vo).map(g=>g(t)),d,h);e.from==p&&(o=p)}if(o>-1)n={changes:e,selection:X.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let h=a.from<e.from?r.sliceDoc(a.from,e.from):"",d=a.to>e.to?r.sliceDoc(e.to,a.to):"";n=r.replaceSelection(t.state.toText(h+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let h=r.changes(e),d=i&&i.main.to<=h.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let p=t.state.sliceDoc(e.from,e.to),g,x=i&&rC(t,i.main.head);if(x){let w=e.insert.length-(e.to-e.from);g={from:x.from,to:x.to-w}}else g=t.state.doc.lineAt(a.head);let v=a.to-e.to;n=r.changeByRange(w=>{if(w.from==a.from&&w.to==a.to)return{changes:h,range:d||w.map(h)};let k=w.to-v,C=k-p.length;if(t.state.sliceDoc(C,k)!=p||k>=g.from&&C<=g.to)return{range:w};let M=r.changes({from:C,to:k,insert:e.insert}),E=w.to-a.to;return{changes:M,range:d?X.range(Math.max(0,d.anchor+E),Math.max(0,d.head+E)):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 oC(t,e,i,n){let r=Math.min(t.length,e.length),a=0;for(;a<r&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==r&&t.length==e.length)return null;let o=t.length,c=e.length;for(;o>0&&c>0&&t.charCodeAt(o-1)==e.charCodeAt(c-1);)o--,c--;if(n=="end"){let h=Math.max(0,a-Math.min(o,c));i-=o+h-a}if(o<a&&t.length<e.length){let h=i<=a&&i>=o?a-i:0;a-=h,c=a+(c-o),o=a}else if(c<a){let h=i<=a&&i>=c?a-i:0;a-=h,o=a+(o-c),c=a}return{from:a,toA:o,toB:c}}function Oj(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a}=t.observer.selectionRange;return i&&(e.push(new Wv(i,n)),(r!=i||a!=n)&&e.push(new Wv(r,a))),e}function Ej(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?X.single(i+e,n+e):null}function xh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class Nj{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,ae.safari&&e.contentDOM.addEventListener("input",()=>null),ae.gecko&&Qj(e.contentDOM.ownerDocument)}handleEvent(e){!Hj(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=Rj(e),n=this.handlers,r=this.view.contentDOM;for(let a in i)if(a!="scroll"){let o=!i[a].handlers.length,c=n[a];c&&o!=!c.handlers.length&&(r.removeEventListener(a,this.handleEvent),c=null),c||r.addEventListener(a,this.handleEvent,{passive:o})}for(let a in n)a!="scroll"&&!i[a]&&r.removeEventListener(a,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&cC.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ae.android&&ae.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return ae.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=uC.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||Dj.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Tl(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:ae.safari&&!ae.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Xv(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(r){fi(i.state,r)}}}function Rj(t){let e=Object.create(null);function i(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let r=n.spec,a=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(a)for(let c in a){let h=a[c];h&&i(c).handlers.push(Xv(n.value,h))}if(o)for(let c in o){let h=o[c];h&&i(c).observers.push(Xv(n.value,h))}}for(let n in tn)i(n).handlers.push(tn[n]);for(let n in Gi)i(n).observers.push(Gi[n]);return e}const uC=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Dj="dthko",cC=[16,17,18,20,91,92,224,225],bc=6;function vc(t){return Math.max(0,t)*.7+8}function jj(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Lj{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=z4(e.contentDOM),this.atoms=e.state.facet(Vo).map(o=>o(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(Be.allowMultipleSelections)&&Bj(e,i),this.dragging=_j(e,i)&&dC(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&&jj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=0,a=0,o=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:c}=this.scrollParents.y.getBoundingClientRect());let h=c0(this.view);e.clientX-h.left<=r+bc?i=-vc(r-e.clientX):e.clientX+h.right>=o-bc&&(i=vc(e.clientX-o)),e.clientY-h.top<=a+bc?n=-vc(a-e.clientY):e.clientY+h.bottom>=c-bc&&(n=vc(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=sC(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 Bj(t,e){let i=t.state.facet(Vk);return i.length?i[0](e):ae.mac?e.metaKey:e.ctrlKey}function zj(t,e){let i=t.state.facet(Ik);return i.length?i[0](e):ae.mac?!e.altKey:!e.ctrlKey}function _j(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Ao(t.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let a=0;a<r.length;a++){let o=r[a];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Hj(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=kt.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const tn=Object.create(null),Gi=Object.create(null),hC=ae.ie&&ae.ie_version<15||ae.ios&&ae.webkit_version<604;function Uj(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(),fC(t,i.value)},50)}function Wh(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function fC(t,e){e=Wh(t.state,l0,e);let{state:i}=t,n,r=1,a=i.toText(e),o=a.lines==i.selection.ranges.length;if(ug!=null&&i.selection.ranges.every(h=>h.empty)&&ug==a.toString()){let h=-1;n=i.changeByRange(d=>{let p=i.doc.lineAt(d.from);if(p.from==h)return{range:d};h=p.from;let g=i.toText((o?a.line(r++).text:e)+i.lineBreak);return{changes:{from:p.from,insert:g},range:X.cursor(d.from+g.length)}})}else o?n=i.changeByRange(h=>{let d=a.line(r++);return{changes:{from:h.from,to:h.to,insert:d.text},range:X.cursor(h.from+d.length)}}):n=i.replaceSelection(a);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Gi.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};tn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Gi.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Gi.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};tn.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(Qk))if(i=n(t,e),i)break;if(!i&&e.button==0&&(i=Pj(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new Lj(t,e,i,n)),n&&t.observer.ignore(()=>{Lk(t.contentDOM);let a=t.root.activeElement;a&&!a.contains(t.contentDOM)&&a.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Jv(t,e,i,n){if(n==1)return X.cursor(e,i);if(n==2)return yj(t.state,e,i);{let r=t.docView.lineAt(e,i),a=t.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:a.from,c=r?r.posAtEnd:a.to;return c<t.state.doc.length&&c==a.to&&c++,X.range(o,c)}}const qj=ae.ie&&ae.ie_version<=11;let Zv=null,$v=0,eS=0;function dC(t){if(!qj)return t.detail;let e=Zv,i=eS;return Zv=t,eS=Date.now(),$v=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?($v+1)%3:1}function Pj(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=dC(e),r=t.state.selection;return{update(a){a.docChanged&&(i.pos=a.changes.mapPos(i.pos),r=r.map(a.changes))},get(a,o,c){let h=t.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=Jv(t,h.pos,h.assoc,n);if(i.pos!=h.pos&&!o){let g=Jv(t,i.pos,i.assoc,n),x=Math.min(g.from,p.from),v=Math.max(g.to,p.to);p=x<p.from?X.range(x,v):X.range(v,x)}return o?r.replaceRange(r.main.extend(p.from,p.to)):c&&n==1&&r.ranges.length>1&&(d=Fj(r,h.pos))?d:c?r.addRange(p):X.create([p])}}}function Fj(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 X.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}tn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let r=t.docView.tile.nearest(e.target);if(r&&r.isWidget()){let a=r.posAtStart,o=a+r.length;(a>=i.to||o<=i.from)&&(i=X.range(a,o))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Wh(t.state,a0,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};tn.dragend=t=>(t.inputState.draggedContent=null,!1);function tS(t,e,i,n){if(i=Wh(t.state,l0,i),!i)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=t.inputState,o=n&&a&&zj(t,e)?{from:a.from,to:a.to}:null,c={from:r,insert:i},h=t.state.changes(o?[o,c]:c);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}tn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),r=0,a=()=>{++r==i.length&&tS(t,e,n.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<i.length;o++){let c=new FileReader;c.onerror=a,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[o]=c.result),a()},c.readAsText(i[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return tS(t,e,n,!0),!0}return!1};tn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=hC?null:e.clipboardData;return i?(fC(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(Uj(t),!1)};function Vj(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 Ij(t){let e=[],i=[],n=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),i.push(r));if(!e.length){let r=-1;for(let{from:a}of t.selection.ranges){let o=t.doc.lineAt(a);o.number>r&&(e.push(o.text),i.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),r=o.number}n=!0}return{text:Wh(t,a0,e.join(t.lineBreak)),ranges:i,linewise:n}}let ug=null;tn.copy=tn.cut=(t,e)=>{if(!oo(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:r}=Ij(t.state);if(!i&&!r)return!1;ug=r?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let a=hC?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",i),!0):(Vj(t,i),!1)};const pC=kn.define();function mC(t,e){let i=[];for(let n of t.facet(Kk)){let r=n(t,e);r&&i.push(r)}return i.length?t.update({effects:i,annotations:pC.of(!0)}):null}function gC(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=mC(t.state,e);i?t.dispatch(i):t.update([])}},10)}Gi.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),gC(t)};Gi.blur=t=>{t.observer.clearSelectionRange(),gC(t)};Gi.compositionstart=Gi.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Gi.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,ae.chrome&&ae.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Gi.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};tn.beforeinput=(t,e)=>{var i,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let a=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),o=e.getTargetRanges();if(a&&o.length){let c=o[0],h=t.posAtDOM(c.startContainer,c.startOffset),d=t.posAtDOM(c.endContainer,c.endOffset);return h0(t,{from:h,to:d,insert:t.state.toText(a)},null),!0}}let r;if(ae.chrome&&ae.android&&(r=uC.find(a=>a.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return ae.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),ae.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Gi.compositionend(t,e),20),!1};const iS=new Set;function Qj(t){iS.has(t)||(iS.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const nS=["pre-wrap","normal","pre-line","break-spaces"];let ql=!1;function rS(){ql=!1}class Gj{constructor(e){this.lineWrapping=e,this.doc=Pe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,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 nS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(i=!0,this.heightSamples[Math.floor(r*10)]=!0)}return i}refresh(e,i,n,r,a,o){let c=nS.indexOf(e)>-1,h=Math.abs(i-this.lineHeight)>.3||this.lineWrapping!=c||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=c,this.lineHeight=i,this.charWidth=n,this.textHeight=r,this.lineLength=a,h){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return h}}class Yj{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class Ji{constructor(e,i,n,r,a){this.from=e,this.length=i,this.top=n,this.height=r,this._content=a}get type(){return typeof this._content=="number"?Pt.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 As?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 Ji(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var $e=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})($e||($e={}));const Gc=.001;class ei{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)>Gc&&(ql=!0),this.height=e)}replace(e,i,n){return ei.of(n)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,n,r){let a=this,o=n.doc;for(let c=r.length-1;c>=0;c--){let{fromA:h,toA:d,fromB:p,toB:g}=r[c],x=a.lineAt(h,$e.ByPosNoHeight,n.setDoc(i),0,0),v=x.to>=d?x:a.lineAt(d,$e.ByPosNoHeight,n,0,0);for(g+=v.to-d,d=v.to;c>0&&x.from<=r[c-1].toA;)h=r[c-1].fromA,p=r[c-1].fromB,c--,h<x.from&&(x=a.lineAt(h,$e.ByPosNoHeight,n,0,0));p+=x.from-h,h=x.from;let w=f0.build(n.setDoc(o),e,p,g);a=bh(a,a.replace(h,d,w))}return a.updateHeight(n,0)}static empty(){return new Ti(0,0,0)}static of(e){if(e.length==1)return e[0];let i=0,n=e.length,r=0,a=0;for(;;)if(i==n)if(r>a*2){let c=e[i-1];c.break?e.splice(--i,1,c.left,null,c.right):e.splice(--i,1,c.left,c.right),n+=1+c.break,r-=c.size}else if(a>r*2){let c=e[n];c.break?e.splice(n,1,c.left,null,c.right):e.splice(n,1,c.left,c.right),n+=2+c.break,a-=c.size}else break;else if(r<a){let c=e[i++];c&&(r+=c.size)}else{let c=e[--n];c&&(a+=c.size)}let o=0;return e[i-1]==null?(o=1,i--):e[i]==null&&(o=1,n++),new Wj(ei.of(e.slice(0,i)),o,ei.of(e.slice(n)))}}function bh(t,e){return t==e?t:(t.constructor!=e.constructor&&(ql=!0),e)}ei.prototype.size=1;const Kj=ye.replace({});class yC extends ei{constructor(e,i,n){super(e,i),this.deco=n,this.spaceAbove=0}mainBlock(e,i){return new Ji(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 Ji(r,0,n,this.spaceAbove,Kj):this.mainBlock(n,r)}lineAt(e,i,n,r,a){let o=this.mainBlock(r,a);return this.spaceAbove?this.blockAt(0,n,r,a).join(o):o}forEachLine(e,i,n,r,a,o){e<=a+this.length&&i>=a&&o(this.lineAt(0,$e.ByPos,n,r,a))}setMeasuredHeight(e){let i=e.heights[e.index++];i<0?(this.spaceAbove=-i,i=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(i)}updateHeight(e,i=0,n=!1,r){return r&&r.from<=i&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ti extends yC{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 Ji(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 Ti||r instanceof Ht&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Ht?r=new Ti(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):ei.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 Ht extends ei{constructor(e){super(e,0)}heightMetrics(e,i){let n=e.doc.lineAt(i).number,r=e.doc.lineAt(i+this.length).number,a=r-n+1,o,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*a);o=h/a,this.length>a+1&&(c=(this.height-h)/(this.length-a-1))}else o=this.height/a;return{firstLine:n,lastLine:r,perLine:o,perChar:c}}blockAt(e,i,n,r){let{firstLine:a,lastLine:o,perLine:c,perChar:h}=this.heightMetrics(i,r);if(i.lineWrapping){let d=r+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),p=i.doc.lineAt(d),g=c+p.length*h,x=Math.max(n,e-g/2);return new Ji(p.from,p.length,x,g,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((e-n)/c))),{from:p,length:g}=i.doc.line(a+d);return new Ji(p,g,n+c*d,c,0)}}lineAt(e,i,n,r,a){if(i==$e.ByHeight)return this.blockAt(e,n,r,a);if(i==$e.ByPosNoHeight){let{from:v,to:w}=n.doc.lineAt(e);return new Ji(v,w-v,0,0,0)}let{firstLine:o,perLine:c,perChar:h}=this.heightMetrics(n,a),d=n.doc.lineAt(e),p=c+d.length*h,g=d.number-o,x=r+c*g+h*(d.from-a-g);return new Ji(d.from,d.length,Math.max(r,Math.min(x,r+this.height-p)),p,0)}forEachLine(e,i,n,r,a,o){e=Math.max(e,a),i=Math.min(i,a+this.length);let{firstLine:c,perLine:h,perChar:d}=this.heightMetrics(n,a);for(let p=e,g=r;p<=i;){let x=n.doc.lineAt(p);if(p==e){let w=x.number-c;g+=h*w+d*(e-a-w)}let v=h+d*x.length;o(new Ji(x.from,x.length,g,v,0)),g+=v,p=x.to+1}}replace(e,i,n){let r=this.length-i;if(r>0){let a=n[n.length-1];a instanceof Ht?n[n.length-1]=new Ht(a.length+r):n.push(null,new Ht(r-1))}if(e>0){let a=n[0];a instanceof Ht?n[0]=new Ht(e+a.length):n.unshift(new Ht(e-1),null)}return ei.of(n)}decomposeLeft(e,i){i.push(new Ht(e-1),null)}decomposeRight(e,i){i.push(null,new Ht(this.length-e-1))}updateHeight(e,i=0,n=!1,r){let a=i+this.length;if(r&&r.from<=i+this.length&&r.more){let o=[],c=Math.max(i,r.from),h=-1;for(r.from>i&&o.push(new Ht(r.from-i-1).updateHeight(e,i));c<=a&&r.more;){let p=e.doc.lineAt(c).length;o.length&&o.push(null);let g=r.heights[r.index++],x=0;g<0&&(x=-g,g=r.heights[r.index++]),h==-1?h=g:Math.abs(g-h)>=Gc&&(h=-2);let v=new Ti(p,g,x);v.outdated=!1,o.push(v),c+=p+1}c<=a&&o.push(null,new Ht(a-c).updateHeight(e,c));let d=ei.of(o);return(h<0||Math.abs(d.height-this.height)>=Gc||Math.abs(h-this.heightMetrics(e,i).perLine)>=Gc)&&(ql=!0),bh(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 Wj extends ei{constructor(e,i,n){super(e.length+i+n.length,e.height+n.height,i|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,i,n,r){let a=n+this.left.height;return e<a?this.left.blockAt(e,i,n,r):this.right.blockAt(e,i,a,r+this.left.length+this.break)}lineAt(e,i,n,r,a){let o=r+this.left.height,c=a+this.left.length+this.break,h=i==$e.ByHeight?e<o:e<c,d=h?this.left.lineAt(e,i,n,r,a):this.right.lineAt(e,i,n,o,c);if(this.break||(h?d.to<c:d.from>c))return d;let p=i==$e.ByPosNoHeight?$e.ByPosNoHeight:$e.ByPos;return h?d.join(this.right.lineAt(c,p,n,o,c)):this.left.lineAt(c,p,n,r,a).join(d)}forEachLine(e,i,n,r,a,o){let c=r+this.left.height,h=a+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,i,n,r,a,o),i>=h&&this.right.forEachLine(e,i,n,c,h,o);else{let d=this.lineAt(h,$e.ByPos,n,r,a);e<d.from&&this.left.forEachLine(e,d.from-1,n,r,a,o),d.to>=e&&d.from<=i&&o(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,c,h,o)}}replace(e,i,n){let r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(e,i,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,i-r,n));let a=[];e>0&&this.decomposeLeft(e,a);let o=a.length;for(let c of n)a.push(c);if(e>0&&sS(a,o-1),i<this.length){let c=a.length;this.decomposeRight(i,a),sS(a,c)}return ei.of(a)}decomposeLeft(e,i){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(n++,e>=n&&i.push(null)),e>n&&this.right.decomposeLeft(e-n,i)}decomposeRight(e,i){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,i);e<n&&this.left.decomposeRight(e,i),this.break&&e<r&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?ei.of(this.break?[e,null,i]:[e,i]):(this.left=bh(this.left,e),this.right=bh(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,n=!1,r){let{left:a,right:o}=this,c=i+a.length+this.break,h=null;return r&&r.from<=i+a.length&&r.more?h=a=a.updateHeight(e,i,n,r):a.updateHeight(e,i,n),r&&r.from<=c+o.length&&r.more?h=o=o.updateHeight(e,c,n,r):o.updateHeight(e,c,n),h?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function sS(t,e){let i,n;t[e]==null&&(i=t[e-1])instanceof Ht&&(n=t[e+1])instanceof Ht&&t.splice(e-1,3,new Ht(i.length+1+n.length))}const Xj=5;class f0{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 Ti?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ti(n-this.pos,-1,0)),this.writtenTo=n,i>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,n){if(e<i||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=i-e;n.block?this.addBlock(new yC(o,r,n)):(o||a||r>=Xj)&&this.addLineDeco(r,a,o)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ti(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let n=new Ht(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 Ti)return e;let i=new Ti(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 Ti)&&!this.isCovered?this.nodes.push(new Ti(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 Ti&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,i,n,r){let a=new f0(n,e);return Re.spans(i,n,r,a,0),a.finish(n)}}function Jj(t,e,i){let n=new Zj;return Re.compare(t,e,i,n,0),n.changes}class Zj{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,r){(e<i||n&&n.heightRelevant||r&&r.heightRelevant)&&Ml(e,i,this.changes,5)}}function $j(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,r=n.defaultView||window,a=Math.max(0,i.left),o=Math.min(r.innerWidth,i.right),c=Math.max(0,i.top),h=Math.min(r.innerHeight,i.bottom);for(let d=t.parentNode;d&&d!=n.body;)if(d.nodeType==1){let p=d,g=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&g.overflow!="visible"){let x=p.getBoundingClientRect();a=Math.max(a,x.left),o=Math.min(o,x.right),c=Math.max(c,x.top),h=Math.min(d==t.parentNode?r.innerHeight:h,x.bottom)}d=g.position=="absolute"||g.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-i.left,right:Math.max(a,o)-i.left,top:c-(i.top+e),bottom:Math.max(c,h)-(i.top+e)}}function eL(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 tL(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Kp{constructor(e,i,n,r){this.from=e,this.to=i,this.size=n,this.displaySize=r}static same(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=i[n];if(r.from!=a.from||r.to!=a.to||r.size!=a.size)return!1}return!0}draw(e,i){return ye.replace({widget:new iL(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class iL extends An{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 lS{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=aS,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Je.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(o0).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Gj(i),this.stateDeco=oS(e),this.heightMap=ei.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle.setDoc(e.doc),[new Fi(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=ye.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let n=0;n<=1;n++){let r=n?i.head:i.anchor;if(!e.some(({from:a,to:o})=>r>=a&&r<=o)){let{from:a,to:o}=this.lineBlockAt(r);e.push(new Sc(a,o))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?aS:new d0(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(no(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=oS(this.state);let r=e.changedRanges,a=Fi.extendWithRanges(r,Jj(n,this.stateDeco,e?e.changes:At.empty(this.state.doc.length))),o=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);rS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||ql)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let h=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<h.from||i.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,i));let d=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Xk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),r=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Je.RTL:Je.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",c=i.getBoundingClientRect(),h=o||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let d=0,p=0;if(c.width&&c.height){let{scaleX:G,scaleY:L}=jk(i,c);(G>.005&&Math.abs(this.scaleX-G)>.005||L>.005&&Math.abs(this.scaleY-L)>.005)&&(this.scaleX=G,this.scaleY=L,d|=16,o=h=!0)}let g=(parseInt(n.paddingTop)||0)*this.scaleY,x=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=x)&&(this.paddingTop=g,this.paddingBottom=x,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=Bk(e.scrollDOM);let w=(this.printing?tL:$j)(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&&!eL(e.dom))return 0;let E=c.width;if((this.contentDOMWidth!=E||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),h){let G=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(G)&&(o=!0),o||r.lineWrapping&&Math.abs(E-this.contentDOMWidth)>r.charWidth){let{lineHeight:L,charWidth:I,textHeight:q}=e.docView.measureTextSize();o=L>0&&r.refresh(a,L,I,q,Math.max(5,E/I),G),o&&(e.docView.minWidth=0,d|=16)}k>0&&C>0?p=Math.max(k,C):k<0&&C<0&&(p=Math.min(k,C)),rS();for(let L of this.viewports){let I=L.from==this.viewport.from?G:e.docView.measureVisibleLineHeights(L);this.heightMap=(o?ei.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle,[new Fi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Yj(L.from,I))}ql&&(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(o?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:c}=this,h=new Sc(r.lineAt(o-n*1e3,$e.ByHeight,a,0,0).from,r.lineAt(c+(1-n)*1e3,$e.ByHeight,a,0,0).to);if(i){let{head:d}=i.range;if(d<h.from||d>h.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=r.lineAt(d,$e.ByPos,a,0,0),x;i.y=="center"?x=(g.top+g.bottom)/2-p/2:i.y=="start"||i.y=="nearest"&&d<h.from?x=g.top:x=g.bottom-p,h=new Sc(r.lineAt(x-1e3/2,$e.ByHeight,a,0,0).from,r.lineAt(x+p+1e3/2,$e.ByHeight,a,0,0).to)}}return h}mapViewport(e,i){let n=i.mapPos(e.from,-1),r=i.mapPos(e.to,1);return new Sc(this.heightMap.lineAt(n,$e.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,$e.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,$e.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(i,$e.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:c}=this;return(e==0||r<=o-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||a>=c+Math.max(10,Math.min(n,250)))&&r>o-2*1e3&&a<c+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let n=[];for(let r of e)i.touchesRange(r.from,r.to)||n.push(new Kp(i.mapPos(r.from),i.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,i){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,a=r>>1,o=r<<1;if(this.defaultTextDirection!=Je.LTR&&!n)return[];let c=[],h=(p,g,x,v)=>{if(g-p<a)return;let w=this.state.selection.main,k=[w.from];w.empty||k.push(w.to);for(let M of k)if(M>p&&M<g){h(p,M-10,x,v),h(M+10,g,x,v);return}let C=rL(e,M=>M.from>=x.from&&M.to<=x.to&&Math.abs(M.from-p)<a&&Math.abs(M.to-g)<a&&!k.some(E=>M.from<E&&M.to>E));if(!C){if(g<x.to&&i&&n&&i.visibleRanges.some(D=>D.from<=g&&D.to>=g)){let D=i.moveToLineBoundary(X.cursor(g),!1,!0).head;D>p&&(g=D)}let M=this.gapSize(x,p,g,v),E=n||M<2e6?M:2e6;C=new Kp(p,g,M,E)}c.push(C)},d=p=>{if(p.length<o||p.type!=Pt.Text)return;let g=nL(p.from,p.to,this.stateDeco);if(g.total<o)return;let x=this.scrollTarget?this.scrollTarget.range.head:null,v,w;if(n){let k=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,M;if(x!=null){let E=kc(g,x),D=((this.visibleBottom-this.visibleTop)/2+k)/p.height;C=E-D,M=E+D}else C=(this.visibleTop-p.top-k)/p.height,M=(this.visibleBottom-p.top+k)/p.height;v=wc(g,C),w=wc(g,M)}else{let k=g.total*this.heightOracle.charWidth,C=r*this.heightOracle.charWidth,M=0;if(k>2e6)for(let I of e)I.from>=p.from&&I.from<p.to&&I.size!=I.displaySize&&I.from*this.heightOracle.charWidth+M<this.pixelViewport.left&&(M=I.size-I.displaySize);let E=this.pixelViewport.left+M,D=this.pixelViewport.right+M,G,L;if(x!=null){let I=kc(g,x),q=((D-E)/2+C)/k;G=I-q,L=I+q}else G=(E-C)/k,L=(D+C)/k;v=wc(g,G),w=wc(g,L)}v>p.from&&h(p.from,v,p,g),w<p.to&&h(w,p.to,p,g)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return c}gapSize(e,i,n,r){let a=kc(r,n)-kc(r,i);return this.heightOracle.lineWrapping?e.height*a:r.total*this.heightOracle.charWidth*a}updateLineGaps(e){Kp.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ye.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let n=[];Re.spans(i,this.viewport.from,this.viewport.to,{span(a,o){n.push({from:a,to:o})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let a=0;a<n.length&&!(r&8);a++){let o=this.visibleRanges[a],c=n[a];(o.from!=c.from||o.to!=c.to)&&(r|=4,e&&e.mapPos(o.from,-1)==c.from&&e.mapPos(o.to,1)==c.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||no(this.heightMap.lineAt(e,$e.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)||no(this.heightMap.lineAt(this.scaler.fromDOM(e),$e.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 no(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 Sc{constructor(e,i){this.from=e,this.to=i}}function nL(t,e,i){let n=[],r=t,a=0;return Re.spans(i,t,e,{span(){},point(o,c){o>r&&(n.push({from:r,to:o}),a+=o-r),r=c}},20),r<e&&(n.push({from:r,to:e}),a+=e-r),{total:a,ranges:n}}function wc({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let r=0;;r++){let{from:a,to:o}=e[r],c=o-a;if(n<=c)return a+n;n-=c}}function kc(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 rL(t,e){for(let i of t)if(e(i))return i}const aS={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function oS(t){let e=t.facet(Gh).filter(n=>typeof n!="function"),i=t.facet(u0).filter(n=>typeof n!="function");return i.length&&e.push(Re.join(i)),e}class d0{constructor(e,i,n){let r=0,a=0,o=0;this.viewports=n.map(({from:c,to:h})=>{let d=i.lineAt(c,$e.ByPos,e,0,0).top,p=i.lineAt(h,$e.ByPos,e,0,0).bottom;return r+=p-d,{from:c,to:h,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(i.height-r);for(let c of this.viewports)c.domTop=o+(c.top-a)*this.scale,o=c.domBottom=c.domTop+(c.bottom-c.top),a=c.bottom}toDOM(e){for(let i=0,n=0,r=0;;i++){let a=i<this.viewports.length?this.viewports[i]:null;if(!a||e<a.top)return r+(e-n)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);n=a.bottom,r=a.domBottom}}fromDOM(e){for(let i=0,n=0,r=0;;i++){let a=i<this.viewports.length?this.viewports[i]:null;if(!a||e<a.domTop)return n+(e-r)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);n=a.bottom,r=a.domBottom}}eq(e){return e instanceof d0?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 no(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Ji(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(r=>no(r,e)):t._content)}const Cc=oe.define({combine:t=>t.join(" ")}),cg=oe.define({combine:t=>t.indexOf(!0)>-1}),hg=qr.newName(),xC=qr.newName(),bC=qr.newName(),vC={"&light":"."+xC,"&dark":"."+bC};function fg(t,e,i){return new qr(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 sL=fg("."+hg,{"&":{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"}},vC),lL={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Wp=ae.ie&&ae.ie_version<=11;class aL{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new _4,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);(ae.ie&&ae.ie_version<=11||ae.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&&ae.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ae.chrome&&ae.chrome_version<126)&&(this.editContext=new uL(e),e.state.facet(Gn)&&(e.contentDOM.editContext=this.editContext.editContext)),Wp&&(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(Gn)?n.root.activeElement!=this.dom:!oo(this.dom,r))return;let a=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(ae.ie&&ae.ie_version<=11||ae.android&&ae.chrome)&&!n.state.selection.main.empty&&r.focusNode&&co(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=Ao(e.root);if(!i)return!1;let n=ae.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&oL(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let r=oo(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&U4(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,lL),Wp&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wp&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var n;if(!this.delayedAndroidKey){let r=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&Tl(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,n=-1,r=!1;for(let a of e){let o=this.readMutation(a);o&&(o.typeOver&&(r=!0),i==-1?{from:i,to:n}=o:(i=Math.min(o.from,i),n=Math.max(o.to,n)))}return{from:i,to:n,typeOver:r}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),r=this.selectionChanged&&oo(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new Mj(this.view,e,i,n);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,r=aC(this.view,i);return this.view.state==n&&(i.domChanged||i.newSel&&!xh(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=uS(i,e.previousSibling||e.target.previousSibling,-1),r=uS(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(Gn)!=e.state.facet(Gn)&&(e.view.contentDOM.editContext=e.state.facet(Gn)?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 uS(t,e,i){for(;e;){let n=kt.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 cS(t,e){let i=e.startContainer,n=e.startOffset,r=e.endContainer,a=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return co(o.node,o.offset,r,a)&&([i,n,r,a]=[r,a,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a}}function oL(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return cS(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?cS(t,i):null}class uL{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:a,head:o}=r,c=this.toEditorPos(n.updateRangeStart),h=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:c,drifted:!1});let d=h-c>n.text.length;c==this.from&&a<this.from?c=a:h==this.to&&a>this.to&&(h=a);let p=oC(e.state.sliceDoc(c,h),n.text,(d?r.from:r.to)-c,d?"end":null);if(!p){let x=X.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));xh(x,r)||e.dispatch({selection:x,userEvent:"select"});return}let g={from:p.from+c,to:p.toA+c,insert:Pe.of(n.text.slice(p.from,p.toB).split(`
|
|
51
|
+
`))};if((ae.mac||ae.android)&&g.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:c,to:h,insert:Pe.of([n.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let x=this.to-this.from+(g.to-g.from+g.insert.length);h0(e,g,X.single(this.toEditorPos(n.selectionStart,x),this.toEditorPos(n.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],a=null;for(let o=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);o<c;o++){let h=e.coordsForChar(o);a=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||a||new DOMRect,r.push(a)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let a of n.getTextFormats()){let o=a.underlineStyle,c=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(c)){let h=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;r.push(ye.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:Zk.of(ye.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=Ao(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((a,o,c,h,d)=>{if(n)return;let p=d.length-(o-a);if(r&&o>=r.to)if(r.from==a&&r.to==o&&r.insert.eq(d)){r=this.pendingContextChange=null,i+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(a+=i,o+=i,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}i+=p}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class le{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(a=>n(a,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||H4(e.parent)||document,this.viewState=new lS(e.state||Be.create(e)),e.scrollTo&&e.scrollTo.is(xc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(vl).map(r=>new Vp(r));for(let r of this.plugins)r.update(this);this.observer=new aL(this),this.inputState=new Nj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Yv(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 Ot?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,n=!1,r,a=this.state;for(let x of e){if(x.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=x.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,c=0,h=null;e.some(x=>x.annotation(pC))?(this.inputState.notifiedFocused=o,c=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,h=mC(a,o),h||(c=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(Be.phrases)!=this.state.facet(Be.phrases))return this.setState(a);r=mh.create(this,a,e),r.flags|=c;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(g&&(g=g.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;g=new Ol(v.empty?v:X.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(xc)&&(g=v.value.clip(this.state))}this.viewState.update(r,g),this.bidiCache=vh.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),i=this.docView.update(r),this.state.facet(to)!=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(Cc)!=r.state.facet(Cc)&&(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(sg))try{x(r)}catch(v){fi(this.state,v,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!aC(this,p)&&d.force&&Tl(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 lS(e),this.plugins=e.facet(vl).map(n=>new Vp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Yv(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(vl),n=e.state.facet(vl);if(i!=n){let r=[];for(let a of n){let o=i.indexOf(a);if(o<0)r.push(new Vp(a));else{let c=this.plugins[o];c.mustUpdate=e,r.push(c)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);i!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(n){fi(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(o<0)if(Bk(n))a=-1,o=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(r);a=v.from,o=v.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];h&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(w){return fi(this.state,w),hS}}),g=mh.create(this,this.state,[]),x=!1;g.flags|=h,i?i.flags|=h:i=g,this.updateState=2,g.empty||(this.updatePlugins(g),this.inputState.update(g),this.updateAttrs(),x=this.docView.update(g),x&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=hS)try{let w=d[v];w.write&&w.write(p[v],this)}catch(w){fi(this.state,w)}if(x&&this.docView.updateSelection(!0),!g.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let w=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o;if(w>1||w<-1){r=r+w,n.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let c of this.state.facet(sg))c(i)}get themeClasses(){return hg+" "+(this.state.facet(cg)?bC:xC)+" "+this.state.facet(Cc)}updateAttrs(){let e=fS(this,$k,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Gn)?"true":"false",class:"cm-content",style:`${ae.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),fS(this,o0,i);let n=this.observer.ignore(()=>{let r=Pv(this.contentDOM,this.contentAttrs,i),a=Pv(this.dom,this.editorAttrs,e);return r||a});return this.editorAttrs=e,this.contentAttrs=i,n}showAnnouncements(e){let i=!0;for(let n of e)for(let r of n.effects)if(r.is(le.announce)){i&&(this.announceDOM.textContent=""),i=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(to);let e=this.state.facet(le.cspNonce);qr.mount(this.root,this.styleModules.concat(sL).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 Yp(this,e,Kv(this,e,i,n))}moveByGroup(e,i){return Yp(this,e,Kv(this,e,i,n=>vj(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),a=n[i?n.length-1:0];return X.cursor(a.side(i,r)+e.from,a.forward(!i,r)?1:-1)}moveToLineBoundary(e,i,n=!0){return bj(this,e,i,n)}moveVertically(e,i,n){return Yp(this,e,Sj(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=og(this,e,i);return n&&n.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),og(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let n=this.docView.coordsAt(e,i);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),a=this.bidiSpans(r),o=a[yn.find(a,e-r.from,-1,i)];return Mo(n,o.dir==Je.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(Wk)||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>cL)return Pk(e.length);let i=this.textDirectionAt(e.from),n;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==i&&(a.fresh||qk(a.isolates,n=Iv(this,e))))return a.order;n||(n=Iv(this,e));let r=G4(e.text,i,n);return this.bidiCache.push(new vh(e.from,e.to,i,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ae.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Lk(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 xc.of(new Ol(typeof e=="number"?X.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 xc.of(new Ol(X.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 ht.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ht.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=qr.newName(),r=[Cc.of(n),to.of(fg(`.${n}`,e))];return i&&i.dark&&r.push(cg.of(!0)),r}static baseTheme(e){return Es.lowest(to.of(fg("."+hg,e,vC)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),r=n&&kt.get(n)||kt.get(e);return((i=r?.root)===null||i===void 0?void 0:i.view)||null}}le.styleModule=to;le.inputHandler=Yk;le.clipboardInputFilter=l0;le.clipboardOutputFilter=a0;le.scrollHandler=Jk;le.focusChangeEffect=Kk;le.perLineTextDirection=Wk;le.exceptionSink=Gk;le.updateListener=sg;le.editable=Gn;le.mouseSelectionStyle=Qk;le.dragMovesSelection=Ik;le.clickAddsSelectionRange=Vk;le.decorations=Gh;le.blockWrappers=eC;le.outerDecorations=u0;le.atomicRanges=Vo;le.bidiIsolatedRanges=tC;le.scrollMargins=iC;le.darkTheme=cg;le.cspNonce=oe.define({combine:t=>t.length?t[0]:""});le.contentAttributes=o0;le.editorAttributes=$k;le.lineWrapping=le.contentAttributes.of({class:"cm-lineWrapping"});le.announce=ke.define();const cL=4096,hS={};class vh{constructor(e,i,n,r,a,o){this.from=e,this.to=i,this.dir=n,this.isolates=r,this.fresh=a,this.order=o}static update(e,i){if(i.empty&&!e.some(a=>a.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:Je.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let o=e[a];o.dir==r&&!i.touchesRange(o.from,o.to)&&n.push(new vh(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function fS(t,e,i){for(let n=t.state.facet(e),r=n.length-1;r>=0;r--){let a=n[r],o=typeof a=="function"?a(t):a;o&&n0(o,i)}return i}const hL=ae.mac?"mac":ae.windows?"win":ae.linux?"linux":"key";function fL(t,e){const i=t.split(/-(?!$)/);let n=i[i.length-1];n=="Space"&&(n=" ");let r,a,o,c;for(let h=0;h<i.length-1;++h){const d=i[h];if(/^(cmd|meta|m)$/i.test(d))c=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?c=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),a&&(n="Ctrl-"+n),c&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ac(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 dL=Es.default(le.domEventHandlers({keydown(t,e){return wC(SC(e.state),t,e,"editor")}})),Xh=oe.define({enables:dL}),dS=new WeakMap;function SC(t){let e=t.facet(Xh),i=dS.get(e);return i||dS.set(e,i=gL(e.reduce((n,r)=>n.concat(r),[]))),i}function pL(t,e,i){return wC(SC(t.state),e,t,i)}let Rr=null;const mL=4e3;function gL(t,e=hL){let i=Object.create(null),n=Object.create(null),r=(o,c)=>{let h=n[o];if(h==null)n[o]=c;else if(h!=c)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,c,h,d,p)=>{var g,x;let v=i[o]||(i[o]=Object.create(null)),w=c.split(/ (?!$)/).map(M=>fL(M,e));for(let M=1;M<w.length;M++){let E=w.slice(0,M).join(" ");r(E,!0),v[E]||(v[E]={preventDefault:!0,stopPropagation:!1,run:[D=>{let G=Rr={view:D,prefix:E,scope:o};return setTimeout(()=>{Rr==G&&(Rr=null)},mL),!0}]})}let k=w.join(" ");r(k,!1);let C=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(g=v._any)===null||g===void 0?void 0:g.run)===null||x===void 0?void 0:x.slice())||[]});h&&C.run.push(h),d&&(C.preventDefault=!0),p&&(C.stopPropagation=!0)};for(let o of t){let c=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of c){let p=i[d]||(i[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=o;for(let x in p)p[x].run.push(v=>g(v,dg))}let h=o[e]||o.key;if(h)for(let d of c)a(d,h,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+h,o.shift,o.preventDefault,o.stopPropagation)}return i}let dg=null;function wC(t,e,i,n){dg=e;let r=E4(e),a=oi(r,0),o=mn(a)==r.length&&r!=" ",c="",h=!1,d=!1,p=!1;Rr&&Rr.view==i&&Rr.scope==n&&(c=Rr.prefix+" ",cC.indexOf(e.keyCode)<0&&(d=!0,Rr=null));let g=new Set,x=C=>{if(C){for(let M of C.run)if(!g.has(M)&&(g.add(M),M(i)))return C.stopPropagation&&(p=!0),!0;C.preventDefault&&(C.stopPropagation&&(p=!0),d=!0)}return!1},v=t[n],w,k;return v&&(x(v[c+Ac(r,e,!o)])?h=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ae.windows&&e.ctrlKey&&e.altKey)&&!(ae.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=Pr[e.keyCode])&&w!=r?(x(v[c+Ac(w,e,!0)])||e.shiftKey&&(k=ko[e.keyCode])!=r&&k!=w&&x(v[c+Ac(k,e,!1)]))&&(h=!0):o&&e.shiftKey&&x(v[c+Ac(r,e,!0)])&&(h=!0),!h&&x(v._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),dg=null,h}class Io{constructor(e,i,n,r,a){this.className=e,this.left=i,this.top=n,this.width=r,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,i,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let a=kC(e);return[new Io(i,r.left-a.left,r.top-a.top,null,r.bottom-r.top)]}else return yL(e,i,n)}}function kC(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Je.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function pS(t,e,i,n){let r=t.coordsAtPos(e,i*2);if(!r)return n;let a=t.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,c=t.posAtCoords({x:a.left+1,y:o}),h=t.posAtCoords({x:a.right-1,y:o});return c==null||h==null?n:{from:Math.max(n.from,Math.min(c,h)),to:Math.min(n.to,Math.max(c,h))}}function yL(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),a=t.textDirection==Je.LTR,o=t.contentDOM,c=o.getBoundingClientRect(),h=kC(t),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),g=c.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),x=c.right-(p?parseInt(p.paddingRight):0),v=ag(t,n,1),w=ag(t,r,-1),k=v.type==Pt.Text?v:null,C=w.type==Pt.Text?w:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=pS(t,n,1,k)),C&&(t.lineWrapping||w.widgetLineBreaks)&&(C=pS(t,r,-1,C)),k&&C&&k.from==C.from&&k.to==C.to)return E(D(i.from,i.to,k));{let L=k?D(i.from,null,k):G(v,!1),I=C?D(null,i.to,C):G(w,!0),q=[];return(k||v).to<(C||w).from-(k&&C?1:0)||v.widgetLineBreaks>1&&L.bottom+t.defaultLineHeight/2<I.top?q.push(M(g,L.bottom,x,I.top)):L.bottom<I.top&&t.elementAtHeight((L.bottom+I.top)/2).type==Pt.Text&&(L.bottom=I.top=(L.bottom+I.top)/2),E(L).concat(q).concat(E(I))}function M(L,I,q,$){return new Io(e,L-h.left,I-h.top,Math.max(0,q-L),$-I)}function E({top:L,bottom:I,horizontal:q}){let $=[];for(let ee=0;ee<q.length;ee+=2)$.push(M(q[ee],L,q[ee+1],I));return $}function D(L,I,q){let $=1e9,ee=-1e9,fe=[];function ce(de,ue,_,J,se){let H=t.coordsAtPos(de,de==q.to?-2:2),te=t.coordsAtPos(_,_==q.from?2:-2);!H||!te||($=Math.min(H.top,te.top,$),ee=Math.max(H.bottom,te.bottom,ee),se==Je.LTR?fe.push(a&&ue?g:H.left,a&&J?x:te.right):fe.push(!a&&J?g:te.left,!a&&ue?x:H.right))}let P=L??q.from,ie=I??q.to;for(let de of t.visibleRanges)if(de.to>P&&de.from<ie)for(let ue=Math.max(de.from,P),_=Math.min(de.to,ie);;){let J=t.state.doc.lineAt(ue);for(let se of t.bidiSpans(J)){let H=se.from+J.from,te=se.to+J.from;if(H>=_)break;te>ue&&ce(Math.max(H,ue),L==null&&H<=P,Math.min(te,_),I==null&&te>=ie,se.dir)}if(ue=J.to+1,ue>=_)break}return fe.length==0&&ce(P,L==null,ie,I==null,t.textDirection),{top:$,bottom:ee,horizontal:fe}}function G(L,I){let q=c.top+(I?L.top:L.bottom);return{top:q,bottom:q,horizontal:[]}}}function xL(t,e){return t.constructor==e.constructor&&t.eq(e)}class bL{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(Yc)!=e.state.facet(Yc)&&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(Yc);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)=>!xL(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,ae.safari&&ae.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 Yc=oe.define();function CC(t){return[ht.define(e=>new bL(e,t)),Yc.of(t)]}const Oo=oe.define({combine(t){return Cn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function vL(t={}){return[Oo.of(t),SL,wL,kL,Xk.of(!0)]}function AC(t){return t.startState.facet(Oo)!=t.state.facet(Oo)}const SL=CC({above:!0,markers(t){let{state:e}=t,i=e.facet(Oo),n=[];for(let r of e.selection.ranges){let a=r==e.selection.main;if(r.empty||i.drawRangeCursor){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=r.empty?r:X.cursor(r.head,r.head>r.anchor?-1:1);for(let h of Io.forRange(t,o,c))n.push(h)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let i=AC(t);return i&&mS(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){mS(e.state,t)},class:"cm-cursorLayer"});function mS(t,e){e.style.animationDuration=t.facet(Oo).cursorBlinkRate+"ms"}const wL=CC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Io.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||AC(t)},class:"cm-selectionLayer"}),kL=Es.highest(le.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"}}}})),MC=ke.define({map(t,e){return t==null?null:e.mapPos(t)}}),ro=Gt.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,n)=>n.is(MC)?n.value:i,t)}}),CL=ht.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(ro);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(ro)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(ro),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(ro)!=t&&this.view.dispatch({effects:MC.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 AL(){return[ro,CL]}function gS(t,e,i,n,r){e.lastIndex=0;for(let a=t.iterRange(i,n),o=i,c;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;c=e.exec(a.value);)r(o+c.index,c)}function ML(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:r,to:a}of i)r=Math.max(t.state.doc.lineAt(r).from,r-e),a=Math.min(t.state.doc.lineAt(a).to,a+e),n.length&&n[n.length-1].to>=r?n[n.length-1].to=a:n.push({from:r,to:a});return n}class TL{constructor(e){const{regexp:i,decoration:n,decorate:r,boundary:a,maxLength:o=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=(c,h,d,p)=>r(p,d,d+c[0].length,c,h);else if(typeof n=="function")this.addMatch=(c,h,d,p)=>{let g=n(c,h,d);g&&p(d,d+c[0].length,g)};else if(n)this.addMatch=(c,h,d,p)=>p(d,d+c[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(e){let i=new Zn,n=i.add.bind(i);for(let{from:r,to:a}of ML(e,this.maxLength))gS(e.state.doc,this.regexp,r,a,(o,c)=>this.addMatch(c,e,o,n));return i.finish()}updateDeco(e,i){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((a,o,c,h)=>{h>=e.view.viewport.from&&c<=e.view.viewport.to&&(n=Math.min(c,n),r=Math.max(h,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,i.map(e.changes),n,r):i}updateRange(e,i,n,r){for(let a of e.visibleRanges){let o=Math.max(a.from,n),c=Math.min(a.to,r);if(c>=o){let h=e.state.doc.lineAt(o),d=h.to<c?e.state.doc.lineAt(c):h,p=Math.max(a.from,h.from),g=Math.min(a.to,d.to);if(this.boundary){for(;o>h.from;o--)if(this.boundary.test(h.text[o-1-h.from])){p=o;break}for(;c<d.to;c++)if(this.boundary.test(d.text[c-d.from])){g=c;break}}let x=[],v,w=(k,C,M)=>x.push(M.range(k,C));if(h==d)for(this.regexp.lastIndex=p-h.from;(v=this.regexp.exec(h.text))&&v.index<g-h.from;)this.addMatch(v,e,v.index+h.from,w);else gS(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 pg=/x/.unicode!=null?"gu":"g",OL=new RegExp(`[\0-\b
|
|
52
|
+
--\u2028\u2029\uFEFF-]`,pg),EL={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Xp=null;function NL(){var t;if(Xp==null&&typeof document<"u"&&document.body){let e=document.body.style;Xp=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Xp||!1}const Kc=oe.define({combine(t){let e=Cn(t,{render:null,specialChars:OL,addSpecialChars:null});return(e.replaceTabs=!NL())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,pg)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,pg)),e}});function RL(t={}){return[Kc.of(t),DL()]}let yS=null;function DL(){return yS||(yS=ht.fromClass(class{constructor(t){this.view=t,this.decorations=ye.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Kc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new TL({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,a=oi(e[0],0);if(a==9){let o=r.lineAt(n),c=i.state.tabSize,h=Kl(o.text,c,n-o.from);return ye.replace({widget:new zL((c-h%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ye.replace({widget:new BL(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Kc);t.startState.facet(Kc)!=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 jL="•";function LL(t){return t>=32?jL:t==10?"":String.fromCharCode(9216+t)}class BL extends An{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=LL(this.code),n=e.state.phrase("Control character")+" "+(EL[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let a=document.createElement("span");return a.textContent=i,a.title=n,a.setAttribute("aria-label",n),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class zL extends An{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 _L(){return UL}const HL=ye.line({class:"cm-activeLine"}),UL=ht.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(HL.range(r.from)),e=r.from)}return ye.set(i)}},{decorations:t=>t.decorations});class qL extends An{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?uo(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=Mo(i[0],n.direction!="rtl"),a=parseInt(n.lineHeight);return r.bottom-r.top>a*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+a}:r}ignoreEvent(){return!1}}function PL(t){let e=ht.fromClass(class{constructor(i){this.view=i,this.placeholder=t?ye.set([ye.widget({widget:new qL(t),side:1}).range(0)]):ye.none}get decorations(){return this.view.state.doc.length?ye.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,le.contentAttributes.of({"aria-placeholder":t})]:e}const mg=2e3;function FL(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),a=[];if(e.off>mg||i.off>mg||e.col<0||i.col<0){let o=Math.min(e.off,i.off),c=Math.max(e.off,i.off);for(let h=n;h<=r;h++){let d=t.doc.line(h);d.length<=c&&a.push(X.range(d.from+o,d.to+c))}}else{let o=Math.min(e.col,i.col),c=Math.max(e.col,i.col);for(let h=n;h<=r;h++){let d=t.doc.line(h),p=Km(d.text,o,t.tabSize,!0);if(p<0)a.push(X.cursor(d.to));else{let g=Km(d.text,c,t.tabSize);a.push(X.range(d.from+p,d.from+g))}}}return a}function VL(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function xS(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,a=r>mg?-1:r==n.length?VL(t,e.clientX):Kl(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:a,off:r}}function IL(t,e){let i=xS(t,e),n=t.state.selection;return i?{update(r){if(r.docChanged){let a=r.changes.mapPos(r.startState.doc.line(i.line).from),o=r.state.doc.lineAt(a);i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},n=n.map(r.changes)}},get(r,a,o){let c=xS(t,r);if(!c)return n;let h=FL(t.state,i,c);return h.length?o?X.create(h.concat(n.ranges)):X.create(h):n}}:null}function QL(t){let e=(i=>i.altKey&&i.button==0);return le.mouseSelectionStyle.of((i,n)=>e(n)?IL(i,n):null)}const GL={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},YL={style:"cursor: crosshair"};function KL(t={}){let[e,i]=GL[t.key||"Alt"],n=ht.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,le.contentAttributes.of(r=>{var a;return!((a=r.plugin(n))===null||a===void 0)&&a.isDown?YL:null})]}const Mc="-10000px";class TC{constructor(e,i,n,r){this.facet=i,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(i),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=n(o,a))}update(e,i){var n;let r=e.state.facet(this.facet),a=r.filter(h=>h);if(r===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let o=[],c=i?[]:null;for(let h=0;h<a.length;h++){let d=a[h],p=-1;if(d){for(let g=0;g<this.tooltips.length;g++){let x=this.tooltips[g];x&&x.create==d.create&&(p=g)}if(p<0)o[h]=this.createTooltipView(d,h?o[h-1]:null),c&&(c[h]=!!d.above);else{let g=o[h]=this.tooltipViews[p];c&&(c[h]=i[p]),g.update&&g.update(e)}}}for(let h of this.tooltipViews)o.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return i&&(c.forEach((h,d)=>i[d]=h),i.length=c.length),this.input=r,this.tooltips=a,this.tooltipViews=o,!0}}function WL(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Jp=oe.define({combine:t=>{var e,i,n;return{position:ae.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)||WL}}}),bS=new WeakMap,p0=ht.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(Jp);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 TC(t,m0,(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(Jp);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=Mc,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(t=n.destroy)===null||t===void 0||t.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(i=this.intersectionObserver)===null||i===void 0||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(ae.safari){let o=a.getBoundingClientRect();i=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else i=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(i||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(t=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),r=c0(this.view);return{visible:{left:n.left+r.left,top:n.top+r.top,right:n.right-r.right,bottom:n.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let c=this.manager.tooltipViews[o];return c.getCoords?c.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(Jp).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:i,space:n,scaleX:r,scaleY:a}=t,o=[];for(let c=0;c<this.manager.tooltips.length;c++){let h=this.manager.tooltips[c],d=this.manager.tooltipViews[c],{dom:p}=d,g=t.pos[c],x=t.size[c];if(!g||h.clip!==!1&&(g.bottom<=Math.max(i.top,n.top)||g.top>=Math.min(i.bottom,n.bottom)||g.right<Math.max(i.left,n.left)-.1||g.left>Math.min(i.right,n.right)+.1)){p.style.top=Mc;continue}let v=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,k=x.right-x.left,C=(e=bS.get(d))!==null&&e!==void 0?e:x.bottom-x.top,M=d.offset||JL,E=this.view.textDirection==Je.LTR,D=x.width>n.right-n.left?E?n.left:n.right-x.width:E?Math.max(n.left,Math.min(g.left-(v?14:0)+M.x,n.right-k)):Math.min(Math.max(n.left,g.left-k+(v?14:0)-M.x),n.right-k),G=this.above[c];!h.strictSide&&(G?g.top-C-w-M.y<n.top:g.bottom+C+w+M.y>n.bottom)&&G==n.bottom-g.bottom>g.top-n.top&&(G=this.above[c]=!G);let L=(G?g.top-n.top:n.bottom-g.bottom)-w;if(L<C&&d.resize!==!1){if(L<this.view.defaultLineHeight){p.style.top=Mc;continue}bS.set(d,C),p.style.height=(C=L)/a+"px"}else p.style.height&&(p.style.height="");let I=G?g.top-C-w-M.y:g.bottom+w+M.y,q=D+k;if(d.overlap!==!0)for(let $ of o)$.left<q&&$.right>D&&$.top<I+C&&$.bottom>I&&(I=G?$.top-C-2-w:$.bottom+w+2);if(this.position=="absolute"?(p.style.top=(I-t.parent.top)/a+"px",vS(p,(D-t.parent.left)/r)):(p.style.top=I/a+"px",vS(p,D/r)),v){let $=g.left+(E?M.x:-M.x)-(D+14-7);v.style.left=$/r+"px"}d.overlap!==!0&&o.push({left:D,top:I,right:q,bottom:I+C}),p.classList.toggle("cm-tooltip-above",G),p.classList.toggle("cm-tooltip-below",!G),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=Mc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function vS(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const XL=le.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},m0=oe.define({enables:[p0,XL]}),Sh=oe.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])});class Jh{static create(e){return new Jh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new TC(e,Sh,(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 ZL=m0.compute([Sh],t=>{let e=t.facet(Sh);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:Jh.create,above:e[0].above,arrow:e.some(i=>i.arrow)}});class $L{constructor(e,i,n,r,a){this.view=e,this.source=i,this.field=n,this.setHover=r,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:i}=this,n=e.docView.tile.nearest(i.target);if(!n)return;let r,a=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(i),r==null)return;let c=e.coordsAtPos(r);if(!c||i.y<c.top||i.y>c.bottom||i.x<c.left-e.defaultCharacterWidth||i.x>c.right+e.defaultCharacterWidth)return;let h=e.bidiSpans(e.state.doc.lineAt(r)).find(p=>p.from<=r&&p.to>=r),d=h&&h.dir==Je.RTL?-1:1;a=i.x<c.left?-d:d}let o=this.source(e,r,a);if(o?.then){let c=this.pending={pos:r};o.then(h=>{this.pending==c&&(this.pending=null,h&&!(Array.isArray(h)&&!h.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(h)?h:[h])}))},h=>fi(e.state,h,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(p0),i=e?e.manager.tooltips.findIndex(n=>n.create==Jh.create):-1;return i>-1?e.manager.tooltipViews[i]:null}mousemove(e){var i,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:a}=this;if(r.length&&a&&!e6(a.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,c=(n=(i=r[0])===null||i===void 0?void 0:i.end)!==null&&n!==void 0?n:o;(o==c?this.view.posAtCoords(this.lastMove)!=o:!t6(this.view,o,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:i}=this;if(i.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let i=n=>{e.removeEventListener("mouseleave",i),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",i)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Tc=4;function e6(t,e){let{left:i,right:n,top:r,bottom:a}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let c=o.getBoundingClientRect();r=Math.min(c.top,r),a=Math.max(c.bottom,a)}return e.clientX>=i-Tc&&e.clientX<=n+Tc&&e.clientY>=r-Tc&&e.clientY<=a+Tc}function t6(t,e,i,n,r,a){let o=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>n||o.right<n||o.top>r||Math.min(o.bottom,c)<r)return!1;let h=t.posAtCoords({x:n,y:r},!1);return h>=e&&h<=i}function i6(t,e={}){let i=ke.define(),n=Gt.define({create(){return[]},update(r,a){if(r.length&&(e.hideOnChange&&(a.docChanged||a.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(a,o))),a.docChanged)){let o=[];for(let c of r){let h=a.changes.mapPos(c.pos,-1,$t.TrackDel);if(h!=null){let d=Object.assign(Object.create(null),c);d.pos=h,d.end!=null&&(d.end=a.changes.mapPos(d.end)),o.push(d)}}r=o}for(let o of a.effects)o.is(i)&&(r=o.value),o.is(n6)&&(r=[]);return r},provide:r=>Sh.from(r)});return{active:n,extension:[n,ht.define(r=>new $L(r,t,n,i,e.hoverTime||300)),ZL]}}function OC(t,e){let i=t.plugin(p0);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const n6=ke.define(),SS=oe.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 g0(t,e){let i=t.plugin(EC),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const EC=ht.fromClass(class{constructor(t){this.input=t.state.facet(Eo),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(SS);this.top=new Oc(t,!0,e.topContainer),this.bottom=new Oc(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(SS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Oc(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Oc(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Eo);if(i!=this.input){let n=i.filter(h=>h),r=[],a=[],o=[],c=[];for(let h of n){let d=this.specs.indexOf(h),p;d<0?(p=h(t.view),c.push(p)):(p=this.panels[d],p.update&&p.update(t)),r.push(p),(p.top?a:o).push(p)}this.specs=n,this.panels=r,this.top.sync(a),this.bottom.sync(o);for(let h of c)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>le.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class Oc{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=wS(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=wS(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 wS(t){let e=t.nextSibling;return t.remove(),e}const Eo=oe.define({enables:EC});function r6(t,e){let i,n=new Promise(o=>i=o),r=o=>s6(o,e,i);t.state.field(Zp,!1)?t.dispatch({effects:NC.of(r)}):t.dispatch({effects:ke.appendConfig.of(Zp.init(()=>[r]))});let a=RC.of(r);return{close:a,result:n.then(o=>((t.win.queueMicrotask||(h=>t.win.setTimeout(h,10)))(()=>{t.state.field(Zp).indexOf(r)>-1&&t.dispatch({effects:a})}),o))}}const Zp=Gt.define({create(){return[]},update(t,e){for(let i of e.effects)i.is(NC)?t=[i.value].concat(t):i.is(RC)&&(t=t.filter(n=>n!=i.value));return t},provide:t=>Eo.computeN([t],e=>e.field(t))}),NC=ke.define(),RC=ke.define();function s6(t,e,i){let n=e.content?e.content(t,()=>o(null)):null;if(!n){if(n=Ke("form"),e.input){let c=Ke("input",e.input);/^(text|password|number|email|tel|url)$/.test(c.type)&&c.classList.add("cm-textfield"),c.name||(c.name="input"),n.appendChild(Ke("label",(e.label||"")+": ",c))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(Ke("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let c=0;c<r.length;c++){let h=r[c];h.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(h))}),h.addEventListener("submit",d=>{d.preventDefault(),o(h)})}let a=Ke("div",n,Ke("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(a.className=e.class),a.classList.add("cm-dialog");function o(c){a.contains(a.ownerDocument.activeElement)&&t.focus(),i(c)}return{dom:a,top:e.top,mount:()=>{if(e.focus){let c;typeof e.focus=="string"?c=n.querySelector(e.focus):c=n.querySelector("input")||n.querySelector("button"),c&&"select"in c?c.select():c&&"focus"in c&&c.focus()}}}}class er extends Ur{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}er.prototype.elementClass="";er.prototype.toDOM=void 0;er.prototype.mapMode=$t.TrackBefore;er.prototype.startSide=er.prototype.endSide=-1;er.prototype.point=!0;const Wc=oe.define(),l6=oe.define(),a6={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Re.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},fo=oe.define();function o6(t){return[DC(),fo.of({...a6,...t})]}const kS=oe.define({combine:t=>t.some(e=>e)});function DC(t){return[u6]}const u6=ht.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(fo).map(e=>new AS(t,e)),this.fixed=!t.state.facet(kS);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(kS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=Re.iter(this.view.state.facet(Wc),this.view.viewport.from),n=[],r=this.gutters.map(a=>new c6(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(a.type)){let o=!0;for(let c of a.type)if(c.type==Pt.Text&&o){gg(i,n,c.from);for(let h of r)h.line(this.view,c,n);o=!1}else if(c.widget)for(let h of r)h.widget(this.view,c)}else if(a.type==Pt.Text){gg(i,n,a.from);for(let o of r)o.line(this.view,a,n)}else if(a.widget)for(let o of r)o.widget(this.view,a);for(let a of r)a.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(fo),i=t.state.facet(fo),n=t.docChanged||t.heightChanged||t.viewportChanged||!Re.eq(t.startState.facet(Wc),t.state.facet(Wc),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let r of this.gutters)r.update(t)&&(n=!0);else{n=!0;let r=[];for(let a of i){let o=e.indexOf(a);o<0?r.push(new AS(this.view,a)):(this.gutters[o].update(t),r.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),r.indexOf(a)<0&&a.destroy();for(let a of r)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=r}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>le.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==Je.LTR?{left:n,right:r}:{right:n,left:r}})});function CS(t){return Array.isArray(t)?t:[t]}function gg(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class c6{constructor(e,i,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Re.iter(e.markers,i.from)}addElement(e,i,n){let{gutter:r}=this,a=(i.top-this.height)/e.scaleY,o=i.height/e.scaleY;if(this.i==r.elements.length){let c=new jC(e,o,a,n);r.elements.push(c),r.dom.appendChild(c.dom)}else r.elements[this.i].update(e,o,a,n);this.height=i.bottom,this.i++}line(e,i,n){let r=[];gg(this.cursor,r,i.from),n.length&&(r=r.concat(n));let a=this.gutter.config.lineMarker(e,i,r);a&&r.unshift(a);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,i,r)}widget(e,i){let n=this.gutter.config.widgetMarker(e,i.widget,i),r=n?[n]:null;for(let a of e.state.facet(l6)){let o=a(e,i.widget,i);o&&(r||(r=[])).push(o)}r&&this.addElement(e,i,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}}class AS{constructor(e,i){this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in i.domEventHandlers)this.dom.addEventListener(n,r=>{let a=r.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let h=a.getBoundingClientRect();o=(h.top+h.bottom)/2}else o=r.clientY;let c=e.lineBlockAtHeight(o-e.documentTop);i.domEventHandlers[n](e,c,r)&&r.preventDefault()});this.markers=CS(i.markers(e)),i.initialSpacer&&(this.spacer=new jC(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=CS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!Re.eq(this.markers,i,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class jC{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":""),h6(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,i){let n="cm-gutterElement",r=this.dom.firstChild;for(let a=0,o=0;;){let c=o,h=a<i.length?i[a++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let g=o;g<this.markers.length;g++)if(this.markers[g].compare(h)){c=g,d=!0;break}}else c=this.markers.length;for(;o<c;){let p=this.markers[o++];if(p.toDOM){p.destroy(r);let g=r.nextSibling;r.remove(),r=g}}if(!h)break;h.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(h.toDOM(e),r)),d&&o++}this.dom.className=n,this.markers=i}destroy(){this.setMarkers(null,[])}}function h6(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 f6=oe.define(),d6=oe.define(),Sl=oe.define({combine(t){return Cn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let n=Object.assign({},e);for(let r in i){let a=n[r],o=i[r];n[r]=a?(c,h,d)=>a(c,h,d)||o(c,h,d):o}return n}})}});class $p extends er{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function em(t,e){return t.state.facet(Sl).formatNumber(e,t.state)}const p6=fo.compute([Sl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(f6)},lineMarker(e,i,n){return n.some(r=>r.toDOM)?null:new $p(em(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,n)=>{for(let r of e.state.facet(d6)){let a=r(e,i,n);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(Sl)!=e.state.facet(Sl),initialSpacer(e){return new $p(em(e,MS(e.state.doc.lines)))},updateSpacer(e,i){let n=em(i.view,MS(i.view.state.doc.lines));return n==e.number?e:new $p(n)},domEventHandlers:t.facet(Sl).domEventHandlers,side:"before"}));function m6(t={}){return[Sl.of(t),DC(),p6]}function MS(t){let e=9;for(;e<t;)e=e*10+9;return e}const g6=new class extends er{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},y6=Wc.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(g6.range(r)))}return Re.of(e)});function x6(){return y6}const LC=1024;let b6=0;class tm{constructor(e,i){this.from=e,this.to=i}}class Oe{constructor(e={}){this.id=b6++,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=pi.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}Oe.closedBy=new Oe({deserialize:t=>t.split(" ")});Oe.openedBy=new Oe({deserialize:t=>t.split(" ")});Oe.group=new Oe({deserialize:t=>t.split(" ")});Oe.isolate=new Oe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Oe.contextHash=new Oe({perNode:!0});Oe.lookAhead=new Oe({perNode:!0});Oe.mounted=new Oe({perNode:!0});class po{constructor(e,i,n,r=!1){this.tree=e,this.overlay=i,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Oe.mounted.id]}}const v6=Object.create(null);class pi{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):v6,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new pi(e.name||"",i,e.id,n);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(r)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[a[0].id]=a[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(Oe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let n in e)for(let r of n.split(" "))i[r]=e[n];return n=>{for(let r=n.prop(Oe.group),a=-1;a<(r?r.length:0);a++){let o=i[a<0?n.name:r[a]];if(o)return o}}}}pi.none=new pi("",Object.create(null),0,8);class y0{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let n of this.types){let r=null;for(let a of e){let o=a(n);if(o){r||(r=Object.assign({},n.props));let c=o[1],h=o[0];h.combine&&h.id in r&&(c=h.combine(r[h.id],c)),r[h.id]=c}}i.push(r?new pi(n.name,r,n.id,n.flags):n)}return new y0(i)}}const Ec=new WeakMap,TS=new WeakMap;var ct;(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"})(ct||(ct={}));class gt{constructor(e,i,n,r,a){if(this.type=e,this.children=i,this.positions=n,this.length=r,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,c]of a)this.props[typeof o=="number"?o:o.id]=c}}toString(){let e=po.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 xg(this.topNode,e)}cursorAt(e,i=0,n=0){let r=Ec.get(this)||this.topNode,a=new xg(r);return a.moveTo(e,i),Ec.set(this,a._tree),a}get topNode(){return new Qi(this,0,0,null)}resolve(e,i=0){let n=No(Ec.get(this)||this.topNode,e,i,!1);return Ec.set(this,n),n}resolveInner(e,i=0){let n=No(TS.get(this)||this.topNode,e,i,!0);return TS.set(this,n),n}resolveStack(e,i=0){return k6(this,e,i)}iterate(e){let{enter:i,leave:n,from:r=0,to:a=this.length}=e,o=e.mode||0,c=(o&ct.IncludeAnonymous)>0;for(let h=this.cursor(o|ct.IncludeAnonymous);;){let d=!1;if(h.from<=a&&h.to>=r&&(!c&&h.type.isAnonymous||i(h)!==!1)){if(h.firstChild())continue;d=!0}for(;d&&n&&(c||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:v0(pi.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,r)=>new gt(this.type,i,n,r,this.propValues),e.makeTree||((i,n,r)=>new gt(pi.none,i,n,r)))}static build(e){return C6(e)}}gt.empty=new gt(pi.none,[],[],0);class x0{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 x0(this.buffer,this.index)}}class Vr{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return pi.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],n=this.buffer[e+3],r=this.set.types[i],a=r.name;if(/\W/.test(a)&&!r.isError&&(a=JSON.stringify(a)),e+=4,n==e)return a;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return a+"("+o.join(",")+")"}findChild(e,i,n,r,a){let{buffer:o}=this,c=-1;for(let h=e;h!=i&&!(BC(a,r,o[h+1],o[h+2])&&(c=h,n>0));h=o[h+3]);return c}slice(e,i,n){let r=this.buffer,a=new Uint16Array(i-e),o=0;for(let c=e,h=0;c<i;){a[h++]=r[c++],a[h++]=r[c++]-n;let d=a[h++]=r[c++]-n;a[h++]=r[c++]-e,o=Math.max(o,d)}return new Vr(a,o,this.set)}}function BC(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 No(t,e,i,n){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let o=!n&&t instanceof Qi&&t.index<0?null:t.parent;if(!o)return t;t=o}let a=n?0:ct.IgnoreOverlays;if(n)for(let o=t,c=o.parent;c;o=c,c=o.parent)o instanceof Qi&&o.index<0&&((r=c.enter(e,i,a))===null||r===void 0?void 0:r.from)!=o.from&&(t=c);for(;;){let o=t.enter(e,i,a);if(!o)return t;t=o}}class zC{cursor(e=0){return new xg(this,e)}getChild(e,i=null,n=null){let r=OS(this,e,i,n);return r.length?r[0]:null}getChildren(e,i=null,n=null){return OS(this,e,i,n)}resolve(e,i=0){return No(this,e,i,!1)}resolveInner(e,i=0){return No(this,e,i,!0)}matchContext(e){return yg(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 Qi extends zC{constructor(e,i,n,r){super(),this._tree=e,this.from=i,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,n,r,a=0){for(let o=this;;){for(let{children:c,positions:h}=o._tree,d=i>0?c.length:-1;e!=d;e+=i){let p=c[e],g=h[e]+o.from,x;if(!(!(a&ct.EnterBracketed&&p instanceof gt&&(x=po.get(p))&&!x.overlay&&x.bracketed&&n>=g&&n<=g+p.length)&&!BC(r,n,g,g+p.length))){if(p instanceof Vr){if(a&ct.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,i,n-g,r);if(v>-1)return new jr(new S6(o,p,e,g),null,v)}else if(a&ct.IncludeAnonymous||!p.type.isAnonymous||b0(p)){let v;if(!(a&ct.IgnoreMounts)&&(v=po.get(p))&&!v.overlay)return new Qi(v.tree,g,e,o);let w=new Qi(p,g,e,o);return a&ct.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(i<0?p.children.length-1:0,i,n,r,a)}}}if(a&ct.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+i:e=i<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,i,n=0){let r;if(!(n&ct.IgnoreOverlays)&&(r=po.get(this._tree))&&r.overlay){let a=e-this.from,o=n&ct.EnterBracketed&&r.bracketed;for(let{from:c,to:h}of r.overlay)if((i>0||o?c<=a:c<a)&&(i<0||o?h>=a:h>a))return new Qi(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 OS(t,e,i,n){let r=t.cursor(),a=[];if(!r.firstChild())return a;if(i!=null){for(let o=!1;!o;)if(o=r.type.is(i),!r.nextSibling())return a}for(;;){if(n!=null&&r.type.is(n))return a;if(r.type.is(e)&&a.push(r.node),!r.nextSibling())return n==null?a:[]}}function yg(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 S6{constructor(e,i,n,r){this.parent=e,this.buffer=i,this.index=n,this.start=r}}class jr extends zC{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,n){super(),this.context=e,this._parent=i,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,i,n){let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.context.start,n);return a<0?null:new jr(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,i,n=0){if(n&ct.ExcludeBuffers)return null;let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return a<0?null:new jr(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new jr(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 jr(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:n}=this.context,r=this.index+4,a=n.buffer[this.index+3];if(a>r){let o=n.buffer[this.index+1];e.push(n.slice(r,a,o)),i.push(0)}return new gt(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function _C(t){if(!t.length)return null;let e=0,i=t[0];for(let a=1;a<t.length;a++){let o=t[a];(o.from>i.from||o.to<i.to)&&(i=o,e=a)}let n=i instanceof Qi&&i.index<0?null:i.parent,r=t.slice();return n?r[e]=n:r.splice(e,1),new w6(r,i)}class w6{constructor(e,i){this.heads=e,this.node=i}get next(){return _C(this.heads)}}function k6(t,e,i){let n=t.resolveInner(e,i),r=null;for(let a=n instanceof Qi?n:n.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(r||(r=[n])).push(o.resolve(e,i)),a=o}else{let o=po.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let c=new Qi(o.tree,o.overlay[0].from+a.from,-1,a);(r||(r=[n])).push(No(c,e,i,!1))}}return r?_C(r):n}class xg{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&~ct.EnterBracketed,e instanceof Qi)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 Qi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,n,this.mode));let{buffer:r}=this.buffer,a=r.findChild(this.index+4,r.buffer[this.index+3],e,i-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,n=this.mode){return this.buffer?n&ct.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ct.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ct.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else{let r=i.buffer[this.index+3];if(r<(n<0?i.buffer.length:i.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(r.buffer.buffer[a+3]<this.index)return!1;({index:i,parent:n}=r)}else({index:i,_parent:n}=this._tree);for(;n;{index:i,_parent:n}=n)if(i>-1)for(let a=i+e,o=e<0?-1:n._tree.children.length;a!=o;a+=e){let c=n._tree.children[a];if(this.mode&ct.IncludeAnonymous||c instanceof Vr||!c.type.isAnonymous||b0(c))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,a=this.stack.length;a>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;i=o,n=a+1;break e}r=this.stack[--a]}for(let r=n;r<this.stack.length;r++)i=new jr(this.buffer,i,this.stack[r]);return this.bufferNode=new jr(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 yg(this.node.parent,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let r=e.length-1,a=this.stack.length-1;r>=0;a--){if(a<0)return yg(this._tree,e,r);let o=n[i.buffer[this.stack[a]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function b0(t){return t.children.some(e=>e instanceof Vr||!e.type.isAnonymous||b0(e))}function C6(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:r=LC,reused:a=[],minRepeatType:o=n.types.length}=t,c=Array.isArray(i)?new x0(i,i.length):i,h=n.types,d=0,p=0;function g(L,I,q,$,ee,fe){let{id:ce,start:P,end:ie,size:de}=c,ue=p,_=d;if(de<0)if(c.next(),de==-1){let T=a[ce];q.push(T),$.push(P-L);return}else if(de==-3){d=ce;return}else if(de==-4){p=ce;return}else throw new RangeError(`Unrecognized record size: ${de}`);let J=h[ce],se,H,te=P-L;if(ie-P<=r&&(H=C(c.pos-I,ee))){let T=new Uint16Array(H.size-H.skip),F=c.pos-H.size,Z=T.length;for(;c.pos>F;)Z=M(H.start,T,Z);se=new Vr(T,ie-H.start,n),te=H.start-L}else{let T=c.pos-de;c.next();let F=[],Z=[],ne=ce>=o?ce:-1,xe=0,Ce=ie;for(;c.pos>T;)ne>=0&&c.id==ne&&c.size>=0?(c.end<=Ce-r&&(w(F,Z,P,xe,c.end,Ce,ne,ue,_),xe=F.length,Ce=c.end),c.next()):fe>2500?x(P,T,F,Z):g(P,T,F,Z,ne,fe+1);if(ne>=0&&xe>0&&xe<F.length&&w(F,Z,P,xe,P,Ce,ne,ue,_),F.reverse(),Z.reverse(),ne>-1&&xe>0){let He=v(J,_);se=v0(J,F,Z,0,F.length,0,ie-P,He,He)}else se=k(J,F,Z,ie-P,ue-ie,_)}q.push(se),$.push(te)}function x(L,I,q,$){let ee=[],fe=0,ce=-1;for(;c.pos>I;){let{id:P,start:ie,end:de,size:ue}=c;if(ue>4)c.next();else{if(ce>-1&&ie<ce)break;ce<0&&(ce=de-r),ee.push(P,ie,de),fe++,c.next()}}if(fe){let P=new Uint16Array(fe*4),ie=ee[ee.length-2];for(let de=ee.length-3,ue=0;de>=0;de-=3)P[ue++]=ee[de],P[ue++]=ee[de+1]-ie,P[ue++]=ee[de+2]-ie,P[ue++]=ue;q.push(new Vr(P,ee[2]-ie,n)),$.push(ie-L)}}function v(L,I){return(q,$,ee)=>{let fe=0,ce=q.length-1,P,ie;if(ce>=0&&(P=q[ce])instanceof gt){if(!ce&&P.type==L&&P.length==ee)return P;(ie=P.prop(Oe.lookAhead))&&(fe=$[ce]+P.length+ie)}return k(L,q,$,ee,fe,I)}}function w(L,I,q,$,ee,fe,ce,P,ie){let de=[],ue=[];for(;L.length>$;)de.push(L.pop()),ue.push(I.pop()+q-ee);L.push(k(n.types[ce],de,ue,fe-ee,P-fe,ie)),I.push(ee-q)}function k(L,I,q,$,ee,fe,ce){if(fe){let P=[Oe.contextHash,fe];ce=ce?[P].concat(ce):[P]}if(ee>25){let P=[Oe.lookAhead,ee];ce=ce?[P].concat(ce):[P]}return new gt(L,I,q,$,ce)}function C(L,I){let q=c.fork(),$=0,ee=0,fe=0,ce=q.end-r,P={size:0,start:0,skip:0};e:for(let ie=q.pos-L;q.pos>ie;){let de=q.size;if(q.id==I&&de>=0){P.size=$,P.start=ee,P.skip=fe,fe+=4,$+=4,q.next();continue}let ue=q.pos-de;if(de<0||ue<ie||q.start<ce)break;let _=q.id>=o?4:0,J=q.start;for(q.next();q.pos>ue;){if(q.size<0)if(q.size==-3||q.size==-4)_+=4;else break e;else q.id>=o&&(_+=4);q.next()}ee=J,$+=de,fe+=_}return(I<0||$==L)&&(P.size=$,P.start=ee,P.skip=fe),P.size>4?P:void 0}function M(L,I,q){let{id:$,start:ee,end:fe,size:ce}=c;if(c.next(),ce>=0&&$<o){let P=q;if(ce>4){let ie=c.pos-(ce-4);for(;c.pos>ie;)q=M(L,I,q)}I[--q]=P,I[--q]=fe-L,I[--q]=ee-L,I[--q]=$}else ce==-3?d=$:ce==-4&&(p=$);return q}let E=[],D=[];for(;c.pos>0;)g(t.start||0,t.bufferStart||0,E,D,-1,0);let G=(e=t.length)!==null&&e!==void 0?e:E.length?D[0]+E[0].length:0;return new gt(h[t.topID],E.reverse(),D.reverse(),G)}const ES=new WeakMap;function Xc(t,e){if(!t.isAnonymous||e instanceof Vr||e.type!=t)return 1;let i=ES.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof gt)){i=1;break}i+=Xc(t,n)}ES.set(e,i)}return i}function v0(t,e,i,n,r,a,o,c,h){let d=0;for(let w=n;w<r;w++)d+=Xc(t,e[w]);let p=Math.ceil(d*1.5/8),g=[],x=[];function v(w,k,C,M,E){for(let D=C;D<M;){let G=D,L=k[D],I=Xc(t,w[D]);for(D++;D<M;D++){let q=Xc(t,w[D]);if(I+q>=p)break;I+=q}if(D==G+1){if(I>p){let q=w[G];v(q.children,q.positions,0,q.children.length,k[G]+E);continue}g.push(w[G])}else{let q=k[D-1]+w[D-1].length-L;g.push(v0(t,w,k,G,D,L,q,null,h))}x.push(L+E-a)}}return v(e,i,n,r,0),(c||h)(g,x,o)}class Ss{constructor(e,i,n,r,a=!1,o=!1){this.from=e,this.to=i,this.tree=n,this.offset=r,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],n=!1){let r=[new Ss(0,e.length,e,0,!1,n)];for(let a of i)a.to>e.length&&r.push(a);return r}static applyChanges(e,i,n=128){if(!i.length)return e;let r=[],a=1,o=e.length?e[0]:null;for(let c=0,h=0,d=0;;c++){let p=c<i.length?i[c]:null,g=p?p.fromA:1e9;if(g-h>=n)for(;o&&o.from<g;){let x=o;if(h>=x.from||g<=x.to||d){let v=Math.max(x.from,h)-d,w=Math.min(x.to,g)-d;x=v>=w?null:new Ss(v,w,x.tree,x.offset+d,c>0,!!p)}if(x&&r.push(x),o.to>g)break;o=a<e.length?e[a++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return r}}class HC{startParse(e,i,n){return typeof e=="string"&&(e=new A6(e)),n=n?n.length?n.map(r=>new tm(r.from,r.to)):[new tm(0,0)]:[new tm(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let r=this.startParse(e,i,n);for(;;){let a=r.advance();if(a)return a}}}class A6{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new Oe({perNode:!0});let M6=0;class Pi{constructor(e,i,n,r){this.name=e,this.set=i,this.base=n,this.modified=r,this.id=M6++}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 Pi&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let r=new Pi(n,[],null,[]);if(r.set.push(r),i)for(let a of i.set)r.set.push(a);return r}static defineModifier(e){let i=new wh(e);return n=>n.modified.indexOf(i)>-1?n:wh.get(n.base||n,n.modified.concat(i).sort((r,a)=>r.id-a.id))}}let T6=0;class wh{constructor(e){this.name=e,this.instances=[],this.id=T6++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(c=>c.base==e&&O6(i,c.modified));if(n)return n;let r=[],a=new Pi(e.name,r,e,i);for(let c of i)c.instances.push(a);let o=E6(i);for(let c of e.set)if(!c.modified.length)for(let h of o)r.push(wh.get(c,h));return a}}function O6(t,e){return t.length==e.length&&t.every((i,n)=>i==e[n])}function E6(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 UC(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let r of i.split(" "))if(r){let a=[],o=2,c=r;for(let g=0;;){if(c=="..."&&g>0&&g+3==r.length){o=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+r);if(a.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),g+=x[0].length,g==r.length)break;let v=r[g++];if(g==r.length&&v=="!"){o=0;break}if(v!="/")throw new RangeError("Invalid path: "+r);c=r.slice(g)}let h=a.length-1,d=a[h];if(!d)throw new RangeError("Invalid path: "+r);let p=new Ro(n,o,h>0?a.slice(0,h):null);e[d]=p.sort(e[d])}}return qC.add(e)}const qC=new Oe({combine(t,e){let i,n,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),i&&i.mode==r.mode&&!r.context&&!i.context)continue;let a=new Ro(r.tags,r.mode,r.context);i?i.next=a:n=a,i=a}return n}});class Ro{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}}Ro.empty=new Ro([],2,null);function PC(t,e){let i=Object.create(null);for(let a of t)if(!Array.isArray(a.tag))i[a.tag.id]=a.class;else for(let o of a.tag)i[o.id]=a.class;let{scope:n,all:r=null}=e||{};return{style:a=>{let o=r;for(let c of a)for(let h of c.set){let d=i[h.id];if(d){o=o?o+" "+d:d;break}}return o},scope:n}}function N6(t,e){let i=null;for(let n of t){let r=n.style(e);r&&(i=i?i+" "+r:r)}return i}function R6(t,e,i,n=0,r=t.length){let a=new D6(n,Array.isArray(e)?e:[e],i);a.highlightRange(t.cursor(),n,r,"",a.highlighters),a.flush(r)}class D6{constructor(e,i,n){this.at=e,this.highlighters=i,this.span=n,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,n,r,a){let{type:o,from:c,to:h}=e;if(c>=n||h<=i)return;o.isTop&&(a=this.highlighters.filter(v=>!v.scope||v.scope(o)));let d=r,p=j6(e)||Ro.empty,g=N6(a,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(r+=(r?" ":"")+g)),this.startSpan(Math.max(i,c),d),p.opaque)return;let x=e.tree&&e.tree.prop(Oe.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),w=this.highlighters.filter(C=>!C.scope||C.scope(x.tree.type)),k=e.firstChild();for(let C=0,M=c;;C++){let E=C<x.overlay.length?x.overlay[C]:null,D=E?E.from+c:h,G=Math.max(i,M),L=Math.min(n,D);if(G<L&&k)for(;e.from<L&&(this.highlightRange(e,G,L,r,a),this.startSpan(Math.min(L,e.to),d),!(e.to>=D||!e.nextSibling())););if(!E||D>n)break;M=E.to+c,M>i&&(this.highlightRange(v.cursor(),Math.max(i,E.from+c),Math.min(n,M),"",w),this.startSpan(Math.min(n,M),d))}k&&e.parent()}else if(e.firstChild()){x&&(r="");do if(!(e.to<=i)){if(e.from>=n)break;this.highlightRange(e,i,n,r,a),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function j6(t){let e=t.type.prop(qC);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const re=Pi.define,Nc=re(),Er=re(),NS=re(Er),RS=re(Er),Nr=re(),Rc=re(Nr),im=re(Nr),dn=re(),fs=re(dn),hn=re(),fn=re(),bg=re(),Ja=re(bg),Dc=re(),Q={comment:Nc,lineComment:re(Nc),blockComment:re(Nc),docComment:re(Nc),name:Er,variableName:re(Er),typeName:NS,tagName:re(NS),propertyName:RS,attributeName:re(RS),className:re(Er),labelName:re(Er),namespace:re(Er),macroName:re(Er),literal:Nr,string:Rc,docString:re(Rc),character:re(Rc),attributeValue:re(Rc),number:im,integer:re(im),float:re(im),bool:re(Nr),regexp:re(Nr),escape:re(Nr),color:re(Nr),url:re(Nr),keyword:hn,self:re(hn),null:re(hn),atom:re(hn),unit:re(hn),modifier:re(hn),operatorKeyword:re(hn),controlKeyword:re(hn),definitionKeyword:re(hn),moduleKeyword:re(hn),operator:fn,derefOperator:re(fn),arithmeticOperator:re(fn),logicOperator:re(fn),bitwiseOperator:re(fn),compareOperator:re(fn),updateOperator:re(fn),definitionOperator:re(fn),typeOperator:re(fn),controlOperator:re(fn),punctuation:bg,separator:re(bg),bracket:Ja,angleBracket:re(Ja),squareBracket:re(Ja),paren:re(Ja),brace:re(Ja),content:dn,heading:fs,heading1:re(fs),heading2:re(fs),heading3:re(fs),heading4:re(fs),heading5:re(fs),heading6:re(fs),contentSeparator:re(dn),list:re(dn),quote:re(dn),emphasis:re(dn),strong:re(dn),link:re(dn),monospace:re(dn),strikethrough:re(dn),inserted:re(),deleted:re(),changed:re(),invalid:re(),meta:Dc,documentMeta:re(Dc),annotation:re(Dc),processingInstruction:re(Dc),definition:Pi.defineModifier("definition"),constant:Pi.defineModifier("constant"),function:Pi.defineModifier("function"),standard:Pi.defineModifier("standard"),local:Pi.defineModifier("local"),special:Pi.defineModifier("special")};for(let t in Q){let e=Q[t];e instanceof Pi&&(e.name=t)}PC([{tag:Q.link,class:"tok-link"},{tag:Q.heading,class:"tok-heading"},{tag:Q.emphasis,class:"tok-emphasis"},{tag:Q.strong,class:"tok-strong"},{tag:Q.keyword,class:"tok-keyword"},{tag:Q.atom,class:"tok-atom"},{tag:Q.bool,class:"tok-bool"},{tag:Q.url,class:"tok-url"},{tag:Q.labelName,class:"tok-labelName"},{tag:Q.inserted,class:"tok-inserted"},{tag:Q.deleted,class:"tok-deleted"},{tag:Q.literal,class:"tok-literal"},{tag:Q.string,class:"tok-string"},{tag:Q.number,class:"tok-number"},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],class:"tok-string2"},{tag:Q.variableName,class:"tok-variableName"},{tag:Q.local(Q.variableName),class:"tok-variableName tok-local"},{tag:Q.definition(Q.variableName),class:"tok-variableName tok-definition"},{tag:Q.special(Q.variableName),class:"tok-variableName2"},{tag:Q.definition(Q.propertyName),class:"tok-propertyName tok-definition"},{tag:Q.typeName,class:"tok-typeName"},{tag:Q.namespace,class:"tok-namespace"},{tag:Q.className,class:"tok-className"},{tag:Q.macroName,class:"tok-macroName"},{tag:Q.propertyName,class:"tok-propertyName"},{tag:Q.operator,class:"tok-operator"},{tag:Q.comment,class:"tok-comment"},{tag:Q.meta,class:"tok-meta"},{tag:Q.invalid,class:"tok-invalid"},{tag:Q.punctuation,class:"tok-punctuation"}]);var nm;const wl=new Oe;function L6(t){return oe.define({combine:t?e=>e.concat(t):void 0})}const B6=new Oe;class $i{constructor(e,i,n=[],r=""){this.data=e,this.name=r,Be.prototype.hasOwnProperty("tree")||Object.defineProperty(Be.prototype,"tree",{get(){return It(this)}}),this.parser=i,this.extension=[Ir.of(this),Be.languageData.of((a,o,c)=>{let h=DS(a,o,c),d=h.type.prop(wl);if(!d)return[];let p=a.facet(d),g=h.type.prop(B6);if(g){let x=h.resolve(o-h.from,c);for(let v of g)if(v.test(x,a)){let w=a.facet(v.facet);return v.type=="replace"?w:w.concat(p)}}return p})].concat(n)}isActiveAt(e,i,n=-1){return DS(e,i,n).type.prop(wl)==this.data}findRegions(e){let i=e.facet(Ir);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let n=[],r=(a,o)=>{if(a.prop(wl)==this.data){n.push({from:o,to:o+a.length});return}let c=a.prop(Oe.mounted);if(c){if(c.tree.prop(wl)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+o,to:h.to+o});else n.push({from:o,to:o+a.length});return}else if(c.overlay){let h=n.length;if(r(c.tree,c.overlay[0].from+o),n.length>h)return}}for(let h=0;h<a.children.length;h++){let d=a.children[h];d instanceof gt&&r(d,a.positions[h]+o)}};return r(It(e),0),n}get allowsNesting(){return!0}}$i.setState=ke.define();function DS(t,e,i){let n=t.facet(Ir),r=It(t).topNode;if(!n||n.allowsNesting)for(let a=r;a;a=a.enter(e,i,ct.ExcludeBuffers|ct.EnterBracketed))a.type.isTop&&(r=a);return r}class kh extends $i{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=L6(e.languageData);return new kh(i,e.parser.configure({props:[wl.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new kh(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function It(t){let e=t.field($i.state,!1);return e?e.tree:gt.empty}class z6{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 Za=null;class Ch{constructor(e,i,n=[],r,a,o,c,h){this.parser=e,this.state=i,this.fragments=n,this.tree=r,this.treeLen=a,this.viewport=o,this.skipped=c,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new Ch(e,i,[],gt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new z6(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=gt.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(Ss.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(Ss.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Za;Za=this;try{return e()}finally{Za=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=jS(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:r,treeLen:a,viewport:o,skipped:c}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((d,p,g,x)=>h.push({fromA:d,toA:p,fromB:g,toB:x})),n=Ss.applyChanges(n,h),r=gt.empty,a=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){c=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);p<g&&c.push({from:p,to:g})}}}return new Ch(this.parser,i,n,r,a,o,c,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:a}=this.skipped[n];r<e.to&&a>e.from&&(this.fragments=jS(this.fragments,r,a),this.skipped.splice(n--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends HC{createParse(i,n,r){let a=r[0].from,o=r[r.length-1].to;return{parsedPos:a,advance(){let h=Za;if(h){for(let d of r)h.tempSkipped.push(d);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new gt(pi.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Za}}function jS(t,e,i){return Ss.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Pl{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 Pl(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=Ch.create(e.facet(Ir).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new Pl(n)}}$i.state=Gt.define({create:Pl.init,update(t,e){for(let i of e.effects)if(i.is($i.setState))return i.value;return e.startState.facet(Ir)!=e.state.facet(Ir)?Pl.init(e.state):t.apply(e)}});let FC=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(FC=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const rm=typeof navigator<"u"&&(!((nm=navigator.scheduling)===null||nm===void 0)&&nm.isInputPending)?()=>navigator.scheduling.isInputPending():null,_6=ht.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($i.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($i.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=FC(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,a=n.field($i.state);if(a.tree==a.context.tree&&a.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!rm?Math.max(25,e.timeRemaining()-5):1e9),c=a.context.treeLen<r&&n.doc.length>r+1e3,h=a.context.work(()=>rm&&rm()||Date.now()>o,r+(c?0:1e5));this.chunkBudget-=Date.now()-i,(h||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:$i.setState.of(new Pl(a.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>fi(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()}}}),Ir=oe.define({combine(t){return t.length?t[0]:null},enables:t=>[$i.state,_6,le.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class H6{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const U6=oe.define(),Zh=oe.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 Ah(t){let e=t.facet(Zh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Do(t,e){let i="",n=t.tabSize,r=t.facet(Zh)[0];if(r==" "){for(;e>=n;)i+=" ",e-=n;r=" "}for(let a=0;a<e;a++)i+=r;return i}function S0(t,e){t instanceof Be&&(t=new $h(t));for(let n of t.state.facet(U6)){let r=n(t,e);if(r!==void 0)return r}let i=It(t.state);return i.length>=e?q6(t,i,e):null}class $h{constructor(e,i={}){this.state=e,this.options=i,this.unit=Ah(e)}lineAt(e,i=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:a}=this.options;return r!=null&&r>=n.from&&r<=n.to?a&&r==e?{text:"",from:e}:(i<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,i=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,i);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,i=1){let{text:n,from:r}=this.lineAt(e,i),a=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(a+=o-this.countColumn(n,n.search(/\S|$/))),a}countColumn(e,i=e.length){return Kl(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:n,from:r}=this.lineAt(e,i),a=this.options.overrideIndentation;if(a){let o=a(r);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const VC=new Oe;function q6(t,e,i){let n=e.resolveStack(i),r=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(r!=n.node){let a=[];for(let o=r;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)n={node:a[o],next:n}}return IC(n,t,i)}function IC(t,e,i){for(let n=t;n;n=n.next){let r=F6(n.node);if(r)return r(w0.create(e,i,n))}return 0}function P6(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function F6(t){let e=t.type.prop(VC);if(e)return e;let i=t.firstChild,n;if(i&&(n=i.type.prop(Oe.closedBy))){let r=t.lastChild,a=r&&n.indexOf(r.name)>-1;return o=>G6(o,!0,1,void 0,a&&!P6(o)?r.from:void 0)}return t.parent==null?V6:null}function V6(){return 0}class w0 extends $h{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 w0(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(I6(n,e))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}continue(){return IC(this.context.next,this.base,this.pos)}}function I6(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function Q6(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let r=t.options.simulateBreak,a=t.state.doc.lineAt(i.from),o=r==null||r<=a.from?a.to:Math.min(a.to,r);for(let c=i.to;;){let h=e.childAfter(c);if(!h||h==n)return null;if(!h.type.isSkipped){if(h.from>=o)return null;let d=/^ */.exec(a.text.slice(i.to-a.from))[0].length;return{from:i.from,to:i.to+d}}c=h.to}}function G6(t,e,i,n,r){let a=t.textAfter,o=a.match(/^\s*/)[0].length,c=n&&a.slice(o,o+n.length)==n||r==t.pos+o,h=Q6(t);return h?c?t.column(h.from):t.column(h.to):t.baseIndent+(c?0:t.unit*i)}function LS({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const Y6=200;function K6(){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+Y6)return t;let a=i.sliceString(r.from,n);if(!e.some(d=>d.test(a)))return t;let{state:o}=t,c=-1,h=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==c)continue;c=p.from;let g=S0(o,p.from);if(g==null)continue;let x=/^\s*/.exec(p.text)[0],v=Do(o,g);x!=v&&h.push({from:p.from,to:p.from+x.length,insert:v})}return h.length?[t,{changes:h,sequential:!0}]:t})}const W6=oe.define(),QC=new Oe;function X6(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=It(t);if(n.length<i)return null;let r=n.resolveStack(i,1),a=null;for(let o=r;o;o=o.next){let c=o.node;if(c.to<=i||c.from>i)continue;if(a&&c.from<e)break;let h=c.type.prop(QC);if(h&&(c.to<n.length-50||n.length==t.doc.length||!Z6(c))){let d=h(c,t);d&&d.from<=i&&d.from>=e&&d.to>i&&(a=d)}}return a}function Z6(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Mh(t,e,i){for(let n of t.facet(W6)){let r=n(t,e,i);if(r)return r}return J6(t,e,i)}function GC(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 ef=ke.define({map:GC}),Qo=ke.define({map:GC});function YC(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 Os=Gt.define({create(){return ye.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,n)=>t=BS(t,i,n)),t=t.map(e.changes);for(let i of e.effects)if(i.is(ef)&&!$6(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(XC),r=n?ye.replace({widget:new lB(n(e.state,i.value))}):zS;t=t.update({add:[r.range(i.value.from,i.value.to)]})}else i.is(Qo)&&(t=t.update({filter:(n,r)=>i.value.from!=n||i.value.to!=r,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=BS(t,e.selection.main.head)),t},provide:t=>le.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(zS.range(n,r))}return ye.set(e,!0)}});function BS(t,e,i=e){let n=!1;return t.between(e,i,(r,a)=>{r<i&&a>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(r,a)=>r>=i||a<=e}):t}function Th(t,e,i){var n;let r=null;return(n=t.field(Os,!1))===null||n===void 0||n.between(e,i,(a,o)=>{(!r||r.from>a)&&(r={from:a,to:o})}),r}function $6(t,e,i){let n=!1;return t.between(e,e,(r,a)=>{r==e&&a==i&&(n=!0)}),n}function KC(t,e){return t.field(Os,!1)?e:e.concat(ke.appendConfig.of(JC()))}const eB=t=>{for(let e of YC(t)){let i=Mh(t.state,e.from,e.to);if(i)return t.dispatch({effects:KC(t.state,[ef.of(i),WC(t,i)])}),!0}return!1},tB=t=>{if(!t.state.field(Os,!1))return!1;let e=[];for(let i of YC(t)){let n=Th(t.state,i.from,i.to);n&&e.push(Qo.of(n),WC(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function WC(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return le.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${r}.`)}const iB=t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let r=t.lineBlockAt(n),a=Mh(e,r.from,r.to);a&&i.push(ef.of(a)),n=(a?t.lineBlockAt(a.to):r).to+1}return i.length&&t.dispatch({effects:KC(t.state,i)}),!!i.length},nB=t=>{let e=t.state.field(Os,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(n,r)=>{i.push(Qo.of({from:n,to:r}))}),t.dispatch({effects:i}),!0},rB=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:eB},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:tB},{key:"Ctrl-Alt-[",run:iB},{key:"Ctrl-Alt-]",run:nB}],sB={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},XC=oe.define({combine(t){return Cn(t,sB)}});function JC(t){return[Os,uB]}function ZC(t,e){let{state:i}=t,n=i.facet(XC),r=o=>{let c=t.lineBlockAt(t.posAtDOM(o.target)),h=Th(t.state,c.from,c.to);h&&t.dispatch({effects:Qo.of(h)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r,e);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",i.phrase("folded code")),a.title=i.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=r,a}const zS=ye.replace({widget:new class extends An{toDOM(t){return ZC(t,null)}}});class lB extends An{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ZC(e,this.value)}}const aB={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class sm extends er{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 oB(t={}){let e={...aB,...t},i=new sm(e,!0),n=new sm(e,!1),r=ht.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ir)!=o.state.facet(Ir)||o.startState.field(Os,!1)!=o.state.field(Os,!1)||It(o.startState)!=It(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let c=new Zn;for(let h of o.viewportLineBlocks){let d=Th(o.state,h.from,h.to)?n:Mh(o.state,h.from,h.to)?i:null;d&&c.add(h.from,h.from,d)}return c.finish()}}),{domEventHandlers:a}=e;return[r,o6({class:"cm-foldGutter",markers(o){var c;return((c=o.plugin(r))===null||c===void 0?void 0:c.markers)||Re.empty},initialSpacer(){return new sm(e,!1)},domEventHandlers:{...a,click:(o,c,h)=>{if(a.click&&a.click(o,c,h))return!0;let d=Th(o.state,c.from,c.to);if(d)return o.dispatch({effects:Qo.of(d)}),!0;let p=Mh(o.state,c.from,c.to);return p?(o.dispatch({effects:ef.of(p)}),!0):!1}}}),JC()]}const uB=le.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 Go{constructor(e,i){this.specs=e;let n;function r(c){let h=qr.newName();return(n||(n=Object.create(null)))["."+h]=c,h}const a=typeof i.all=="string"?i.all:i.all?r(i.all):void 0,o=i.scope;this.scope=o instanceof $i?c=>c.prop(wl)==o.data:o?c=>c==o:void 0,this.style=PC(e.map(c=>({tag:c.tag,class:c.class||r(Object.assign({},c,{tag:null}))})),{all:a}).style,this.module=n?new qr(n):null,this.themeType=i.themeType}static define(e,i){return new Go(e,i||{})}}const vg=oe.define(),$C=oe.define({combine(t){return t.length?[t[0]]:null}});function lm(t){let e=t.facet(vg);return e.length?e:t.facet($C)}function eA(t,e){let i=[hB],n;return t instanceof Go&&(t.module&&i.push(le.styleModule.of(t.module)),n=t.themeType),e?.fallback?i.push($C.of(t)):n?i.push(vg.computeN([le.darkTheme],r=>r.facet(le.darkTheme)==(n=="dark")?[t]:[])):i.push(vg.of(t)),i}class cB{constructor(e){this.markCache=Object.create(null),this.tree=It(e.state),this.decorations=this.buildDeco(e,lm(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=It(e.state),n=lm(e.state),r=n!=lm(e.startState),{viewport:a}=e.view,o=e.changes.mapPos(this.decoratedTo,1);i.length<a.to&&!r&&i.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(i!=this.tree||e.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=a.to)}buildDeco(e,i){if(!i||!this.tree.length)return ye.none;let n=new Zn;for(let{from:r,to:a}of e.visibleRanges)R6(this.tree,i,(o,c,h)=>{n.add(o,c,this.markCache[h]||(this.markCache[h]=ye.mark({class:h})))},r,a);return n.finish()}}const hB=Es.high(ht.fromClass(cB,{decorations:t=>t.decorations})),fB=Go.define([{tag:Q.meta,color:"#404740"},{tag:Q.link,textDecoration:"underline"},{tag:Q.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Q.emphasis,fontStyle:"italic"},{tag:Q.strong,fontWeight:"bold"},{tag:Q.strikethrough,textDecoration:"line-through"},{tag:Q.keyword,color:"#708"},{tag:[Q.atom,Q.bool,Q.url,Q.contentSeparator,Q.labelName],color:"#219"},{tag:[Q.literal,Q.inserted],color:"#164"},{tag:[Q.string,Q.deleted],color:"#a11"},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],color:"#e40"},{tag:Q.definition(Q.variableName),color:"#00f"},{tag:Q.local(Q.variableName),color:"#30a"},{tag:[Q.typeName,Q.namespace],color:"#085"},{tag:Q.className,color:"#167"},{tag:[Q.special(Q.variableName),Q.macroName],color:"#256"},{tag:Q.definition(Q.propertyName),color:"#00c"},{tag:Q.comment,color:"#940"},{tag:Q.invalid,color:"#f00"}]),dB=le.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),tA=1e4,iA="()[]{}",nA=oe.define({combine(t){return Cn(t,{afterCursor:!0,brackets:iA,maxScanDistance:tA,renderMatch:gB})}}),pB=ye.mark({class:"cm-matchingBracket"}),mB=ye.mark({class:"cm-nonmatchingBracket"});function gB(t){let e=[],i=t.matched?pB:mB;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 _S(t){let e=[],i=t.facet(nA);for(let n of t.selection.ranges){if(!n.empty)continue;let r=xn(t,n.head,-1,i)||n.head>0&&xn(t,n.head-1,1,i)||i.afterCursor&&(xn(t,n.head,1,i)||n.head<t.doc.length&&xn(t,n.head+1,-1,i));r&&(e=e.concat(i.renderMatch(r,t)))}return ye.set(e,!0)}const yB=ht.fromClass(class{constructor(t){this.paused=!1,this.decorations=_S(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=_S(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),xB=[yB,dB];function bB(t={}){return[nA.of(t),xB]}const vB=new Oe;function Sg(t,e,i){let n=t.prop(e<0?Oe.openedBy:Oe.closedBy);if(n)return n;if(t.name.length==1){let r=i.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[i[r+e]]}return null}function wg(t){let e=t.type.prop(vB);return e?e(t.node):t}function xn(t,e,i,n={}){let r=n.maxScanDistance||tA,a=n.brackets||iA,o=It(t),c=o.resolveInner(e,i);for(let h=c;h;h=h.parent){let d=Sg(h.type,i,a);if(d&&h.from<h.to){let p=wg(h);if(p&&(i>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return SB(t,e,i,h,p,d,a)}}return wB(t,e,i,o,c.type,r,a)}function SB(t,e,i,n,r,a,o){let c=n.parent,h={from:r.from,to:r.to},d=0,p=c?.cursor();if(p&&(i<0?p.childBefore(n.from):p.childAfter(n.to)))do if(i<0?p.to<=n.from:p.from>=n.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let g=wg(p);return{start:h,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(Sg(p.type,i,o))d++;else if(Sg(p.type,-i,o)){if(d==0){let g=wg(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 wB(t,e,i,n,r,a,o){let c=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=o.indexOf(c);if(h<0||h%2==0!=i>0)return null;let d={from:i<0?e-1:e,to:i>0?e+1:e},p=t.doc.iterRange(e,i>0?t.doc.length:0),g=0;for(let x=0;!p.next().done&&x<=a;){let v=p.value;i<0&&(x+=v.length);let w=e+x*i;for(let k=i>0?0:v.length-1,C=i>0?v.length:-1;k!=C;k+=i){let M=o.indexOf(v[k]);if(!(M<0||n.resolveInner(w+k,1).type!=r))if(M%2==0==i>0)g++;else{if(g==1)return{start:d,end:{from:w+k,to:w+k+1},matched:M>>1==h>>1};g--}}i>0&&(x+=v.length)}return p.done?{start:d,matched:!1}:null}const kB=Object.create(null),HS=[pi.none],US=[],qS=Object.create(null),CB=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"]])CB[t]=AB(kB,e);function am(t,e){US.indexOf(t)>-1||(US.push(t),console.warn(e))}function AB(t,e){let i=[];for(let c of e.split(" ")){let h=[];for(let d of c.split(".")){let p=t[d]||Q[d];p?typeof p=="function"?h.length?h=h.map(p):am(d,`Modifier ${d} used at start of tag`):h.length?am(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:am(d,`Unknown highlighting tag ${d}`)}for(let d of h)i.push(d)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(c=>c.id),a=qS[r];if(a)return a.id;let o=qS[r]=pi.define({id:HS.length,name:n,props:[UC({[n]:i})]});return HS.push(o),o.id}Je.RTL,Je.LTR;const MB=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=C0(t.state,i.from);return n.line?TB(t):n.block?EB(t):!1};function k0(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 TB=k0(DB,0),OB=k0(rA,0),EB=k0((t,e)=>rA(t,e,RB(e)),0);function C0(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const $a=50;function NB(t,{open:e,close:i},n,r){let a=t.sliceDoc(n-$a,n),o=t.sliceDoc(r,r+$a),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(o)[0].length,d=a.length-c;if(a.slice(d-e.length,d)==e&&o.slice(h,h+i.length)==i)return{open:{pos:n-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};let p,g;r-n<=2*$a?p=g=t.sliceDoc(n,r):(p=t.sliceDoc(n,n+$a),g=t.sliceDoc(r-$a,r));let x=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-i.length;return p.slice(x,x+e.length)==e&&g.slice(w,w+i.length)==i?{open:{pos:n+x+e.length,margin:/\s/.test(p.charAt(x+e.length))?1:0},close:{pos:r-v-i.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function RB(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let a=e.length-1;a>=0&&e[a].to>n.from?e[a].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function rA(t,e,i=e.selection.ranges){let n=i.map(a=>C0(e,a.from).block);if(!n.every(a=>a))return null;let r=i.map((a,o)=>NB(e,n[o],a.from,a.to));if(t!=2&&!r.every(a=>a))return{changes:e.changes(i.map((a,o)=>r[o]?[]:[{from:a.from,insert:n[o].open+" "},{from:a.to,insert:" "+n[o].close}]))};if(t!=1&&r.some(a=>a)){let a=[];for(let o=0,c;o<r.length;o++)if(c=r[o]){let h=n[o],{open:d,close:p}=c;a.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:a}}return null}function DB(t,e,i=e.selection.ranges){let n=[],r=-1;e:for(let{from:a,to:o}of i){let c=n.length,h=1e9,d;for(let p=a;p<=o;){let g=e.doc.lineAt(p);if(d==null&&(d=C0(e,g.from).line,!d))continue e;if(g.from>r&&(a==o||o>g.from)){r=g.from;let x=/^\s*/.exec(g.text)[0].length,v=x==g.length,w=g.text.slice(x,x+d.length)==d?x:-1;x<g.text.length&&x<h&&(h=x),n.push({line:g,comment:w,token:d,indent:x,empty:v,single:!1})}p=g.to+1}if(h<1e9)for(let p=c;p<n.length;p++)n[p].indent<n[p].line.text.length&&(n[p].indent=h);n.length==c+1&&(n[c].single=!0)}if(t!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:c,token:h,indent:d,empty:p,single:g}of n)(g||!p)&&a.push({from:c.from+d,insert:h+" "});let o=e.changes(a);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:c,token:h}of n)if(c>=0){let d=o.from+c,p=d+h.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const kg=kn.define(),jB=kn.define(),LB=oe.define(),sA=oe.define({combine(t){return Cn(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)})}}),lA=Gt.define({create(){return bn.empty},update(t,e){let i=e.state.facet(sA),n=e.annotation(kg);if(n){let h=di.fromTransaction(e,n.selection),d=n.side,p=d==0?t.undone:t.done;return h?p=Oh(p,p.length,i.minDepth,h):p=uA(p,e.startState.selection),new bn(d==0?n.rest:p,d==0?p:n.rest)}let r=e.annotation(jB);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Ot.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let a=di.fromTransaction(e),o=e.annotation(Ot.time),c=e.annotation(Ot.userEvent);return a?t=t.addChanges(a,o,c,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,c,i.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new bn(t.done.map(di.fromJSON),t.undone.map(di.fromJSON))}});function BB(t={}){return[lA,sA.of(t),le.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?aA:e.inputType=="historyRedo"?Cg:null;return n?(e.preventDefault(),n(i)):!1}})]}function tf(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(lA,!1);if(!r)return!1;let a=r.pop(t,i,e);return a?(n(a),!0):!1}}const aA=tf(0,!1),Cg=tf(1,!1),zB=tf(0,!0),_B=tf(1,!0);class di{constructor(e,i,n,r,a){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=a}setSelAfter(e){return new di(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 di(e.changes&&At.fromJSON(e.changes),[],e.mapped&&wn.fromJSON(e.mapped),e.startSelection&&X.fromJSON(e.startSelection),e.selectionsAfter.map(X.fromJSON))}static fromTransaction(e,i){let n=Vi;for(let r of e.startState.facet(LB)){let a=r(e);a.length&&(n=n.concat(a))}return!n.length&&e.changes.empty?null:new di(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,Vi)}static selection(e){return new di(void 0,Vi,void 0,void 0,e)}}function Oh(t,e,i,n){let r=e+1>i+20?e-i-1:0,a=t.slice(r,e);return a.push(n),a}function HB(t,e){let i=[],n=!1;return t.iterChangedRanges((r,a)=>i.push(r,a)),e.iterChangedRanges((r,a,o,c)=>{for(let h=0;h<i.length;){let d=i[h++],p=i[h++];c>=d&&o<=p&&(n=!0)}}),n}function UB(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function oA(t,e){return t.length?e.length?t.concat(e):t:e}const Vi=[],qB=200;function uA(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-qB));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Oh(t,t.length-1,1e9,i.setSelAfter(n)))}else return[di.selection([e])]}function PB(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 om(t,e){if(!t.length)return t;let i=t.length,n=Vi;for(;i;){let r=FB(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let a=t.slice(0,i);return a[i-1]=r,a}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[di.selection(n)]:Vi}function FB(t,e,i){let n=oA(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Vi,i);if(!t.changes)return di.selection(n);let r=t.changes.map(e),a=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(a):a;return new di(r,ke.mapEffects(t.effects,e),o,t.startSelection.map(a),n)}const VB=/^(input\.type|delete)($|\.)/;class bn{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 bn(this.done,this.undone):this}addChanges(e,i,n,r,a){let o=this.done,c=o[o.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||VB.test(n))&&(!c.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(a,HB(c.changes,e.changes))||n=="input.type.compose")?o=Oh(o,o.length-1,r.minDepth,new di(e.changes.compose(c.changes),oA(ke.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,Vi)):o=Oh(o,o.length,r.minDepth,e),new bn(o,Vi,i,n)}addSelection(e,i,n,r){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Vi;return a.length>0&&i-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&UB(a[a.length-1],e)?this:new bn(uA(this.done,e),this.undone,i,n)}addMapping(e){return new bn(om(this.done,e),om(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,i,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let a=r[r.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):i.selection);if(n&&a.selectionsAfter.length)return i.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:kg.of({side:e,rest:PB(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let c=r.length==1?Vi:r.slice(0,r.length-1);return a.mapped&&(c=om(c,a.mapped)),i.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:kg.of({side:e,rest:c,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}bn.empty=new bn(Vi,Vi);const IB=[{key:"Mod-z",run:aA,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Cg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Cg,preventDefault:!0},{key:"Mod-u",run:zB,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:_B,preventDefault:!0}];function Wl(t,e){return X.create(t.ranges.map(e),t.mainIndex)}function rn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function sn({state:t,dispatch:e},i){let n=Wl(t.selection,i);return n.eq(t.selection,!0)?!1:(e(rn(t,n)),!0)}function nf(t,e){return X.cursor(e?t.to:t.from)}function cA(t,e){return sn(t,i=>i.empty?t.moveByChar(i,e):nf(i,e))}function Yt(t){return t.textDirectionAt(t.state.selection.main.head)==Je.LTR}const hA=t=>cA(t,!Yt(t)),fA=t=>cA(t,Yt(t));function dA(t,e){return sn(t,i=>i.empty?t.moveByGroup(i,e):nf(i,e))}const QB=t=>dA(t,!Yt(t)),GB=t=>dA(t,Yt(t));function YB(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 rf(t,e,i){let n=It(t).resolveInner(e.head),r=i?Oe.closedBy:Oe.openedBy;for(let h=e.head;;){let d=i?n.childAfter(h):n.childBefore(h);if(!d)break;YB(t,d,r)?n=d:h=i?d.to:d.from}let a=n.type.prop(r),o,c;return a&&(o=i?xn(t,n.from,1):xn(t,n.to,-1))&&o.matched?c=i?o.end.to:o.end.from:c=i?n.to:n.from,X.cursor(c,i?-1:1)}const KB=t=>sn(t,e=>rf(t.state,e,!Yt(t))),WB=t=>sn(t,e=>rf(t.state,e,Yt(t)));function pA(t,e){return sn(t,i=>{if(!i.empty)return nf(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}const mA=t=>pA(t,!1),gA=t=>pA(t,!0);function yA(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,n=0,r;if(e){for(let a of t.state.facet(le.scrollMargins)){let o=a(t);o?.top&&(i=Math.max(o?.top,i)),o?.bottom&&(n=Math.max(o?.bottom,n))}r=t.scrollDOM.clientHeight-i-n}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function xA(t,e){let i=yA(t),{state:n}=t,r=Wl(n.selection,o=>o.empty?t.moveVertically(o,e,i.height):nf(o,e));if(r.eq(n.selection))return!1;let a;if(i.selfScroll){let o=t.coordsAtPos(n.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),h=c.top+i.marginTop,d=c.bottom-i.marginBottom;o&&o.top>h&&o.bottom<d&&(a=le.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-h}))}return t.dispatch(rn(n,r),{effects:a}),!0}const PS=t=>xA(t,!1),Ag=t=>xA(t,!0);function Gr(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let a=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&e.head!=n.from+a&&(r=X.cursor(n.from+a))}return r}const XB=t=>sn(t,e=>Gr(t,e,!0)),JB=t=>sn(t,e=>Gr(t,e,!1)),ZB=t=>sn(t,e=>Gr(t,e,!Yt(t))),$B=t=>sn(t,e=>Gr(t,e,Yt(t))),e8=t=>sn(t,e=>X.cursor(t.lineBlockAt(e.head).from,1)),t8=t=>sn(t,e=>X.cursor(t.lineBlockAt(e.head).to,-1));function i8(t,e,i){let n=!1,r=Wl(t.selection,a=>{let o=xn(t,a.head,-1)||xn(t,a.head,1)||a.head>0&&xn(t,a.head-1,1)||a.head<t.doc.length&&xn(t,a.head+1,-1);if(!o||!o.end)return a;n=!0;let c=o.start.from==a.head?o.end.to:o.end.from;return X.cursor(c)});return n?(e(rn(t,r)),!0):!1}const n8=({state:t,dispatch:e})=>i8(t,e);function Yi(t,e){let i=Wl(t.state.selection,n=>{let r=e(n);return X.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(rn(t.state,i)),!0)}function bA(t,e){return Yi(t,i=>t.moveByChar(i,e))}const vA=t=>bA(t,!Yt(t)),SA=t=>bA(t,Yt(t));function wA(t,e){return Yi(t,i=>t.moveByGroup(i,e))}const r8=t=>wA(t,!Yt(t)),s8=t=>wA(t,Yt(t)),l8=t=>Yi(t,e=>rf(t.state,e,!Yt(t))),a8=t=>Yi(t,e=>rf(t.state,e,Yt(t)));function kA(t,e){return Yi(t,i=>t.moveVertically(i,e))}const CA=t=>kA(t,!1),AA=t=>kA(t,!0);function MA(t,e){return Yi(t,i=>t.moveVertically(i,e,yA(t).height))}const FS=t=>MA(t,!1),VS=t=>MA(t,!0),o8=t=>Yi(t,e=>Gr(t,e,!0)),u8=t=>Yi(t,e=>Gr(t,e,!1)),c8=t=>Yi(t,e=>Gr(t,e,!Yt(t))),h8=t=>Yi(t,e=>Gr(t,e,Yt(t))),f8=t=>Yi(t,e=>X.cursor(t.lineBlockAt(e.head).from)),d8=t=>Yi(t,e=>X.cursor(t.lineBlockAt(e.head).to)),IS=({state:t,dispatch:e})=>(e(rn(t,{anchor:0})),!0),QS=({state:t,dispatch:e})=>(e(rn(t,{anchor:t.doc.length})),!0),GS=({state:t,dispatch:e})=>(e(rn(t,{anchor:t.selection.main.anchor,head:0})),!0),YS=({state:t,dispatch:e})=>(e(rn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),p8=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),m8=({state:t,dispatch:e})=>{let i=sf(t).map(({from:n,to:r})=>X.range(n,Math.min(r+1,t.doc.length)));return e(t.update({selection:X.create(i),userEvent:"select"})),!0},g8=({state:t,dispatch:e})=>{let i=Wl(t.selection,n=>{let r=It(t),a=r.resolveStack(n.from,1);if(n.empty){let o=r.resolveStack(n.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:c}=o;if((c.from<n.from&&c.to>=n.to||c.to>n.to&&c.from<=n.from)&&o.next)return X.range(c.to,c.from)}return n});return i.eq(t.selection)?!1:(e(rn(t,i)),!0)};function TA(t,e){let{state:i}=t,n=i.selection,r=i.selection.ranges.slice();for(let a of i.selection.ranges){let o=i.doc.lineAt(a.head);if(e?o.to<t.state.doc.length:o.from>0)for(let c=a;;){let h=t.moveVertically(c,e);if(h.head<o.from||h.head>o.to){r.some(d=>d.head==h.head)||r.push(h);break}else{if(h.head==c.head)break;c=h}}}return r.length==n.ranges.length?!1:(t.dispatch(rn(i,X.create(r,r.length-1))),!0)}const y8=t=>TA(t,!1),x8=t=>TA(t,!0),b8=({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=X.create([i.main]):i.main.empty||(n=X.create([X.cursor(i.main.head)])),n?(e(rn(t,n)),!0):!1};function Yo(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(a=>{let{from:o,to:c}=a;if(o==c){let h=e(a);h<o?(i="delete.backward",h=jc(t,h,!1)):h>o&&(i="delete.forward",h=jc(t,h,!0)),o=Math.min(o,h),c=Math.max(c,h)}else o=jc(t,o,!1),c=jc(t,c,!0);return o==c?{range:a}:{changes:{from:o,to:c},range:X.cursor(o,o<a.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(n.update(r,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?le.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function jc(t,e,i){if(t instanceof le)for(let n of t.state.facet(le.atomicRanges).map(r=>r(t)))n.between(e,e,(r,a)=>{r<e&&a>e&&(e=i?a:r)});return e}const OA=(t,e,i)=>Yo(t,n=>{let r=n.from,{state:a}=t,o=a.doc.lineAt(r),c,h;if(i&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(c=o.text.slice(0,r-o.from))){if(c[c.length-1]==" ")return r-1;let d=Kl(c,a.tabSize),p=d%Ah(a)||Ah(a);for(let g=0;g<p&&c[c.length-1-g]==" ";g++)r--;h=r}else h=Dt(o.text,r-o.from,e,e)+o.from,h==r&&o.number!=(e?a.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(h-o.from,r-o.from))&&(h=Dt(o.text,h-o.from,!1,!1)+o.from);return h}),Mg=t=>OA(t,!1,!0),EA=t=>OA(t,!0,!1),NA=(t,e)=>Yo(t,i=>{let n=i.head,{state:r}=t,a=r.doc.lineAt(n),o=r.charCategorizer(n);for(let c=null;;){if(n==(e?a.to:a.from)){n==i.head&&a.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=Dt(a.text,n-a.from,e)+a.from,d=a.text.slice(Math.min(n,h)-a.from,Math.max(n,h)-a.from),p=o(d);if(c!=null&&p!=c)break;(d!=" "||n!=i.head)&&(c=p),n=h}return n}),RA=t=>NA(t,!1),v8=t=>NA(t,!0),S8=t=>Yo(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),w8=t=>Yo(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),k8=t=>Yo(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),C8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Pe.of(["",""])},range:X.cursor(n.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},A8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let r=n.from,a=t.doc.lineAt(r),o=r==a.from?r-1:Dt(a.text,r-a.from,!1)+a.from,c=r==a.to?r+1:Dt(a.text,r-a.from,!0)+a.from;return{changes:{from:o,to:c,insert:t.doc.slice(r,c).append(t.doc.slice(o,r))},range:X.cursor(c)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function sf(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),a=t.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=t.doc.lineAt(n.to-1)),i>=r.number){let o=e[e.length-1];o.to=a.to,o.ranges.push(n)}else e.push({from:r.from,to:a.to,ranges:[n]});i=a.number+1}return e}function DA(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let a of sf(t)){if(i?a.to==t.doc.length:a.from==0)continue;let o=t.doc.lineAt(i?a.to+1:a.from-1),c=o.length+1;if(i){n.push({from:a.to,to:o.to},{from:a.from,insert:o.text+t.lineBreak});for(let h of a.ranges)r.push(X.range(Math.min(t.doc.length,h.anchor+c),Math.min(t.doc.length,h.head+c)))}else{n.push({from:o.from,to:a.from},{from:a.to,insert:t.lineBreak+o.text});for(let h of a.ranges)r.push(X.range(h.anchor-c,h.head-c))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:X.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const M8=({state:t,dispatch:e})=>DA(t,e,!1),T8=({state:t,dispatch:e})=>DA(t,e,!0);function jA(t,e,i){if(t.readOnly)return!1;let n=[];for(let a of sf(t))i?n.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):n.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)});let r=t.changes(n);return e(t.update({changes:r,selection:t.selection.map(r,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const O8=({state:t,dispatch:e})=>jA(t,e,!1),E8=({state:t,dispatch:e})=>jA(t,e,!0),N8=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(sf(e).map(({from:r,to:a})=>(r>0?r--:a<e.doc.length&&a++,{from:r,to:a}))),n=Wl(e.selection,r=>{let a;if(t.lineWrapping){let o=t.lineBlockAt(r.head),c=t.coordsAtPos(r.head,r.assoc||1);c&&(a=o.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,a)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function R8(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=It(t).resolveInner(e),n=i.childBefore(e),r=i.childAfter(e),a;return n&&r&&n.to<=e&&r.from>=e&&(a=n.type.prop(Oe.closedBy))&&a.indexOf(r.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const KS=LA(!1),D8=LA(!0);function LA(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:a,to:o}=r,c=e.doc.lineAt(a),h=!t&&a==o&&R8(e,a);t&&(a=o=(o<=c.to?c:e.doc.lineAt(o)).to);let d=new $h(e,{simulateBreak:a,simulateDoubleBreak:!!h}),p=S0(d,a);for(p==null&&(p=Kl(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));o<c.to&&/\s/.test(c.text[o-c.from]);)o++;h?{from:a,to:o}=h:a>c.from&&a<c.from+100&&!/\S/.test(c.text.slice(0,a))&&(a=c.from);let g=["",Do(e,p)];return h&&g.push(Do(e,d.lineIndent(c.from,-1))),{changes:{from:a,to:o,insert:Pe.of(g)},range:X.cursor(a+1+g[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function A0(t,e){let i=-1;return t.changeByRange(n=>{let r=[];for(let o=n.from;o<=n.to;){let c=t.doc.lineAt(o);c.number>i&&(n.empty||n.to>c.from)&&(e(c,r,n),i=c.number),o=c.to+1}let a=t.changes(r);return{changes:r,range:X.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const j8=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new $h(t,{overrideIndentation:a=>{let o=i[a];return o??-1}}),r=A0(t,(a,o,c)=>{let h=S0(n,a.from);if(h==null)return;/\S/.test(a.text)||(h=0);let d=/^\s*/.exec(a.text)[0],p=Do(t,h);(d!=p||c.from<a.from+d.length)&&(i[a.from]=h,o.push({from:a.from,to:a.from+d.length,insert:p}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},BA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(A0(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Zh)})}),{userEvent:"input.indent"})),!0),zA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(A0(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let a=Kl(r,t.tabSize),o=0,c=Do(t,Math.max(0,a-Ah(t)));for(;o<r.length&&o<c.length&&r.charCodeAt(o)==c.charCodeAt(o);)o++;n.push({from:i.from+o,to:i.from+r.length,insert:c.slice(o)})}),{userEvent:"delete.dedent"})),!0),L8=t=>(t.setTabFocusMode(),!0),B8=[{key:"Ctrl-b",run:hA,shift:vA,preventDefault:!0},{key:"Ctrl-f",run:fA,shift:SA},{key:"Ctrl-p",run:mA,shift:CA},{key:"Ctrl-n",run:gA,shift:AA},{key:"Ctrl-a",run:e8,shift:f8},{key:"Ctrl-e",run:t8,shift:d8},{key:"Ctrl-d",run:EA},{key:"Ctrl-h",run:Mg},{key:"Ctrl-k",run:S8},{key:"Ctrl-Alt-h",run:RA},{key:"Ctrl-o",run:C8},{key:"Ctrl-t",run:A8},{key:"Ctrl-v",run:Ag}],z8=[{key:"ArrowLeft",run:hA,shift:vA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:QB,shift:r8,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ZB,shift:c8,preventDefault:!0},{key:"ArrowRight",run:fA,shift:SA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:GB,shift:s8,preventDefault:!0},{mac:"Cmd-ArrowRight",run:$B,shift:h8,preventDefault:!0},{key:"ArrowUp",run:mA,shift:CA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:IS,shift:GS},{mac:"Ctrl-ArrowUp",run:PS,shift:FS},{key:"ArrowDown",run:gA,shift:AA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:QS,shift:YS},{mac:"Ctrl-ArrowDown",run:Ag,shift:VS},{key:"PageUp",run:PS,shift:FS},{key:"PageDown",run:Ag,shift:VS},{key:"Home",run:JB,shift:u8,preventDefault:!0},{key:"Mod-Home",run:IS,shift:GS},{key:"End",run:XB,shift:o8,preventDefault:!0},{key:"Mod-End",run:QS,shift:YS},{key:"Enter",run:KS,shift:KS},{key:"Mod-a",run:p8},{key:"Backspace",run:Mg,shift:Mg,preventDefault:!0},{key:"Delete",run:EA,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:RA,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:v8,preventDefault:!0},{mac:"Mod-Backspace",run:w8,preventDefault:!0},{mac:"Mod-Delete",run:k8,preventDefault:!0}].concat(B8.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),_8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:KB,shift:l8},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:WB,shift:a8},{key:"Alt-ArrowUp",run:M8},{key:"Shift-Alt-ArrowUp",run:O8},{key:"Alt-ArrowDown",run:T8},{key:"Shift-Alt-ArrowDown",run:E8},{key:"Mod-Alt-ArrowUp",run:y8},{key:"Mod-Alt-ArrowDown",run:x8},{key:"Escape",run:b8},{key:"Mod-Enter",run:D8},{key:"Alt-l",mac:"Ctrl-l",run:m8},{key:"Mod-i",run:g8,preventDefault:!0},{key:"Mod-[",run:zA},{key:"Mod-]",run:BA},{key:"Mod-Alt-\\",run:j8},{key:"Shift-Mod-k",run:N8},{key:"Shift-Mod-\\",run:n8},{key:"Mod-/",run:MB},{key:"Alt-A",run:OB},{key:"Ctrl-m",mac:"Shift-Alt-m",run:L8}].concat(z8),H8={key:"Tab",run:BA,shift:zA},WS=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Fl{constructor(e,i,n=0,r=e.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=a?c=>a(WS(c)):WS,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 oi(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=Zg(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=mn(e);let r=this.normalize(i);if(r.length)for(let a=0,o=n;;a++){let c=r.charCodeAt(a),h=this.match(c,o,this.bufferPos+this.bufferStart);if(a==r.length-1){if(h)return this.value=h,this;break}o==n&&a<i.length&&i.charCodeAt(a)==c&&o++}}}match(e,i,n){let r=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],c=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[a+1],to:n}:(this.matches[a]++,c=!0)),c||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:i,to:n}:this.matches.push(1,i)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(Fl.prototype[Symbol.iterator]=function(){return this});const _A={from:-1,to:-1,match:/.*/.exec("")},M0="gm"+(/x/.unicode==null?"":"u");class HA{constructor(e,i,n,r=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=_A,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new UA(e,i,n,r,a);this.re=new RegExp(i,M0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=Eh(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=Eh(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 um=new WeakMap;class El{constructor(e,i){this.from=e,this.text=i}get to(){return this.from+this.text.length}static get(e,i,n){let r=um.get(e);if(!r||r.from>=n||r.to<=i){let c=new El(i,e.sliceString(i,n));return um.set(e,c),c}if(r.from==i&&r.to==n)return r;let{text:a,from:o}=r;return o>i&&(a=e.sliceString(i,o)+a,o=i),r.to<n&&(a+=e.sliceString(r.to,n)),um.set(e,new El(o,a)),new El(i,a.slice(i-o,n-o))}}class UA{constructor(e,i,n,r,a){this.text=e,this.to=a,this.done=!1,this.value=_A,this.matchPos=Eh(e,r),this.re=new RegExp(i,M0+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=El.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=Eh(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=El.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(HA.prototype[Symbol.iterator]=UA.prototype[Symbol.iterator]=function(){return this});function U8(t){try{return new RegExp(t,M0),!0}catch{return!1}}function Eh(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 q8=t=>{let{state:e}=t,i=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:r}=r6(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:e.phrase("go")});return r.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){t.dispatch({effects:n});return}let c=e.doc.lineAt(e.selection.main.head),[,h,d,p,g]=o,x=p?+p.slice(1):0,v=d?+d:c.number;if(d&&g){let C=v/100;h&&(C=C*(h=="-"?-1:1)+c.number/e.doc.lines),v=Math.round(e.doc.lines*C)}else d&&h&&(v=v*(h=="-"?-1:1)+c.number);let w=e.doc.line(Math.max(1,Math.min(e.doc.lines,v))),k=X.cursor(w.from+Math.max(0,Math.min(x,w.length)));t.dispatch({effects:[n,le.scrollIntoView(k.from,{y:"center"})],selection:k})}),!0},P8={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},F8=oe.define({combine(t){return Cn(t,P8,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function V8(t){return[K8,Y8]}const I8=ye.mark({class:"cm-selectionMatch"}),Q8=ye.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function XS(t,e,i,n){return(i==0||t(e.sliceDoc(i-1,i))!=rt.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=rt.Word)}function G8(t,e,i,n){return t(e.sliceDoc(i,i+1))==rt.Word&&t(e.sliceDoc(n-1,n))==rt.Word}const Y8=ht.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(F8),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ye.none;let r=n.main,a,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ye.none;let h=i.wordAt(r.head);if(!h)return ye.none;o=i.charCategorizer(r.head),a=i.sliceDoc(h.from,h.to)}else{let h=r.to-r.from;if(h<e.minSelectionLength||h>200)return ye.none;if(e.wholeWords){if(a=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!(XS(o,i,r.from,r.to)&&G8(o,i,r.from,r.to)))return ye.none}else if(a=i.sliceDoc(r.from,r.to),!a)return ye.none}let c=[];for(let h of t.visibleRanges){let d=new Fl(i.doc,a,h.from,h.to);for(;!d.next().done;){let{from:p,to:g}=d.value;if((!o||XS(o,i,p,g))&&(r.empty&&p<=r.from&&g>=r.to?c.push(Q8.range(p,g)):(p>=r.to||g<=r.from)&&c.push(I8.range(p,g)),c.length>e.maxMatches))return ye.none}}return ye.set(c)}},{decorations:t=>t.decorations}),K8=le.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),W8=({state:t,dispatch:e})=>{let{selection:i}=t,n=X.create(i.ranges.map(r=>t.wordAt(r.head)||X.cursor(r.head)),i.mainIndex);return n.eq(i)?!1:(e(t.update({selection:n})),!0)};function X8(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),a=r&&r.from==i.from&&r.to==i.to;for(let o=!1,c=new Fl(t.doc,e,n[n.length-1].to);;)if(c.next(),c.done){if(o)return null;c=new Fl(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(h=>h.from==c.value.from))continue;if(a){let h=t.wordAt(c.value.from);if(!h||h.from!=c.value.from||h.to!=c.value.to)continue}return c.value}}const J8=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(a=>a.from===a.to))return W8({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let r=X8(t,n);return r?(e(t.update({selection:t.selection.addRange(X.range(r.from,r.to),!1),effects:le.scrollIntoView(r.to)})),!0):!1},Xl=oe.define({combine(t){return Cn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new h9(e),scrollToMatch:e=>le.scrollIntoView(e)})}});class qA{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||U8(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 n9(this):new e9(this)}getCursor(e,i=0,n){let r=e.doc?e:Be.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?yl(this,r,i,n):gl(this,r,i,n)}}class PA{constructor(e){this.spec=e}}function Z8(t,e,i){return(n,r,a,o)=>{if(i&&!i(n,r,a,o))return!1;let c=n>=o&&r<=o+a.length?a.slice(n-o,r-o):e.doc.sliceString(n,r);return t(c,e,n,r)}}function gl(t,e,i,n){let r;return t.wholeWord&&(r=$8(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(r=Z8(t.test,e,r)),new Fl(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:a=>a.toLowerCase(),r)}function $8(t,e){return(i,n,r,a)=>((a>i||a+r.length<n)&&(a=Math.max(0,i-2),r=t.sliceString(a,Math.min(t.length,n+2))),(e(Nh(r,i-a))!=rt.Word||e(Rh(r,i-a))!=rt.Word)&&(e(Rh(r,n-a))!=rt.Word||e(Nh(r,n-a))!=rt.Word))}class e9 extends PA{constructor(e){super(e)}nextMatch(e,i,n){let r=gl(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let a=Math.min(e.doc.length,i+this.spec.unquoted.length);r=gl(this.spec,e,0,a).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let a=Math.max(i,r-1e4-this.spec.unquoted.length),o=gl(this.spec,e,a,r),c=null;for(;!o.nextOverlapping().done;)c=o.value;if(c)return c;if(a==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=gl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let a=gl(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}function t9(t,e,i){return(n,r,a)=>(!i||i(n,r,a))&&t(a[0],e,n,r)}function yl(t,e,i,n){let r;return t.wholeWord&&(r=i9(e.charCategorizer(e.selection.main.head))),t.test&&(r=t9(t.test,e,r)),new HA(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:r},i,n)}function Nh(t,e){return t.slice(Dt(t,e,!1),e)}function Rh(t,e){return t.slice(e,Dt(t,e))}function i9(t){return(e,i,n)=>!n[0].length||(t(Nh(n.input,n.index))!=rt.Word||t(Rh(n.input,n.index))!=rt.Word)&&(t(Rh(n.input,n.index+n[0].length))!=rt.Word||t(Nh(n.input,n.index+n[0].length))!=rt.Word)}class n9 extends PA{nextMatch(e,i,n){let r=yl(this.spec,e,n,e.doc.length).next();return r.done&&(r=yl(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let a=Math.max(i,n-r*1e4),o=yl(this.spec,e,a,n),c=null;for(;!o.next().done;)c=o.value;if(c&&(a==i||c.from>a+10))return c;if(a==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(i,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let a=+n.slice(0,r);if(a>0&&a<e.match.length)return e.match[a]+n.slice(r)}return i})}matchAll(e,i){let n=yl(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let a=yl(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}const jo=ke.define(),T0=ke.define(),_r=Gt.define({create(t){return new cm(Tg(t).create(),null)},update(t,e){for(let i of e.effects)i.is(jo)?t=new cm(i.value.create(),t.panel):i.is(T0)&&(t=new cm(t.query,i.value?O0:null));return t},provide:t=>Eo.from(t,e=>e.panel)});class cm{constructor(e,i){this.query=e,this.panel=i}}const r9=ye.mark({class:"cm-searchMatch"}),s9=ye.mark({class:"cm-searchMatch cm-searchMatch-selected"}),l9=ht.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(_r))}update(t){let e=t.state.field(_r);(e!=t.startState.field(_r)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ye.none;let{view:i}=this,n=new Zn;for(let r=0,a=i.visibleRanges,o=a.length;r<o;r++){let{from:c,to:h}=a[r];for(;r<o-1&&h>a[r+1].from-500;)h=a[++r].to;t.highlight(i.state,c,h,(d,p)=>{let g=i.state.selection.ranges.some(x=>x.from==d&&x.to==p);n.add(d,p,g?s9:r9)})}return n.finish()}},{decorations:t=>t.decorations});function Ko(t){return e=>{let i=e.state.field(_r,!1);return i&&i.query.spec.valid?t(e,i):IA(e)}}const Dh=Ko((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=X.single(n.from,n.to),a=t.state.facet(Xl);return t.dispatch({selection:r,effects:[E0(t,n),a.scrollToMatch(r.main,t)],userEvent:"select.search"}),VA(t),!0}),jh=Ko((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let a=X.single(r.from,r.to),o=t.state.facet(Xl);return t.dispatch({selection:a,effects:[E0(t,r),o.scrollToMatch(a.main,t)],userEvent:"select.search"}),VA(t),!0}),a9=Ko((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:X.create(i.map(n=>X.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),o9=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,a=[],o=0;for(let c=new Fl(t.doc,t.sliceDoc(n,r));!c.next().done;){if(a.length>1e3)return!1;c.value.from==n&&(o=a.length),a.push(X.range(c.value.from,c.value.to))}return e(t.update({selection:X.create(a,o),userEvent:"select.search.matches"})),!0},JS=Ko((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let a=e.nextMatch(i,n,n);if(!a)return!1;let o=a,c=[],h,d,p=[];o.from==n&&o.to==r&&(d=i.toText(e.getReplacement(o)),c.push({from:o.from,to:o.to,insert:d}),o=e.nextMatch(i,o.from,o.to),p.push(le.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+".")));let g=t.state.changes(c);return o&&(h=X.single(o.from,o.to).map(g),p.push(E0(t,o)),p.push(i.facet(Xl).scrollToMatch(h.main,t))),t.dispatch({changes:g,selection:h,effects:p,userEvent:"input.replace"}),!0}),u9=Ko((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(r=>{let{from:a,to:o}=r;return{from:a,to:o,insert:e.getReplacement(r)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:le.announce.of(n),userEvent:"input.replace.all"}),!0});function O0(t){return t.state.facet(Xl).createPanel(t)}function Tg(t,e){var i,n,r,a,o;let c=t.selection.main,h=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!h)return e;let d=t.facet(Xl);return new qA({search:((i=e?.literal)!==null&&i!==void 0?i:d.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:d.literal,regexp:(a=e?.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function FA(t){let e=g0(t,O0);return e&&e.dom.querySelector("[main-field]")}function VA(t){let e=FA(t);e&&e==t.root.activeElement&&e.select()}const IA=t=>{let e=t.state.field(_r,!1);if(e&&e.panel){let i=FA(t);if(i&&i!=t.root.activeElement){let n=Tg(t.state,e.query.spec);n.valid&&t.dispatch({effects:jo.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[T0.of(!0),e?jo.of(Tg(t.state,e.query.spec)):ke.appendConfig.of(d9)]});return!0},QA=t=>{let e=t.state.field(_r,!1);if(!e||!e.panel)return!1;let i=g0(t,O0);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:T0.of(!1)}),!0},c9=[{key:"Mod-f",run:IA,scope:"editor search-panel"},{key:"F3",run:Dh,shift:jh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Dh,shift:jh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:QA,scope:"editor search-panel"},{key:"Mod-Shift-l",run:o9},{key:"Mod-Alt-g",run:q8},{key:"Mod-d",run:J8,preventDefault:!0}];class h9{constructor(e){this.view=e;let i=this.query=e.state.field(_r).query.spec;this.commit=this.commit.bind(this),this.searchField=Ke("input",{value:i.search,placeholder:Ai(e,"Find"),"aria-label":Ai(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:Ai(e,"Replace"),"aria-label":Ai(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ke("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=Ke("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=Ke("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function n(r,a,o){return Ke("button",{class:"cm-button",name:r,onclick:a,type:"button"},o)}this.dom=Ke("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>Dh(e),[Ai(e,"next")]),n("prev",()=>jh(e),[Ai(e,"previous")]),n("select",()=>a9(e),[Ai(e,"all")]),Ke("label",null,[this.caseField,Ai(e,"match case")]),Ke("label",null,[this.reField,Ai(e,"regexp")]),Ke("label",null,[this.wordField,Ai(e,"by word")]),...e.state.readOnly?[]:[Ke("br"),this.replaceField,n("replace",()=>JS(e),[Ai(e,"replace")]),n("replaceAll",()=>u9(e),[Ai(e,"replace all")])],Ke("button",{name:"close",onclick:()=>QA(e),"aria-label":Ai(e,"close"),type:"button"},["×"])])}commit(){let e=new qA({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:jo.of(e)}))}keydown(e){pL(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jh:Dh)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),JS(this.view))}update(e){for(let i of e.transactions)for(let n of i.effects)n.is(jo)&&!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(Xl).top}}function Ai(t,e){return t.state.phrase(e)}const Lc=30,Bc=/[\s\.,:;?!]/;function E0(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,a=Math.max(n.from,e-Lc),o=Math.min(r,i+Lc),c=t.state.sliceDoc(a,o);if(a!=n.from){for(let h=0;h<Lc;h++)if(!Bc.test(c[h+1])&&Bc.test(c[h])){c=c.slice(h);break}}if(o!=r){for(let h=c.length-1;h>c.length-Lc;h--)if(!Bc.test(c[h-1])&&Bc.test(c[h])){c=c.slice(0,h);break}}return le.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${n.number}.`)}const f9=le.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"}}),d9=[_r,Es.low(l9),f9];class GA{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=It(this.state).resolveInner(this.pos,-1);for(;i&&e.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}matchBefore(e){let i=this.state.doc.lineAt(this.pos),n=Math.max(i.from,this.pos-250),r=i.text.slice(n-i.from,this.pos-i.from),a=r.search(YA(e,!1));return a<0?null:{from:n+a,to:this.pos,text:r.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,i,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(i),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function ZS(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 p9(t){let e=Object.create(null),i=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let a=1;a<r.length;a++)i[r[a]]=!0}let n=ZS(e)+ZS(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function m9(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[i,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:p9(e);return r=>{let a=r.matchBefore(n);return a||r.explicit?{from:a?a.from:r.pos,options:e,validFor:i}:null}}class $S{constructor(e,i,n,r){this.completion=e,this.source=i,this.match=n,this.score=r}}function ws(t){return t.selection.main.from}function YA(t,e){var i;let{source:n}=t,r=e&&n[0]!="^",a=n[n.length-1]!="$";return!r&&!a?t:new RegExp(`${r?"^":""}(?:${n})${a?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}const KA=kn.define();function g9(t,e,i,n){let{main:r}=t.selection,a=i-r.from,o=n-r.from;return{...t.changeByRange(c=>{if(c!=r&&i!=n&&t.sliceDoc(c.from+a,c.from+o)!=t.sliceDoc(i,n))return{range:c};let h=t.toText(e);return{changes:{from:c.from+a,to:n==r.from?c.to:c.from+o,insert:h},range:X.cursor(c.from+a+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const e2=new WeakMap;function y9(t){if(!Array.isArray(t))return t;let e=e2.get(t);return e||e2.set(t,e=m9(t)),e}const Lh=ke.define(),Lo=ke.define();class x9{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=oi(e,i),r=mn(n);this.chars.push(n);let a=e.slice(i,i+r),o=a.toUpperCase();this.folded.push(oi(o==a?a.toLowerCase():o,0)),i+=r}this.astral=e.length!=this.chars.length}ret(e,i){return this.score=e,this.matched=i,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:i,folded:n,any:r,precise:a,byWord:o}=this;if(i.length==1){let E=oi(e,0),D=mn(E),G=D==e.length?0:-100;if(E!=i[0])if(E==n[0])G+=-200;else return null;return this.ret(G,[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 E=0,D=Math.min(e.length,200);E<D&&d<h;){let G=oi(e,E);(G==i[d]||G==n[d])&&(r[d++]=E),E+=mn(G)}if(d<h)return null}let p=0,g=0,x=!1,v=0,w=-1,k=-1,C=/[a-z]/.test(e),M=!0;for(let E=0,D=Math.min(e.length,200),G=0;E<D&&g<h;){let L=oi(e,E);c<0&&(p<h&&L==i[p]&&(a[p++]=E),v<h&&(L==i[v]||L==n[v]?(v==0&&(w=E),k=E+1,v++):v=0));let I,q=L<255?L>=48&&L<=57||L>=97&&L<=122?2:L>=65&&L<=90?1:0:(I=Zg(L))!=I.toLowerCase()?1:I!=I.toUpperCase()?2:0;(!E||q==1&&C||G==0&&q!=0)&&(i[g]==L||n[g]==L&&(x=!0)?o[g++]=E:o.length&&(M=!1)),G=q,E+=mn(L)}return g==h&&o[0]==0&&M?this.result(-100+(x?-200:0),o,e):v==h&&w==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==h?this.ret(-900-e.length,[w,k]):g==h?this.result(-100+(x?-200:0)+-700+(M?0:-1100),o,e):i.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,i,n){let r=[],a=0;for(let o of i){let c=o+(this.astral?mn(oi(n,o)):1);a&&r[a-1]==o?r[a-1]=c:(r[a++]=o,r[a++]=c)}return this.ret(e-n.length,r)}}class b9{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 Rt=oe.define({combine(t){return Cn(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:v9,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=>t2(e(n),i(n)),optionClass:(e,i)=>n=>t2(e(n),i(n)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function t2(t,e){return t?e?t+" "+e:t:e}function v9(t,e,i,n,r,a){let o=t.textDirection==Je.RTL,c=o,h=!1,d="top",p,g,x=e.left-r.left,v=r.right-e.right,w=n.right-n.left,k=n.bottom-n.top;if(c&&x<Math.min(w,v)?c=!1:!c&&v<Math.min(w,x)&&(c=!0),w<=(c?x:v))p=Math.max(r.top,Math.min(i.top,r.bottom-k))-e.top,g=Math.min(400,c?x:v);else{h=!0,g=Math.min(400,(o?e.right:r.right-e.left)-30);let E=r.bottom-e.bottom;E>=k||E>e.top?p=i.bottom-e.top:(d="bottom",p=e.bottom-i.top)}let C=(e.bottom-e.top)/a.offsetHeight,M=(e.right-e.left)/a.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${g/M}px`,class:"cm-completionInfo-"+(h?o?"left-narrow":"right-narrow":c?"left":"right")}}function S9(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(i){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),i.type&&n.classList.add(...i.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(i,n,r,a){let o=document.createElement("span");o.className="cm-completionLabel";let c=i.displayLabel||i.label,h=0;for(let d=0;d<a.length;){let p=a[d++],g=a[d++];p>h&&o.appendChild(document.createTextNode(c.slice(h,p)));let x=o.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(p,g))),x.className="cm-completionMatchedText",h=g}return h<c.length&&o.appendChild(document.createTextNode(c.slice(h))),o},position:50},{render(i){if(!i.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=i.detail,n},position:80}),e.sort((i,n)=>i.position-n.position).map(i=>i.render)}function hm(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 w9{constructor(e,i,n){this.view=e,this.stateField=i,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let r=e.state.field(i),{options:a,selected:o}=r.open,c=e.state.facet(Rt);this.optionContent=S9(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=hm(a.length,o,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{let{options:d}=e.state.field(i).open;for(let p=h.target,g;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(g=/-(\d+)$/.exec(p.id))&&+g[1]<d.length){this.applyCompletion(e,d[+g[1]]),h.preventDefault();return}}),this.dom.addEventListener("focusout",h=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Rt).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:Lo.of(null)})}),this.showOptions(a,r.id)}mount(){this.updateSel()}showOptions(e,i){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,i,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var i;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:a,selected:o,disabled:c}=n.open;(!r.open||r.open.options!=a)&&(this.range=hm(a.length,o,e.state.facet(Rt).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),c!=((i=r.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let i=this.tooltipClass(e);if(i!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of i.split(" "))n&&this.dom.classList.add(n);this.currentClass=i}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),i=e.open;(i.selected>-1&&i.selected<this.range.from||i.selected>=this.range.to)&&(this.range=hm(i.options.length,i.selected,this.view.state.facet(Rt).maxRenderedOptions),this.showOptions(i.options,e.id));let n=this.updateSelectedOption(i.selected);if(n){this.destroyInfo();let{completion:r}=i.options[i.selected],{info:a}=r;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(r);if(!o)return;"then"in o?o.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,r)}).catch(c=>fi(this.view.state,c,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,i){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:a}=e;n.appendChild(r),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let i=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),i=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return i&&C9(this.list,i),i}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let i=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(a.bottom,i.bottom)-10||r.bottom<Math.max(a.top,i.top)+10?null:this.view.state.facet(Rt).positionInfo(this.view,i,r,n,a,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,i,n){const r=document.createElement("ul");r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let a=null;for(let o=n.from;o<n.to;o++){let{completion:c,match:h}=e[o],{section:d}=c;if(d){let x=typeof d=="string"?d:d.name;if(x!=a&&(o>n.from||n.from==0))if(a=x,typeof d!="string"&&d.header)r.appendChild(d.header(d));else{let v=r.appendChild(document.createElement("completion-section"));v.textContent=x}}const p=r.appendChild(document.createElement("li"));p.id=i+"-"+o,p.setAttribute("role","option");let g=this.optionClass(c);g&&(p.className=g);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,h);v&&p.appendChild(v)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function k9(t,e){return i=>new w9(i,t,e)}function C9(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 i2(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function A9(t,e){let i=[],n=null,r=null,a=p=>{i.push(p);let{section:g}=p.completion;if(g){n||(n=[]);let x=typeof g=="string"?g:g.name;n.some(v=>v.name==x)||n.push(typeof g=="string"?{name:x}:g)}},o=e.facet(Rt);for(let p of t)if(p.hasResult()){let g=p.result.getMatch;if(p.result.filter===!1)for(let x of p.result.options)a(new $S(x,p.source,g?g(x):[],1e9-i.length));else{let x=e.sliceDoc(p.from,p.to),v,w=o.filterStrict?new b9(x):new x9(x);for(let k of p.result.options)if(v=w.match(k.label)){let C=k.displayLabel?g?g(k,v.matched):[]:v.matched,M=v.score+(k.boost||0);if(a(new $S(k,p.source,C,M)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:E}=k.section;r||(r=Object.create(null)),r[E]=Math.max(M,r[E]||-1e9)}}}}if(n){let p=Object.create(null),g=0,x=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?r[w.name]-r[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.name<w.name?-1:1);for(let v of n.sort(x))g-=1e5,p[v.name]=g;for(let v of i){let{section:w}=v.completion;w&&(v.score+=p[typeof w=="string"?w:w.name])}}let c=[],h=null,d=o.compareCompletions;for(let p of i.sort((g,x)=>x.score-g.score||d(g.completion,x.completion))){let g=p.completion;!h||h.label!=g.label||h.detail!=g.detail||h.type!=null&&g.type!=null&&h.type!=g.type||h.apply!=g.apply||h.boost!=g.boost?c.push(p):i2(p.completion)>i2(h)&&(c[c.length-1]=p),h=p.completion}return c}class kl{constructor(e,i,n,r,a,o){this.options=e,this.attrs=i,this.tooltip=n,this.timestamp=r,this.selected=a,this.disabled=o}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new kl(this.options,n2(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,n,r,a,o){if(r&&!o&&e.some(d=>d.isPending))return r.setDisabled();let c=A9(e,i);if(!c.length)return r&&e.some(d=>d.isPending)?r.setDisabled():null;let h=i.facet(Rt).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 kl(c,n2(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:R9,above:a.aboveCursor},r?r.timestamp:Date.now(),h,!1)}map(e){return new kl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new kl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Bh{constructor(e,i,n){this.active=e,this.id=i,this.open=n}static start(){return new Bh(E9,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,n=i.facet(Rt),a=(n.override||i.languageDataAt("autocomplete",ws(i)).map(y9)).map(h=>(this.active.find(p=>p.source==h)||new Ii(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));a.length==this.active.length&&a.every((h,d)=>h==this.active[d])&&(a=this.active);let o=this.open,c=e.effects.some(h=>h.is(N0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||a.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!M9(a,this.active)||c?o=kl.build(a,i,this.id,o,n,c):o&&o.disabled&&!a.some(h=>h.isPending)&&(o=null),!o&&a.every(h=>!h.isPending)&&a.some(h=>h.hasResult())&&(a=a.map(h=>h.hasResult()?new Ii(h.source,0):h));for(let h of e.effects)h.is(XA)&&(o=o&&o.setSelected(h.value,this.id));return a==this.active&&o==this.open?this:new Bh(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?T9:O9}}function M9(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i<t.length&&!t[i].hasResult();)i++;for(;n<e.length&&!e[n].hasResult();)n++;let r=i==t.length,a=n==e.length;if(r||a)return r==a;if(t[i++].result!=e[n++].result)return!1}}const T9={"aria-autocomplete":"list"},O9={};function n2(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const E9=[];function WA(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(KA);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 Ii{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=WA(e,i),r=this;(n&8||n&16&&this.touches(e))&&(r=new Ii(r.source,0)),n&4&&r.state==0&&(r=new Ii(this.source,1)),r=r.updateFor(e,n);for(let a of e.effects)if(a.is(Lh))r=new Ii(r.source,1,a.value);else if(a.is(Lo))r=new Ii(r.source,0);else if(a.is(N0))for(let o of a.value)o.source==r.source&&(r=o);return r}updateFor(e,i){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ws(e.state))}}class Nl extends Ii{constructor(e,i,n,r,a,o){super(e,3,i),this.limit=n,this.result=r,this.from=a,this.to=o}hasResult(){return!0}updateFor(e,i){var n;if(!(i&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let a=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),c=ws(e.state);if(c>o||!r||i&2&&(ws(e.startState)==this.from||c<this.limit))return new Ii(this.source,i&4?1:0);let h=e.changes.mapPos(this.limit);return N9(r.validFor,e.state,a,o)?new Nl(this.source,this.explicit,h,r,a,o):r.update&&(r=r.update(r,a,o,new GA(e.state,c,!1)))?new Nl(this.source,this.explicit,h,r,r.from,(n=r.to)!==null&&n!==void 0?n:ws(e.state)):new Ii(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Nl(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ii(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function N9(t,e,i,n){if(!t)return!1;let r=e.sliceDoc(i,n);return typeof t=="function"?t(r,i,n,e):YA(t,!0).test(r)}const N0=ke.define({map(t,e){return t.map(i=>i.map(e))}}),XA=ke.define(),ui=Gt.define({create(){return Bh.start()},update(t,e){return t.update(e)},provide:t=>[m0.from(t,e=>e.tooltip),le.contentAttributes.from(t,e=>e.attrs)]});function R0(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(ui).active.find(r=>r.source==e.source);return n instanceof Nl?(typeof i=="string"?t.dispatch({...g9(t.state,i,n.from,n.to),annotations:KA.of(e.completion)}):i(t,e.completion,n.from,n.to),!0):!1}const R9=k9(ui,R0);function zc(t,e="option"){return i=>{let n=i.state.field(ui,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(Rt).interactionDelay)return!1;let r=1,a;e=="page"&&(a=OC(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,c=n.open.selected>-1?n.open.selected+r*(t?1:-1):t?0:o-1;return c<0?c=e=="page"?0:o-1:c>=o&&(c=e=="page"?o-1:0),i.dispatch({effects:XA.of(c)}),!0}}const D9=t=>{let e=t.state.field(ui,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Rt).interactionDelay?!1:R0(t,e.open.options[e.open.selected])},fm=t=>t.state.field(ui,!1)?(t.dispatch({effects:Lh.of(!0)}),!0):!1,j9=t=>{let e=t.state.field(ui,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:Lo.of(null)}),!0)};class L9{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}}const B9=50,z9=1e3,_9=ht.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(ui).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ui),i=t.state.facet(Rt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ui)==e)return;let n=t.transactions.some(a=>{let o=WA(a,i);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(n||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>B9&&Date.now()-o.time>z9){for(let c of o.context.abortListeners)try{c()}catch(h){fi(this.view.state,h)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(a=>a.effects.some(o=>o.is(Lh)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let a of t.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ui);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(Rt).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=ws(e),n=new GA(e,i,t.explicit,this.view),r=new L9(t,n);this.running.push(r),Promise.resolve(t.source(n)).then(a=>{r.context.aborted||(r.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:Lo.of(null)}),fi(this.view.state,a)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Rt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(Rt),n=this.view.state.field(ui);for(let r=0;r<this.running.length;r++){let a=this.running[r];if(a.done===void 0)continue;if(this.running.splice(r--,1),a.done){let c=ws(a.updates.length?a.updates[0].startState:this.view.state),h=Math.min(c,a.done.from+(a.active.explicit?0:1)),d=new Nl(a.active.source,a.active.explicit,h,a.done,a.done.from,(t=a.done.to)!==null&&t!==void 0?t:c);for(let p of a.updates)d=d.update(p,i);if(d.hasResult()){e.push(d);continue}}let o=n.active.find(c=>c.source==a.active.source);if(o&&o.isPending)if(a.done==null){let c=new Ii(a.active.source,0);for(let h of a.updates)c=c.update(h,i);c.isPending||e.push(c)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:N0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ui,!1);if(e&&e.tooltip&&this.view.state.facet(Rt).closeOnBlur){let i=e.open&&OC(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Lo.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Lh.of(!1)}),20),this.composing=0}}}),H9=typeof navigator=="object"&&/Win/.test(navigator.platform),U9=Es.highest(le.domEventHandlers({keydown(t,e){let i=e.state.field(ui,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(H9&&t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],r=i.active.find(o=>o.source==n.source),a=n.completion.commitCharacters||r.result.commitCharacters;return a&&a.indexOf(t.key)>-1&&R0(e,n),!1}})),q9=le.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"}}}),Bo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},bs=ke.define({map(t,e){let i=e.mapPos(t,-1,$t.TrackAfter);return i??void 0}}),D0=new class extends Ur{};D0.startSide=1;D0.endSide=-1;const JA=Gt.define({create(){return Re.empty},update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=i.from&&n<=i.to})}for(let i of e.effects)i.is(bs)&&(t=t.update({add:[D0.range(i.value,i.value+1)]}));return t}});function P9(){return[V9,JA]}const dm="()[]{}<>«»»«[]{}";function ZA(t){for(let e=0;e<dm.length;e+=2)if(dm.charCodeAt(e)==t)return dm.charAt(e+1);return Zg(t<128?t:t+1)}function $A(t,e){return t.languageDataAt("closeBrackets",e)[0]||Bo}const F9=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),V9=le.inputHandler.of((t,e,i,n)=>{if((F9?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(n.length>2||n.length==2&&mn(oi(n,0))==1||e!=r.from||i!=r.to)return!1;let a=G9(t.state,n);return a?(t.dispatch(a),!0):!1}),I9=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=$A(t,t.selection.main.head).brackets||Bo.brackets,r=null,a=t.changeByRange(o=>{if(o.empty){let c=Y9(t.doc,o.head);for(let h of n)if(h==c&&lf(t.doc,o.head)==ZA(oi(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:X.cursor(o.head-h.length)}}return{range:r=o}});return r||e(t.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},Q9=[{key:"Backspace",run:I9}];function G9(t,e){let i=$A(t,t.selection.main.head),n=i.brackets||Bo.brackets;for(let r of n){let a=ZA(oi(r,0));if(e==r)return a==r?X9(t,r,n.indexOf(r+r+r)>-1,i):K9(t,r,a,i.before||Bo.before);if(e==a&&eM(t,t.selection.main.from))return W9(t,r,a)}return null}function eM(t,e){let i=!1;return t.field(JA).between(0,t.doc.length,n=>{n==e&&(i=!0)}),i}function lf(t,e){let i=t.sliceString(e,e+2);return i.slice(0,mn(oi(i,0)))}function Y9(t,e){let i=t.sliceString(e-2,e);return mn(oi(i,0))==i.length?i:i.slice(1)}function K9(t,e,i,n){let r=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:i,from:o.to}],effects:bs.of(o.to+e.length),range:X.range(o.anchor+e.length,o.head+e.length)};let c=lf(t.doc,o.head);return!c||/\s/.test(c)||n.indexOf(c)>-1?{changes:{insert:e+i,from:o.head},effects:bs.of(o.head+e.length),range:X.cursor(o.head+e.length)}:{range:r=o}});return r?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function W9(t,e,i){let n=null,r=t.changeByRange(a=>a.empty&&lf(t.doc,a.head)==i?{changes:{from:a.head,to:a.head+i.length,insert:i},range:X.cursor(a.head+i.length)}:n={range:a});return n?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function X9(t,e,i,n){let r=n.stringPrefixes||Bo.stringPrefixes,a=null,o=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:bs.of(c.to+e.length),range:X.range(c.anchor+e.length,c.head+e.length)};let h=c.head,d=lf(t.doc,h),p;if(d==e){if(r2(t,h))return{changes:{insert:e+e,from:h},effects:bs.of(h+e.length),range:X.cursor(h+e.length)};if(eM(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:X.cursor(h+x.length)}}}else{if(i&&t.sliceDoc(h-2*e.length,h)==e+e&&(p=s2(t,h-2*e.length,r))>-1&&r2(t,p))return{changes:{insert:e+e+e+e,from:h},effects:bs.of(h+e.length),range:X.cursor(h+e.length)};if(t.charCategorizer(h)(d)!=rt.Word&&s2(t,h,r)>-1&&!J9(t,h,e,r))return{changes:{insert:e+e,from:h},effects:bs.of(h+e.length),range:X.cursor(h+e.length)}}return{range:a=c}});return a?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function r2(t,e){let i=It(t).resolveInner(e+1);return i.parent&&i.from==e}function J9(t,e,i,n){let r=It(t).resolveInner(e,-1),a=n.reduce((o,c)=>Math.max(o,c.length),0);for(let o=0;o<5;o++){let c=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+a)),h=c.indexOf(i);if(!h||h>-1&&n.indexOf(c.slice(0,h))>-1){let p=r.firstChild;for(;p&&p.from==r.from&&p.to-p.from>i.length+h;){if(t.sliceDoc(p.to-i.length,p.to)==i)return!1;p=p.firstChild}return!0}let d=r.to==e&&r.parent;if(!d)break;r=d}return!1}function s2(t,e,i){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=rt.Word)return e;for(let r of i){let a=e-r.length;if(t.sliceDoc(a,e)==r&&n(t.sliceDoc(a-1,a))!=rt.Word)return a}return-1}function Z9(t={}){return[U9,ui,Rt.of(t),_9,$9,q9]}const tM=[{key:"Ctrl-Space",run:fm},{mac:"Alt-`",run:fm},{mac:"Alt-i",run:fm},{key:"Escape",run:j9},{key:"ArrowDown",run:zc(!0)},{key:"ArrowUp",run:zc(!1)},{key:"PageDown",run:zc(!0,"page")},{key:"PageUp",run:zc(!1,"page")},{key:"Enter",run:D9}],$9=Es.highest(Xh.computeN([Rt],t=>t.facet(Rt).defaultKeymap?[tM]:[]));class l2{constructor(e,i,n){this.from=e,this.to=i,this.diagnostic=n}}class ms{constructor(e,i,n){this.diagnostics=e,this.panel=i,this.selected=n}static init(e,i,n){let r=n.facet(zo).markerFilter;r&&(e=r(e,n));let a=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),o=new Zn,c=[],h=0,d=n.doc.iter(),p=0,g=n.doc.length;for(let v=0;;){let w=v==a.length?null:a[v];if(!w&&!c.length)break;let k,C;if(c.length)k=h,C=c.reduce((D,G)=>Math.min(D,G.to),w&&w.from>k?w.from:1e8);else{if(k=w.from,k>g)break;C=w.to,c.push(w),v++}for(;v<a.length;){let D=a[v];if(D.from==k&&(D.to>D.from||D.to==k))c.push(D),v++,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 G=k;;){if(G>=C){M=!0;break}if(!d.lineBreak&&p+d.value.length>G)break;G=p+d.value.length,p+=d.value.length,d.next()}}let E=fz(c);if(M)o.add(k,k,ye.widget({widget:new oz(E),diagnostics:c.slice()}));else{let D=c.reduce((G,L)=>L.markClass?G+" "+L.markClass:G,"");o.add(k,C,ye.mark({class:"cm-lintRange cm-lintRange-"+E+D,diagnostics:c.slice(),inclusiveEnd:c.some(G=>G.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=o.finish();return new ms(x,i,Qr(x))}}function Qr(t,e=null,i=0){let n=null;return t.between(i,1e9,(r,a,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!n)n=new l2(r,a,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new l2(n.from,a,n.diagnostic)}}),n}function ez(t,e){let i=e.pos,n=e.end||i,r=t.state.facet(zo).hideOn(t,i,n);if(r!=null)return r;let a=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(iM))||t.changes.touchesRange(a.from,Math.max(a.to,n)))}function tz(t,e){return t.field(Oi,!1)?e:e.concat(ke.appendConfig.of(dz))}const iM=ke.define(),j0=ke.define(),nM=ke.define(),Oi=Gt.define({create(){return new ms(ye.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,r=t.panel;if(t.selected){let a=e.changes.mapPos(t.selected.from,1);n=Qr(i,t.selected.diagnostic,a)||Qr(i,null,a)}!i.size&&r&&e.state.facet(zo).autoPanel&&(r=null),t=new ms(i,r,n)}for(let i of e.effects)if(i.is(iM)){let n=e.state.facet(zo).autoPanel?i.value.length?_o.open:null:t.panel;t=ms.init(i.value,n,e.state)}else i.is(j0)?t=new ms(t.diagnostics,i.value?_o.open:null,t.selected):i.is(nM)&&(t=new ms(t.diagnostics,t.panel,i.value));return t},provide:t=>[Eo.from(t,e=>e.panel),le.decorations.from(t,e=>e.diagnostics)]}),iz=ye.mark({class:"cm-lintRange cm-lintRange-active"});function nz(t,e,i){let{diagnostics:n}=t.state.field(Oi),r,a=-1,o=-1;n.between(e-(i<0?1:0),e+(i>0?1:0),(h,d,{spec:p})=>{if(e>=h&&e<=d&&(h==d||(e>h||i>0)&&(e<d||i<0)))return r=p.diagnostics,a=h,o=d,!1});let c=t.state.facet(zo).tooltipFilter;return r&&c&&(r=c(r,t.state)),r?{pos:a,end:o,above:t.state.doc.lineAt(a).to<o,create(){return{dom:rz(t,r)}}}:null}function rz(t,e){return Ke("ul",{class:"cm-tooltip-lint"},e.map(i=>sM(t,i,!1)))}const sz=t=>{let e=t.state.field(Oi,!1);(!e||!e.panel)&&t.dispatch({effects:tz(t.state,[j0.of(!0)])});let i=g0(t,_o.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},a2=t=>{let e=t.state.field(Oi,!1);return!e||!e.panel?!1:(t.dispatch({effects:j0.of(!1)}),!0)},lz=t=>{let e=t.state.field(Oi,!1);if(!e)return!1;let i=t.state.selection.main,n=Qr(e.diagnostics,null,i.to+1);return!n&&(n=Qr(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)},az=[{key:"Mod-Shift-m",run:sz,preventDefault:!0},{key:"F8",run:lz}],zo=oe.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Cn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:o2,tooltipFilter:o2,needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i,hideOn:(e,i)=>e?i?(n,r,a)=>e(n,r,a)||i(n,r,a):e:i,autoPanel:(e,i)=>e||i})}}});function o2(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function rM(t){let e=[];if(t)e:for(let{name:i}of t){for(let n=0;n<i.length;n++){let r=i[n];if(/[a-zA-Z]/.test(r)&&!e.some(a=>a.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function sM(t,e,i){var n;let r=i?rM(e.actions):[];return Ke("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ke("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((a,o)=>{let c=!1,h=v=>{if(v.preventDefault(),c)return;c=!0;let w=Qr(t.state.field(Oi).diagnostics,e);w&&a.apply(t,w.from,w.to)},{name:d}=a,p=r[o]?d.indexOf(r[o]):-1,g=p<0?d:[d.slice(0,p),Ke("u",d.slice(p,p+1)),d.slice(p+1)],x=a.markClass?" "+a.markClass:"";return Ke("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:h,onmousedown:h,"aria-label":` Action: ${d}${p<0?"":` (access key "${r[o]})"`}.`},g)}),e.source&&Ke("div",{class:"cm-diagnosticSource"},e.source))}class oz extends An{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 u2{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=sM(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _o{constructor(e){this.view=e,this.items=[];let i=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)a2(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=rM(a.actions);for(let c=0;c<o.length;c++)if(o[c].toUpperCase().charCodeAt(0)==r.keyCode){let h=Qr(this.view.state.field(Oi).diagnostics,a);h&&a.actions[c].apply(e,h.from,h.to)}}else return;r.preventDefault()}},n=r=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(r.target)&&this.moveSelection(a)};this.list=Ke("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:n}),this.dom=Ke("div",{class:"cm-panel-lint"},this.list,Ke("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>a2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Oi).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(Oi),n=0,r=!1,a=null,o=new Set;for(e.between(0,this.view.state.doc.length,(c,h,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let g=-1,x;for(let v=n;v<this.items.length;v++)if(this.items[v].diagnostic==p){g=v;break}g<0?(x=new u2(this.view,p),this.items.splice(n,0,x),r=!0):(x=this.items[g],g>n&&(this.items.splice(n,g-n),r=!0)),i&&x.diagnostic==i.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),a=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new u2(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:h})=>{let d=h.height/this.list.offsetHeight;c.top<h.top?this.list.scrollTop-=(h.top-c.top)/d:c.bottom>h.bottom&&(this.list.scrollTop+=(c.bottom-h.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function i(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)i();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(Oi),n=Qr(i.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:nM.of(n)})}static open(e){return new _o(e)}}function uz(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 _c(t){return uz(`<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 cz=le.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:_c("#d11")},".cm-lintRange-warning":{backgroundImage:_c("orange")},".cm-lintRange-info":{backgroundImage:_c("#999")},".cm-lintRange-hint":{backgroundImage:_c("#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 hz(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function fz(t){let e="hint",i=1;for(let n of t){let r=hz(n.severity);r>i&&(i=r,e=n.severity)}return e}const dz=[Oi,le.decorations.compute([Oi],t=>{let{selected:e,panel:i}=t.field(Oi);return!e||!i||e.from==e.to?ye.none:ye.set([iz.range(e.from,e.to)])}),i6(nz,{hideOn:ez}),cz];var c2=function(e){e===void 0&&(e={});var{crosshairCursor:i=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(Q9)),e.defaultKeymap!==!1&&(n=n.concat(_8)),e.searchKeymap!==!1&&(n=n.concat(c9)),e.historyKeymap!==!1&&(n=n.concat(IB)),e.foldKeymap!==!1&&(n=n.concat(rB)),e.completionKeymap!==!1&&(n=n.concat(tM)),e.lintKeymap!==!1&&(n=n.concat(az));var r=[];return e.lineNumbers!==!1&&r.push(m6()),e.highlightActiveLineGutter!==!1&&r.push(x6()),e.highlightSpecialChars!==!1&&r.push(RL()),e.history!==!1&&r.push(BB()),e.foldGutter!==!1&&r.push(oB()),e.drawSelection!==!1&&r.push(vL()),e.dropCursor!==!1&&r.push(AL()),e.allowMultipleSelections!==!1&&r.push(Be.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(K6()),e.syntaxHighlighting!==!1&&r.push(eA(fB,{fallback:!0})),e.bracketMatching!==!1&&r.push(bB()),e.closeBrackets!==!1&&r.push(P9()),e.autocompletion!==!1&&r.push(Z9()),e.rectangularSelection!==!1&&r.push(QL()),i!==!1&&r.push(KL()),e.highlightActiveLine!==!1&&r.push(_L()),e.highlightSelectionMatches!==!1&&r.push(V8()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Zh.of(" ".repeat(e.tabSize))),r.concat([Xh.of(n.flat())]).filter(Boolean)};const pz="#e5c07b",h2="#e06c75",mz="#56b6c2",gz="#ffffff",Jc="#abb2bf",Og="#7d8799",yz="#61afef",xz="#98c379",f2="#d19a66",bz="#c678dd",vz="#21252b",d2="#2c313a",p2="#282c34",pm="#353a42",Sz="#3E4451",m2="#528bff",wz=le.theme({"&":{color:Jc,backgroundColor:p2},".cm-content":{caretColor:m2},".cm-cursor, .cm-dropCursor":{borderLeftColor:m2},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Sz},".cm-panels":{backgroundColor:vz,color:Jc},".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:p2,color:Og,border:"none"},".cm-activeLineGutter":{backgroundColor:d2},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:pm},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:pm,borderBottomColor:pm},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:d2,color:Jc}}},{dark:!0}),kz=Go.define([{tag:Q.keyword,color:bz},{tag:[Q.name,Q.deleted,Q.character,Q.propertyName,Q.macroName],color:h2},{tag:[Q.function(Q.variableName),Q.labelName],color:yz},{tag:[Q.color,Q.constant(Q.name),Q.standard(Q.name)],color:f2},{tag:[Q.definition(Q.name),Q.separator],color:Jc},{tag:[Q.typeName,Q.className,Q.number,Q.changed,Q.annotation,Q.modifier,Q.self,Q.namespace],color:pz},{tag:[Q.operator,Q.operatorKeyword,Q.url,Q.escape,Q.regexp,Q.link,Q.special(Q.string)],color:mz},{tag:[Q.meta,Q.comment],color:Og},{tag:Q.strong,fontWeight:"bold"},{tag:Q.emphasis,fontStyle:"italic"},{tag:Q.strikethrough,textDecoration:"line-through"},{tag:Q.link,color:Og,textDecoration:"underline"},{tag:Q.heading,fontWeight:"bold",color:h2},{tag:[Q.atom,Q.bool,Q.special(Q.variableName)],color:f2},{tag:[Q.processingInstruction,Q.string,Q.inserted],color:xz},{tag:Q.invalid,color:gz}]),Cz=[wz,eA(kz)];var Az=le.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Mz=function(e){e===void 0&&(e={});var{indentWithTab:i=!0,editable:n=!0,readOnly:r=!1,theme:a="light",placeholder:o="",basicSetup:c=!0}=e,h=[];switch(i&&h.unshift(Xh.of([H8])),c&&(typeof c=="boolean"?h.unshift(c2()):h.unshift(c2(c))),o&&h.unshift(PL(o)),a){case"light":h.push(Az);break;case"dark":h.push(Cz);break;case"none":break;default:h.push(a);break}return n===!1&&h.push(le.editable.of(!1)),r&&h.push(Be.readOnly.of(!0)),[...h]},Tz=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 Oz{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 g2{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 mm=null,Ez=()=>typeof window>"u"?new g2:(mm||(mm=new g2),mm),y2=kn.define(),Nz=200,Rz=[];function Dz(t){var{value:e,selection:i,onChange:n,onStatistics:r,onCreateEditor:a,onUpdate:o,extensions:c=Rz,autoFocus:h,theme:d="light",height:p=null,minHeight:g=null,maxHeight:x=null,width:v=null,minWidth:w=null,maxWidth:k=null,placeholder:C="",editable:M=!0,readOnly:E=!1,indentWithTab:D=!0,basicSetup:G=!0,root:L,initialState:I}=t,[q,$]=O.useState(),[ee,fe]=O.useState(),[ce,P]=O.useState(),ie=O.useState(()=>({current:null}))[0],de=O.useState(()=>({current:null}))[0],ue=le.theme({"&":{height:p,minHeight:g,maxHeight:x,width:v,minWidth:w,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),_=le.updateListener.of(H=>{if(H.docChanged&&typeof n=="function"&&!H.transactions.some(F=>F.annotation(y2))){ie.current?ie.current.reset():(ie.current=new Oz(()=>{if(de.current){var F=de.current;de.current=null,F()}ie.current=null},Nz),Ez().add(ie.current));var te=H.state.doc,T=te.toString();n(T,H)}r&&r(Tz(H))}),J=Mz({theme:d,editable:M,readOnly:E,placeholder:C,indentWithTab:D,basicSetup:G}),se=[_,ue,...J];return o&&typeof o=="function"&&se.push(le.updateListener.of(o)),se=se.concat(c),O.useLayoutEffect(()=>{if(q&&!ce){var H={doc:e,selection:i,extensions:se},te=I?Be.fromJSON(I.json,H,I.fields):Be.create(H);if(P(te),!ee){var T=new le({state:te,parent:q,root:L});fe(T),a&&a(T,te)}}return()=>{ee&&(P(void 0),fe(void 0))}},[q,ce]),O.useEffect(()=>{t.container&&$(t.container)},[t.container]),O.useEffect(()=>()=>{ee&&(ee.destroy(),fe(void 0)),ie.current&&(ie.current.cancel(),ie.current=null)},[ee]),O.useEffect(()=>{h&&ee&&ee.focus()},[h,ee]),O.useEffect(()=>{ee&&ee.dispatch({effects:ke.reconfigure.of(se)})},[d,c,p,g,x,v,w,k,C,M,E,D,G,n,o]),O.useEffect(()=>{if(e!==void 0){var H=ee?ee.state.doc.toString():"";if(ee&&e!==H){var te=ie.current&&!ie.current.isDone,T=()=>{ee&&e!==ee.state.doc.toString()&&ee.dispatch({changes:{from:0,to:ee.state.doc.toString().length,insert:e||""},annotations:[y2.of(!0)]})};te?de.current=T:T()}}},[e,ee]),{state:ce,setState:P,view:ee,setView:fe,container:q,setContainer:$}}var jz=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],lM=O.forwardRef((t,e)=>{var{className:i,value:n="",selection:r,extensions:a=[],onChange:o,onStatistics:c,onCreateEditor:h,onUpdate:d,autoFocus:p,theme:g="light",height:x,minHeight:v,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:E,placeholder:D,indentWithTab:G,editable:L,readOnly:I,root:q,initialState:$}=t,ee=l4(t,jz),fe=O.useRef(null),{state:ce,view:P,container:ie,setContainer:de}=Dz({root:q,value:n,autoFocus:p,theme:g,height:x,minHeight:v,maxHeight:w,width:k,minWidth:C,maxWidth:M,basicSetup:E,placeholder:D,indentWithTab:G,editable:L,readOnly:I,selection:r,onChange:o,onStatistics:c,onCreateEditor:h,onUpdate:d,extensions:a,initialState:$});O.useImperativeHandle(e,()=>({editor:fe.current,state:ce,view:P}),[fe,ie,ce,P]);var ue=O.useCallback(J=>{fe.current=J,de(J)},[de]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var _=typeof g=="string"?"cm-theme-"+g:"cm-theme";return b.jsx("div",Bm({ref:ue,className:""+_+(i?" "+i:"")},ee))});lM.displayName="CodeMirror";var x2={};class zh{constructor(e,i,n,r,a,o,c,h,d,p=0,g){this.p=e,this.stack=i,this.state=n,this.reducePos=r,this.pos=a,this.score=o,this.buffer=c,this.bufferBase=h,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let r=e.parser.context;return new zh(e,[],i,n,n,0,[],0,r?new b2(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let n=e>>19,r=e&65535,{parser:a}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=a.dynamicPrecedence(r);if(c&&(this.score+=c),n==0){this.pushState(a.getGoto(this.state,r,!0),this.reducePos),r<a.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let h=this.stack.length-(n-1)*3-(e&262144?6:0),d=h?this.stack[h-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((i=this.p.parser.nodeSet.types[r])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=h?this.stack[h-1]:0,x=this.bufferBase+this.buffer.length-g;if(r<a.minRepeatTerm||e&131072){let v=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,v,x+4,!0)}if(e&262144)this.state=this.stack[h];else{let v=this.stack[h-3];this.state=a.getGoto(v,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,i,n,r=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,c=this.buffer.length;if(c==0&&o.parent&&(c=o.bufferBase-o.parent.bufferBase,o=o.parent),c>0&&o.buffer[c-4]==0&&o.buffer[c-1]>-1){if(i==n)return;if(o.buffer[c-2]>=i){o.buffer[c-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(e,i,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let c=!1;for(let h=o;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){c=!0;break}if(c)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=i,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,i,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let a=e,{parser:o}=this.p;this.pos=r;let c=o.stateFlag(a,1);!c&&(r>n||i<=o.maxNode)&&(this.reducePos=r),this.pushState(a,c?n:Math.min(n,this.reducePos)),this.shiftContext(i,n),i<=o.maxNode&&this.buffer.push(i,n,r,4)}else this.pos=r,this.shiftContext(i,n),i<=this.p.parser.maxNode&&this.buffer.push(i,n,r,4)}apply(e,i,n,r){e&65536?this.reduce(e):this.shift(e,i,n,r)}useNode(e,i){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(i,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),r=e.bufferBase+i;for(;e&&r==e.bufferBase;)e=e.parent;return new zh(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 Lz(this);;){let n=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(n==0)return!1;if((n&65536)==0)return!0;i.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let r=[];for(let a=0,o;a<i.length;a+=2)(o=i[a+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(i[a],o);if(this.stack.length<120)for(let a=0;r.length<8&&a<i.length;a+=2){let o=i[a+1];r.some((c,h)=>h&1&&c==o)||r.push(i[a],o)}i=r}let n=[];for(let r=0;r<i.length&&n.length<4;r+=2){let a=i[r+1];if(a==this.state)continue;let o=this.split();o.pushState(a,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(i[r],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if((i&65536)==0)return!1;if(!e.validAction(this.state,i)){let n=i>>19,r=i&65535,a=this.stack.length-n*3;if(a<0||e.getGoto(this.stack[a],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;i=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],n=(r,a)=>{if(!i.includes(r))return i.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let c=(o>>19)-a;if(c>1){let h=o&65535,d=this.stack.length-c*3;if(d>=0&&e.getGoto(this.stack[d],h,!1)>=0)return c<<19|65536|h}}else{let c=n(o,a+1);if(c!=null)return c}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new b2(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 b2{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class Lz{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 _h{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 _h(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 _h(this.stack,this.pos,this.index)}}function Hc(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let n=0,r=0;n<t.length;){let a=0;for(;;){let o=t.charCodeAt(n++),c=!1;if(o==126){a=65535;break}o>=92&&o--,o>=34&&o--;let h=o-32;if(h>=46&&(h-=46,c=!0),a+=h,c)break;a*=46}i?i[r++]=a:i=new e(a)}return i}class Zc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const v2=new Zc;class Bz{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=v2,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let n=this.range,r=this.rangeIndex,a=this.pos+e;for(;a<n.from;){if(!r)return null;let o=this.ranges[--r];a-=n.from-o.to,n=o}for(;i<0?a>n.to:a>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];a+=o.from-n.to,n=o}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,n,r;if(i>=0&&i<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(i);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(n=a,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,i=0){let n=i?this.resolveOffset(i,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=v2,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 Rl{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;zz(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}Rl.prototype.contextual=Rl.prototype.fallback=Rl.prototype.extend=!1;Rl.prototype.fallback=Rl.prototype.extend=!1;function zz(t,e,i,n,r,a){let o=0,c=1<<n,{dialect:h}=i.p.parser;e:for(;(c&t[o])!=0;){let d=t[o+1];for(let v=o+3;v<d;v+=2)if((t[v+1]&c)>0){let w=t[v];if(h.allows(w)&&(e.token.value==-1||e.token.value==w||_z(w,e.token.value,r,a))){e.acceptToken(w);break}}let p=e.next,g=0,x=t[o+2];if(e.next<0&&x>g&&t[d+x*3-3]==65535){o=t[d+x*3-1];continue e}for(;g<x;){let v=g+x>>1,w=d+v+(v<<1),k=t[w],C=t[w+1]||65536;if(p<k)x=v;else if(p>=C)g=v+1;else{o=t[w+2],e.advance();continue e}}break}}function S2(t,e,i){for(let n=e,r;(r=t[n])!=65535;n++)if(r==i)return n-e;return-1}function _z(t,e,i,n){let r=S2(i,n,e);return r<0||S2(i,n,t)<r}const Mi=typeof process<"u"&&x2&&/\bparse\b/.test(x2.LOG);let gm=null;function w2(t,e,i){let n=t.cursor(ct.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 Hz{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?w2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?w2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let n=this.trees[i],r=this.index[i];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=n.children[r],o=this.start[i]+n.positions[r];if(o>e)return this.nextStart=o,null;if(a instanceof gt){if(o==e){if(o<this.safeFrom)return null;let c=o+a.length;if(c<=this.safeTo){let h=a.prop(Oe.lookAhead);if(!h||c+h<this.fragment.to)return a}}this.index[i]++,o+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[i]++,this.nextStart=o+a.length}}}class Uz{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Zc)}getActions(e){let i=0,n=null,{parser:r}=e.p,{tokenizers:a}=r,o=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<a.length;d++){if((1<<d&o)==0)continue;let p=a[d],g=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=o||g.context!=c)&&(this.updateCachedToken(g,p,e),g.mask=o,g.context=c),g.lookAhead>g.end+25&&(h=Math.max(g.lookAhead,h)),g.value!=0)){let x=i;if(g.extended>-1&&(i=this.addActions(e,g.extended,g.end,i)),i=this.addActions(e,g.value,g.end,i),!p.extend&&(n=g,i>x))break}}for(;this.actions.length>i;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new Zc,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 Zc,{pos:n,p:r}=e;return i.start=n,i.end=Math.min(n+1,r.stream.end),i.value=n==r.stream.end?r.parser.eofTerm:0,i}updateCachedToken(e,i,n){let r=this.stream.clipPos(n.pos);if(i.token(this.stream.reset(r,e),n),e.value>-1){let{parser:a}=n.p;for(let o=0;o<a.specialized.length;o++)if(a.specialized[o]==e.value){let c=a.specializers[o](this.stream.read(e.start,e.end),n);if(c>=0&&n.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,i,n,r){for(let a=0;a<r;a+=3)if(this.actions[a]==e)return r;return this.actions[r++]=e,this.actions[r++]=i,this.actions[r++]=n,r}addActions(e,i,n,r){let{state:a}=e,{parser:o}=e.p,{data:c}=o;for(let h=0;h<2;h++)for(let d=o.stateSlot(a,h?2:1);;d+=3){if(c[d]==65535)if(c[d+1]==1)d=Qn(c,d+2);else{r==0&&c[d+1]==2&&(r=this.putAction(Qn(c,d+2),i,n,r));break}c[d]==i&&(r=this.putAction(Qn(c,d+1),i,n,r))}return r}}class qz{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 Bz(i,r),this.tokens=new Uz(e,this.stream),this.topTerm=e.top[1];let{from:a}=r[0];this.stacks=[zh.start(this,e.top[0],a)],this.fragments=n.length&&this.stream.end-a>e.bufferLength*4?new Hz(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],r,a;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let c=e[o];for(;;){if(this.tokens.mainToken=null,c.pos>i)n.push(c);else{if(this.advanceStack(c,n,e))continue;{r||(r=[],a=[]),r.push(c);let h=this.tokens.getMainToken(c);a.push(h.value,h.end)}}break}}if(!n.length){let o=r&&Fz(r);if(o)return Mi&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Mi&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,a,n);if(o)return Mi&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((c,h)=>h.score-c.score);n.length>o;)n.pop();n.some(c=>c.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let c=n[o];for(let h=o+1;h<n.length;h++){let d=n[h];if(c.sameState(d)||c.buffer.length>500&&d.buffer.length>500)if((c.score-d.score||c.buffer.length-d.buffer.length)>0)n.splice(h--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,c)=>c.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let r=e.pos,{parser:a}=this,o=Mi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(r);g;){let x=this.parser.nodeSet.types[g.type.id]==g.type?a.getGoto(e.state,g.type.id):-1;if(x>-1&&g.length&&(!d||(g.prop(Oe.contextHash)||0)==p))return e.useNode(g,x),Mi&&console.log(o+this.stackID(e)+` (via reuse of ${a.getName(g.type.id)})`),!0;if(!(g instanceof gt)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof gt&&g.positions[0]==0)g=v;else break}}let c=a.stateSlot(e.state,4);if(c>0)return e.reduce(c),Mi&&console.log(o+this.stackID(e)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let d=0;d<h.length;){let p=h[d++],g=h[d++],x=h[d++],v=d==h.length||!n,w=v?e:e.split(),k=this.tokens.mainToken;if(w.apply(p,g,k?k.start:w.pos,x),Mi&&console.log(o+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${a.getName(p&65535)}`} for ${a.getName(g)} @ ${r}${w==e?"":", split"})`),v)return!0;w.pos>r?i.push(w):n.push(w)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return k2(e,i),!0}}runRecovery(e,i,n){let r=null,a=!1;for(let o=0;o<e.length;o++){let c=e[o],h=i[o<<1],d=i[(o<<1)+1],p=Mi?this.stackID(c)+" -> ":"";if(c.deadEnd&&(a||(a=!0,c.restart(),Mi&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let g=c.split(),x=p;for(let v=0;v<10&&g.forceReduce()&&(Mi&&console.log(x+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,n));v++)Mi&&(x=this.stackID(g)+" -> ");for(let v of c.recoverByInsert(h))Mi&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,n);this.stream.end>c.pos?(d==c.pos&&(d++,h=0),c.recoverByDelete(h,d),Mi&&console.log(p+this.stackID(c)+` (via recover-delete ${this.parser.getName(h)})`),k2(c,n)):(!r||r.score<g.score)&&(r=g)}return r}stackToTree(e){return e.close(),gt.build({buffer:_h.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=(gm||(gm=new WeakMap)).get(e);return i||gm.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function k2(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 Pz{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Hh extends HC{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let c=0;c<e.repeatNodeCount;c++)i.push("");let n=Object.keys(e.topRules).map(c=>e.topRules[c][1]),r=[];for(let c=0;c<i.length;c++)r.push([]);function a(c,h,d){r[c].push([h,h.deserialize(String(d))])}if(e.nodeProps)for(let c of e.nodeProps){let h=c[0];typeof h=="string"&&(h=Oe[h]);for(let d=1;d<c.length;){let p=c[d++];if(p>=0)a(p,h,c[d++]);else{let g=c[d+-p];for(let x=-p;x>0;x--)a(c[d++],h,g);d++}}}this.nodeSet=new y0(i.map((c,h)=>pi.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=LC;let o=Hc(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(C2),this.states=Hc(e.states,Uint32Array),this.data=Hc(e.stateData),this.goto=Hc(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new Rl(o,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,n){let r=new qz(this,e,i,n);for(let a of this.wrappers)r=a(r,e,i,n);return r}getGoto(e,i,n=!1){let r=this.goto;if(i>=r[0])return-1;for(let a=r[i+1];;){let o=r[a++],c=o&1,h=r[a++];if(c&&n)return h;for(let d=a+(o>>1);a<d;a++)if(r[a]==e)return h;if(c)return-1}}hasAction(e,i){let n=this.data;for(let r=0;r<2;r++)for(let a=this.stateSlot(e,r?2:1),o;;a+=3){if((o=n[a])==65535)if(n[a+1]==1)o=n[a=Qn(n,a+2)];else{if(n[a+1]==2)return Qn(n,a+2);break}if(o==i||o==0)return Qn(n,a+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,n=>n==i?!0:null)}allActions(e,i){let n=this.stateSlot(e,4),r=n?i(n):void 0;for(let a=this.stateSlot(e,1);r==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Qn(this.data,a+2);else break;r=i(Qn(this.data,a+1))}return r}nextStates(e){let i=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Qn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];i.some((a,o)=>o&1&&a==r)||i.push(this.data[n],r)}}return i}configure(e){let i=Object.assign(Object.create(Hh.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=n}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(a=>a.from==n);return r?r.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,r)=>{let a=e.specializers.find(c=>c.from==n.external);if(!a)return n;let o=Object.assign(Object.assign({},n),{external:a.to});return i.specializers[r]=C2(o),o})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),n=i.map(()=>!1);if(e)for(let a of e.split(" ")){let o=i.indexOf(a);o>=0&&(n[o]=!0)}let r=null;for(let a=0;a<i.length;a++)if(!n[a])for(let o=this.dialects[i[a]],c;(c=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new Pz(e,n,r)}static deserialize(e){return new Hh(e)}}function Qn(t,e){return t[e]|t[e+1]<<16}function Fz(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 C2(t){if(t.external){let e=t.extend?1:0;return(i,n)=>t.external(i,n)<<1|e}return t.get}const Vz=UC({String:Q.string,Number:Q.number,"True False":Q.bool,PropertyName:Q.propertyName,Null:Q.null,", :":Q.separator,"[ ]":Q.squareBracket,"{ }":Q.brace}),Iz=Hh.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:[Vz],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}),Qz=kh.define({name:"json",parser:Iz.configure({props:[VC.add({Object:LS({except:/^\s*\}/}),Array:LS({except:/^\s*\]/})}),QC.add({"Object Array":X6})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Gz(){return new H6(Qz)}const $c=["Alice","Bob","Carol","David","Emma","Frank","Grace","Henry","Isla","James"],Eg=["Johnson","Smith","Williams","Brown","Davis","Miller","Wilson","Taylor","Anderson","Thomas"],Yz=["New York","London","Berlin","Tokyo","Sydney","Paris","Toronto","Amsterdam","Singapore","Dubai"],Kz=["United States","United Kingdom","Germany","Japan","Australia","France","Canada","Netherlands"],L0=["example.com","test.org","demo.io","sample.net","mock.dev"],af=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor"];function at(t){return t[Math.floor(Math.random()*t.length)]}function Ze(t,e){return Math.floor(Math.random()*(e-t+1))+t}function aM(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Ng(){const t=new Date;return t.setDate(t.getDate()-Ze(0,365)),t.toISOString()}function ym(t=Ze(5,12)){return Array.from({length:t},()=>at(af)).join(" ")}function oM(){return`${at($c).toLowerCase()}.${at(Eg).toLowerCase()}@${at(L0)}`}function uM(){return`https://${at(L0)}/${at(af)}-${Ze(1,9999)}`}function Wz(t,e){const i=t.toLowerCase().replace(/[-_ ]/g,"");if(["id","uid","uuid","guid"].includes(i)||i.endsWith("id")&&i.length<=8)return aM();if(i==="email"||e?.format==="email")return oM();if(i.includes("phone")||i.includes("mobile")||i.includes("tel"))return`+1-${Ze(200,999)}-${Ze(200,999)}-${Ze(1e3,9999)}`;if(i==="name"||i==="fullname"||i==="displayname")return`${at($c)} ${at(Eg)}`;if(i==="firstname"||i==="givenname")return at($c);if(i==="lastname"||i==="surname"||i==="familyname")return at(Eg);if(i==="username"||i==="login"||i==="handle")return`${at($c).toLowerCase()}${Ze(10,99)}`;if(i==="city")return at(Yz);if(i==="country")return at(Kz);if(i==="zipcode"||i==="postalcode"||i==="zip")return`${Ze(1e4,99999)}`;if(i==="address"||i==="street")return`${Ze(1,999)} ${at(af).replace(/^\w/,n=>n.toUpperCase())} St`;if(i==="color"||i==="colour")return`#${Ze(0,16777215).toString(16).padStart(6,"0")}`;if(i==="age")return Ze(18,75);if(i.includes("price")||i.includes("amount")||i.includes("cost")||i.includes("salary"))return Math.round(Ze(100,99900))/100;if(i.includes("count")||i.includes("quantity")||i.includes("num"))return Ze(1,100);if(i.includes("percent")||i.includes("rate")||i.includes("ratio"))return Ze(0,100);if(i.includes("url")||i.includes("href")||i.includes("link")||i==="website"||i==="homepage"||e?.format==="uri")return uM();if(i.includes("description")||i==="bio"||i==="summary"||i==="about"||i==="details")return ym();if(i.includes("title")||i==="headline"||i==="subject")return ym(Ze(3,6));if(i.includes("text")||i.includes("content")||i.includes("message")||i.includes("comment")||i.includes("note"))return ym();if(i.includes("createdat")||i.includes("updatedat")||i.includes("deletedat")||i.includes("timestamp")||i.includes("date")||e?.format==="date-time")return Ng();if(i==="status")return at(["active","inactive","pending","completed"]);if(i==="role")return at(["user","admin","moderator","editor"]);if(i==="type")return at(["default","primary","secondary"]);if(i==="locale"||i==="language"||i==="lang")return at(["en-US","en-GB","de-DE","fr-FR","ja-JP"]);if(i==="timezone"||i==="tz")return at(["UTC","America/New_York","Europe/Berlin","Asia/Tokyo"]);if(i==="currency")return at(["USD","EUR","GBP","JPY"]);if(i==="version")return`${Ze(1,5)}.${Ze(0,9)}.${Ze(0,99)}`;if(i==="token"||i.includes("apikey")||i.includes("accesstoken")||i.includes("refreshtoken"))return[...Array(32)].map(()=>Ze(0,15).toString(16)).join("")}function so(t){if(!t)return null;if(t.example!==void 0)return t.example;if(t.default!==void 0)return t.default;if(t.enum?.length)return at(t.enum);if(t.oneOf||t.anyOf){const e=t.oneOf??t.anyOf;return so(e[Ze(0,e.length-1)])}if(t.allOf){const e={type:"object",properties:{}};for(const i of t.allOf)i.properties&&Object.assign(e.properties,i.properties),i.type&&(e.type=i.type);return so(e)}if(t.type==="object"||t.properties){const e={};for(const[i,n]of Object.entries(t.properties??{})){const r=Wz(i,n);e[i]=r!==void 0?r:so(n)}return e}if(t.type==="array"){const e=t.items??{};return Array.from({length:Ze(2,3)},()=>so(e))}if(t.type==="string")return t.format==="uuid"?aM():t.format==="email"?oM():t.format==="date-time"?Ng():t.format==="date"?Ng().slice(0,10):t.format==="uri"||t.format==="url"?uM():t.format==="hostname"?at(L0):t.format==="ipv4"?`${Ze(1,254)}.${Ze(0,254)}.${Ze(0,254)}.${Ze(1,254)}`:at(af);if(t.type==="integer"||t.type==="number"){const e=t.minimum??1,i=t.maximum??9999,n=Ze(e,i);return t.type==="integer"?n:Math.round(n*100)/100}return t.type==="boolean"?Math.random()>.5:null}function Xz(){return Wn({queryKey:["saved-responses"],queryFn:_e.savedResponses.list})}function cM(){const t=lt();return yt({mutationFn:e=>_e.savedResponses.create(e),onSuccess:()=>t.invalidateQueries({queryKey:["saved-responses"]})})}function Jz(){const t=lt();return yt({mutationFn:({id:e,data:i})=>_e.savedResponses.update(e,i),onSuccess:()=>t.invalidateQueries({queryKey:["saved-responses"]})})}function Zz(){const t=lt();return yt({mutationFn:e=>_e.savedResponses.delete(e),onSuccess:()=>t.invalidateQueries({queryKey:["saved-responses"]})})}const A2=[200,201,204,400,401,403,404,500,502,503],$z=["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"],e_=["application/json","text/plain","text/html","application/xml","application/octet-stream"],t_=[{key:"content-type",value:"application/json",label:"Content-Type"},{key:"cache-control",value:"no-cache",label:"No-Cache"},{key:"location",value:"/",label:"Location"},{key:"retry-after",value:"5",label:"Retry-After"}];function Uc(t){return Object.entries(t).map(([e,i])=>({key:e,value:i}))}function qc(t){const e={};for(const{key:i,value:n}of t)i.trim()&&(e[i.trim().toLowerCase()]=n.trim());return e}function i_({mock:t,specResponses:e,onChange:i}){const[n,r]=O.useState(t.statusCode),[a,o]=O.useState(t.body),[c,h]=O.useState(()=>Uc(t.headers)),[d,p]=O.useState(null),[g,x]=O.useState(""),[v,w]=O.useState(!1),[k,C]=O.useState(null),{data:M}=Xz(),E=cM(),D=Jz(),G=Zz();O.useEffect(()=>{r(t.statusCode),o(t.body),h(Uc(t.headers))},[t.statusCode,t.body,t.headers]);const L=O.useRef(!1);O.useEffect(()=>{if(L.current||M===void 0)return;L.current=!0;const H=M.find(te=>te.statusCode===t.statusCode&&te.body===t.body&&JSON.stringify(te.headers)===JSON.stringify(t.headers));if(H){C({type:"saved",id:H.id});return}if(e){const te=e.findIndex(T=>T.statusCode===t.statusCode&&(T.body??"")===t.body);te>=0&&C({type:"spec",index:te})}},[M]),O.useEffect(()=>{if(!a.trim()){p(null);return}try{JSON.parse(a),p(null)}catch(H){p(H instanceof SyntaxError?H.message:"Invalid JSON")}},[a]);const I=O.useCallback((H,te,T)=>{i({statusCode:te,headers:qc(H),body:T})},[i]),q=()=>{try{const H=JSON.stringify(JSON.parse(a),null,2);o(H),I(c,n,H)}catch{}},$=(H,te,T)=>{h(F=>F.map((Z,ne)=>ne===H?{...Z,[te]:T}:Z))},ee=H=>{h(te=>{const T=te.filter((F,Z)=>Z!==H);return I(T,n,a),T})},fe=()=>h(H=>[...H,{key:"",value:""}]),ce=(H,te)=>{h(T=>{const F=T.findIndex(ne=>ne.key.toLowerCase()===H.toLowerCase()),Z=F>=0?T.map((ne,xe)=>xe===F?{key:ne.key,value:te}:ne):[...T,{key:H,value:te}];return I(Z,n,a),Z})},P=(H,te)=>{const T=H.statusCode,F=H.headers&&Object.keys(H.headers).length>0?H.headers:{"content-type":"application/json"};r(T),h(Uc(F)),o(te),i({statusCode:T,headers:F,body:te})},ie=(H,te)=>{C({type:"spec",index:te}),P(H,H.body??"")},de=(H,te)=>{C({type:"spec",index:te});const T=H.schema?so(H.schema):null,F=T!==null?JSON.stringify(T,null,2):H.body??"";P(H,F)},ue=k?.type==="saved"?M?.find(H=>H.id===k.id)??null:null,_=ue!==null&&(n!==ue.statusCode||a!==ue.body||JSON.stringify(qc(c))!==JSON.stringify(ue.headers)),J=()=>{ue?D.mutate({id:ue.id,data:{name:ue.name,statusCode:n,headers:qc(c),body:a}}):w(!0)},se=()=>{g.trim()&&E.mutate({name:g.trim(),statusCode:n,headers:qc(c),body:a},{onSuccess:()=>{x(""),w(!1)}})};return b.jsxs("div",{className:"flex flex-col gap-6 p-2 bg-background",children:[e&&e.length>0&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(uw,{className:"w-3.5 h-3.5 text-primary"}),"Spec Defined Responses"]}),b.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:e.map((H,te)=>{const T=k?.type==="spec"&&k.index===te;return b.jsxs("div",{className:ve("flex items-stretch rounded-xl border transition-all group overflow-hidden",T?"border-primary/50 bg-primary/5":"border-border bg-card hover:border-primary/40 hover:bg-primary/5"),children:[b.jsxs("button",{onClick:()=>ie(H,te),className:"flex flex-1 items-start gap-3 p-3 text-left",children:[b.jsx("span",{className:ve("px-1.5 py-0.5 text-[10px] font-black font-mono rounded border shrink-0",H.statusCode<300?"text-emerald-400 border-emerald-400/30":H.statusCode<500?"text-amber-400 border-amber-400/30":"text-rose-400 border-rose-400/30"),children:H.statusCode}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("p",{className:"text-[11px] font-bold text-foreground truncate group-hover:text-primary transition-colors",children:H.name}),H.description&&H.description!==H.name&&b.jsx("p",{className:"text-[9px] text-muted-foreground line-clamp-1 mt-0.5",children:H.description})]})]}),H.schema&&b.jsx("button",{onClick:()=>de(H,te),className:"px-2.5 border-l border-border/50 text-muted-foreground/40 hover:text-primary hover:bg-primary/5 transition-all shrink-0",title:"Generate test data from schema","aria-label":"Generate test data",children:b.jsx(x3,{className:"w-3.5 h-3.5"})})]},te)})})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[b.jsx(rw,{className:"w-3.5 h-3.5"}),"Saved Responses"]}),v?b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:g,onChange:H=>x(H.target.value),onKeyDown:H=>{H.key==="Enter"&&se(),H.key==="Escape"&&(w(!1),x(""))},className:"px-2 py-1 text-[11px] font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner w-32"}),b.jsx("button",{onClick:se,disabled:!g.trim()||E.isPending,className:"p-1 text-primary hover:bg-primary/10 rounded-md transition-all disabled:opacity-40","aria-label":"Confirm save",children:b.jsx(Br,{className:"w-3.5 h-3.5"})}),b.jsx("button",{onClick:()=>{w(!1),x("")},className:"p-1 text-muted-foreground hover:text-foreground rounded-md transition-all","aria-label":"Cancel save",children:b.jsx(Xn,{className:"w-3 h-3"})})]}):b.jsxs("button",{onClick:J,disabled:ue!==null&&!_,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":"Save current response",children:[b.jsx(Ll,{className:"w-3 h-3"}),"Save current"]})]}),M&&M.length>0?b.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:M.map(H=>{const te=k?.type==="saved"&&k.id===H.id;return b.jsxs("div",{className:ve("flex items-stretch rounded-xl border transition-all group overflow-hidden",te?"border-primary/50 bg-primary/5":"border-border bg-card hover:border-primary/40 hover:bg-primary/5"),children:[b.jsxs("button",{onClick:()=>{C({type:"saved",id:H.id}),r(H.statusCode),h(Uc(H.headers)),o(H.body),i({statusCode:H.statusCode,headers:H.headers,body:H.body})},className:"flex flex-1 items-center gap-3 p-3 text-left",children:[b.jsx("span",{className:ve("px-1.5 py-0.5 text-[10px] font-black font-mono rounded border shrink-0",H.statusCode<300?"text-emerald-400 border-emerald-400/30":H.statusCode<500?"text-amber-400 border-amber-400/30":"text-rose-400 border-rose-400/30"),children:H.statusCode}),b.jsx("p",{className:"text-[11px] font-bold text-foreground truncate group-hover:text-primary transition-colors flex-1",children:H.name})]}),b.jsx("button",{onClick:()=>G.mutate(H.id),className:"px-2.5 border-l border-border/50 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/5 transition-all shrink-0","aria-label":"Delete saved response",children:b.jsx(Bl,{className:"w-3.5 h-3.5"})})]},H.id)})}):b.jsx("p",{className:"text-[10px] text-muted-foreground/40 font-mono px-1",children:"No saved responses yet — configure a response and click Save current."})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(rh,{className:"w-3.5 h-3.5"}),"Status Code"]}),b.jsxs("div",{className:"flex flex-wrap gap-2",children:[A2.map(H=>b.jsx("button",{onClick:()=>{r(H),I(c,H,a)},className:ve("px-2.5 py-1.5 text-xs font-mono font-bold rounded-lg border transition-colors duration-75",n===H?"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:H},H)),b.jsx("input",{type:"number",value:n,onChange:H=>r(Number(H.target.value)),onBlur:()=>I(c,n,a),className:ve("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",A2.includes(n)?"border-border text-muted-foreground hover:border-mode-mock/20":"bg-mode-mock/20 border-mode-mock text-mode-mock shadow-sm")})]})]}),b.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[b.jsx(jl,{className:"w-3.5 h-3.5"}),"Headers"]}),b.jsxs("button",{onClick:fe,className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors","aria-label":"Add header",children:[b.jsx(Ll,{className:"w-3 h-3"}),"Add"]})]}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:t_.map(H=>b.jsx("button",{onClick:()=>ce(H.key,H.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:H.label},`${H.key}:${H.value}`))}),b.jsx("datalist",{id:"header-names",children:$z.map(H=>b.jsx("option",{value:H},H))}),b.jsxs("div",{className:"space-y-1.5",children:[c.length===0&&b.jsx("p",{className:"text-[10px] text-muted-foreground/50 font-mono px-1 py-2",children:"No headers — use quick-add or + Add"}),c.map((H,te)=>b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"text",list:"header-names",value:H.key,onChange:T=>$(te,"key",T.target.value),onBlur:()=>I(c,n,a),placeholder:"Header-Name","aria-label":"Header name",className:"w-[45%] px-2.5 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-mode-mock shadow-inner"}),b.jsx("span",{className:"text-muted-foreground/40 text-xs font-mono shrink-0",children:":"}),b.jsx("input",{type:"text",value:H.value,onChange:T=>$(te,"value",T.target.value),onBlur:()=>I(c,n,a),placeholder:"value","aria-label":"Header value",className:"flex-1 px-2.5 py-1.5 text-[11px] font-mono rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-mode-mock shadow-inner"}),b.jsx("button",{onClick:()=>ee(te),className:"p-1 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 rounded transition-all shrink-0","aria-label":"Remove header",children:b.jsx(Xn,{className:"w-3 h-3"})})]}),H.key.toLowerCase()==="content-type"&&b.jsx("div",{className:"flex flex-wrap gap-1 pl-1",children:e_.map(T=>b.jsx("button",{onClick:()=>{$(te,"value",T);const F=c.map((Z,ne)=>ne===te?{...Z,value:T}:Z);I(F,n,a)},className:ve("px-1.5 py-0.5 text-[9px] font-mono rounded border transition-all",H.value===T?"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:T},T))})]},te))]})]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("label",{className:"flex items-center gap-2 text-[10px] font-black text-muted-foreground uppercase tracking-widest",children:[b.jsx(nh,{className:"w-3.5 h-3.5"}),"Body"]}),b.jsxs("button",{onClick:q,disabled:!!d||!a.trim(),className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Format JSON",children:[b.jsx(z3,{className:"w-3 h-3"}),"Format"]})]}),b.jsx("div",{className:ve("rounded-xl border bg-background overflow-hidden shadow-inner focus-within:ring-1",d?"border-destructive/50 focus-within:ring-destructive/50":"border-border focus-within:ring-mode-mock"),children:b.jsx(lM,{value:a,onChange:o,onBlur:()=>I(c,n,a),extensions:[Gz()],height:"150px",theme:"dark",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"text-[11px] font-mono"})}),d&&b.jsxs("div",{className:"flex items-start gap-1.5 px-1",children:[b.jsx(m3,{className:"w-3 h-3 text-destructive shrink-0 mt-0.5"}),b.jsx("p",{"data-testid":"json-error",className:"text-[10px] text-destructive font-mono leading-tight",children:d})]})]})]})]})}const n_={passthrough:"border-mode-passthrough/20",delay:"border-mode-delay/20",mock:"border-mode-mock/20","mock-delay":"border-mode-mock/20"},r_={passthrough:"bg-mode-passthrough",delay:"bg-mode-delay",mock:"bg-mode-mock","mock-delay":"bg-mode-mock"};function s_({endpoint:t,specName:e,showSpecBadge:i}){const[n,r]=O.useState(!1),a=e4(),o=c=>{const h=t.mode==="delay"||t.mode==="mock-delay",d=t.mode==="mock"||t.mode==="mock-delay";let p;c==="passthrough"?p="passthrough":c==="delay"?h?p=d?"mock":"passthrough":p=d?"mock-delay":"delay":d?p=h?"delay":"passthrough":p=h?"mock-delay":"mock";const g={mode:p};(p==="delay"||p==="mock-delay")&&!t.delay&&(g.delay={ms:1e3}),(p==="mock"||p==="mock-delay")&&!t.mock&&(g.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),a.mutate({id:t.id,config:g}),p!=="passthrough"&&r(!0)};return b.jsxs("div",{className:ve("group relative border sm:rounded-xl card-slab overflow-hidden mb-1 shadow-sm",n_[t.mode]),children:[b.jsx("div",{className:ve("absolute left-0 top-0 bottom-0 w-[2px] transition-all duration-75",r_[t.mode])}),b.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 cursor-pointer select-none hover:bg-primary/5 transition-colors duration-75",onClick:()=>r(!n),children:[b.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsx("button",{className:"text-muted-foreground/40 group-hover:text-primary transition-colors duration-75",children:n?b.jsx(qo,{className:"w-4 h-4"}):b.jsx(sw,{className:"w-4 h-4"})}),b.jsx(Jg,{method:t.method})]}),b.jsxs("div",{className:"flex flex-col min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-sm font-black font-mono tracking-tight text-foreground/90 truncate",children:t.path}),i&&e&&b.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-black uppercase tracking-widest rounded-[4px] bg-accent text-accent-foreground border border-border",children:e})]}),t.summary&&b.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-medium truncate mt-0.5",children:t.summary})]})]}),b.jsxs("div",{className:"flex items-center gap-4 shrink-0",onClick:c=>c.stopPropagation(),children:[b.jsxs("div",{className:"flex items-center gap-2",children:[(t.mode==="delay"||t.mode==="mock-delay")&&t.delay&&b.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-black font-mono rounded bg-mode-delay/10 text-mode-delay border border-mode-delay/20 shadow-sm",children:[t.delay.ms,"ms"]}),(t.mode==="mock"||t.mode==="mock-delay")&&t.mock&&b.jsx("span",{className:ve("px-2 py-0.5 text-[10px] font-black font-mono rounded border shadow-sm",t.mock.statusCode<300?"bg-emerald-400/10 text-emerald-400 border-emerald-400/20":t.mock.statusCode<500?"bg-amber-400/10 text-amber-400 border-amber-400/20":"bg-rose-400/10 text-rose-400 border-rose-400/20"),children:t.mock.statusCode})]}),b.jsx(r4,{value:t.mode,onChange:o})]})]}),n&&b.jsx("div",{className:ve("px-5 pb-5 pt-0","border-t border-border/20 mx-4"),children:b.jsxs("div",{className:"pt-5 space-y-4",children:[(t.mode==="delay"||t.mode==="mock-delay")&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-delay uppercase tracking-widest px-1",children:[b.jsx(rh,{className:"w-3 h-3"}),"Delay"]}),b.jsx("div",{className:"bg-muted rounded-xl p-4 border border-border",children:b.jsx(s4,{delay:t.delay??{ms:1e3},onChange:c=>a.mutate({id:t.id,config:{delay:c}})})})]}),(t.mode==="mock"||t.mode==="mock-delay")&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-mode-mock uppercase tracking-widest px-1",children:[b.jsx(rh,{className:"w-3 h-3"}),"Mock Response"]}),b.jsx("div",{className:"bg-muted rounded-xl border border-border overflow-hidden",children:b.jsx(i_,{mock:t.mock??{statusCode:200,headers:{},body:"{}"},specResponses:t.responses,onChange:c=>a.mutate({id:t.id,config:{mock:c}})})})]}),t.mode==="passthrough"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center space-y-2",children:[b.jsx("div",{className:"w-10 h-10 rounded-full bg-mode-passthrough/5 flex items-center justify-center border border-border",children:b.jsx(Om,{className:"w-5 h-5 text-mode-passthrough opacity-40"})}),b.jsxs("div",{className:"max-w-[300px]",children:[b.jsx("p",{className:"text-xs font-semibold text-foreground/80",children:"Passthrough Mode Active"}),b.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mt-1",children:"Requests will be forwarded directly to the upstream server without modification."})]})]})]})})]})}function l_(){const{data:t,isLoading:e}=uk(),{data:i,isLoading:n}=Vh(),r=ck(),[a,o]=O.useState(""),[c,h]=O.useState(new Set),d=O.useMemo(()=>{const k=new Map;for(const C of i??[])k.set(C.id,C);return k},[i]),p=O.useMemo(()=>new Set(i?.filter(k=>k.active).map(k=>k.id)??[]),[i]),g=O.useMemo(()=>{if(!t)return new Map;let k=t.filter(M=>p.has(M.specId));if(a){const M=a.toLowerCase();k=k.filter(E=>E.path.toLowerCase().includes(M)||E.method.toLowerCase().includes(M)||E.operationId?.toLowerCase().includes(M)||E.summary?.toLowerCase().includes(M))}const C=new Map;for(const M of k){const E=M.tags[0]??"Untagged";C.has(E)||C.set(E,[]),C.get(E).push(M)}return C},[t,a,p]),x=k=>{h(C=>{const M=new Set(C);return M.has(k)?M.delete(k):M.add(k),M})},v=(k,C)=>{const M={};k.forEach(E=>{const D={mode:C};C==="delay"&&!E.delay&&(D.delay={ms:1e3}),C==="mock"&&!E.mock&&(D.mock={statusCode:200,headers:{"content-type":"application/json"},body:"{}"}),M[E.id]=D}),r.mutate(M)};return e||n?b.jsxs("div",{className:"flex flex-col items-center justify-center h-80 gap-4",children:[b.jsx(sh,{className:"w-10 h-10 animate-spin text-primary/40"}),b.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Indexing endpoints..."})]}):!t?.length||p.size===0?b.jsxs("div",{className:"flex flex-col items-center justify-center h-80 text-center space-y-4 px-6",children:[b.jsx("div",{className:"w-16 h-16 rounded-3xl bg-muted border border-border/40 flex items-center justify-center text-muted-foreground opacity-20",children:b.jsx(rh,{className:"w-8 h-8"})}),b.jsxs("div",{className:"max-w-xs",children:[b.jsx("h3",{className:"text-sm font-black text-foreground uppercase tracking-tight",children:p.size===0?"No Active Specifications":"No endpoints detected"}),b.jsx("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:p.size===0?"Select or import a specification from the header to begin.":"Import an OpenAPI specification to automatically populate your workspace."})]})]}):b.jsxs("div",{className:"space-y-6",children:[b.jsxs("div",{className:"relative group",children:[b.jsx(R3,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/40 group-focus-within:text-primary transition-colors"}),b.jsx("input",{type:"text",placeholder:"Search by path, method, or operation...",value:a,onChange:k=>o(k.target.value),className:"w-full pl-10 pr-9 py-2.5 text-sm font-bold rounded-xl border border-border/60 bg-card/30 backdrop-blur-sm placeholder:text-muted-foreground/40 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/40 shadow-sm transition-all"}),a&&b.jsx("button",{onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground/40 hover:text-foreground rounded transition-colors","aria-label":"Clear search",children:b.jsx(Xn,{className:"w-3.5 h-3.5"})})]}),b.jsxs("div",{className:"space-y-8",children:[Array.from(g.entries()).map(([k,C])=>{const M=c.has(k);return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-3 w-full",children:[b.jsxs("button",{onClick:()=>x(k),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-muted/40 border border-border/20 text-muted-foreground hover:text-foreground hover:bg-muted/60 hover:border-border/40 transition-all shrink-0",children:[M?b.jsx(sw,{className:"w-3.5 h-3.5"}):b.jsx(qo,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest",children:k}),b.jsxs("span",{className:"text-[10px] font-black opacity-40 tabular-nums",children:["(",C.length,")"]})]}),b.jsxs("div",{className:"flex items-center gap-1 bg-muted/20 p-0.5 rounded-lg border border-border/10 shrink-0",children:[b.jsx("button",{onClick:()=>v(C,"passthrough"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-passthrough hover:bg-mode-passthrough/10 rounded-md transition-all",title:"Pass all in group",children:"Pass"}),b.jsx("button",{onClick:()=>v(C,"delay"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-delay hover:bg-mode-delay/10 rounded-md transition-all",title:"Delay all in group",children:"Delay"}),b.jsx("button",{onClick:()=>v(C,"mock"),className:"px-2 py-1 text-[9px] font-black uppercase tracking-tighter text-muted-foreground/60 hover:text-mode-mock hover:bg-mode-mock/10 rounded-md transition-all",title:"Mock all in group",children:"Mock"})]}),b.jsx("div",{className:"h-px flex-1 bg-border/20 opacity-40 group-hover:opacity-100 group-hover:bg-primary/20 transition-all"})]}),!M&&b.jsx("div",{className:"grid grid-cols-1 gap-1 px-1",children:C.map(E=>b.jsx(s_,{endpoint:E,specName:d.get(E.specId)?.name,showSpecBadge:p.size>1},E.id))})]},k)}),g.size===0&&a&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[b.jsx(aw,{className:"w-10 h-10 text-muted-foreground opacity-20"}),b.jsxs("div",{className:"max-w-[240px]",children:[b.jsx("p",{className:"text-sm font-bold text-foreground/80",children:"No results found"}),b.jsxs("p",{className:"text-[11px] text-muted-foreground font-medium mt-1 leading-relaxed",children:['The search term "',a,'" did not match any active endpoints.']})]})]})]})]})}const a_=["Access-Control-Allow-Origin","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Cache-Control","Content-Type","X-Request-ID"],o_=[{key:"access-control-allow-origin",value:"*",label:"CORS Origin"},{key:"access-control-allow-headers",value:"*",label:"CORS Headers"},{key:"access-control-allow-methods",value:"*",label:"CORS Methods"},{key:"cache-control",value:"no-cache",label:"No-Cache"}];function M2(t={}){return Object.entries(t).map(([e,i])=>({key:e,value:i}))}function u_(t){const e={};for(const{key:i,value:n}of t)i.trim()&&(e[i.trim().toLowerCase()]=n.trim());return e}function c_({spec:t}){const e=lk(),[i,n]=O.useState(()=>M2(t.globalHeaders));O.useEffect(()=>{n(M2(t.globalHeaders))},[t.globalHeaders]);const r=g=>{e.mutate({specId:t.id,data:{globalHeaders:u_(g)}})},a=()=>{e.mutate({specId:t.id,data:{applyGlobalHeadersToAll:!t.applyGlobalHeadersToAll}})},o=()=>n(g=>[...g,{key:"",value:""}]),c=(g,x,v)=>n(w=>w.map((k,C)=>C===g?{...k,[x]:v}:k)),h=g=>{const x=i.filter((v,w)=>w!==g);n(x),r(x)},d=(g,x)=>{n(v=>{const w=v.findIndex(C=>C.key.toLowerCase()===g.toLowerCase()),k=w>=0?v.map((C,M)=>M===w?{key:C.key,value:x}:C):[...v,{key:g,value:x}];return r(k),k})},p=Object.keys(t.globalHeaders??{}).length;return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-[10px] font-black text-foreground/70 uppercase tracking-widest",children:t.name}),p>0&&b.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-black rounded-full bg-primary/15 text-primary border border-primary/20",children:p})]}),b.jsxs("button",{onClick:o,className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-primary hover:text-primary/80 transition-colors","aria-label":"Add global header",children:[b.jsx(Ll,{className:"w-3 h-3"}),"Add"]})]}),b.jsxs("div",{className:"flex items-center justify-between py-1.5 px-2 rounded-lg bg-muted/60 border border-border/30",children:[b.jsxs("div",{className:"flex flex-col",children:[b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-foreground/60",children:"Apply to all requests"}),b.jsx("span",{className:"text-[9px] text-muted-foreground/50 font-medium",children:"Include unmatched endpoints"})]}),b.jsx("button",{onClick:a,className:ve("px-2.5 py-1 text-[9px] font-black uppercase tracking-widest rounded border transition-all duration-150",t.applyGlobalHeadersToAll?"bg-primary/15 text-primary border-primary/30":"bg-muted text-muted-foreground/60 border-border/40 hover:text-foreground hover:bg-accent/40"),children:t.applyGlobalHeadersToAll?"On":"Off"})]}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:o_.map(g=>b.jsx("button",{onClick:()=>d(g.key,g.value),className:ve("px-2 py-0.5 text-[9px] font-black uppercase tracking-wider rounded-md border transition-all",i.some(x=>x.key.toLowerCase()===g.key&&x.value===g.value)?"border-primary/40 text-primary bg-primary/10":"border-border bg-muted text-muted-foreground hover:border-primary/30 hover:text-foreground hover:bg-accent"),children:g.label},`${g.key}:${g.value}`))}),b.jsx("datalist",{id:"global-header-names",children:a_.map(g=>b.jsx("option",{value:g},g))}),i.length===0?b.jsx("p",{className:"text-[10px] text-muted-foreground/40 font-mono py-1",children:"No global headers — use quick-add or + Add."}):b.jsx("div",{className:"space-y-1",children:i.map((g,x)=>b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{type:"text",list:"global-header-names",value:g.key,onChange:v=>c(x,"key",v.target.value),onBlur:()=>r(i),placeholder:"Header-Name","aria-label":"Global header name",className:"w-[45%] px-2.5 py-1.5 text-[11px] font-mono font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("span",{className:"text-muted-foreground/40 text-xs font-mono shrink-0",children:":"}),b.jsx("input",{type:"text",value:g.value,onChange:v=>c(x,"value",v.target.value),onBlur:()=>r(i),placeholder:"value","aria-label":"Global header value",className:"flex-1 px-2.5 py-1.5 text-[11px] font-mono rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner"}),b.jsx("button",{onClick:()=>h(x),className:"p-1 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 rounded transition-all shrink-0","aria-label":"Remove global header",children:b.jsx(Xn,{className:"w-3 h-3"})})]},x))})]})}function h_({open:t}){const{data:e}=Vh(),i=e?.filter(n=>n.active)??[];return t?b.jsxs("div",{className:"border-b border-border/60 bg-muted/20 px-6 py-4 space-y-4 animate-in slide-in-from-top-1 duration-150",children:[b.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[b.jsx(jl,{className:"w-3.5 h-3.5 text-muted-foreground/60"}),b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-muted-foreground/60",children:"Global Response Headers"}),b.jsx("span",{className:"text-[9px] text-muted-foreground/40 font-medium",children:"— injected into every response for the spec. Per-endpoint mock headers take priority."})]}),i.length===0?b.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"No active spec selected."}):b.jsx("div",{className:ve("space-y-5",i.length>1&&"divide-y divide-border/40"),children:i.map(n=>b.jsx("div",{className:ve(i.length>1&&"pt-4 first:pt-0"),children:b.jsx(c_,{spec:n})},n.id))})]}):null}function f_({open:t,onToggle:e}){const{data:i}=Vh(),n=i?.filter(o=>o.active)??[],r=n.reduce((o,c)=>o+Object.keys(c.globalHeaders??{}).length,0),a=n.some(o=>o.applyGlobalHeadersToAll);return b.jsxs("button",{onClick:e,className:ve("flex items-center gap-1.5 px-2.5 py-1.5 text-[9px] font-black uppercase tracking-widest rounded-lg border transition-all",t?"bg-primary/10 border-primary/20 text-primary":"bg-muted/30 border-border/40 text-muted-foreground hover:bg-accent/40 hover:border-border/60 hover:text-foreground"),title:"Global Response Headers",children:[b.jsx(jl,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden sm:inline",children:"Global Headers"}),r>0&&b.jsx("span",{className:ve("px-1.5 py-0.5 rounded-full text-[9px] font-black border",t?"bg-primary/20 border-primary/30 text-primary":"bg-muted border-border text-muted-foreground"),children:r}),a&&b.jsx("span",{className:ve("px-1.5 py-0.5 rounded text-[8px] font-black border uppercase tracking-wider",t?"bg-primary/20 border-primary/30 text-primary":"bg-muted border-border text-muted-foreground"),children:"All"})]})}function d_(){return Wn({queryKey:["presets"],queryFn:_e.presets.list})}function p_(){const t=lt();return yt({mutationFn:e=>_e.presets.create(e),onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function m_(){const t=lt();return yt({mutationFn:_e.presets.delete,onSuccess:()=>{t.invalidateQueries({queryKey:["presets"]})}})}function g_(){const t=lt();return yt({mutationFn:_e.presets.apply,onSuccess:()=>{t.invalidateQueries({queryKey:["endpoints"]})}})}const hM=[{name:"Slow",icon:B3,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:cw,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:Vg,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 y_(t,e){for(const[i,n]of Object.entries(e.endpoints)){const r=t.find(a=>a.id===i);if(!r||n.mode!==void 0&&r.mode!==n.mode||n.mode==="delay"&&n.delay&&r.delay?.ms!==n.delay.ms||n.mode==="mock"&&n.mock&&(r.mock?.statusCode!==n.mock.statusCode||r.mock?.body!==n.mock.body))return!1}return!0}function x_(t,e){if(!t?.length)return null;for(const i of hM)if(i.match(t))return`builtin:${i.name}`;if(e){for(const i of e)if(y_(t,i))return`saved:${i.name}`}return null}function b_(){const{data:t}=d_(),{data:e}=uk(),i=p_(),n=m_(),r=g_(),a=ck(),o=O.useMemo(()=>x_(e,t),[e,t]),[c,h]=O.useState(!1),[d,p]=O.useState(!1),[g,x]=O.useState(""),v=O.useRef(null);O.useEffect(()=>{function C(M){v.current&&!v.current.contains(M.target)&&h(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);const w=!!e?.length,k=()=>{if(!g.trim()||!e)return;const C={};for(const M of e)C[M.id]={mode:M.mode,delay:M.delay,mock:M.mock};i.mutate({name:g.trim(),endpoints:C},{onSuccess:()=>{x(""),p(!1)}})};return w?b.jsxs("div",{className:"bg-card/30 backdrop-blur-sm border border-border/40 rounded-xl p-1 flex items-center gap-1 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-1 bg-muted/40 rounded-lg p-0.5 border border-border/20 shadow-inner",children:[b.jsx("div",{className:"px-2 text-[9px] font-black text-muted-foreground uppercase tracking-widest hidden lg:block",children:"Presets"}),hM.map(({name:C,icon:M,apply:E})=>{const D=o===`builtin:${C}`;return b.jsxs("button",{onClick:()=>{e&&a.mutate(E(e))},className:ve("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:[b.jsx(M,{className:ve("w-3.5 h-3.5")}),b.jsx("span",{className:"hidden sm:inline",children:C}),D&&b.jsx(Br,{className:"w-3 h-3 ml-0.5"})]},C)})]}),b.jsx("div",{className:"h-6 w-px bg-border/40 mx-1 shrink-0"}),t&&t.length>0&&b.jsxs("div",{className:"relative",ref:v,children:[b.jsxs("button",{onClick:()=>h(!c),className:ve("inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border transition-colors duration-75",c||o&&o.startsWith("saved:")?"bg-primary/20 border-primary/30 text-primary shadow-sm":"border-border/40 text-muted-foreground hover:bg-accent/40 hover:text-foreground"),children:[b.jsx(uw,{className:"w-3.5 h-3.5"}),b.jsxs("span",{className:"hidden sm:inline",children:["Saved (",t.length,")"]}),b.jsx(qo,{className:ve("w-3 h-3 text-muted-foreground transition-transform duration-75",c&&"rotate-180")})]}),c&&b.jsxs("div",{className:"absolute right-0 top-full mt-2 z-[100] bg-popover border border-border shadow-2xl rounded-xl py-1.5 min-w-[240px]",children:[b.jsx("div",{className:"px-3 py-1 mb-1 border-b border-border/40",children:b.jsx("span",{className:"text-[9px] font-black text-muted-foreground/60 uppercase tracking-widest",children:"Saved Configurations"})}),b.jsx("div",{className:"max-h-[300px] overflow-y-auto px-1.5 ",children:t.map(C=>{const M=o===`saved:${C.name}`;return b.jsxs("div",{className:ve("group flex items-center gap-3 px-3 py-2 text-xs rounded-lg transition-colors duration-75 mb-0.5 border border-transparent",M?"bg-primary/10 border-primary/20 text-primary font-bold shadow-sm":"hover:bg-accent/50 text-muted-foreground hover:text-foreground"),children:[b.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer py-0.5",onClick:()=>r.mutate(C.name,{onSuccess:()=>h(!1)}),children:[b.jsx("p",{className:"font-bold truncate",children:C.name}),b.jsxs("p",{className:"text-[9px] opacity-60 font-medium",children:[Object.keys(C.endpoints).length," endpoints"]})]}),b.jsx("div",{className:"flex items-center gap-1 shrink-0",children:b.jsx("button",{onClick:E=>{E.stopPropagation(),n.mutate(C.name)},className:"p-1.5 text-muted-foreground hover:text-rose-500 hover:bg-rose-500/10 rounded-md transition-colors duration-75 opacity-0 group-hover:opacity-100",title:"Delete",children:b.jsx(Bl,{className:"w-3.5 h-3.5"})})})]},C.name)})})]})]}),d?b.jsxs("div",{className:"flex items-center gap-1.5 bg-accent/20 rounded-lg p-0.5 border border-primary/20 shadow-inner ml-auto",children:[b.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:C=>x(C.target.value),placeholder:"Name...",onKeyDown:C=>{C.key==="Enter"&&k(),C.key==="Escape"&&(p(!1),x(""))},className:"w-28 sm:w-40 px-3 py-1.5 text-[10px] font-bold rounded-md border border-border/40 bg-background/50 focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/50 transition-colors duration-75"}),b.jsx("button",{onClick:k,disabled:!g.trim(),className:"px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors duration-75 shadow-sm",children:"Save"}),b.jsx("button",{onClick:()=>{p(!1),x("")},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-white/5 rounded-md transition-colors duration-75",children:b.jsx(Xn,{className:"w-3.5 h-3.5"})})]}):b.jsxs("button",{onClick:()=>p(!0),disabled:o!==null,className:ve("ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-black uppercase tracking-wider rounded-lg border border-dashed transition-colors duration-75",o!==null?"border-border/20 text-muted-foreground/20 cursor-not-allowed":"border-border/40 text-muted-foreground hover:border-primary/40 hover:text-primary hover:bg-primary/5 shadow-sm"),children:[b.jsx(N3,{className:"w-3.5 h-3.5"}),b.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]}):null}function v_(){const[t,e]=O.useState([]),[i,n]=O.useState(!1),[r,a]=O.useState(!1),o=O.useRef(null),c=lt();O.useEffect(()=>{_e.logs.get(500).then(({entries:d})=>{e(p=>{const g=new Set(p.map(v=>v.id)),x=[...p];for(const v of d)g.has(v.id)||x.push(v);return x.slice(0,500)}),a(!0)})},[]),O.useEffect(()=>{const d=new EventSource("/api/logs/stream");return o.current=d,d.addEventListener("connected",()=>n(!0)),d.addEventListener("log",p=>{const g=JSON.parse(p.data);e(x=>[g,...x].slice(0,500))}),d.onerror=()=>n(!1),()=>{d.close(),o.current=null}},[]);const h=O.useCallback(()=>{e([]),_e.logs.clear().then(()=>{c.invalidateQueries({queryKey:["logs"]})})},[c]);return{entries:t,connected:i,clear:h,loaded:r}}function fM({status:t}){const e=t<300?"text-emerald-400 bg-emerald-400/10 border-emerald-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-success),0.2)]":t<400?"text-blue-400 bg-blue-400/10 border-blue-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-primary),0.2)]":t<500?"text-amber-400 bg-amber-400/10 border-amber-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-warning),0.2)]":"text-rose-400 bg-rose-400/10 border-rose-400/20 shadow-[0_0_8px_-2px_rgba(var(--color-destructive),0.2)]";return b.jsx("span",{className:ve("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 S_({entry:t,onClose:e}){const[i,n]=O.useState(!1),[r,a]=O.useState(!1),[o,c]=O.useState(""),[h,d]=O.useState(!1),p=cM(),g=()=>{navigator.clipboard.writeText(T2(t.responseBody??"")),n(!0),setTimeout(()=>n(!1),2e3)},x=()=>{o.trim()&&p.mutate({name:o.trim(),statusCode:t.statusCode,headers:t.responseHeaders??{},body:t.responseBody??""},{onSuccess:()=>{c(""),a(!1),d(!0),setTimeout(()=>d(!1),2e3)}})};return b.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[b.jsx("div",{className:"absolute inset-0 bg-background/60",onClick:e}),b.jsxs("div",{className:"relative w-full max-w-xl bg-card border-l border-border shadow-2xl h-full flex flex-col",onClick:v=>v.stopPropagation(),children:[b.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border bg-muted",children:[b.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Jg,{method:t.method}),b.jsx(fM,{status:t.statusCode}),b.jsx("span",{className:"text-[10px] font-black text-muted-foreground uppercase tracking-widest ml-2",children:t.mode})]}),b.jsx("h2",{className:"text-sm font-black font-mono text-foreground truncate break-all",children:t.path})]}),b.jsx("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:b.jsx("button",{onClick:e,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors duration-75",children:b.jsx(Xn,{className:"w-5 h-5"})})})]}),b.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[b.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(Dl,{className:"w-3 h-3"})," Latency"]}),b.jsxs("div",{className:"text-sm font-black font-mono text-primary",children:[t.latencyMs,b.jsx("span",{className:"text-[10px] ml-0.5 opacity-60",children:"ms"})]})]}),b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(Vg,{className:"w-3 h-3"})," Status"]}),b.jsx("div",{className:"text-sm font-black font-mono text-foreground",children:t.statusCode})]}),b.jsxs("div",{className:"bg-muted rounded-xl p-3 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-black text-muted-foreground uppercase tracking-widest mb-1",children:[b.jsx(Dl,{className:"w-3 h-3"})," Timestamp"]}),b.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:new Date(t.timestamp).toLocaleTimeString()})]})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Tm,{className:"w-4 h-4 text-primary"}),b.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Request Details"})]}),t.requestHeaders&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(jl,{className:"w-3 h-3"})," Headers"]}),b.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.requestHeaders).map(([v,w])=>`${v}: ${w}`).join(`
|
|
54
|
+
`)})]})]}),b.jsxs("div",{className:"space-y-4 border-t border-border pt-8",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Tm,{className:"w-4 h-4 text-success rotate-180"}),b.jsx("h3",{className:"text-xs font-black uppercase tracking-widest text-foreground/80",children:"Response Details"})]}),r?b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("input",{autoFocus:!0,type:"text",placeholder:"Name...",value:o,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&x(),v.key==="Escape"&&(a(!1),c(""))},className:"px-2 py-1 text-[11px] font-bold rounded-lg border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary shadow-inner w-32"}),b.jsx("button",{onClick:x,disabled:!o.trim()||p.isPending,className:"p-1 text-primary hover:bg-primary/10 rounded-md transition-all disabled:opacity-40","aria-label":"Confirm save response",children:b.jsx(Br,{className:"w-3.5 h-3.5"})}),b.jsx("button",{onClick:()=>{a(!1),c("")},className:"p-1 text-muted-foreground hover:text-foreground rounded-md transition-all","aria-label":"Cancel save response",children:b.jsx(Xn,{className:"w-3 h-3"})})]}):h?b.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-success",children:[b.jsx(Br,{className:"w-3 h-3"}),"Saved"]}):b.jsxs("button",{onClick:()=>a(!0),className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors","aria-label":"Save as mock response",children:[b.jsx(rw,{className:"w-3 h-3"}),b.jsx(Ll,{className:"w-2.5 h-2.5 -ml-0.5"}),"Save as mock"]})]}),t.responseHeaders&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[b.jsx(jl,{className:"w-3 h-3"})," Headers"]}),b.jsx("pre",{className:"text-[11px] font-mono font-medium bg-muted border border-border rounded-xl p-4 overflow-auto max-h-48 shadow-inner leading-relaxed",children:Object.entries(t.responseHeaders).map(([v,w])=>`${v}: ${w}`).join(`
|
|
55
|
+
`)})]}),t.responseBody&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between px-1",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:[b.jsx(nh,{className:"w-3 h-3"})," Body"]}),b.jsxs("button",{onClick:g,className:"flex items-center gap-1 text-[9px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors","aria-label":"Copy response body",children:[i?b.jsx(Br,{className:"w-3 h-3 text-success"}):b.jsx(g3,{className:"w-3 h-3"}),i?"Copied":"Copy"]})]}),b.jsx("div",{className:"rounded-xl border border-border bg-muted overflow-hidden shadow-inner",children:b.jsx("pre",{className:"text-[11px] font-mono font-medium p-4 overflow-auto max-h-80 leading-relaxed text-foreground/90",children:T2(t.responseBody)})}),t.responseBodyTruncated&&b.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1",children:[b.jsx(cw,{className:"w-3 h-3 text-amber-400 shrink-0"}),b.jsx("p",{className:"text-[10px] text-amber-400 font-mono",children:"Response body truncated — only the first 100 KB is shown."})]})]})]})]}),b.jsx("div",{className:"p-4 border-t border-border bg-muted flex justify-end gap-3 px-6",children:b.jsx("button",{onClick:e,className:"px-6 py-2 text-xs font-black uppercase tracking-widest bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors duration-75 shadow-sm",children:"Dismiss"})})]})]})}function T2(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function w_({isCompact:t}){const{entries:e,connected:i,clear:n,loaded:r}=v_(),[a,o]=O.useState(null),[c,h]=O.useState(""),[d,p]=O.useState(""),[g,x]=O.useState(""),v=O.useMemo(()=>e.filter(k=>!(c&&k.method!==c||d==="2xx"&&(k.statusCode<200||k.statusCode>=300)||d==="4xx"&&(k.statusCode<400||k.statusCode>=500)||d==="5xx"&&k.statusCode<500||g&&k.mode!==g)),[e,c,d,g]),w={mock:"bg-mode-mock/20 text-mode-mock border-mode-mock/20",delay:"bg-mode-delay/20 text-mode-delay border-mode-delay/20",passthrough:"bg-mode-passthrough/20 text-mode-passthrough border-mode-passthrough/20"};return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[!t&&b.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/40 bg-card",children:[b.jsx("div",{className:"flex items-center gap-6",children:b.jsxs("div",{className:"flex items-center gap-2.5",children:[b.jsx("div",{className:"relative",children:b.jsx(O3,{className:ve("w-4 h-4",i?"text-success":"text-destructive")})}),b.jsxs("div",{className:"flex flex-col",children:[b.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest leading-none mb-0.5",children:"Stream"}),b.jsxs("span",{className:"text-[11px] font-bold text-muted-foreground leading-none",children:[i?"Real-time":"Offline"," · ",e.length," entries"]})]})]})}),b.jsx("button",{onClick:n,className:"p-2 text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10 rounded-lg transition-colors duration-75",title:"Clear logs",children:b.jsx(Bl,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"px-4 py-2 flex items-center justify-between bg-muted border-b border-border/20",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(w3,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:c,onChange:k=>h(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Method"}),["GET","POST","PUT","PATCH","DELETE"].map(k=>b.jsx("option",{value:k,children:k},k))]})]}),b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(Mm,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:d,onChange:k=>p(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Status"}),b.jsx("option",{value:"2xx",children:"2xx"}),b.jsx("option",{value:"4xx",children:"4xx"}),b.jsx("option",{value:"5xx",children:"5xx"})]})]}),b.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-background border border-border/20",children:[b.jsx(Dl,{className:"w-3 h-3 text-muted-foreground/60"}),b.jsxs("select",{value:g,onChange:k=>x(k.target.value),className:"text-[10px] font-black uppercase tracking-wide bg-transparent outline-none cursor-pointer text-muted-foreground hover:text-foreground transition-colors duration-75",children:[b.jsx("option",{value:"",children:"Mode"}),b.jsx("option",{value:"passthrough",children:"Pass"}),b.jsx("option",{value:"delay",children:"Delay"}),b.jsx("option",{value:"mock",children:"Mock"}),b.jsx("option",{value:"mock-delay",children:"Mock + Delay"})]})]})]}),t&&b.jsx("button",{onClick:n,className:"p-1.5 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/5 rounded-md transition-colors duration-75",title:"Clear logs",children:b.jsx(Bl,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-y-auto relative bg-background",children:b.jsxs("div",{className:"min-w-full",children:[!t&&b.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 bg-muted border-b border-border/20 sticky top-0 z-10",children:[b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 shrink-0",children:"Time"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-[52px] shrink-0",children:"Method"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 flex-1",children:"Request Path"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-center",children:"Status"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-16 text-right",children:"Latency"}),b.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest text-muted-foreground/60 w-20 text-center",children:"Mode"})]}),b.jsx("div",{className:"divide-y divide-border/20",children:v.length===0?b.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center space-y-3",children:[r?b.jsx(Mm,{className:"w-12 h-12 text-muted-foreground/10"}):b.jsx(sh,{className:"w-8 h-8 animate-spin text-primary opacity-40"}),b.jsx("div",{className:"max-w-[200px]",children:b.jsx("p",{className:"text-sm font-bold text-foreground/80",children:e.length===0?"No Traffic Recorded":"No Matches"})})]}):v.slice(0,200).map(k=>b.jsxs("button",{onClick:()=>o(k),className:ve("flex flex-col gap-2 px-4 py-3 w-full text-left transition-colors duration-75 group border-b border-border/10",a?.id===k.id?"bg-primary/5 shadow-inner":"hover:bg-accent/30"),children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Jg,{method:k.method}),b.jsx("span",{className:"text-[10px] text-muted-foreground/60 font-mono font-bold tabular-nums",children:new Date(k.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsxs("div",{className:"flex items-center gap-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground opacity-60",children:[b.jsx(Dl,{className:"w-2.5 h-2.5 opacity-40"}),b.jsxs("span",{className:"tabular-nums",children:[k.latencyMs,"ms"]})]}),b.jsx(fM,{status:k.statusCode})]})]}),b.jsxs("div",{className:"flex items-center justify-between gap-4",children:[b.jsx("span",{className:"text-xs font-mono font-bold truncate text-foreground/90 group-hover:text-primary transition-colors duration-75 flex-1",children:k.path}),k.mode==="mock-delay"?b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("span",{className:"text-[8px] font-black uppercase tracking-[0.1em] px-1.5 py-0.5 rounded border leading-none bg-mode-delay/20 text-mode-delay border-mode-delay/20",children:"delay"}),b.jsx("span",{className:"text-[8px] font-black uppercase tracking-[0.1em] px-1.5 py-0.5 rounded border leading-none bg-mode-mock/20 text-mode-mock border-mode-mock/20",children:"mock"})]}):b.jsx("span",{className:ve("text-[8px] font-black uppercase tracking-[0.1em] px-1.5 py-0.5 rounded border leading-none",w[k.mode]),children:k.mode})]})]},k.id))})]})}),a&&b.jsx(S_,{entry:a,onClose:()=>o(null)})]})}function k_(){const[t,e]=O.useState(!1);return b.jsxs("div",{className:"flex h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-r border-border/60 bg-background",children:[b.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-border/60 bg-muted/30 shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:b.jsx(jl,{className:"w-4 h-4"})}),b.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Endpoints Registry"})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(f_,{open:t,onToggle:()=>e(i=>!i)}),b.jsx(b_,{})]})]}),b.jsx(h_,{open:t}),b.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:b.jsx("div",{className:"max-w-5xl mx-auto space-y-6",children:b.jsx(l_,{})})})]}),b.jsxs("div",{className:"w-[400px] lg:w-[450px] xl:w-[500px] hidden lg:flex flex-col bg-muted/5 shrink-0",children:[b.jsxs("div",{className:"px-5 py-4 flex items-center gap-3 border-b border-border/60 bg-muted/30 shrink-0",children:[b.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center border border-primary/20 text-primary",children:b.jsx(Mm,{className:"w-4 h-4"})}),b.jsx("h2",{className:"text-sm font-black uppercase tracking-widest text-foreground",children:"Traffic Monitor"})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx(w_,{isCompact:!0})})]})]})}const C_=new WN({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function A_(){return b.jsx(XN,{client:C_,children:b.jsx(gN,{children:b.jsx(GE,{children:b.jsxs(Pc,{element:b.jsx($D,{}),children:[b.jsx(Pc,{path:"/",element:b.jsx(k_,{})}),b.jsx(Pc,{path:"*",element:b.jsx(VE,{to:"/",replace:!0})})]})})})})}QO.createRoot(document.getElementById("root")).render(b.jsx(O.StrictMode,{children:b.jsx(A_,{})}));
|